@axhub/genie 0.2.6 → 0.2.8
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/api-docs.html +2 -2
- package/dist/assets/App-CTKZtqB1.js +460 -0
- package/dist/assets/{ReviewApp-BEicSBzW.js → ReviewApp-DM6BNAzR.js} +1 -1
- package/dist/assets/{_basePickBy-DkiHsp3X.js → _basePickBy-CqJbRZ9y.js} +1 -1
- package/dist/assets/{_baseUniq-7ElXb2sX.js → _baseUniq-BS8YH8jO.js} +1 -1
- package/dist/assets/{arc-CEsS3MdK.js → arc-BBmKEN-S.js} +1 -1
- package/dist/assets/{architectureDiagram-2XIMDMQ5-BubZ7T3U.js → architectureDiagram-2XIMDMQ5-N5lcb82R.js} +1 -1
- package/dist/assets/{blockDiagram-WCTKOSBZ-Cza6M6Ht.js → blockDiagram-WCTKOSBZ-DTMwHuLn.js} +1 -1
- package/dist/assets/{c4Diagram-IC4MRINW-jhjtOQ12.js → c4Diagram-IC4MRINW-BTKlkXI9.js} +1 -1
- package/dist/assets/channel-1oJBvF-0.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB--HkodwbY.js → chunk-4BX2VUAB-DUdoTxAc.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-CyBuez4e.js → chunk-55IACEB6-Bm_92xe4.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-CuzG4iAl.js → chunk-FMBD7UC4-CGW0g62g.js} +1 -1
- package/dist/assets/{chunk-JSJVCQXG-BNi8S861.js → chunk-JSJVCQXG-DYkTH3w1.js} +1 -1
- package/dist/assets/{chunk-KX2RTZJC-D817O-GT.js → chunk-KX2RTZJC-C9oTlISU.js} +1 -1
- package/dist/assets/{chunk-NQ4KR5QH-DyujyOvx.js → chunk-NQ4KR5QH-CM50ygWP.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-VMEn-zxh.js → chunk-QZHKN3VN-7dzpYeNJ.js} +1 -1
- package/dist/assets/{chunk-WL4C6EOR-CQHHFLvx.js → chunk-WL4C6EOR-Cm9nQrsr.js} +1 -1
- package/dist/assets/classDiagram-VBA2DB6C-d5TeKFM4.js +1 -0
- package/dist/assets/classDiagram-v2-RAHNMMFH-d5TeKFM4.js +1 -0
- package/dist/assets/clone-CinxIlEu.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-qykDd54p.js → cose-bilkent-S5V4N54A-Ccp_p0JZ.js} +1 -1
- package/dist/assets/{dagre-KLK3FWXG-Bqp7DjEa.js → dagre-KLK3FWXG-fBwTLUp9.js} +1 -1
- package/dist/assets/{diagram-E7M64L7V-BKtx468K.js → diagram-E7M64L7V-CeNVmFUp.js} +1 -1
- package/dist/assets/{diagram-IFDJBPK2--fHfW6V2.js → diagram-IFDJBPK2-CtavyLGa.js} +1 -1
- package/dist/assets/{diagram-P4PSJMXO-D1kQI5RB.js → diagram-P4PSJMXO-CpQTjQwc.js} +1 -1
- package/dist/assets/{erDiagram-INFDFZHY-DT9YzdNw.js → erDiagram-INFDFZHY-B8R5vwhd.js} +1 -1
- package/dist/assets/{flowDiagram-PKNHOUZH-DWeNr4yg.js → flowDiagram-PKNHOUZH-BvkVVwIQ.js} +1 -1
- package/dist/assets/{ganttDiagram-A5KZAMGK--IgwcUhI.js → ganttDiagram-A5KZAMGK-DOu3hSNa.js} +1 -1
- package/dist/assets/{gitGraphDiagram-K3NZZRJ6-B5a8UWjN.js → gitGraphDiagram-K3NZZRJ6-C7zT67YE.js} +1 -1
- package/dist/assets/{graph-Cw1rYoD9.js → graph-D11wiwHo.js} +1 -1
- package/dist/assets/{highlighted-body-TPN3WLV5-BCxJHuqY.js → highlighted-body-TPN3WLV5-Babpthg-.js} +1 -1
- package/dist/assets/index-DFxzgWoO.js +2 -0
- package/dist/assets/index-YCFGDVKw.css +1 -0
- package/dist/assets/{infoDiagram-LFFYTUFH-D2u70rhN.js → infoDiagram-LFFYTUFH-BmA7IpQG.js} +1 -1
- package/dist/assets/{ishikawaDiagram-PHBUUO56-Cl8yrezU.js → ishikawaDiagram-PHBUUO56-BEquZd3E.js} +1 -1
- package/dist/assets/{journeyDiagram-4ABVD52K-ddP0AMU9.js → journeyDiagram-4ABVD52K-BfemGz7f.js} +1 -1
- package/dist/assets/{kanban-definition-K7BYSVSG-DbVt0v29.js → kanban-definition-K7BYSVSG-CWja3mln.js} +1 -1
- package/dist/assets/{layout-W_tRx4UV.js → layout-BLUNf-PJ.js} +1 -1
- package/dist/assets/{linear-CcMb2ay-.js → linear-DukIV_Xv.js} +1 -1
- package/dist/assets/{mermaid-O7DHMXV3-BBJqt8pT.js → mermaid-O7DHMXV3-SgtM28qI.js} +265 -215
- package/dist/assets/{mindmap-definition-YRQLILUH-BGhZa7Na.js → mindmap-definition-YRQLILUH-4UjqXITU.js} +1 -1
- package/dist/assets/{pieDiagram-SKSYHLDU-CDyJaACv.js → pieDiagram-SKSYHLDU-8AxqJd0M.js} +1 -1
- package/dist/assets/{quadrantDiagram-337W2JSQ-BSYuqf0Q.js → quadrantDiagram-337W2JSQ-D60m8V8r.js} +1 -1
- package/dist/assets/{requirementDiagram-Z7DCOOCP-Cfi9YX9H.js → requirementDiagram-Z7DCOOCP-zqh9jBVf.js} +1 -1
- package/dist/assets/{sankeyDiagram-WA2Y5GQK-Di1ShaMF.js → sankeyDiagram-WA2Y5GQK-CDZILTLI.js} +1 -1
- package/dist/assets/{sequenceDiagram-2WXFIKYE-CYTTG38e.js → sequenceDiagram-2WXFIKYE-7BReFd0L.js} +1 -1
- package/dist/assets/{stateDiagram-RAJIS63D-CVZYMqyW.js → stateDiagram-RAJIS63D-HPTVdIG4.js} +1 -1
- package/dist/assets/stateDiagram-v2-FVOUBMTO-DTUf5_gC.js +1 -0
- package/dist/assets/{timeline-definition-YZTLITO2-B1sdb5mK.js → timeline-definition-YZTLITO2-CTVllFgr.js} +1 -1
- package/dist/assets/{treemap-KZPCXAKY-CGG4gx3C.js → treemap-KZPCXAKY-BtyxboJZ.js} +1 -1
- package/dist/assets/{vennDiagram-LZ73GAT5-Dds37L2k.js → vennDiagram-LZ73GAT5-D96ZI6Mg.js} +1 -1
- package/dist/assets/{xychartDiagram-JWTSCODW-C8QKSyRR.js → xychartDiagram-JWTSCODW-eRk-39YO.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +35 -33
- package/server/_legacy-providers/README.md +30 -0
- package/server/_legacy-providers/claude-sdk.js +956 -0
- package/server/_legacy-providers/gemini-cli.js +368 -0
- package/server/_legacy-providers/openai-codex.js +705 -0
- package/server/_legacy-providers/opencode-cli.js +674 -0
- package/server/acp-runtime/client.js +1872 -0
- package/server/acp-runtime/index.js +408 -0
- package/server/acp-runtime/registry.js +45 -0
- package/server/acp-runtime/session-store.js +254 -0
- package/server/channels/runtime/AgentRuntimeAdapter.js +22 -80
- package/server/claude-sdk.js +24 -946
- package/server/cli.js +140 -2
- package/server/external-agent/service.js +52 -63
- package/server/gemini-cli.js +21 -360
- package/server/index.js +133 -58
- package/server/openai-codex.js +19 -695
- package/server/opencode-cli.js +68 -640
- package/server/projects.js +128 -85
- package/server/routes/agent.js +2 -0
- package/server/routes/cc-connect.js +1131 -0
- package/server/routes/cli-auth.js +1 -73
- package/server/routes/commands.js +4 -9
- package/server/routes/git.js +3 -20
- package/server/routes/projects.js +45 -24
- package/server/routes/session-core.js +44 -10
- package/server/session-core/abortSession.js +2 -18
- package/server/session-core/eventStore.js +5 -1
- package/server/session-core/providerAdapters.js +98 -10
- package/server/session-core/providerDiscovery.js +8 -3
- package/server/session-core/runtimeState.js +16 -17
- package/server/session-core/runtimeWriter.js +19 -12
- package/server/utils/ccConnectManager.js +390 -0
- package/server/utils/ccConnectState.js +575 -0
- package/server/utils/resolveCommandPath.js +71 -0
- package/server/utils/workspaceRoots.js +154 -0
- package/shared/conversationEvents.js +347 -10
- package/dist/assets/App-CYTE30Cf.js +0 -484
- package/dist/assets/channel-RmqTALN0.js +0 -1
- package/dist/assets/classDiagram-VBA2DB6C-wvVV1ggz.js +0 -1
- package/dist/assets/classDiagram-v2-RAHNMMFH-wvVV1ggz.js +0 -1
- package/dist/assets/clone-oT5aWXpf.js +0 -1
- package/dist/assets/index-CBuAXA5S.js +0 -2
- package/dist/assets/index-CyLWKyxy.css +0 -1
- package/dist/assets/stateDiagram-v2-FVOUBMTO-Bbl0b4-i.js +0 -1
- package/server/cli.test.js +0 -76
- package/server/external-agent/service.test.js +0 -53
- package/server/external-agent/ws.test.js +0 -289
package/server/cli.js
CHANGED
|
@@ -24,6 +24,10 @@ import {
|
|
|
24
24
|
DEFAULT_WORKING_DIRECTORY_ENV,
|
|
25
25
|
getConfiguredDefaultProjectPath,
|
|
26
26
|
} from './utils/defaultWorkingDirectory.js';
|
|
27
|
+
import {
|
|
28
|
+
getCcConnectConnectionSummary,
|
|
29
|
+
updateCcConnectPlatformBinding,
|
|
30
|
+
} from './utils/ccConnectManager.js';
|
|
27
31
|
|
|
28
32
|
const __filename = fileURLToPath(import.meta.url);
|
|
29
33
|
const __dirname = dirname(__filename);
|
|
@@ -374,6 +378,27 @@ function buildEditorErrorResponse({ requestId, channel = null, targetClientId =
|
|
|
374
378
|
};
|
|
375
379
|
}
|
|
376
380
|
|
|
381
|
+
function buildCcConnectSuccessResponse({ command, platform = null, data = {} }) {
|
|
382
|
+
return {
|
|
383
|
+
ok: true,
|
|
384
|
+
command,
|
|
385
|
+
platform,
|
|
386
|
+
data,
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function buildCcConnectErrorResponse({ command, platform = null, code, message }) {
|
|
391
|
+
return {
|
|
392
|
+
ok: false,
|
|
393
|
+
command,
|
|
394
|
+
platform,
|
|
395
|
+
error: {
|
|
396
|
+
code,
|
|
397
|
+
message,
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
|
|
377
402
|
function printJson(payload) {
|
|
378
403
|
console.log(JSON.stringify(payload, null, 2));
|
|
379
404
|
}
|
|
@@ -627,6 +652,96 @@ async function runEditorCommand(positionals, options) {
|
|
|
627
652
|
}
|
|
628
653
|
}
|
|
629
654
|
|
|
655
|
+
function buildCcConnectCommand(positionals, options) {
|
|
656
|
+
const commandPath = positionals.join(' ');
|
|
657
|
+
const requestedPlatform = typeof options.platform === 'string' ? options.platform.trim() : '';
|
|
658
|
+
|
|
659
|
+
if (commandPath === 'cc-connect' || commandPath === 'cc-connect status') {
|
|
660
|
+
return {
|
|
661
|
+
command: 'cc-connect status',
|
|
662
|
+
action: 'status',
|
|
663
|
+
platform: requestedPlatform || null,
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
if (commandPath === 'cc-connect set') {
|
|
668
|
+
const platform = requireOption(options, 'platform', '--platform is required');
|
|
669
|
+
const provider = typeof options.provider === 'string' && options.provider.trim()
|
|
670
|
+
? options.provider.trim()
|
|
671
|
+
: null;
|
|
672
|
+
const projectPath = typeof options.projectPath === 'string' && options.projectPath.trim()
|
|
673
|
+
? path.resolve(options.projectPath)
|
|
674
|
+
: null;
|
|
675
|
+
|
|
676
|
+
if (!provider && !projectPath) {
|
|
677
|
+
throw new Error('At least one of --provider or --project-path is required.');
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
return {
|
|
681
|
+
command: 'cc-connect set',
|
|
682
|
+
action: 'set',
|
|
683
|
+
platform,
|
|
684
|
+
provider,
|
|
685
|
+
projectPath,
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
throw new Error(`Unknown cc-connect command: ${commandPath}`);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
async function runCcConnectCommand(positionals, options) {
|
|
693
|
+
const command = buildCcConnectCommand(positionals, options);
|
|
694
|
+
|
|
695
|
+
try {
|
|
696
|
+
if (command.action === 'status') {
|
|
697
|
+
const summary = await getCcConnectConnectionSummary(command.platform);
|
|
698
|
+
const data = command.platform
|
|
699
|
+
? {
|
|
700
|
+
ccConnect: summary.ccConnect,
|
|
701
|
+
providers: summary.providers,
|
|
702
|
+
platform: summary.platform,
|
|
703
|
+
}
|
|
704
|
+
: {
|
|
705
|
+
ccConnect: summary.ccConnect,
|
|
706
|
+
providers: summary.providers,
|
|
707
|
+
platforms: summary.platforms,
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
printJson(buildCcConnectSuccessResponse({
|
|
711
|
+
command: command.command,
|
|
712
|
+
platform: command.platform,
|
|
713
|
+
data,
|
|
714
|
+
}));
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
if (command.action === 'set') {
|
|
719
|
+
const result = await updateCcConnectPlatformBinding({
|
|
720
|
+
platformId: command.platform,
|
|
721
|
+
provider: command.provider === null ? undefined : command.provider,
|
|
722
|
+
projectPath: command.projectPath === null ? undefined : command.projectPath,
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
printJson(buildCcConnectSuccessResponse({
|
|
726
|
+
command: command.command,
|
|
727
|
+
platform: result.platform,
|
|
728
|
+
data: result,
|
|
729
|
+
}));
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
throw new Error(`Unsupported cc-connect action: ${command.action}`);
|
|
734
|
+
} catch (error) {
|
|
735
|
+
printJson(buildCcConnectErrorResponse({
|
|
736
|
+
command: command.command,
|
|
737
|
+
platform: command.platform || null,
|
|
738
|
+
code: error.code || 'CC_CONNECT_COMMAND_FAILED',
|
|
739
|
+
message: error.message,
|
|
740
|
+
}));
|
|
741
|
+
process.exit(1);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
630
745
|
// Show status command
|
|
631
746
|
function showStatus(options = {}) {
|
|
632
747
|
const runtimeStatus = getRuntimeStatus();
|
|
@@ -740,6 +855,8 @@ function showStatus(options = {}) {
|
|
|
740
855
|
|
|
741
856
|
// Show help
|
|
742
857
|
function showHelp() {
|
|
858
|
+
const defaultProjectUrl = 'https://github.com/lintendo/AI-Web-UI';
|
|
859
|
+
const defaultIssuesUrl = `${defaultProjectUrl}/issues`;
|
|
743
860
|
console.log(`
|
|
744
861
|
╔═══════════════════════════════════════════════════════════════╗
|
|
745
862
|
║ Axhub Genie - Command Line Tool ║
|
|
@@ -752,6 +869,7 @@ Commands:
|
|
|
752
869
|
start Start the Axhub Genie server (default)
|
|
753
870
|
stop Stop the running Axhub Genie server
|
|
754
871
|
status Show configuration and data locations
|
|
872
|
+
cc-connect Inspect or update platform connection bindings
|
|
755
873
|
editor Query or control a connected web editor frontend
|
|
756
874
|
update Update to the latest version
|
|
757
875
|
help Show this help information
|
|
@@ -767,9 +885,12 @@ Options:
|
|
|
767
885
|
--json Output JSON (status or editor commands)
|
|
768
886
|
--api-base <url> Override API base URL for editor commands
|
|
769
887
|
--api-key <key> API key for /api/agent/ws editor commands
|
|
888
|
+
--platform <id> Target platform for cc-connect commands
|
|
889
|
+
--provider <id> Provider for cc-connect updates or editor task references
|
|
770
890
|
--channel <name> Integration channel for editor commands
|
|
771
891
|
--target-client-id <id> Target frontend client ID for editor commands
|
|
772
892
|
--client-id <id> Optional client filter for editor clients list
|
|
893
|
+
--project-path <path> Project path for cc-connect platform binding updates
|
|
773
894
|
--element-key <key> Target element key for editor node commands
|
|
774
895
|
--status <values> Comma-separated status filters for editor nodes list
|
|
775
896
|
--state <editing|idle> Target editing state for editor editing set
|
|
@@ -788,6 +909,9 @@ Examples:
|
|
|
788
909
|
$ axhub-genie stop # Stop running server
|
|
789
910
|
$ axhub-genie status # Show configuration
|
|
790
911
|
$ axhub-genie status --json # Get machine-readable status
|
|
912
|
+
$ axhub-genie cc-connect status
|
|
913
|
+
$ axhub-genie cc-connect set --platform weixin --provider codex
|
|
914
|
+
$ axhub-genie cc-connect set --platform feishu --project-path /path/to/repo
|
|
791
915
|
$ axhub-genie editor clients list --channel project-a
|
|
792
916
|
$ axhub-genie editor snapshot --channel project-a --target-client-id figma-123
|
|
793
917
|
$ axhub-genie editor nodes list --channel project-a --target-client-id figma-123 --status pending-dispatch,dirty
|
|
@@ -805,10 +929,10 @@ Environment Variables:
|
|
|
805
929
|
AXHUB_GENIE_NO_OPEN Set to true to disable auto-opening the homepage
|
|
806
930
|
|
|
807
931
|
Documentation:
|
|
808
|
-
${packageJson.homepage ||
|
|
932
|
+
${packageJson.homepage || defaultProjectUrl}
|
|
809
933
|
|
|
810
934
|
Report Issues:
|
|
811
|
-
${packageJson.bugs?.url ||
|
|
935
|
+
${packageJson.bugs?.url || defaultIssuesUrl}
|
|
812
936
|
`);
|
|
813
937
|
}
|
|
814
938
|
|
|
@@ -938,10 +1062,18 @@ function parseArgs(args) {
|
|
|
938
1062
|
parsed.options.apiKey = args[++i];
|
|
939
1063
|
} else if (arg.startsWith('--api-key=')) {
|
|
940
1064
|
parsed.options.apiKey = arg.split('=')[1];
|
|
1065
|
+
} else if (arg === '--platform') {
|
|
1066
|
+
parsed.options.platform = args[++i];
|
|
1067
|
+
} else if (arg.startsWith('--platform=')) {
|
|
1068
|
+
parsed.options.platform = arg.split('=')[1];
|
|
941
1069
|
} else if (arg === '--channel') {
|
|
942
1070
|
parsed.options.channel = args[++i];
|
|
943
1071
|
} else if (arg.startsWith('--channel=')) {
|
|
944
1072
|
parsed.options.channel = arg.split('=')[1];
|
|
1073
|
+
} else if (arg === '--project-path') {
|
|
1074
|
+
parsed.options.projectPath = args[++i];
|
|
1075
|
+
} else if (arg.startsWith('--project-path=')) {
|
|
1076
|
+
parsed.options.projectPath = arg.split('=')[1];
|
|
945
1077
|
} else if (arg === '--target-client-id') {
|
|
946
1078
|
parsed.options.targetClientId = args[++i];
|
|
947
1079
|
} else if (arg.startsWith('--target-client-id=')) {
|
|
@@ -1039,6 +1171,9 @@ async function main() {
|
|
|
1039
1171
|
case 'editor':
|
|
1040
1172
|
await runEditorCommand(positionals, options);
|
|
1041
1173
|
break;
|
|
1174
|
+
case 'cc-connect':
|
|
1175
|
+
await runCcConnectCommand(positionals, options);
|
|
1176
|
+
break;
|
|
1042
1177
|
case 'status':
|
|
1043
1178
|
case 'info':
|
|
1044
1179
|
showStatus(options);
|
|
@@ -1076,6 +1211,9 @@ if (isDirectExecution) {
|
|
|
1076
1211
|
}
|
|
1077
1212
|
|
|
1078
1213
|
export {
|
|
1214
|
+
buildCcConnectCommand,
|
|
1215
|
+
buildCcConnectErrorResponse,
|
|
1216
|
+
buildCcConnectSuccessResponse,
|
|
1079
1217
|
buildEditorRequest,
|
|
1080
1218
|
buildEditorSuccessResponse,
|
|
1081
1219
|
buildEditorErrorResponse,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { promises as fs } from 'fs';
|
|
2
2
|
|
|
3
3
|
import { addProjectManually } from '../projects.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import {
|
|
5
|
+
applyConversationEventToTimelineMessages,
|
|
6
|
+
CONVERSATION_EVENT_KINDS
|
|
7
|
+
} from '../../shared/conversationEvents.js';
|
|
8
|
+
import { executeAgentPrompt } from '../acp-runtime/index.js';
|
|
8
9
|
import { detectProviderInstallationStatus } from '../routes/cli-auth.js';
|
|
9
10
|
import {
|
|
10
11
|
buildAgentCallbackPayload,
|
|
@@ -16,7 +17,6 @@ import {
|
|
|
16
17
|
} from '../utils/agentCallback.js';
|
|
17
18
|
import { normalizeExternalImages } from '../utils/agentImages.js';
|
|
18
19
|
import { resolveWorkingDirectory } from '../utils/defaultWorkingDirectory.js';
|
|
19
|
-
import { CODEX_MODELS, GEMINI_MODELS, OPENCODE_MODELS } from '../../shared/modelConstants.js';
|
|
20
20
|
|
|
21
21
|
export const SUPPORTED_EXTERNAL_AGENT_PROVIDERS = ['claude', 'codex', 'gemini', 'opencode'];
|
|
22
22
|
|
|
@@ -274,7 +274,7 @@ function extractTerminalErrorMessage(payload) {
|
|
|
274
274
|
export class CallbackCaptureWriter {
|
|
275
275
|
constructor() {
|
|
276
276
|
this.sessionId = null;
|
|
277
|
-
this.
|
|
277
|
+
this.timelineMessages = [];
|
|
278
278
|
this.tokenSummary = createEmptyTokenSummary();
|
|
279
279
|
this.terminalState = null;
|
|
280
280
|
this.terminalErrorMessage = null;
|
|
@@ -303,24 +303,34 @@ export class CallbackCaptureWriter {
|
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
if (payload.type === '
|
|
307
|
-
this.
|
|
308
|
-
|
|
306
|
+
if (payload.type === 'conversation-event' && payload.event) {
|
|
307
|
+
this.timelineMessages = applyConversationEventToTimelineMessages(
|
|
308
|
+
this.timelineMessages,
|
|
309
|
+
payload.event,
|
|
310
|
+
payload.event.provider || 'claude'
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
if (payload.event.kind === CONVERSATION_EVENT_KINDS.ERROR) {
|
|
314
|
+
this.terminalState = 'errored';
|
|
315
|
+
this.terminalErrorMessage = payload.event.payload?.message || this.terminalErrorMessage || 'Agent session failed';
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
309
318
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
content: payload.data.content
|
|
319
|
+
if (payload.event.kind === CONVERSATION_EVENT_KINDS.SESSION_STATE_CHANGED) {
|
|
320
|
+
const nextState = String(payload.event.payload?.state || '').trim().toLowerCase();
|
|
321
|
+
if (nextState === 'completed') {
|
|
322
|
+
this.terminalState = 'completed';
|
|
323
|
+
this.terminalErrorMessage = null;
|
|
324
|
+
} else if (nextState === 'aborted') {
|
|
325
|
+
this.terminalState = 'aborted';
|
|
326
|
+
this.terminalErrorMessage = 'Session aborted';
|
|
327
|
+
} else if (nextState === 'errored') {
|
|
328
|
+
this.terminalState = 'errored';
|
|
329
|
+
this.terminalErrorMessage = payload.event.payload?.message || this.terminalErrorMessage || 'Agent session failed';
|
|
322
330
|
}
|
|
323
|
-
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return;
|
|
324
334
|
}
|
|
325
335
|
|
|
326
336
|
if (payload.type === 'session-aborted') {
|
|
@@ -359,7 +369,16 @@ export class CallbackCaptureWriter {
|
|
|
359
369
|
}
|
|
360
370
|
|
|
361
371
|
getAssistantMessages() {
|
|
362
|
-
return this.
|
|
372
|
+
return this.timelineMessages
|
|
373
|
+
.filter((message) => message?.type === 'assistant' && !message?.isToolUse && !message?.isSystemNotice)
|
|
374
|
+
.map((message) => ({
|
|
375
|
+
type: 'assistant',
|
|
376
|
+
message: {
|
|
377
|
+
role: 'assistant',
|
|
378
|
+
content: message.content || ''
|
|
379
|
+
},
|
|
380
|
+
timestamp: message.timestamp || null
|
|
381
|
+
}));
|
|
363
382
|
}
|
|
364
383
|
|
|
365
384
|
getTotalTokens() {
|
|
@@ -418,52 +437,19 @@ async function ensureProjectPathExists(projectPath) {
|
|
|
418
437
|
}
|
|
419
438
|
|
|
420
439
|
async function runProviderSession({ provider, message, images, finalProjectPath, sessionId, model, writer }) {
|
|
421
|
-
|
|
422
|
-
|
|
440
|
+
await executeAgentPrompt({
|
|
441
|
+
agentKey: provider,
|
|
442
|
+
command: message,
|
|
443
|
+
options: {
|
|
423
444
|
projectPath: finalProjectPath,
|
|
424
445
|
cwd: finalProjectPath,
|
|
425
446
|
sessionId,
|
|
426
447
|
model,
|
|
427
448
|
permissionMode: 'bypassPermissions',
|
|
428
449
|
images
|
|
429
|
-
},
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
if (provider === 'codex') {
|
|
434
|
-
await queryCodex(message, {
|
|
435
|
-
projectPath: finalProjectPath,
|
|
436
|
-
cwd: finalProjectPath,
|
|
437
|
-
sessionId,
|
|
438
|
-
model: model || CODEX_MODELS.DEFAULT,
|
|
439
|
-
permissionMode: 'bypassPermissions',
|
|
440
|
-
images
|
|
441
|
-
}, writer);
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if (provider === 'gemini') {
|
|
446
|
-
await queryGemini(message, {
|
|
447
|
-
projectPath: finalProjectPath,
|
|
448
|
-
cwd: finalProjectPath,
|
|
449
|
-
sessionId,
|
|
450
|
-
resume: !!sessionId,
|
|
451
|
-
model: model || GEMINI_MODELS.DEFAULT,
|
|
452
|
-
permissionMode: 'bypassPermissions'
|
|
453
|
-
}, writer);
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
if (provider === 'opencode') {
|
|
458
|
-
await queryOpencode(message, {
|
|
459
|
-
projectPath: finalProjectPath,
|
|
460
|
-
cwd: finalProjectPath,
|
|
461
|
-
sessionId,
|
|
462
|
-
resume: !!sessionId,
|
|
463
|
-
model: model || OPENCODE_MODELS.DEFAULT,
|
|
464
|
-
permissionMode: 'bypassPermissions'
|
|
465
|
-
}, writer);
|
|
466
|
-
}
|
|
450
|
+
},
|
|
451
|
+
writer
|
|
452
|
+
});
|
|
467
453
|
}
|
|
468
454
|
|
|
469
455
|
export async function runExternalAgentRequest({
|
|
@@ -483,6 +469,7 @@ export async function runExternalAgentRequest({
|
|
|
483
469
|
const response = {
|
|
484
470
|
success: true,
|
|
485
471
|
openOnly: true,
|
|
472
|
+
runtime: 'acp',
|
|
486
473
|
sessionId: normalized.normalizedSessionId,
|
|
487
474
|
...buildSessionNavigation(normalized.normalizedSessionId),
|
|
488
475
|
isResumed: true,
|
|
@@ -491,6 +478,7 @@ export async function runExternalAgentRequest({
|
|
|
491
478
|
|
|
492
479
|
transportWriter?.send?.({
|
|
493
480
|
type: 'open-only',
|
|
481
|
+
runtime: 'acp',
|
|
494
482
|
...response
|
|
495
483
|
});
|
|
496
484
|
|
|
@@ -550,6 +538,7 @@ export async function runExternalAgentRequest({
|
|
|
550
538
|
const response = {
|
|
551
539
|
success: true,
|
|
552
540
|
sessionId: callbackSessionId,
|
|
541
|
+
runtime: 'acp',
|
|
553
542
|
...navigation,
|
|
554
543
|
isResumed: !!normalized.normalizedSessionId,
|
|
555
544
|
messages: callbackCaptureWriter.getAssistantMessages(),
|