11// Native JS implementation of stargazers:workflow/workflow.star-added-parallel
22// Fetches account info and LLM settings concurrently using join sets.
33
4+ import { accountInfoSubmit , accountInfoAwaitNext } from 'stargazers:github-obelisk-ext/account' ;
5+ import { getSettingsJsonSubmit , getSettingsJsonAwaitNext } from 'stargazers:db-obelisk-ext/llm' ;
6+ import { addStarGetDescription , updateUserDescription } from 'stargazers:db/user' ;
7+ import { respond as llmRespond } from 'stargazers:llm/llm' ;
8+
49export default function star_added_parallel ( login , repo ) {
5- const existingDescription = obelisk . call (
6- 'stargazers:db/user.add-star-get-description' , [ login , repo ] ) ;
10+ const existingDescription = addStarGetDescription ( login , repo ) ;
711
812 if ( existingDescription !== null && existingDescription !== undefined ) {
913 console . log ( `Description already exists for ${ login } on ${ repo } .` ) ;
@@ -14,27 +18,22 @@ export default function star_added_parallel(login, repo) {
1418
1519 // Submit account-info and get-settings-json concurrently.
1620 const jsInfo = obelisk . createJoinSet ( { name : `info_${ login } ` } ) ;
17- const infoExecId = jsInfo . submit ( 'stargazers:github/account.account-info' , [ login ] ) ;
21+ accountInfoSubmit ( jsInfo , login ) ;
1822
1923 const jsSettings = obelisk . createJoinSet ( { name : `settings_${ login } ` } ) ;
20- const settingsExecId = jsSettings . submit ( 'stargazers:db/llm.get-settings-json' , [ ] ) ;
24+ getSettingsJsonSubmit ( jsSettings ) ;
2125
2226 // Await account info.
23- jsInfo . joinNext ( ) ;
24- const infoResult = obelisk . getResult ( infoExecId ) ;
25- if ( infoResult . err !== undefined ) throw infoResult . err ;
27+ const infoResult = accountInfoAwaitNext ( jsInfo ) ;
2628
2729 // Await settings.
28- jsSettings . joinNext ( ) ;
29- const settingsResult = obelisk . getResult ( settingsExecId ) ;
30- if ( settingsResult . err !== undefined ) throw settingsResult . err ;
30+ const settingsResult = getSettingsJsonAwaitNext ( jsSettings ) ;
3131
3232 console . log ( `Got info and settings for ${ login } , generating description...` ) ;
3333
3434 // Generate and persist the description sequentially.
35- const description = obelisk . call ( 'stargazers:llm/llm.respond' ,
36- [ infoResult . ok , settingsResult . ok ] ) ;
37- obelisk . call ( 'stargazers:db/user.update-user-description' , [ login , description ] ) ;
35+ const description = llmRespond ( infoResult , settingsResult ) ;
36+ updateUserDescription ( login , description ) ;
3837
3938 console . log ( `Generated and saved description in parallel for ${ login } ` ) ;
4039}
0 commit comments