@sideboard-ai/core 0.1.349 → 0.1.350
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{abletime-CGFJZB7L.js → abletime-TX7BTTR2.js} +5 -5
- package/dist/{abletime-3HRWLQZJ.js → abletime-URSRZW7P.js} +4 -4
- package/dist/{abletime-oauth-QNJQLHR4.js → abletime-oauth-QS3WPSCC.js} +3 -3
- package/dist/{abletime-oauth-JQDSH5OL.js → abletime-oauth-SL3NMNEC.js} +4 -4
- package/dist/{abletime-rest-TANL5TMY.js → abletime-rest-GGQLUO55.js} +3 -3
- package/dist/{abletime-rest-UQA2CRZN.js → abletime-rest-JZU6JJCV.js} +4 -4
- package/dist/agents/acp-runner.cjs +491 -0
- package/dist/agents/acp-runner.d.cts +46 -0
- package/dist/agents/acp-runner.d.ts +46 -0
- package/dist/agents/acp-runner.js +323 -0
- package/dist/{agents-DMPBFF3F.js → agents-P5QIV24I.js} +37 -7
- package/dist/{agents-AZ2PV6XP.js → agents-RGAV5OHD.js} +42 -11
- package/dist/{app-settings-SNOPJ7P5.js → app-settings-IA7ZZKWQ.js} +2 -2
- package/dist/{app-settings-PPIMYJKS.js → app-settings-XILTSD6L.js} +1 -1
- package/dist/{chunk-Q4I6KDOL.js → chunk-2MESZ5XR.js} +60 -39
- package/dist/{chunk-RUIHNWRV.js → chunk-37ZBEBP6.js} +6 -6
- package/dist/{chunk-WHMLMCPU.js → chunk-5AHWUJRT.js} +1925 -1722
- package/dist/{chunk-7B2OUQON.js → chunk-5TCMXEYL.js} +48 -3
- package/dist/{chunk-FDYMVJFU.js → chunk-5WF54R3B.js} +5 -5
- package/dist/{chunk-PVCECFJK.js → chunk-7ZD4OK6G.js} +1 -1
- package/dist/{chunk-RYPD7XWV.js → chunk-B4EFQTMP.js} +5 -5
- package/dist/chunk-BF6INES4.js +144 -0
- package/dist/{chunk-IVRWRYTH.js → chunk-BZK62VPT.js} +2 -2
- package/dist/{chunk-AJMERXZP.js → chunk-CCWQ65VD.js} +2 -2
- package/dist/{chunk-62ALWH3T.js → chunk-DL4OHDBV.js} +3 -3
- package/dist/{chunk-CATTIFSP.js → chunk-EZ2MUWNW.js} +3 -3
- package/dist/{chunk-4NXGVJA6.js → chunk-F4RFFE2H.js} +48 -3
- package/dist/{chunk-E77SRVVO.js → chunk-FCKTBE26.js} +1 -1
- package/dist/{chunk-3DBL2C45.js → chunk-FQ3JYUKI.js} +2 -2
- package/dist/{chunk-CEQ4Z32M.js → chunk-J4EA5SHF.js} +3 -3
- package/dist/{chunk-MHSBF3SO.js → chunk-LFSTOECH.js} +3 -3
- package/dist/{chunk-OHUAAX3O.js → chunk-M45WGODR.js} +2 -2
- package/dist/{chunk-MVFFLU5V.js → chunk-MANERA6F.js} +12 -5
- package/dist/{chunk-ZXI5DR5S.js → chunk-NDEVAA34.js} +1624 -1487
- package/dist/{chunk-UJMCTGV7.js → chunk-PXSWVZIL.js} +2 -2
- package/dist/{chunk-6RIPZ73M.js → chunk-SMSD6U3N.js} +3 -1
- package/dist/{chunk-RPHH4FNK.js → chunk-TCEUNSLX.js} +3 -1
- package/dist/chunk-TRMPDDVL.js +232 -0
- package/dist/{chunk-6WMNIX2U.js → chunk-UFUAIVNV.js} +9 -5
- package/dist/{chunk-QHXZKHUL.js → chunk-VHQ6OG3U.js} +2 -2
- package/dist/{chunk-WWU4SYZR.js → chunk-VL6F2KRE.js} +5 -1
- package/dist/{chunk-IRFBD6GU.js → chunk-W5GHFT7E.js} +71 -47
- package/dist/{chunk-5FUAOU3G.js → chunk-WB3G2LQO.js} +1 -1
- package/dist/{chunk-JCYGQKER.js → chunk-WFX4ZVSZ.js} +1 -1
- package/dist/{chunk-F7WP2U5I.js → chunk-WJURGCBR.js} +1 -1
- package/dist/chunk-YE7Z5WH3.js +142 -0
- package/dist/{chunk-ROXM6QZV.js → chunk-ZBSEJIOV.js} +12 -5
- package/dist/{conductor-NHC6X74J.js → conductor-HVOGBK63.js} +6 -5
- package/dist/{conductor-65VPUPOW.js → conductor-VGCXUUG6.js} +7 -6
- package/dist/connected-teams-2YDE2EZ2.js +1 -1
- package/dist/{coordinator-prompt-5GZWIVSY.js → coordinator-prompt-DPO7L2JO.js} +5 -5
- package/dist/{coordinator-prompt-R2PURZL3.js → coordinator-prompt-E736TJBS.js} +4 -4
- package/dist/{global-workspace-64KC7PST.js → global-workspace-4RDPAOTT.js} +5 -5
- package/dist/{global-workspace-UEECLWSX.js → global-workspace-TG2TVLUF.js} +4 -4
- package/dist/index.cjs +1600 -929
- package/dist/index.d.cts +132 -891
- package/dist/index.d.ts +132 -891
- package/dist/index.js +433 -207
- package/dist/{linear-PKYJH4WK.js → linear-E3BX5PX5.js} +2 -2
- package/dist/{linear-MIJO6DCV.js → linear-WG23LBCX.js} +3 -3
- package/dist/{linear-list-JPQ27RXG.js → linear-list-OINZWVV5.js} +1 -1
- package/dist/{linear-list-N57PR6JM.js → linear-list-VU47BNUV.js} +1 -1
- package/dist/mcp/run-stdio.cjs +1097 -720
- package/dist/mcp/run-stdio.js +32 -24
- package/dist/{optional-cli-4GTEDEYJ.js → optional-cli-K6HX2X5O.js} +4 -3
- package/dist/{optional-cli-RPJIQBDX.js → optional-cli-SA3EQYML.js} +6 -5
- package/dist/{orchestrator-Y5PYSMR6.js → orchestrator-3I2FLEZL.js} +17 -15
- package/dist/{orchestrator-I5G5A5BV.js → orchestrator-QDHZ56LA.js} +11 -10
- package/dist/thread-CJRchYLj.d.cts +856 -0
- package/dist/thread-CJRchYLj.d.ts +856 -0
- package/dist/{thread-store-HZ4U4OXB.js → thread-store-4YTOV2HL.js} +3 -3
- package/dist/{thread-store-QKNU5CHM.js → thread-store-LME2ICZP.js} +2 -2
- package/dist/{workspaces-6TIM2TM2.js → workspaces-4PA24IX6.js} +4 -4
- package/dist/{workspaces-I2EHNTFE.js → workspaces-6TMYV4N2.js} +5 -5
- package/dist/{worktree-7JFYDNUX.js → worktree-4ATMCYIE.js} +3 -3
- package/dist/{worktree-M2GJGK2P.js → worktree-DA6SKIU5.js} +4 -4
- package/package.json +3 -3
- /package/dist/{chunk-XOEKCE6L.js → chunk-OHXNGBC4.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -17,13 +17,16 @@ import {
|
|
|
17
17
|
toAbleTimeIssueInfo,
|
|
18
18
|
updateAbleTimeTask,
|
|
19
19
|
verifyAbleTimeConnection
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-37ZBEBP6.js";
|
|
21
|
+
import {
|
|
22
|
+
looksLikeAbleTimeUlid
|
|
23
|
+
} from "./chunk-CCWQ65VD.js";
|
|
21
24
|
import {
|
|
22
25
|
clearOptionalCliPresenceCache,
|
|
23
26
|
detectOptionalServiceClis,
|
|
24
27
|
installOptionalServiceCli,
|
|
25
28
|
optionalCliPresence
|
|
26
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-PXSWVZIL.js";
|
|
27
30
|
import {
|
|
28
31
|
AGENT_GIT_ACTIONS,
|
|
29
32
|
BOARD_COLUMN_DEFS,
|
|
@@ -222,7 +225,7 @@ import {
|
|
|
222
225
|
worktreeCleanupSettings,
|
|
223
226
|
writeAgentBlock,
|
|
224
227
|
writeWorktreeFile
|
|
225
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-W5GHFT7E.js";
|
|
226
229
|
import {
|
|
227
230
|
OPTIONAL_SERVICES,
|
|
228
231
|
OPTIONAL_SERVICE_IDS,
|
|
@@ -238,7 +241,7 @@ import {
|
|
|
238
241
|
optionalServiceConnected,
|
|
239
242
|
optionalServiceSpec,
|
|
240
243
|
verifyOptionalService
|
|
241
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-BZK62VPT.js";
|
|
242
245
|
import {
|
|
243
246
|
LEGACY_PLAN_FILE_REL,
|
|
244
247
|
PLAN_FILE_NAME,
|
|
@@ -295,7 +298,7 @@ import {
|
|
|
295
298
|
startLinearOAuth,
|
|
296
299
|
updateLinearIssue,
|
|
297
300
|
validateLinearApiKey
|
|
298
|
-
} from "./chunk-
|
|
301
|
+
} from "./chunk-7ZD4OK6G.js";
|
|
299
302
|
import {
|
|
300
303
|
downloadAuthenticatedFile,
|
|
301
304
|
extractHttpUrls,
|
|
@@ -322,6 +325,9 @@ import {
|
|
|
322
325
|
WORKTREE_GITHUB_MCP_TOOLS,
|
|
323
326
|
WORKTREE_LINEAR_MCP_TOOLS,
|
|
324
327
|
WORKTREE_MCP_TOOLS,
|
|
328
|
+
acpAdapter,
|
|
329
|
+
acpHarnessDisplayName,
|
|
330
|
+
acpRunnerPath,
|
|
325
331
|
allAdapters,
|
|
326
332
|
brightsyAdapter,
|
|
327
333
|
brightsyMcpAllowedTools,
|
|
@@ -383,7 +389,7 @@ import {
|
|
|
383
389
|
userMcpNamesToDisable,
|
|
384
390
|
worktreeMcpToolNames,
|
|
385
391
|
writeInjectedMcpConfig
|
|
386
|
-
} from "./chunk-
|
|
392
|
+
} from "./chunk-NDEVAA34.js";
|
|
387
393
|
import {
|
|
388
394
|
getAgentSetupInfo,
|
|
389
395
|
installAgent,
|
|
@@ -395,7 +401,7 @@ import {
|
|
|
395
401
|
prepareTerminalCommand,
|
|
396
402
|
resolveLoginCommand,
|
|
397
403
|
whichOnPath
|
|
398
|
-
} from "./chunk-
|
|
404
|
+
} from "./chunk-F4RFFE2H.js";
|
|
399
405
|
import {
|
|
400
406
|
brightsyMcpServerName,
|
|
401
407
|
connectBrightsyTeam,
|
|
@@ -405,8 +411,21 @@ import {
|
|
|
405
411
|
listBrightsyAccounts,
|
|
406
412
|
listConnectedBrightsyTeams,
|
|
407
413
|
switchBrightsyAccount
|
|
408
|
-
} from "./chunk-
|
|
409
|
-
import
|
|
414
|
+
} from "./chunk-OHXNGBC4.js";
|
|
415
|
+
import {
|
|
416
|
+
BRIGHTSY_OAUTH_CLIENT_ID,
|
|
417
|
+
BRIGHTSY_OAUTH_REDIRECT,
|
|
418
|
+
brightsyAccessTokenNeedsRefresh,
|
|
419
|
+
brightsyConfigPath,
|
|
420
|
+
ensureBrightsyLocalConfigFresh,
|
|
421
|
+
ensureBrightsyOAuthClientId,
|
|
422
|
+
loadBrightsyConfig,
|
|
423
|
+
normalizeBrightsyEndpoint,
|
|
424
|
+
refreshBrightsyAccessToken,
|
|
425
|
+
registerBrightsyOAuthClient,
|
|
426
|
+
saveBrightsyConfig
|
|
427
|
+
} from "./chunk-RSA47QYR.js";
|
|
428
|
+
import "./chunk-WB3G2LQO.js";
|
|
410
429
|
import {
|
|
411
430
|
BRIGHTSY_SUMMARIZE_CONTEXT_TOOL,
|
|
412
431
|
CHARS_PER_CONTEXT_TOKEN,
|
|
@@ -518,7 +537,7 @@ import {
|
|
|
518
537
|
workspaceAgentChatSummaries,
|
|
519
538
|
worktreeRunPortsPath,
|
|
520
539
|
wrapReviewSkillMarkdown
|
|
521
|
-
} from "./chunk-
|
|
540
|
+
} from "./chunk-ZBSEJIOV.js";
|
|
522
541
|
import {
|
|
523
542
|
STDERR_EVENT_MAX_CHARS,
|
|
524
543
|
STDOUT_EVENT_MAX_CHARS,
|
|
@@ -561,6 +580,19 @@ import {
|
|
|
561
580
|
withEventParentId,
|
|
562
581
|
withEventsParentId
|
|
563
582
|
} from "./chunk-WWBPK7GB.js";
|
|
583
|
+
import {
|
|
584
|
+
ACP_HARNESSES,
|
|
585
|
+
ACP_HARNESS_IDS,
|
|
586
|
+
acpHarnessLabel,
|
|
587
|
+
acpHarnessLooksAuthenticated,
|
|
588
|
+
acpHarnessStatus,
|
|
589
|
+
agentSupportsAttach,
|
|
590
|
+
defaultAcpHarness,
|
|
591
|
+
detectAcpHarness,
|
|
592
|
+
detectAcpHarnesses,
|
|
593
|
+
isAcpHarnessId,
|
|
594
|
+
resolveAcpHarnessCommand
|
|
595
|
+
} from "./chunk-YE7Z5WH3.js";
|
|
564
596
|
import "./chunk-7H655NEW.js";
|
|
565
597
|
import {
|
|
566
598
|
ABLETIME_OAUTH_CALLBACK_PATH,
|
|
@@ -584,10 +616,7 @@ import {
|
|
|
584
616
|
parseAbleTimeOAuthCallbackUrl,
|
|
585
617
|
resolveAbleTimeOAuthHost,
|
|
586
618
|
startAbleTimeOAuth
|
|
587
|
-
} from "./chunk-
|
|
588
|
-
import {
|
|
589
|
-
looksLikeAbleTimeUlid
|
|
590
|
-
} from "./chunk-AJMERXZP.js";
|
|
619
|
+
} from "./chunk-J4EA5SHF.js";
|
|
591
620
|
import {
|
|
592
621
|
ABLETIME_MCP_PATH,
|
|
593
622
|
ABLETIME_MCP_PM_PATH,
|
|
@@ -608,7 +637,20 @@ import {
|
|
|
608
637
|
normalizeAbleTimeCredential,
|
|
609
638
|
normalizeAbleTimeHost,
|
|
610
639
|
rewriteAbleTimeError
|
|
611
|
-
} from "./chunk-
|
|
640
|
+
} from "./chunk-5WF54R3B.js";
|
|
641
|
+
import {
|
|
642
|
+
currentHttpFetch,
|
|
643
|
+
formatFetchError,
|
|
644
|
+
httpFetch,
|
|
645
|
+
setHttpFetchImpl
|
|
646
|
+
} from "./chunk-JAT3JFOS.js";
|
|
647
|
+
import {
|
|
648
|
+
caffeinateHoldPath,
|
|
649
|
+
getCaffeinateHold,
|
|
650
|
+
isThreadCaffeinated,
|
|
651
|
+
releaseCaffeinateHoldForThread,
|
|
652
|
+
setCaffeinateHold
|
|
653
|
+
} from "./chunk-LAWLUOWQ.js";
|
|
612
654
|
import {
|
|
613
655
|
CLOUD_COORDINATOR_BUSY_REPLY,
|
|
614
656
|
CLOUD_COORDINATOR_CANCELED_REPLY,
|
|
@@ -661,7 +703,7 @@ import {
|
|
|
661
703
|
stageBuffersAsAttachments,
|
|
662
704
|
syncWorkspacesFromThreads,
|
|
663
705
|
takenTeamSlugsForOrchestration
|
|
664
|
-
} from "./chunk-
|
|
706
|
+
} from "./chunk-LFSTOECH.js";
|
|
665
707
|
import {
|
|
666
708
|
GITHUB_PR_BODY_MAX_CHARS,
|
|
667
709
|
GITHUB_PR_BODY_SAFE_CHARS,
|
|
@@ -751,7 +793,7 @@ import {
|
|
|
751
793
|
suggestSlug,
|
|
752
794
|
switchWorktreeBranch,
|
|
753
795
|
warmGithubAgentAuth
|
|
754
|
-
} from "./chunk-
|
|
796
|
+
} from "./chunk-FQ3JYUKI.js";
|
|
755
797
|
import {
|
|
756
798
|
FAMOUS_SOCCER_TEAMS,
|
|
757
799
|
SCHEDULE_RUN_HISTORY_LIMIT,
|
|
@@ -811,27 +853,9 @@ import {
|
|
|
811
853
|
worktreeNameFromPath,
|
|
812
854
|
worktreeSlugForTicket,
|
|
813
855
|
writeThread
|
|
814
|
-
} from "./chunk-
|
|
856
|
+
} from "./chunk-TCEUNSLX.js";
|
|
815
857
|
import "./chunk-BMRJNRQK.js";
|
|
816
|
-
import
|
|
817
|
-
BRIGHTSY_OAUTH_CLIENT_ID,
|
|
818
|
-
BRIGHTSY_OAUTH_REDIRECT,
|
|
819
|
-
brightsyAccessTokenNeedsRefresh,
|
|
820
|
-
brightsyConfigPath,
|
|
821
|
-
ensureBrightsyLocalConfigFresh,
|
|
822
|
-
ensureBrightsyOAuthClientId,
|
|
823
|
-
loadBrightsyConfig,
|
|
824
|
-
normalizeBrightsyEndpoint,
|
|
825
|
-
refreshBrightsyAccessToken,
|
|
826
|
-
registerBrightsyOAuthClient,
|
|
827
|
-
saveBrightsyConfig
|
|
828
|
-
} from "./chunk-RSA47QYR.js";
|
|
829
|
-
import {
|
|
830
|
-
currentHttpFetch,
|
|
831
|
-
formatFetchError,
|
|
832
|
-
httpFetch,
|
|
833
|
-
setHttpFetchImpl
|
|
834
|
-
} from "./chunk-JAT3JFOS.js";
|
|
858
|
+
import "./chunk-TRMPDDVL.js";
|
|
835
859
|
import {
|
|
836
860
|
PLAN_QUESTION_ANSWERS_PREFIX,
|
|
837
861
|
askBlockStillWaiting,
|
|
@@ -1104,7 +1128,10 @@ import {
|
|
|
1104
1128
|
withTurnScopedCost,
|
|
1105
1129
|
writeSecureJson,
|
|
1106
1130
|
writeViewerContext
|
|
1107
|
-
} from "./chunk-
|
|
1131
|
+
} from "./chunk-UFUAIVNV.js";
|
|
1132
|
+
import {
|
|
1133
|
+
writePrivateFile
|
|
1134
|
+
} from "./chunk-JT7R45JB.js";
|
|
1108
1135
|
import {
|
|
1109
1136
|
stripNestedElectronEnv
|
|
1110
1137
|
} from "./chunk-4TR3HZFT.js";
|
|
@@ -1132,16 +1159,6 @@ import {
|
|
|
1132
1159
|
withRemovedAccount,
|
|
1133
1160
|
withSelectedAccount
|
|
1134
1161
|
} from "./chunk-KI45T4DI.js";
|
|
1135
|
-
import {
|
|
1136
|
-
caffeinateHoldPath,
|
|
1137
|
-
getCaffeinateHold,
|
|
1138
|
-
isThreadCaffeinated,
|
|
1139
|
-
releaseCaffeinateHoldForThread,
|
|
1140
|
-
setCaffeinateHold
|
|
1141
|
-
} from "./chunk-LAWLUOWQ.js";
|
|
1142
|
-
import {
|
|
1143
|
-
writePrivateFile
|
|
1144
|
-
} from "./chunk-JT7R45JB.js";
|
|
1145
1162
|
import {
|
|
1146
1163
|
CONVENTION_SETUP_RELPATHS,
|
|
1147
1164
|
activeRunPreview,
|
|
@@ -3480,11 +3497,12 @@ function listPhoneHistory(opts) {
|
|
|
3480
3497
|
updatedAt: historyStamp(thread),
|
|
3481
3498
|
where: isGlobalThread(thread) ? "Orchestration" : repoName(thread.repoPath),
|
|
3482
3499
|
agent: thread.agent,
|
|
3500
|
+
...thread.agent === "acp" ? { acpHarness: thread.acpHarness === "copilot" ? "copilot" : "gemini" } : {},
|
|
3483
3501
|
...workspace ? { workspace } : {}
|
|
3484
3502
|
};
|
|
3485
3503
|
}).filter((chat) => {
|
|
3486
3504
|
if (!query) return true;
|
|
3487
|
-
return `${chat.title} ${chat.where} ${chat.agent} ${chat.workspace ?? ""} ${chat.preview}`.toLowerCase().includes(query);
|
|
3505
|
+
return `${chat.title} ${chat.where} ${chat.agent} ${chat.acpHarness ?? ""} ${chat.workspace ?? ""} ${chat.preview}`.toLowerCase().includes(query);
|
|
3488
3506
|
});
|
|
3489
3507
|
let start = 0;
|
|
3490
3508
|
if (after) {
|
|
@@ -3501,10 +3519,116 @@ function listPhoneHistory(opts) {
|
|
|
3501
3519
|
};
|
|
3502
3520
|
}
|
|
3503
3521
|
|
|
3522
|
+
// src/remote/phone-create.ts
|
|
3523
|
+
function phoneAcpHarness(agent, raw) {
|
|
3524
|
+
if (agent !== "acp") return null;
|
|
3525
|
+
if (raw === "gemini" || raw === "copilot") return raw;
|
|
3526
|
+
return defaultAcpHarness();
|
|
3527
|
+
}
|
|
3528
|
+
function draftAgentOptions(draft, defaults) {
|
|
3529
|
+
const agent = draft?.agent ?? defaults.agent;
|
|
3530
|
+
return {
|
|
3531
|
+
agent,
|
|
3532
|
+
acpHarness: phoneAcpHarness(agent, draft?.acpHarness),
|
|
3533
|
+
model: draft && "model" in draft ? draft.model ?? null : defaults.model,
|
|
3534
|
+
effort: draft?.effort ?? defaults.effort,
|
|
3535
|
+
fast: draft?.fast ?? defaults.fast,
|
|
3536
|
+
planMode: Boolean(draft?.planMode),
|
|
3537
|
+
autonomy: draft?.autonomy ?? defaults.autonomy
|
|
3538
|
+
};
|
|
3539
|
+
}
|
|
3540
|
+
function createPhoneChat(agent) {
|
|
3541
|
+
const defaults = resolveOrchestratorDefaults();
|
|
3542
|
+
const thread = createGlobalChat({
|
|
3543
|
+
agent: agent ?? defaults.agent,
|
|
3544
|
+
model: defaults.model,
|
|
3545
|
+
effort: defaults.effort,
|
|
3546
|
+
fast: defaults.fast
|
|
3547
|
+
});
|
|
3548
|
+
return openedFrom(thread, { kind: "orchestration" });
|
|
3549
|
+
}
|
|
3550
|
+
async function createPhoneOrchestration(draft) {
|
|
3551
|
+
const goal = (draft?.goal ?? draft?.prompt ?? "").trim();
|
|
3552
|
+
const attachments = phoneTurnAttachments(draft ?? {});
|
|
3553
|
+
if (!goal && attachments.length === 0) return createPhoneChat(draft?.agent);
|
|
3554
|
+
const defaults = resolveOrchestratorDefaults();
|
|
3555
|
+
const options = draftAgentOptions(draft, defaults);
|
|
3556
|
+
const thread = await startOrchestration({
|
|
3557
|
+
goal: goal || "See the attached files.",
|
|
3558
|
+
agent: options.agent,
|
|
3559
|
+
model: options.model,
|
|
3560
|
+
effort: options.effort,
|
|
3561
|
+
fast: options.fast,
|
|
3562
|
+
planMode: options.planMode,
|
|
3563
|
+
autonomy: options.autonomy,
|
|
3564
|
+
attachments
|
|
3565
|
+
});
|
|
3566
|
+
return openedFrom(thread, { kind: "orchestration" });
|
|
3567
|
+
}
|
|
3568
|
+
function createPhoneWorktreeAgent(fromChatId, draft) {
|
|
3569
|
+
const source = readPhoneThread(fromChatId);
|
|
3570
|
+
if (!source || isGlobalThread(source)) throw new Error("That worktree is not on this Mac.");
|
|
3571
|
+
const defaults = resolveNewThreadOptions();
|
|
3572
|
+
const options = draftAgentOptions(draft, defaults);
|
|
3573
|
+
const attachments = persistPendingFileAttachments(
|
|
3574
|
+
source.worktreePath,
|
|
3575
|
+
phoneTurnAttachments(draft ?? {})
|
|
3576
|
+
);
|
|
3577
|
+
const thread = createChatTab({
|
|
3578
|
+
fromThreadId: source.id,
|
|
3579
|
+
agent: options.agent,
|
|
3580
|
+
...options.agent === "acp" ? { acpHarness: options.acpHarness ?? void 0 } : {},
|
|
3581
|
+
model: options.model,
|
|
3582
|
+
effort: options.effort,
|
|
3583
|
+
fast: options.fast,
|
|
3584
|
+
autonomy: options.autonomy,
|
|
3585
|
+
attachments
|
|
3586
|
+
});
|
|
3587
|
+
if (draft?.planMode !== void 0) updateThread(thread.id, { planMode: draft.planMode });
|
|
3588
|
+
return openedFrom(thread, projectPlace(readThread(thread.id) ?? thread));
|
|
3589
|
+
}
|
|
3590
|
+
async function createPhoneProjectWorktree(repoPathOrInput) {
|
|
3591
|
+
const input = typeof repoPathOrInput === "string" ? { repoPath: repoPathOrInput } : repoPathOrInput;
|
|
3592
|
+
const path2 = assertKnownProject(input.repoPath);
|
|
3593
|
+
const defaults = resolveNewThreadOptions();
|
|
3594
|
+
const options = draftAgentOptions(input, defaults);
|
|
3595
|
+
const thread = await createThread({
|
|
3596
|
+
sourceType: input.sourceType ?? "branch",
|
|
3597
|
+
sourceRef: input.sourceRef || "default",
|
|
3598
|
+
repoPath: path2,
|
|
3599
|
+
title: input.title,
|
|
3600
|
+
cowboy: input.cowboy,
|
|
3601
|
+
agent: options.agent,
|
|
3602
|
+
...options.agent === "acp" ? { acpHarness: options.acpHarness ?? void 0 } : {},
|
|
3603
|
+
model: options.model,
|
|
3604
|
+
effort: options.effort,
|
|
3605
|
+
fast: options.fast,
|
|
3606
|
+
planMode: options.planMode,
|
|
3607
|
+
autonomy: options.autonomy,
|
|
3608
|
+
attachments: phoneTurnAttachments(input),
|
|
3609
|
+
prompt: input.prompt,
|
|
3610
|
+
reuseExisting: false
|
|
3611
|
+
});
|
|
3612
|
+
return openedFrom(thread, projectPlace(thread));
|
|
3613
|
+
}
|
|
3614
|
+
async function listPhoneModels(agent) {
|
|
3615
|
+
const catalogs = await listModelsForAgent(agent);
|
|
3616
|
+
return (catalogs[0]?.models ?? []).slice(0, 40).map((model) => ({
|
|
3617
|
+
id: model.id,
|
|
3618
|
+
label: model.displayName || model.id
|
|
3619
|
+
}));
|
|
3620
|
+
}
|
|
3621
|
+
function archivePhoneChat(chatId) {
|
|
3622
|
+
const thread = readPhoneThread(chatId);
|
|
3623
|
+
if (!thread) return false;
|
|
3624
|
+
updateThread(thread.id, { status: "archived" });
|
|
3625
|
+
return true;
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3504
3628
|
// src/remote/phone-chats.ts
|
|
3505
3629
|
var PHONE_CONTROL_PREFIX = "\0sb.phone\n";
|
|
3506
3630
|
var PREVIEW_LIMIT2 = 90;
|
|
3507
|
-
var AGENT_KINDS = /* @__PURE__ */ new Set(["claude", "codex", "opencode", "brightsy", "cursor"]);
|
|
3631
|
+
var AGENT_KINDS = /* @__PURE__ */ new Set(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]);
|
|
3508
3632
|
var MAX_PHONE_FILES = 8;
|
|
3509
3633
|
var MAX_PHONE_FILE_CHARS = Math.ceil(8 * 1024 * 1024 * 4 / 3);
|
|
3510
3634
|
var MAX_PHONE_FILES_CHARS = Math.ceil(20 * 1024 * 1024 * 4 / 3);
|
|
@@ -3619,6 +3743,12 @@ function parsePhoneDraft(value) {
|
|
|
3619
3743
|
if (!agent) return "invalid";
|
|
3620
3744
|
draft.agent = agent;
|
|
3621
3745
|
}
|
|
3746
|
+
if ("acpHarness" in value) {
|
|
3747
|
+
const harness = value.acpHarness;
|
|
3748
|
+
if (harness === null || harness === "") draft.acpHarness = null;
|
|
3749
|
+
else if (harness === "gemini" || harness === "copilot") draft.acpHarness = harness;
|
|
3750
|
+
else return "invalid";
|
|
3751
|
+
}
|
|
3622
3752
|
if ("model" in value) {
|
|
3623
3753
|
const model = value.model;
|
|
3624
3754
|
if (model === null || model === "") draft.model = null;
|
|
@@ -3741,6 +3871,7 @@ function summarize(thread) {
|
|
|
3741
3871
|
preview: previewOf2(thread),
|
|
3742
3872
|
updatedAt: thread.updatedAt,
|
|
3743
3873
|
agent: thread.agent,
|
|
3874
|
+
...thread.agent === "acp" ? { acpHarness: thread.acpHarness === "copilot" ? "copilot" : "gemini" } : {},
|
|
3744
3875
|
...pr?.url ? { prUrl: pr.url } : {},
|
|
3745
3876
|
...pr?.number ? { prNumber: pr.number } : {},
|
|
3746
3877
|
...pr?.status ? { prStatus: pr.status } : {},
|
|
@@ -3817,6 +3948,7 @@ function readPhoneThread(chatId) {
|
|
|
3817
3948
|
function phoneComposerOptions(thread) {
|
|
3818
3949
|
return {
|
|
3819
3950
|
agent: thread.agent,
|
|
3951
|
+
...thread.agent === "acp" ? { acpHarness: thread.acpHarness === "copilot" ? "copilot" : "gemini" } : {},
|
|
3820
3952
|
model: thread.model ?? null,
|
|
3821
3953
|
effort: thread.effort,
|
|
3822
3954
|
fast: Boolean(thread.fast),
|
|
@@ -3875,101 +4007,6 @@ function assertKnownProject(repoPath) {
|
|
|
3875
4007
|
if (!known) throw new Error("That project is not on this Mac.");
|
|
3876
4008
|
return path2;
|
|
3877
4009
|
}
|
|
3878
|
-
function draftAgentOptions(draft, defaults) {
|
|
3879
|
-
return {
|
|
3880
|
-
agent: draft?.agent ?? defaults.agent,
|
|
3881
|
-
model: draft && "model" in draft ? draft.model ?? null : defaults.model,
|
|
3882
|
-
effort: draft?.effort ?? defaults.effort,
|
|
3883
|
-
fast: draft?.fast ?? defaults.fast,
|
|
3884
|
-
planMode: Boolean(draft?.planMode),
|
|
3885
|
-
autonomy: draft?.autonomy ?? defaults.autonomy
|
|
3886
|
-
};
|
|
3887
|
-
}
|
|
3888
|
-
function createPhoneChat(agent) {
|
|
3889
|
-
const defaults = resolveOrchestratorDefaults();
|
|
3890
|
-
const thread = createGlobalChat({
|
|
3891
|
-
agent: agent ?? defaults.agent,
|
|
3892
|
-
model: defaults.model,
|
|
3893
|
-
effort: defaults.effort,
|
|
3894
|
-
fast: defaults.fast
|
|
3895
|
-
});
|
|
3896
|
-
return openedFrom(thread, { kind: "orchestration" });
|
|
3897
|
-
}
|
|
3898
|
-
async function createPhoneOrchestration(draft) {
|
|
3899
|
-
const goal = (draft?.goal ?? draft?.prompt ?? "").trim();
|
|
3900
|
-
const attachments = phoneTurnAttachments(draft ?? {});
|
|
3901
|
-
if (!goal && attachments.length === 0) return createPhoneChat(draft?.agent);
|
|
3902
|
-
const defaults = resolveOrchestratorDefaults();
|
|
3903
|
-
const options = draftAgentOptions(draft, defaults);
|
|
3904
|
-
const thread = await startOrchestration({
|
|
3905
|
-
goal: goal || "See the attached files.",
|
|
3906
|
-
agent: options.agent,
|
|
3907
|
-
model: options.model,
|
|
3908
|
-
effort: options.effort,
|
|
3909
|
-
fast: options.fast,
|
|
3910
|
-
planMode: options.planMode,
|
|
3911
|
-
autonomy: options.autonomy,
|
|
3912
|
-
attachments
|
|
3913
|
-
});
|
|
3914
|
-
return openedFrom(thread, { kind: "orchestration" });
|
|
3915
|
-
}
|
|
3916
|
-
function createPhoneWorktreeAgent(fromChatId, draft) {
|
|
3917
|
-
const source = readPhoneThread(fromChatId);
|
|
3918
|
-
if (!source || isGlobalThread(source)) throw new Error("That worktree is not on this Mac.");
|
|
3919
|
-
const defaults = resolveNewThreadOptions();
|
|
3920
|
-
const options = draftAgentOptions(draft, defaults);
|
|
3921
|
-
const attachments = persistPendingFileAttachments(
|
|
3922
|
-
source.worktreePath,
|
|
3923
|
-
phoneTurnAttachments(draft ?? {})
|
|
3924
|
-
);
|
|
3925
|
-
const thread = createChatTab({
|
|
3926
|
-
fromThreadId: source.id,
|
|
3927
|
-
agent: options.agent,
|
|
3928
|
-
model: options.model,
|
|
3929
|
-
effort: options.effort,
|
|
3930
|
-
fast: options.fast,
|
|
3931
|
-
autonomy: options.autonomy,
|
|
3932
|
-
attachments
|
|
3933
|
-
});
|
|
3934
|
-
if (draft?.planMode !== void 0) updateThread(thread.id, { planMode: draft.planMode });
|
|
3935
|
-
return openedFrom(thread, projectPlace(readThread(thread.id) ?? thread));
|
|
3936
|
-
}
|
|
3937
|
-
async function createPhoneProjectWorktree(repoPathOrInput) {
|
|
3938
|
-
const input = typeof repoPathOrInput === "string" ? { repoPath: repoPathOrInput } : repoPathOrInput;
|
|
3939
|
-
const path2 = assertKnownProject(input.repoPath);
|
|
3940
|
-
const defaults = resolveNewThreadOptions();
|
|
3941
|
-
const options = draftAgentOptions(input, defaults);
|
|
3942
|
-
const thread = await createThread({
|
|
3943
|
-
sourceType: input.sourceType ?? "branch",
|
|
3944
|
-
sourceRef: input.sourceRef || "default",
|
|
3945
|
-
repoPath: path2,
|
|
3946
|
-
title: input.title,
|
|
3947
|
-
cowboy: input.cowboy,
|
|
3948
|
-
agent: options.agent,
|
|
3949
|
-
model: options.model,
|
|
3950
|
-
effort: options.effort,
|
|
3951
|
-
fast: options.fast,
|
|
3952
|
-
planMode: options.planMode,
|
|
3953
|
-
autonomy: options.autonomy,
|
|
3954
|
-
attachments: phoneTurnAttachments(input),
|
|
3955
|
-
prompt: input.prompt,
|
|
3956
|
-
reuseExisting: false
|
|
3957
|
-
});
|
|
3958
|
-
return openedFrom(thread, projectPlace(thread));
|
|
3959
|
-
}
|
|
3960
|
-
async function listPhoneModels(agent) {
|
|
3961
|
-
const catalogs = await listModelsForAgent(agent);
|
|
3962
|
-
return (catalogs[0]?.models ?? []).slice(0, 40).map((model) => ({
|
|
3963
|
-
id: model.id,
|
|
3964
|
-
label: model.displayName || model.id
|
|
3965
|
-
}));
|
|
3966
|
-
}
|
|
3967
|
-
function archivePhoneChat(chatId) {
|
|
3968
|
-
const thread = readPhoneThread(chatId);
|
|
3969
|
-
if (!thread) return false;
|
|
3970
|
-
updateThread(thread.id, { status: "archived" });
|
|
3971
|
-
return true;
|
|
3972
|
-
}
|
|
3973
4010
|
|
|
3974
4011
|
// src/orchestrator/outbound-turn-reply.ts
|
|
3975
4012
|
function outboundReplyFromTurn(result, copy) {
|
|
@@ -5433,6 +5470,8 @@ function publishOpenedChat(opts, chatId) {
|
|
|
5433
5470
|
function applyPhoneOptions(chatId, draft) {
|
|
5434
5471
|
const patch = {};
|
|
5435
5472
|
if (draft.agent) patch.agent = draft.agent;
|
|
5473
|
+
if (draft.acpHarness !== void 0) patch.acpHarness = draft.acpHarness;
|
|
5474
|
+
else if (draft.agent) patch.acpHarness = draft.agent === "acp" ? "gemini" : null;
|
|
5436
5475
|
if ("model" in draft) patch.model = draft.model ?? null;
|
|
5437
5476
|
if (draft.effort) patch.effort = draft.effort;
|
|
5438
5477
|
if (draft.fast !== void 0) patch.fast = draft.fast;
|
|
@@ -5823,6 +5862,7 @@ function chatKey(row2) {
|
|
|
5823
5862
|
row2.title,
|
|
5824
5863
|
row2.status,
|
|
5825
5864
|
row2.agent,
|
|
5865
|
+
row2.acpHarness ?? "",
|
|
5826
5866
|
row2.preview,
|
|
5827
5867
|
row2.needsYou ? "1" : "0",
|
|
5828
5868
|
row2.blockedReason ?? ""
|
|
@@ -6144,12 +6184,12 @@ function runRemoteHost(opts) {
|
|
|
6144
6184
|
refreshViewerLogin: () => refreshPhoneViewerLogin(true)
|
|
6145
6185
|
});
|
|
6146
6186
|
};
|
|
6147
|
-
const
|
|
6187
|
+
const send4 = (msg) => {
|
|
6148
6188
|
if (!socket || socket.readyState !== socket.OPEN) return;
|
|
6149
6189
|
socket.send(JSON.stringify(msg));
|
|
6150
6190
|
};
|
|
6151
6191
|
const sendRegister = () => {
|
|
6152
|
-
|
|
6192
|
+
send4({
|
|
6153
6193
|
type: "host_register",
|
|
6154
6194
|
deviceId: opts.deviceId,
|
|
6155
6195
|
deviceLabel,
|
|
@@ -6214,11 +6254,11 @@ function runRemoteHost(opts) {
|
|
|
6214
6254
|
log(`Remote connected \xB7 ${deviceLabel}`);
|
|
6215
6255
|
opts.onStatus?.({ connected: true, phoneConnected: false });
|
|
6216
6256
|
sendRegister();
|
|
6217
|
-
if (wantPair)
|
|
6257
|
+
if (wantPair) send4({ type: "host_pair" });
|
|
6218
6258
|
keepalive = createRemoteKeepalive({
|
|
6219
6259
|
intervalMs: opts.pingIntervalMs ?? REMOTE_PING_INTERVAL_MS,
|
|
6220
6260
|
pongTimeoutMs: opts.pongTimeoutMs ?? REMOTE_PONG_TIMEOUT_MS,
|
|
6221
|
-
sendPing: () =>
|
|
6261
|
+
sendPing: () => send4({ type: "ping" }),
|
|
6222
6262
|
onTimeout: () => {
|
|
6223
6263
|
log("remote error: ping timeout");
|
|
6224
6264
|
finish(new Error("remote ping timeout"));
|
|
@@ -6270,8 +6310,8 @@ function runRemoteHost(opts) {
|
|
|
6270
6310
|
clientPublicKey: msg.clientPublicKey,
|
|
6271
6311
|
clientNonce: msg.clientNonce
|
|
6272
6312
|
});
|
|
6273
|
-
if (ready)
|
|
6274
|
-
else
|
|
6313
|
+
if (ready) send4({ type: "e2ee_ready", ...ready });
|
|
6314
|
+
else send4({ type: "e2ee_fail" });
|
|
6275
6315
|
return;
|
|
6276
6316
|
}
|
|
6277
6317
|
if (msg.type === "e2ee") {
|
|
@@ -6279,18 +6319,18 @@ function runRemoteHost(opts) {
|
|
|
6279
6319
|
if (!opened) return;
|
|
6280
6320
|
if (opened.reject) {
|
|
6281
6321
|
hostSeal.reset();
|
|
6282
|
-
|
|
6322
|
+
send4({ type: "e2ee_fail" });
|
|
6283
6323
|
return;
|
|
6284
6324
|
}
|
|
6285
6325
|
if (opened.okFrame) {
|
|
6286
|
-
|
|
6326
|
+
send4({ type: "e2ee", frame: opened.okFrame });
|
|
6287
6327
|
try {
|
|
6288
6328
|
startBoardSync();
|
|
6289
6329
|
} catch (err) {
|
|
6290
6330
|
log(`remote error: ${err instanceof Error ? err.message : err}`);
|
|
6291
6331
|
}
|
|
6292
6332
|
opts.onPairingCode?.(null);
|
|
6293
|
-
|
|
6333
|
+
send4({ type: "pairing_done" });
|
|
6294
6334
|
opts.onStatus?.({ connected: true, phoneConnected: true });
|
|
6295
6335
|
log("phone joined");
|
|
6296
6336
|
return;
|
|
@@ -6336,7 +6376,7 @@ function runRemoteHost(opts) {
|
|
|
6336
6376
|
outbound.type === "assistant" ? { type: "assistant", text: outbound.text } : { type: "ask_user", text: outbound.text, questions: outbound.questions }
|
|
6337
6377
|
);
|
|
6338
6378
|
if (!frame) return;
|
|
6339
|
-
|
|
6379
|
+
send4({ type: "e2ee", frame });
|
|
6340
6380
|
};
|
|
6341
6381
|
setPhonePermissionPush((chatId, prompt) => {
|
|
6342
6382
|
if (getPhoneOpenChat() !== chatId) return;
|
|
@@ -6344,7 +6384,7 @@ function runRemoteHost(opts) {
|
|
|
6344
6384
|
});
|
|
6345
6385
|
const stopPush = hostedPushRelay(opts.url) ? startPhonePushWatch({
|
|
6346
6386
|
enabled: () => Boolean(socket && socket.readyState === socket.OPEN),
|
|
6347
|
-
send: (note) =>
|
|
6387
|
+
send: (note) => send4({ type: "push_notify", chatId: note.chatId, kind: note.kind })
|
|
6348
6388
|
}) : null;
|
|
6349
6389
|
opts.signal?.addEventListener("abort", () => stopPush?.(), { once: true });
|
|
6350
6390
|
void loop();
|
|
@@ -6352,7 +6392,7 @@ function runRemoteHost(opts) {
|
|
|
6352
6392
|
requestPairingCode() {
|
|
6353
6393
|
pendingPhoneToken = { token: generatePhoneToken(), expiresAt: Date.now() + PAIR_TTL_MS };
|
|
6354
6394
|
wantPair = true;
|
|
6355
|
-
|
|
6395
|
+
send4({ type: "host_pair" });
|
|
6356
6396
|
},
|
|
6357
6397
|
updateIdentity(label) {
|
|
6358
6398
|
const next = label.trim();
|
|
@@ -8424,9 +8464,49 @@ async function tryServeStatic(req, res, root) {
|
|
|
8424
8464
|
|
|
8425
8465
|
// src/remote/hub.ts
|
|
8426
8466
|
import { randomBytes as randomBytes8 } from "crypto";
|
|
8467
|
+
|
|
8468
|
+
// src/remote/hub-forget.ts
|
|
8469
|
+
function dropForgottenMac(deviceId, hosts, remembered, codes, phonesByToken, bySocket, pushTokenBySocket) {
|
|
8470
|
+
const id = deviceId.trim();
|
|
8471
|
+
if (!id) return;
|
|
8472
|
+
remembered.delete(id);
|
|
8473
|
+
for (const [code, row2] of codes) {
|
|
8474
|
+
if (row2.deviceId === id) codes.delete(code);
|
|
8475
|
+
}
|
|
8476
|
+
for (const [token, session] of phonesByToken) {
|
|
8477
|
+
if (session.deviceId === id) phonesByToken.delete(token);
|
|
8478
|
+
}
|
|
8479
|
+
const host = hosts.get(id);
|
|
8480
|
+
if (!host) return;
|
|
8481
|
+
const phone = host.phone;
|
|
8482
|
+
hosts.delete(id);
|
|
8483
|
+
bySocket.delete(host.socket);
|
|
8484
|
+
if (phone) {
|
|
8485
|
+
bySocket.delete(phone);
|
|
8486
|
+
pushTokenBySocket.delete(phone);
|
|
8487
|
+
send(phone, { type: "host_offline" });
|
|
8488
|
+
try {
|
|
8489
|
+
phone.close();
|
|
8490
|
+
} catch {
|
|
8491
|
+
}
|
|
8492
|
+
}
|
|
8493
|
+
send(host.socket, { type: "error", message: "This Mac was removed from the account." });
|
|
8494
|
+
try {
|
|
8495
|
+
host.socket.close();
|
|
8496
|
+
} catch {
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8499
|
+
function send(socket, msg) {
|
|
8500
|
+
try {
|
|
8501
|
+
socket.send(JSON.stringify(msg));
|
|
8502
|
+
} catch {
|
|
8503
|
+
}
|
|
8504
|
+
}
|
|
8505
|
+
|
|
8506
|
+
// src/remote/hub.ts
|
|
8427
8507
|
var CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
8428
8508
|
var CODE_TTL_MS = 10 * 60 * 1e3;
|
|
8429
|
-
function
|
|
8509
|
+
function send2(socket, msg) {
|
|
8430
8510
|
try {
|
|
8431
8511
|
socket.send(JSON.stringify(msg));
|
|
8432
8512
|
} catch {
|
|
@@ -8454,15 +8534,18 @@ var RemoteHub = class {
|
|
|
8454
8534
|
handleClientMessage(socket, raw) {
|
|
8455
8535
|
const msg = parseRemoteClientMessage(raw);
|
|
8456
8536
|
if (!msg) {
|
|
8457
|
-
|
|
8537
|
+
send2(socket, { type: "error", message: "invalid message" });
|
|
8458
8538
|
return;
|
|
8459
8539
|
}
|
|
8460
8540
|
if (msg.type === "ping") {
|
|
8461
|
-
|
|
8541
|
+
send2(socket, { type: "pong" });
|
|
8462
8542
|
return;
|
|
8463
8543
|
}
|
|
8464
8544
|
this.dispatch(socket, msg);
|
|
8465
8545
|
}
|
|
8546
|
+
forgetDevice(deviceId) {
|
|
8547
|
+
dropForgottenMac(deviceId, this.hosts, this.remembered, this.codes, this.phonesByToken, this.bySocket, this.pushTokenBySocket);
|
|
8548
|
+
}
|
|
8466
8549
|
detachSocket(socket) {
|
|
8467
8550
|
const bound = this.bySocket.get(socket);
|
|
8468
8551
|
if (!bound) return;
|
|
@@ -8471,7 +8554,7 @@ var RemoteHub = class {
|
|
|
8471
8554
|
if (!host) return;
|
|
8472
8555
|
if (bound.role === "host" && host.socket === socket) {
|
|
8473
8556
|
if (host.phone) {
|
|
8474
|
-
|
|
8557
|
+
send2(host.phone, { type: "host_offline" });
|
|
8475
8558
|
this.bySocket.delete(host.phone);
|
|
8476
8559
|
}
|
|
8477
8560
|
this.hosts.delete(bound.deviceId);
|
|
@@ -8480,7 +8563,7 @@ var RemoteHub = class {
|
|
|
8480
8563
|
if (bound.role === "phone" && host.phone === socket) {
|
|
8481
8564
|
host.phone = null;
|
|
8482
8565
|
this.pushTokenBySocket.delete(socket);
|
|
8483
|
-
|
|
8566
|
+
send2(host.socket, { type: "phone_left" });
|
|
8484
8567
|
}
|
|
8485
8568
|
}
|
|
8486
8569
|
dispatch(socket, msg) {
|
|
@@ -8533,36 +8616,36 @@ var RemoteHub = class {
|
|
|
8533
8616
|
const bound = this.bySocket.get(socket);
|
|
8534
8617
|
const host = bound ? this.hosts.get(bound.deviceId) : null;
|
|
8535
8618
|
if (!bound || !host) {
|
|
8536
|
-
|
|
8619
|
+
send2(socket, { type: "error", message: "pair this phone first" });
|
|
8537
8620
|
return;
|
|
8538
8621
|
}
|
|
8539
8622
|
if (bound.role === "phone") {
|
|
8540
8623
|
if (host.phone !== socket || msg.type === "e2ee_ready" || msg.type === "e2ee_fail") {
|
|
8541
|
-
|
|
8624
|
+
send2(socket, { type: "error", message: "pair this phone first" });
|
|
8542
8625
|
return;
|
|
8543
8626
|
}
|
|
8544
|
-
|
|
8627
|
+
send2(host.socket, msg);
|
|
8545
8628
|
return;
|
|
8546
8629
|
}
|
|
8547
8630
|
if (host.socket !== socket || !host.phone || msg.type === "e2ee_hello") return;
|
|
8548
8631
|
if (msg.type === "e2ee_fail") {
|
|
8549
|
-
|
|
8632
|
+
send2(host.phone, { type: "error", message: "phone session expired \u2014 pair again" });
|
|
8550
8633
|
return;
|
|
8551
8634
|
}
|
|
8552
|
-
|
|
8635
|
+
send2(host.phone, msg);
|
|
8553
8636
|
}
|
|
8554
8637
|
registerHost(socket, deviceId, deviceLabel, hostSecret, accountToken) {
|
|
8555
8638
|
if (this.opts.authorizeHost) {
|
|
8556
8639
|
const decision = this.opts.authorizeHost({ accountToken, deviceId, deviceLabel, hostSecret });
|
|
8557
8640
|
if (!decision.ok) {
|
|
8558
|
-
|
|
8641
|
+
send2(socket, { type: "error", message: decision.message });
|
|
8559
8642
|
return;
|
|
8560
8643
|
}
|
|
8561
8644
|
}
|
|
8562
8645
|
const prior = this.remembered.get(deviceId);
|
|
8563
8646
|
const existing = this.hosts.get(deviceId);
|
|
8564
8647
|
if (prior && prior.hostSecret !== hostSecret || existing && existing.hostSecret !== hostSecret) {
|
|
8565
|
-
|
|
8648
|
+
send2(socket, { type: "error", message: "host secret rejected" });
|
|
8566
8649
|
return;
|
|
8567
8650
|
}
|
|
8568
8651
|
if (existing && existing.socket !== socket) {
|
|
@@ -8572,7 +8655,7 @@ var RemoteHub = class {
|
|
|
8572
8655
|
} catch {
|
|
8573
8656
|
}
|
|
8574
8657
|
if (existing.phone) {
|
|
8575
|
-
|
|
8658
|
+
send2(existing.phone, { type: "host_offline" });
|
|
8576
8659
|
this.pushTokenBySocket.delete(existing.phone);
|
|
8577
8660
|
this.bySocket.delete(existing.phone);
|
|
8578
8661
|
}
|
|
@@ -8590,15 +8673,15 @@ var RemoteHub = class {
|
|
|
8590
8673
|
this.hosts.set(deviceId, host);
|
|
8591
8674
|
this.remembered.set(deviceId, { hostSecret, sessionToken, deviceLabel });
|
|
8592
8675
|
this.bySocket.set(socket, { role: "host", deviceId });
|
|
8593
|
-
|
|
8594
|
-
if (host.phone)
|
|
8676
|
+
send2(socket, { type: "registered", deviceId, deviceLabel });
|
|
8677
|
+
if (host.phone) send2(socket, { type: "phone_joined" });
|
|
8595
8678
|
this.opts.onAuthorized?.(socket);
|
|
8596
8679
|
}
|
|
8597
8680
|
issueCode(socket) {
|
|
8598
8681
|
const bound = this.bySocket.get(socket);
|
|
8599
8682
|
const host = bound?.role === "host" ? this.hosts.get(bound.deviceId) : null;
|
|
8600
8683
|
if (!host || host.socket !== socket) {
|
|
8601
|
-
|
|
8684
|
+
send2(socket, { type: "error", message: "register this Mac before pairing" });
|
|
8602
8685
|
return;
|
|
8603
8686
|
}
|
|
8604
8687
|
for (const [code2, row2] of this.codes) {
|
|
@@ -8607,18 +8690,18 @@ var RemoteHub = class {
|
|
|
8607
8690
|
const code = newCode();
|
|
8608
8691
|
const expiresAt = Date.now() + CODE_TTL_MS;
|
|
8609
8692
|
this.codes.set(code, { code, deviceId: host.deviceId, expiresAt });
|
|
8610
|
-
|
|
8693
|
+
send2(socket, { type: "pairing_code", code, expiresAt });
|
|
8611
8694
|
}
|
|
8612
8695
|
pairPhone(socket, code) {
|
|
8613
8696
|
const row2 = this.codes.get(code);
|
|
8614
8697
|
if (!row2 || row2.expiresAt < Date.now()) {
|
|
8615
8698
|
this.codes.delete(code);
|
|
8616
|
-
|
|
8699
|
+
send2(socket, { type: "error", message: "pairing code expired" });
|
|
8617
8700
|
return;
|
|
8618
8701
|
}
|
|
8619
8702
|
const host = this.hosts.get(row2.deviceId);
|
|
8620
8703
|
if (!host) {
|
|
8621
|
-
|
|
8704
|
+
send2(socket, { type: "error", message: "Mac is offline" });
|
|
8622
8705
|
return;
|
|
8623
8706
|
}
|
|
8624
8707
|
this.attachPhone(socket, host, void 0, code);
|
|
@@ -8667,12 +8750,12 @@ var RemoteHub = class {
|
|
|
8667
8750
|
resumePhone(socket, sessionToken) {
|
|
8668
8751
|
const known = this.knownSession(sessionToken);
|
|
8669
8752
|
if (!known) {
|
|
8670
|
-
|
|
8753
|
+
send2(socket, { type: "error", message: "phone session expired \u2014 pair again" });
|
|
8671
8754
|
return;
|
|
8672
8755
|
}
|
|
8673
8756
|
const host = this.hosts.get(known.deviceId);
|
|
8674
8757
|
if (!host) {
|
|
8675
|
-
|
|
8758
|
+
send2(socket, { type: "host_offline" });
|
|
8676
8759
|
return;
|
|
8677
8760
|
}
|
|
8678
8761
|
this.attachPhone(socket, host, sessionToken);
|
|
@@ -8690,7 +8773,7 @@ var RemoteHub = class {
|
|
|
8690
8773
|
};
|
|
8691
8774
|
});
|
|
8692
8775
|
if (hosts.some((host) => host.deviceId)) this.opts.onAuthorized?.(socket);
|
|
8693
|
-
|
|
8776
|
+
send2(socket, { type: "hosts", hosts });
|
|
8694
8777
|
}
|
|
8695
8778
|
releasePhoneSocket(socket) {
|
|
8696
8779
|
const bound = this.bySocket.get(socket);
|
|
@@ -8700,7 +8783,7 @@ var RemoteHub = class {
|
|
|
8700
8783
|
if (prev?.phone === socket) {
|
|
8701
8784
|
prev.phone = null;
|
|
8702
8785
|
this.pushTokenBySocket.delete(socket);
|
|
8703
|
-
|
|
8786
|
+
send2(prev.socket, { type: "phone_left" });
|
|
8704
8787
|
}
|
|
8705
8788
|
}
|
|
8706
8789
|
attachPhone(socket, host, sessionToken, pairingCode) {
|
|
@@ -8735,36 +8818,36 @@ var RemoteHub = class {
|
|
|
8735
8818
|
if (created) this.opts.phoneSessions?.save(host.deviceId, token);
|
|
8736
8819
|
this.bySocket.set(socket, { role: "phone", deviceId: host.deviceId });
|
|
8737
8820
|
this.opts.onAuthorized?.(socket);
|
|
8738
|
-
|
|
8821
|
+
send2(socket, {
|
|
8739
8822
|
type: "paired",
|
|
8740
8823
|
deviceId: host.deviceId,
|
|
8741
8824
|
deviceLabel: host.deviceLabel,
|
|
8742
8825
|
sessionToken: token
|
|
8743
8826
|
});
|
|
8744
|
-
if (!already)
|
|
8827
|
+
if (!already) send2(host.socket, { type: "phone_joined" });
|
|
8745
8828
|
}
|
|
8746
8829
|
fromPhone(socket, msg) {
|
|
8747
8830
|
const bound = this.bySocket.get(socket);
|
|
8748
8831
|
const host = bound?.role === "phone" ? this.hosts.get(bound.deviceId) : null;
|
|
8749
8832
|
if (!host || host.phone !== socket) {
|
|
8750
|
-
|
|
8833
|
+
send2(socket, { type: "error", message: "pair this phone first" });
|
|
8751
8834
|
return;
|
|
8752
8835
|
}
|
|
8753
8836
|
if (msg.type === "stop") {
|
|
8754
|
-
|
|
8837
|
+
send2(host.socket, { type: "stop" });
|
|
8755
8838
|
return;
|
|
8756
8839
|
}
|
|
8757
|
-
|
|
8840
|
+
send2(host.socket, { type: "inbound", text: msg.text });
|
|
8758
8841
|
}
|
|
8759
8842
|
fromHost(socket, msg) {
|
|
8760
8843
|
const bound = this.bySocket.get(socket);
|
|
8761
8844
|
const host = bound?.role === "host" ? this.hosts.get(bound.deviceId) : null;
|
|
8762
8845
|
if (!host || host.socket !== socket || !host.phone) return;
|
|
8763
8846
|
if (msg.type === "assistant") {
|
|
8764
|
-
|
|
8847
|
+
send2(host.phone, { type: "assistant", text: msg.text });
|
|
8765
8848
|
return;
|
|
8766
8849
|
}
|
|
8767
|
-
|
|
8850
|
+
send2(host.phone, { type: "ask_user", text: msg.text, questions: msg.questions });
|
|
8768
8851
|
}
|
|
8769
8852
|
registerPush(socket, token, sessionTokens) {
|
|
8770
8853
|
const deviceIds = [];
|
|
@@ -9025,6 +9108,47 @@ var RelayAccountStore = class {
|
|
|
9025
9108
|
throw err;
|
|
9026
9109
|
}
|
|
9027
9110
|
}
|
|
9111
|
+
/**
|
|
9112
|
+
* Macs registered on the account that owns `accountToken`.
|
|
9113
|
+
* `null` means the credential is missing or no longer valid.
|
|
9114
|
+
*/
|
|
9115
|
+
listMacs(accountToken) {
|
|
9116
|
+
const accountId = this.verifyCredential(accountToken);
|
|
9117
|
+
if (!accountId) return null;
|
|
9118
|
+
const rows = this.db.prepare(
|
|
9119
|
+
"SELECT device_id, device_label, created_at FROM devices WHERE account_id = ? ORDER BY created_at, device_id"
|
|
9120
|
+
).all(accountId);
|
|
9121
|
+
return rows.map((row2) => ({
|
|
9122
|
+
deviceId: row2.device_id,
|
|
9123
|
+
deviceLabel: row2.device_label,
|
|
9124
|
+
createdAt: row2.created_at
|
|
9125
|
+
}));
|
|
9126
|
+
}
|
|
9127
|
+
/**
|
|
9128
|
+
* Remove one Mac from the signed-in account. The row no longer counts
|
|
9129
|
+
* toward the cap. The account and its other credentials stay.
|
|
9130
|
+
*/
|
|
9131
|
+
forgetMac(accountToken, deviceId) {
|
|
9132
|
+
const id = deviceId.trim();
|
|
9133
|
+
const accountId = this.verifyCredential(accountToken);
|
|
9134
|
+
if (!accountId) return { ok: false, message: "sign in required" };
|
|
9135
|
+
if (!id) return { ok: false, message: "Mac not found" };
|
|
9136
|
+
this.db.exec("BEGIN");
|
|
9137
|
+
try {
|
|
9138
|
+
const device = this.db.prepare("SELECT account_id FROM devices WHERE device_id = ?").get(id);
|
|
9139
|
+
if (!device || device.account_id !== accountId) {
|
|
9140
|
+
this.db.exec("ROLLBACK");
|
|
9141
|
+
return { ok: false, message: "Mac not found" };
|
|
9142
|
+
}
|
|
9143
|
+
this.db.prepare("DELETE FROM push_tokens WHERE device_id = ?").run(id);
|
|
9144
|
+
this.db.prepare("DELETE FROM devices WHERE device_id = ?").run(id);
|
|
9145
|
+
this.db.exec("COMMIT");
|
|
9146
|
+
return { ok: true };
|
|
9147
|
+
} catch (err) {
|
|
9148
|
+
this.db.exec("ROLLBACK");
|
|
9149
|
+
throw err;
|
|
9150
|
+
}
|
|
9151
|
+
}
|
|
9028
9152
|
/** Store a phone pairing when it is created. A later process looks it up on a memory miss. */
|
|
9029
9153
|
savePhoneSession(deviceId, sessionToken) {
|
|
9030
9154
|
const id = deviceId.trim();
|
|
@@ -9290,6 +9414,8 @@ var REMOTE_LOGIN_PATH = "/remote/login";
|
|
|
9290
9414
|
var REMOTE_OAUTH_CALLBACK_PATH = "/remote/oauth/callback";
|
|
9291
9415
|
var REMOTE_OAUTH_RESULT_PATH = "/remote/oauth/result";
|
|
9292
9416
|
var REMOTE_LOGOUT_PATH = "/remote/logout";
|
|
9417
|
+
var REMOTE_MACS_PATH = "/remote/macs";
|
|
9418
|
+
var REMOTE_MACS_FORGET_PATH = "/remote/macs/forget";
|
|
9293
9419
|
var STATE_RE = /^[A-Za-z0-9_-]{16,128}$/;
|
|
9294
9420
|
var LOGIN_TTL_MS = 10 * 60 * 1e3;
|
|
9295
9421
|
var EMPTY_AUTH = { codeVerifier: null, issuer: null };
|
|
@@ -9433,6 +9559,12 @@ function sendHtml2(res, status, title, body) {
|
|
|
9433
9559
|
res.writeHead(status, { "Content-Type": "text/html; charset=utf-8", "Cache-Control": "no-store" });
|
|
9434
9560
|
res.end(oauthReturnPage(title, body));
|
|
9435
9561
|
}
|
|
9562
|
+
function bearerToken(req) {
|
|
9563
|
+
const header2 = req.headers.authorization;
|
|
9564
|
+
if (typeof header2 !== "string") return "";
|
|
9565
|
+
const match = /^Bearer\s+(\S+)/i.exec(header2.trim());
|
|
9566
|
+
return match?.[1]?.trim() ?? "";
|
|
9567
|
+
}
|
|
9436
9568
|
async function handleRelayAccountHttp(opts) {
|
|
9437
9569
|
const reqUrl = opts.req.url || "/";
|
|
9438
9570
|
const path2 = reqUrl.split("?")[0];
|
|
@@ -9557,6 +9689,38 @@ async function handleRelayAccountHttp(opts) {
|
|
|
9557
9689
|
});
|
|
9558
9690
|
return true;
|
|
9559
9691
|
}
|
|
9692
|
+
if (method === "GET" && path2 === REMOTE_MACS_PATH) {
|
|
9693
|
+
const macs = opts.store.listMacs(bearerToken(opts.req));
|
|
9694
|
+
if (!macs) {
|
|
9695
|
+
sendJson2(opts.res, 401, { ok: false, error: "sign in required" });
|
|
9696
|
+
return true;
|
|
9697
|
+
}
|
|
9698
|
+
sendJson2(opts.res, 200, { ok: true, macs });
|
|
9699
|
+
return true;
|
|
9700
|
+
}
|
|
9701
|
+
if (method === "POST" && path2 === REMOTE_MACS_FORGET_PATH) {
|
|
9702
|
+
let body;
|
|
9703
|
+
try {
|
|
9704
|
+
body = await readBody2(opts.req);
|
|
9705
|
+
} catch {
|
|
9706
|
+
sendJson2(opts.res, 400, { ok: false, error: "invalid request" });
|
|
9707
|
+
return true;
|
|
9708
|
+
}
|
|
9709
|
+
const token = (typeof body.accountToken === "string" ? body.accountToken.trim() : "") || bearerToken(opts.req);
|
|
9710
|
+
const deviceId = typeof body.deviceId === "string" ? body.deviceId : "";
|
|
9711
|
+
const result = opts.store.forgetMac(token, deviceId);
|
|
9712
|
+
if (!result.ok) {
|
|
9713
|
+
const status = result.message === "sign in required" ? 401 : 404;
|
|
9714
|
+
sendJson2(opts.res, status, { ok: false, error: result.message });
|
|
9715
|
+
return true;
|
|
9716
|
+
}
|
|
9717
|
+
try {
|
|
9718
|
+
opts.onMacForgotten?.(deviceId.trim());
|
|
9719
|
+
} catch {
|
|
9720
|
+
}
|
|
9721
|
+
sendJson2(opts.res, 200, { ok: true });
|
|
9722
|
+
return true;
|
|
9723
|
+
}
|
|
9560
9724
|
if (method === "POST" && path2 === REMOTE_LOGOUT_PATH) {
|
|
9561
9725
|
let body;
|
|
9562
9726
|
try {
|
|
@@ -9693,7 +9857,8 @@ async function startRelayServer(opts) {
|
|
|
9693
9857
|
oauth: relayOAuth,
|
|
9694
9858
|
sessions: accountSessions,
|
|
9695
9859
|
publicOrigin: publicOrigin(),
|
|
9696
|
-
fetchImpl: opts.fetchImpl
|
|
9860
|
+
fetchImpl: opts.fetchImpl,
|
|
9861
|
+
onMacForgotten: (deviceId) => remoteHub.forgetDevice(deviceId)
|
|
9697
9862
|
})) {
|
|
9698
9863
|
return;
|
|
9699
9864
|
}
|
|
@@ -9961,7 +10126,7 @@ async function startHeadlessHost(opts) {
|
|
|
9961
10126
|
};
|
|
9962
10127
|
const refreshRunning = async () => {
|
|
9963
10128
|
try {
|
|
9964
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
10129
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3I2FLEZL.js");
|
|
9965
10130
|
agentsRunning = getOrchestrator2().getRuntime().running;
|
|
9966
10131
|
} catch {
|
|
9967
10132
|
agentsRunning = 0;
|
|
@@ -10738,6 +10903,7 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
|
|
|
10738
10903
|
sourceType: args.sourceType,
|
|
10739
10904
|
sourceRef: args.sourceRef,
|
|
10740
10905
|
agent: opts.agent,
|
|
10906
|
+
...opts.agent === "acp" ? { acpHarness: args.acpHarness } : {},
|
|
10741
10907
|
model: opts.model,
|
|
10742
10908
|
effort: opts.effort,
|
|
10743
10909
|
fast: opts.fast,
|
|
@@ -10762,6 +10928,7 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
|
|
|
10762
10928
|
branchName: thread.branchName,
|
|
10763
10929
|
worktreePath: thread.worktreePath,
|
|
10764
10930
|
agent: thread.agent,
|
|
10931
|
+
...thread.acpHarness ? { acpHarness: thread.acpHarness } : {},
|
|
10765
10932
|
model: thread.model,
|
|
10766
10933
|
status: thread.status,
|
|
10767
10934
|
cowboy: Boolean(thread.cowboy),
|
|
@@ -12767,7 +12934,7 @@ async function handleJobStop(params, _ctx) {
|
|
|
12767
12934
|
return stopDetachedJob(jobCwd(rec), id, reason ? { reason } : void 0);
|
|
12768
12935
|
}
|
|
12769
12936
|
async function defaultTurnWait(ref, timeoutMs) {
|
|
12770
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
12937
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3I2FLEZL.js");
|
|
12771
12938
|
const orch = getOrchestrator2();
|
|
12772
12939
|
const thread = await orch.waitForTurn(ref, timeoutMs, {
|
|
12773
12940
|
resolveIfStillRunning: true
|
|
@@ -13121,7 +13288,7 @@ async function startMcpServer() {
|
|
|
13121
13288
|
);
|
|
13122
13289
|
}
|
|
13123
13290
|
try {
|
|
13124
|
-
const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-
|
|
13291
|
+
const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-IA7ZZKWQ.js");
|
|
13125
13292
|
orch.setMaxConcurrent(maxConcurrentAgents2());
|
|
13126
13293
|
} catch {
|
|
13127
13294
|
}
|
|
@@ -13701,7 +13868,7 @@ async function startMcpServer() {
|
|
|
13701
13868
|
if (!worktreeProfile) {
|
|
13702
13869
|
registerConnectedIssueVendorTools(server);
|
|
13703
13870
|
const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await import("./caffeinate-hold-ZNUEZGHB.js");
|
|
13704
|
-
const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-
|
|
13871
|
+
const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-IA7ZZKWQ.js");
|
|
13705
13872
|
const accountDefaults = resolveThreadDefaults2();
|
|
13706
13873
|
const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
|
|
13707
13874
|
server.tool(
|
|
@@ -13736,9 +13903,10 @@ async function startMcpServer() {
|
|
|
13736
13903
|
{
|
|
13737
13904
|
sourceType: z10.enum(["branch", "pr", "ticket"]),
|
|
13738
13905
|
sourceRef: z10.string(),
|
|
13739
|
-
agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
|
|
13740
|
-
`Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored.`
|
|
13906
|
+
agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]).optional().describe(
|
|
13907
|
+
`Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored. Pass agent=acp and acpHarness=gemini or copilot for Gemini CLI or Copilot CLI.`
|
|
13741
13908
|
),
|
|
13909
|
+
acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini (Gemini CLI) or copilot (GitHub Copilot CLI)."),
|
|
13742
13910
|
model: z10.string().nullable().optional().describe(
|
|
13743
13911
|
`Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
|
|
13744
13912
|
),
|
|
@@ -14058,7 +14226,7 @@ async function startMcpServer() {
|
|
|
14058
14226
|
}
|
|
14059
14227
|
}
|
|
14060
14228
|
);
|
|
14061
|
-
const agentEnum = z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]);
|
|
14229
|
+
const agentEnum = z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]);
|
|
14062
14230
|
server.tool(
|
|
14063
14231
|
"list_models",
|
|
14064
14232
|
"List models for an agent. Prefer Auto: do not call this unless you have a reason to pin a specific model (user request, cost/latency, capability). Omit agent to list all.",
|
|
@@ -14082,10 +14250,11 @@ async function startMcpServer() {
|
|
|
14082
14250
|
ref: z10.string().describe("Worktree thread id/ref to fork"),
|
|
14083
14251
|
through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
|
|
14084
14252
|
agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
|
|
14253
|
+
acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
|
|
14085
14254
|
model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
|
|
14086
14255
|
title: z10.string().optional()
|
|
14087
14256
|
},
|
|
14088
|
-
async ({ ref, through_index, agent, model, title }) => {
|
|
14257
|
+
async ({ ref, through_index, agent, model, title, acpHarness }) => {
|
|
14089
14258
|
try {
|
|
14090
14259
|
const source = orch.getThread(ref);
|
|
14091
14260
|
if (source) await orch.reconcile(source.repoPath, { drainQueues: false });
|
|
@@ -14093,6 +14262,7 @@ async function startMcpServer() {
|
|
|
14093
14262
|
threadId: ref,
|
|
14094
14263
|
throughIndex: through_index,
|
|
14095
14264
|
agent,
|
|
14265
|
+
acpHarness,
|
|
14096
14266
|
model,
|
|
14097
14267
|
title
|
|
14098
14268
|
});
|
|
@@ -14119,11 +14289,12 @@ async function startMcpServer() {
|
|
|
14119
14289
|
{
|
|
14120
14290
|
ref: z10.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
|
|
14121
14291
|
through_index: z10.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
|
|
14122
|
-
agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
|
|
14292
|
+
agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source). agent=acp with acpHarness=gemini or copilot opens Gemini CLI or Copilot CLI. An orchestration fork cannot use acp."),
|
|
14293
|
+
acpHarness: z10.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
|
|
14123
14294
|
model: z10.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
|
|
14124
14295
|
title: z10.string().optional()
|
|
14125
14296
|
},
|
|
14126
|
-
async ({ ref, through_index, agent, model, title }) => {
|
|
14297
|
+
async ({ ref, through_index, agent, model, title, acpHarness }) => {
|
|
14127
14298
|
try {
|
|
14128
14299
|
const source = orch.getThread(ref);
|
|
14129
14300
|
if (!source) {
|
|
@@ -14136,6 +14307,7 @@ async function startMcpServer() {
|
|
|
14136
14307
|
threadId: source.id,
|
|
14137
14308
|
throughIndex: through_index,
|
|
14138
14309
|
agent,
|
|
14310
|
+
acpHarness,
|
|
14139
14311
|
model,
|
|
14140
14312
|
title
|
|
14141
14313
|
});
|
|
@@ -14188,7 +14360,7 @@ async function startMcpServer() {
|
|
|
14188
14360
|
"Best-of-n: create one thread per agent with the same prompt (parallel attempts)",
|
|
14189
14361
|
{
|
|
14190
14362
|
prompt: z10.string(),
|
|
14191
|
-
agents: z10.array(z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"])),
|
|
14363
|
+
agents: z10.array(z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"])),
|
|
14192
14364
|
repoPath: z10.string(),
|
|
14193
14365
|
sourceType: z10.enum(["branch", "pr", "ticket"]).optional(),
|
|
14194
14366
|
sourceRef: z10.string().optional(),
|
|
@@ -14333,7 +14505,7 @@ async function startMcpServer() {
|
|
|
14333
14505
|
{
|
|
14334
14506
|
repoPath: z10.string(),
|
|
14335
14507
|
branches: z10.array(z10.string()).min(1),
|
|
14336
|
-
agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor"]),
|
|
14508
|
+
agent: z10.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]),
|
|
14337
14509
|
base: z10.string().optional(),
|
|
14338
14510
|
title: z10.string().optional()
|
|
14339
14511
|
},
|
|
@@ -15348,7 +15520,7 @@ function wait3(ms, signal) {
|
|
|
15348
15520
|
);
|
|
15349
15521
|
});
|
|
15350
15522
|
}
|
|
15351
|
-
function
|
|
15523
|
+
function send3(ws, msg) {
|
|
15352
15524
|
ws.send(JSON.stringify(msg));
|
|
15353
15525
|
}
|
|
15354
15526
|
async function runSlackRelayClient(opts) {
|
|
@@ -15458,7 +15630,7 @@ function connectSession2(ws, opts, log) {
|
|
|
15458
15630
|
};
|
|
15459
15631
|
const pingOnce = () => {
|
|
15460
15632
|
try {
|
|
15461
|
-
|
|
15633
|
+
send3(ws, { type: "ping" });
|
|
15462
15634
|
armPongTimeout();
|
|
15463
15635
|
} catch (err) {
|
|
15464
15636
|
finish(err instanceof Error ? err : new Error("relay ping failed"));
|
|
@@ -15468,7 +15640,7 @@ function connectSession2(ws, opts, log) {
|
|
|
15468
15640
|
const label = opts.deviceLabel?.trim() || opts.deviceId.trim();
|
|
15469
15641
|
log(`Relay connected \xB7 ${label}`);
|
|
15470
15642
|
for (const wsInfo of opts.workspaces) {
|
|
15471
|
-
|
|
15643
|
+
send3(ws, {
|
|
15472
15644
|
type: "register",
|
|
15473
15645
|
teamId: wsInfo.teamId,
|
|
15474
15646
|
userId: wsInfo.userId,
|
|
@@ -15521,7 +15693,7 @@ function connectSession2(ws, opts, log) {
|
|
|
15521
15693
|
return;
|
|
15522
15694
|
}
|
|
15523
15695
|
pending.set(msg.eventId, msg.message);
|
|
15524
|
-
|
|
15696
|
+
send3(ws, { type: "claim", eventId: msg.eventId });
|
|
15525
15697
|
if (!relayAnswersClaims) {
|
|
15526
15698
|
const eventId = msg.eventId;
|
|
15527
15699
|
const timer = setTimeout(() => {
|
|
@@ -16194,13 +16366,13 @@ async function relayFetch(fetchImpl, url, init) {
|
|
|
16194
16366
|
throw relayFetchError(err, url);
|
|
16195
16367
|
}
|
|
16196
16368
|
}
|
|
16197
|
-
async function readJson4(res, url) {
|
|
16369
|
+
async function readJson4(res, url, what = "sign-in") {
|
|
16198
16370
|
try {
|
|
16199
16371
|
return await res.json();
|
|
16200
16372
|
} catch {
|
|
16201
16373
|
const kind = (res.headers.get("content-type") ?? "").includes("html") ? "an HTML page" : "a non-JSON body";
|
|
16202
16374
|
throw new Error(
|
|
16203
|
-
`Relay
|
|
16375
|
+
`Relay ${what} returned HTTP ${res.status} with ${kind} (${url}). A work proxy or allowlist often answers with a block page instead of the relay.`
|
|
16204
16376
|
);
|
|
16205
16377
|
}
|
|
16206
16378
|
}
|
|
@@ -16267,6 +16439,44 @@ async function disconnectRemoteAccount(opts) {
|
|
|
16267
16439
|
body: JSON.stringify({ accountToken: opts.accountToken })
|
|
16268
16440
|
});
|
|
16269
16441
|
}
|
|
16442
|
+
function macRows(value) {
|
|
16443
|
+
if (!Array.isArray(value)) return [];
|
|
16444
|
+
const macs = [];
|
|
16445
|
+
for (const row2 of value) {
|
|
16446
|
+
if (!row2 || typeof row2 !== "object") continue;
|
|
16447
|
+
const deviceId = "deviceId" in row2 && typeof row2.deviceId === "string" ? row2.deviceId.trim() : "";
|
|
16448
|
+
const deviceLabel = "deviceLabel" in row2 && typeof row2.deviceLabel === "string" ? row2.deviceLabel : "";
|
|
16449
|
+
const createdAt = "createdAt" in row2 && typeof row2.createdAt === "number" ? row2.createdAt : 0;
|
|
16450
|
+
if (!deviceId) continue;
|
|
16451
|
+
macs.push({ deviceId, deviceLabel, createdAt });
|
|
16452
|
+
}
|
|
16453
|
+
return macs;
|
|
16454
|
+
}
|
|
16455
|
+
async function listRemoteAccountMacs(opts) {
|
|
16456
|
+
const origin = (opts.origin ?? remoteAccountHttpOrigin()).replace(/\/+$/, "");
|
|
16457
|
+
const url = `${origin}${REMOTE_MACS_PATH}`;
|
|
16458
|
+
const res = await relayFetch(opts.fetchImpl, url, {
|
|
16459
|
+
headers: { Authorization: `Bearer ${opts.accountToken}` }
|
|
16460
|
+
});
|
|
16461
|
+
const body = await readJson4(res, url, "Mac list");
|
|
16462
|
+
if (!res.ok || !body.ok) {
|
|
16463
|
+
throw new Error(body.error || `Could not list Macs (HTTP ${res.status}).`);
|
|
16464
|
+
}
|
|
16465
|
+
return macRows(body.macs);
|
|
16466
|
+
}
|
|
16467
|
+
async function forgetRemoteAccountMac(opts) {
|
|
16468
|
+
const origin = (opts.origin ?? remoteAccountHttpOrigin()).replace(/\/+$/, "");
|
|
16469
|
+
const url = `${origin}${REMOTE_MACS_FORGET_PATH}`;
|
|
16470
|
+
const res = await relayFetch(opts.fetchImpl, url, {
|
|
16471
|
+
method: "POST",
|
|
16472
|
+
headers: { "Content-Type": "application/json" },
|
|
16473
|
+
body: JSON.stringify({ accountToken: opts.accountToken, deviceId: opts.deviceId })
|
|
16474
|
+
});
|
|
16475
|
+
const body = await readJson4(res, url, "forget Mac");
|
|
16476
|
+
if (!res.ok || !body.ok) {
|
|
16477
|
+
throw new Error(body.error || `Could not forget that Mac (HTTP ${res.status}).`);
|
|
16478
|
+
}
|
|
16479
|
+
}
|
|
16270
16480
|
|
|
16271
16481
|
// src/slack/outbound-watch.ts
|
|
16272
16482
|
import { existsSync as existsSync6, readFileSync as readFileSync8 } from "fs";
|
|
@@ -16345,7 +16555,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
16345
16555
|
await continueOnReply(threadId, prompt);
|
|
16346
16556
|
return;
|
|
16347
16557
|
}
|
|
16348
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
16558
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-3I2FLEZL.js");
|
|
16349
16559
|
await getOrchestrator2().send(threadId, prompt);
|
|
16350
16560
|
} catch {
|
|
16351
16561
|
}
|
|
@@ -16616,6 +16826,8 @@ export {
|
|
|
16616
16826
|
ABLETIME_ORG_KEY_PREFIX,
|
|
16617
16827
|
ABLETIME_PAT_PREFIX,
|
|
16618
16828
|
ABLETIME_PM_TOOL_NAMES,
|
|
16829
|
+
ACP_HARNESSES,
|
|
16830
|
+
ACP_HARNESS_IDS,
|
|
16619
16831
|
AGENT_DONE_CUSTOM_SOUND_EXTENSIONS,
|
|
16620
16832
|
AGENT_DONE_CUSTOM_SOUND_MAX_BYTES,
|
|
16621
16833
|
AGENT_DONE_SOUNDS,
|
|
@@ -16781,6 +16993,12 @@ export {
|
|
|
16781
16993
|
abletimeToolUsesPm,
|
|
16782
16994
|
accountIdToPin,
|
|
16783
16995
|
ackSlackInboundSeen,
|
|
16996
|
+
acpAdapter,
|
|
16997
|
+
acpHarnessDisplayName,
|
|
16998
|
+
acpHarnessLabel,
|
|
16999
|
+
acpHarnessLooksAuthenticated,
|
|
17000
|
+
acpHarnessStatus,
|
|
17001
|
+
acpRunnerPath,
|
|
16784
17002
|
activeAccountId,
|
|
16785
17003
|
activeRunPreview,
|
|
16786
17004
|
addBoardPin,
|
|
@@ -16794,6 +17012,7 @@ export {
|
|
|
16794
17012
|
agentDoneSoundsDir,
|
|
16795
17013
|
agentGitPrompt,
|
|
16796
17014
|
agentRpcConnectFromMetadata,
|
|
17015
|
+
agentSupportsAttach,
|
|
16797
17016
|
alignQueueAttachments,
|
|
16798
17017
|
allAdapters,
|
|
16799
17018
|
allocatePort,
|
|
@@ -16955,6 +17174,7 @@ export {
|
|
|
16955
17174
|
cursorIssuesUnavailableReason,
|
|
16956
17175
|
cursorSdkMessageToEvents,
|
|
16957
17176
|
decodeBrightsyTarget,
|
|
17177
|
+
defaultAcpHarness,
|
|
16958
17178
|
defaultOrderSubject,
|
|
16959
17179
|
defaultScheduleName,
|
|
16960
17180
|
deleteBranchOnPurgeEnabled,
|
|
@@ -16963,6 +17183,8 @@ export {
|
|
|
16963
17183
|
deleteThreadRecord,
|
|
16964
17184
|
deriveTaskState,
|
|
16965
17185
|
desktopHostPidPath,
|
|
17186
|
+
detectAcpHarness,
|
|
17187
|
+
detectAcpHarnesses,
|
|
16966
17188
|
detectAgents,
|
|
16967
17189
|
detectGhStack,
|
|
16968
17190
|
detectLocalMergeConflicts,
|
|
@@ -17040,6 +17262,7 @@ export {
|
|
|
17040
17262
|
flipLinearRelationType,
|
|
17041
17263
|
foldLegacyRolesIntoNotes,
|
|
17042
17264
|
followUpBehavior,
|
|
17265
|
+
forgetRemoteAccountMac,
|
|
17043
17266
|
forkChatTab,
|
|
17044
17267
|
forkMessageSlice,
|
|
17045
17268
|
forkThreadWorktree,
|
|
@@ -17208,6 +17431,7 @@ export {
|
|
|
17208
17431
|
isAbleTimeConnected,
|
|
17209
17432
|
isAbleTimeOAuthCancelled,
|
|
17210
17433
|
isAbleTimeRejectedCredential,
|
|
17434
|
+
isAcpHarnessId,
|
|
17211
17435
|
isAdoptableRunScriptRequest,
|
|
17212
17436
|
isAgentDoneSound,
|
|
17213
17437
|
isAskUserToolName,
|
|
@@ -17340,6 +17564,7 @@ export {
|
|
|
17340
17564
|
listOrderPlans,
|
|
17341
17565
|
listOrderRows,
|
|
17342
17566
|
listPrs,
|
|
17567
|
+
listRemoteAccountMacs,
|
|
17343
17568
|
listRunScripts,
|
|
17344
17569
|
listSchedules,
|
|
17345
17570
|
listSlackOutboundWatches,
|
|
@@ -17537,6 +17762,7 @@ export {
|
|
|
17537
17762
|
resolveAccountForThread,
|
|
17538
17763
|
resolveAccountProfile,
|
|
17539
17764
|
resolveAccountProfileFromSettings,
|
|
17765
|
+
resolveAcpHarnessCommand,
|
|
17540
17766
|
resolveAgentExecutable,
|
|
17541
17767
|
resolveAgentGitAuthEnv,
|
|
17542
17768
|
resolveClaudeExecutable,
|