@yjjeong/omg 0.1.0
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/CHANGELOG.md +85 -0
- package/LICENSE +21 -0
- package/README.md +153 -0
- package/dist/cli/args.d.ts +39 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +129 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/autoCommit.d.ts +20 -0
- package/dist/cli/autoCommit.d.ts.map +1 -0
- package/dist/cli/autoCommit.js +121 -0
- package/dist/cli/autoCommit.js.map +1 -0
- package/dist/cli/bgTasks.d.ts +57 -0
- package/dist/cli/bgTasks.d.ts.map +1 -0
- package/dist/cli/bgTasks.js +193 -0
- package/dist/cli/bgTasks.js.map +1 -0
- package/dist/cli/compactor.d.ts +48 -0
- package/dist/cli/compactor.d.ts.map +1 -0
- package/dist/cli/compactor.js +73 -0
- package/dist/cli/compactor.js.map +1 -0
- package/dist/cli/doctor.d.ts +77 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +279 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/gitStatus.d.ts +7 -0
- package/dist/cli/gitStatus.d.ts.map +1 -0
- package/dist/cli/gitStatus.js +70 -0
- package/dist/cli/gitStatus.js.map +1 -0
- package/dist/cli/handoff.d.ts +36 -0
- package/dist/cli/handoff.d.ts.map +1 -0
- package/dist/cli/handoff.js +60 -0
- package/dist/cli/handoff.js.map +1 -0
- package/dist/cli/interactive/brokers.d.ts +31 -0
- package/dist/cli/interactive/brokers.d.ts.map +1 -0
- package/dist/cli/interactive/brokers.js +259 -0
- package/dist/cli/interactive/brokers.js.map +1 -0
- package/dist/cli/interactive/index.d.ts +8 -0
- package/dist/cli/interactive/index.d.ts.map +1 -0
- package/dist/cli/interactive/index.js +731 -0
- package/dist/cli/interactive/index.js.map +1 -0
- package/dist/cli/interactive/proxyQuestions.d.ts +15 -0
- package/dist/cli/interactive/proxyQuestions.d.ts.map +1 -0
- package/dist/cli/interactive/proxyQuestions.js +48 -0
- package/dist/cli/interactive/proxyQuestions.js.map +1 -0
- package/dist/cli/interactive/tabManager.d.ts +32 -0
- package/dist/cli/interactive/tabManager.d.ts.map +1 -0
- package/dist/cli/interactive/tabManager.js +244 -0
- package/dist/cli/interactive/tabManager.js.map +1 -0
- package/dist/cli/interactive/teamHint.d.ts +2 -0
- package/dist/cli/interactive/teamHint.d.ts.map +1 -0
- package/dist/cli/interactive/teamHint.js +14 -0
- package/dist/cli/interactive/teamHint.js.map +1 -0
- package/dist/cli/login.d.ts +13 -0
- package/dist/cli/login.d.ts.map +1 -0
- package/dist/cli/login.js +53 -0
- package/dist/cli/login.js.map +1 -0
- package/dist/cli/modes/demo.d.ts +12 -0
- package/dist/cli/modes/demo.d.ts.map +1 -0
- package/dist/cli/modes/demo.js +48 -0
- package/dist/cli/modes/demo.js.map +1 -0
- package/dist/cli/modes/doctor.d.ts +28 -0
- package/dist/cli/modes/doctor.d.ts.map +1 -0
- package/dist/cli/modes/doctor.js +79 -0
- package/dist/cli/modes/doctor.js.map +1 -0
- package/dist/cli/modes/login.d.ts +5 -0
- package/dist/cli/modes/login.d.ts.map +1 -0
- package/dist/cli/modes/login.js +40 -0
- package/dist/cli/modes/login.js.map +1 -0
- package/dist/cli/modes/mcpServe.d.ts +9 -0
- package/dist/cli/modes/mcpServe.d.ts.map +1 -0
- package/dist/cli/modes/mcpServe.js +112 -0
- package/dist/cli/modes/mcpServe.js.map +1 -0
- package/dist/cli/modes/orchestrator.d.ts +14 -0
- package/dist/cli/modes/orchestrator.d.ts.map +1 -0
- package/dist/cli/modes/orchestrator.js +64 -0
- package/dist/cli/modes/orchestrator.js.map +1 -0
- package/dist/cli/modes/team.d.ts +14 -0
- package/dist/cli/modes/team.d.ts.map +1 -0
- package/dist/cli/modes/team.js +87 -0
- package/dist/cli/modes/team.js.map +1 -0
- package/dist/cli/registry.d.ts +3 -0
- package/dist/cli/registry.d.ts.map +1 -0
- package/dist/cli/registry.js +15 -0
- package/dist/cli/registry.js.map +1 -0
- package/dist/cli/slash/core.d.ts +3 -0
- package/dist/cli/slash/core.d.ts.map +1 -0
- package/dist/cli/slash/core.js +509 -0
- package/dist/cli/slash/core.js.map +1 -0
- package/dist/cli/slash/index.d.ts +3 -0
- package/dist/cli/slash/index.d.ts.map +1 -0
- package/dist/cli/slash/index.js +28 -0
- package/dist/cli/slash/index.js.map +1 -0
- package/dist/cli/slash/modes.d.ts +3 -0
- package/dist/cli/slash/modes.d.ts.map +1 -0
- package/dist/cli/slash/modes.js +530 -0
- package/dist/cli/slash/modes.js.map +1 -0
- package/dist/cli/slash/session.d.ts +3 -0
- package/dist/cli/slash/session.d.ts.map +1 -0
- package/dist/cli/slash/session.js +376 -0
- package/dist/cli/slash/session.js.map +1 -0
- package/dist/cli/slash/shared.d.ts +43 -0
- package/dist/cli/slash/shared.d.ts.map +1 -0
- package/dist/cli/slash/shared.js +6 -0
- package/dist/cli/slash/shared.js.map +1 -0
- package/dist/cli/slash/tabs.d.ts +3 -0
- package/dist/cli/slash/tabs.d.ts.map +1 -0
- package/dist/cli/slash/tabs.js +497 -0
- package/dist/cli/slash/tabs.js.map +1 -0
- package/dist/cli/slash/team.d.ts +3 -0
- package/dist/cli/slash/team.d.ts.map +1 -0
- package/dist/cli/slash/team.js +85 -0
- package/dist/cli/slash/team.js.map +1 -0
- package/dist/cli/slash.d.ts +3 -0
- package/dist/cli/slash.d.ts.map +1 -0
- package/dist/cli/slash.js +8 -0
- package/dist/cli/slash.js.map +1 -0
- package/dist/cli/teamPipeline.d.ts +42 -0
- package/dist/cli/teamPipeline.d.ts.map +1 -0
- package/dist/cli/teamPipeline.js +406 -0
- package/dist/cli/teamPipeline.js.map +1 -0
- package/dist/cli/touchedFiles.d.ts +14 -0
- package/dist/cli/touchedFiles.d.ts.map +1 -0
- package/dist/cli/touchedFiles.js +66 -0
- package/dist/cli/touchedFiles.js.map +1 -0
- package/dist/cli/turn.d.ts +47 -0
- package/dist/cli/turn.d.ts.map +1 -0
- package/dist/cli/turn.js +626 -0
- package/dist/cli/turn.js.map +1 -0
- package/dist/cli/types.d.ts +47 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +5 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/uiSession.d.ts +10 -0
- package/dist/cli/uiSession.d.ts.map +1 -0
- package/dist/cli/uiSession.js +66 -0
- package/dist/cli/uiSession.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +128 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/adapter.d.ts +47 -0
- package/dist/core/adapter.d.ts.map +1 -0
- package/dist/core/adapter.js +48 -0
- package/dist/core/adapter.js.map +1 -0
- package/dist/core/adapters/anthropic.d.ts +35 -0
- package/dist/core/adapters/anthropic.d.ts.map +1 -0
- package/dist/core/adapters/anthropic.js +203 -0
- package/dist/core/adapters/anthropic.js.map +1 -0
- package/dist/core/adapters/claudeCli.d.ts +126 -0
- package/dist/core/adapters/claudeCli.d.ts.map +1 -0
- package/dist/core/adapters/claudeCli.js +584 -0
- package/dist/core/adapters/claudeCli.js.map +1 -0
- package/dist/core/adapters/cliAdapterBase.d.ts +48 -0
- package/dist/core/adapters/cliAdapterBase.d.ts.map +1 -0
- package/dist/core/adapters/cliAdapterBase.js +105 -0
- package/dist/core/adapters/cliAdapterBase.js.map +1 -0
- package/dist/core/adapters/cliStderr.d.ts +35 -0
- package/dist/core/adapters/cliStderr.d.ts.map +1 -0
- package/dist/core/adapters/cliStderr.js +87 -0
- package/dist/core/adapters/cliStderr.js.map +1 -0
- package/dist/core/adapters/codexCli.d.ts +113 -0
- package/dist/core/adapters/codexCli.d.ts.map +1 -0
- package/dist/core/adapters/codexCli.js +424 -0
- package/dist/core/adapters/codexCli.js.map +1 -0
- package/dist/core/adapters/gemini.d.ts +17 -0
- package/dist/core/adapters/gemini.d.ts.map +1 -0
- package/dist/core/adapters/gemini.js +133 -0
- package/dist/core/adapters/gemini.js.map +1 -0
- package/dist/core/adapters/geminiCli.d.ts +91 -0
- package/dist/core/adapters/geminiCli.d.ts.map +1 -0
- package/dist/core/adapters/geminiCli.js +276 -0
- package/dist/core/adapters/geminiCli.js.map +1 -0
- package/dist/core/adapters/nudges.d.ts +21 -0
- package/dist/core/adapters/nudges.d.ts.map +1 -0
- package/dist/core/adapters/nudges.js +75 -0
- package/dist/core/adapters/nudges.js.map +1 -0
- package/dist/core/adapters/openai.d.ts +17 -0
- package/dist/core/adapters/openai.d.ts.map +1 -0
- package/dist/core/adapters/openai.js +138 -0
- package/dist/core/adapters/openai.js.map +1 -0
- package/dist/core/adapters/parseFailures.d.ts +10 -0
- package/dist/core/adapters/parseFailures.d.ts.map +1 -0
- package/dist/core/adapters/parseFailures.js +35 -0
- package/dist/core/adapters/parseFailures.js.map +1 -0
- package/dist/core/adapters/utils.d.ts +11 -0
- package/dist/core/adapters/utils.d.ts.map +1 -0
- package/dist/core/adapters/utils.js +33 -0
- package/dist/core/adapters/utils.js.map +1 -0
- package/dist/core/askBroker.d.ts +11 -0
- package/dist/core/askBroker.d.ts.map +1 -0
- package/dist/core/askBroker.js +78 -0
- package/dist/core/askBroker.js.map +1 -0
- package/dist/core/atomicWrite.d.ts +5 -0
- package/dist/core/atomicWrite.d.ts.map +1 -0
- package/dist/core/atomicWrite.js +18 -0
- package/dist/core/atomicWrite.js.map +1 -0
- package/dist/core/brokers/askBroker.d.ts +11 -0
- package/dist/core/brokers/askBroker.d.ts.map +1 -0
- package/dist/core/brokers/askBroker.js +78 -0
- package/dist/core/brokers/askBroker.js.map +1 -0
- package/dist/core/brokers/permissionBroker.d.ts +7 -0
- package/dist/core/brokers/permissionBroker.d.ts.map +1 -0
- package/dist/core/brokers/permissionBroker.js +63 -0
- package/dist/core/brokers/permissionBroker.js.map +1 -0
- package/dist/core/brokers/socketBroker.d.ts +35 -0
- package/dist/core/brokers/socketBroker.d.ts.map +1 -0
- package/dist/core/brokers/socketBroker.js +74 -0
- package/dist/core/brokers/socketBroker.js.map +1 -0
- package/dist/core/clipboard.d.ts +4 -0
- package/dist/core/clipboard.d.ts.map +1 -0
- package/dist/core/clipboard.js +46 -0
- package/dist/core/clipboard.js.map +1 -0
- package/dist/core/compactor.d.ts +32 -0
- package/dist/core/compactor.d.ts.map +1 -0
- package/dist/core/compactor.js +91 -0
- package/dist/core/compactor.js.map +1 -0
- package/dist/core/consensusEngine.d.ts +21 -0
- package/dist/core/consensusEngine.d.ts.map +1 -0
- package/dist/core/consensusEngine.js +116 -0
- package/dist/core/consensusEngine.js.map +1 -0
- package/dist/core/context/contextCompressor.d.ts +10 -0
- package/dist/core/context/contextCompressor.d.ts.map +1 -0
- package/dist/core/context/contextCompressor.js +54 -0
- package/dist/core/context/contextCompressor.js.map +1 -0
- package/dist/core/context/contextWindows.d.ts +25 -0
- package/dist/core/context/contextWindows.d.ts.map +1 -0
- package/dist/core/context/contextWindows.js +101 -0
- package/dist/core/context/contextWindows.js.map +1 -0
- package/dist/core/context/summarizer.d.ts +65 -0
- package/dist/core/context/summarizer.d.ts.map +1 -0
- package/dist/core/context/summarizer.js +184 -0
- package/dist/core/context/summarizer.js.map +1 -0
- package/dist/core/context/usageCache.d.ts +19 -0
- package/dist/core/context/usageCache.d.ts.map +1 -0
- package/dist/core/context/usageCache.js +157 -0
- package/dist/core/context/usageCache.js.map +1 -0
- package/dist/core/context/usageWindow.d.ts +19 -0
- package/dist/core/context/usageWindow.d.ts.map +1 -0
- package/dist/core/context/usageWindow.js +73 -0
- package/dist/core/context/usageWindow.js.map +1 -0
- package/dist/core/contextCompressor.d.ts +10 -0
- package/dist/core/contextCompressor.d.ts.map +1 -0
- package/dist/core/contextCompressor.js +54 -0
- package/dist/core/contextCompressor.js.map +1 -0
- package/dist/core/contextWindows.d.ts +5 -0
- package/dist/core/contextWindows.d.ts.map +1 -0
- package/dist/core/contextWindows.js +60 -0
- package/dist/core/contextWindows.js.map +1 -0
- package/dist/core/continuum/digest.d.ts +35 -0
- package/dist/core/continuum/digest.d.ts.map +1 -0
- package/dist/core/continuum/digest.js +91 -0
- package/dist/core/continuum/digest.js.map +1 -0
- package/dist/core/continuum/index.d.ts +6 -0
- package/dist/core/continuum/index.d.ts.map +1 -0
- package/dist/core/continuum/index.js +7 -0
- package/dist/core/continuum/index.js.map +1 -0
- package/dist/core/continuum/inject.d.ts +9 -0
- package/dist/core/continuum/inject.d.ts.map +1 -0
- package/dist/core/continuum/inject.js +78 -0
- package/dist/core/continuum/inject.js.map +1 -0
- package/dist/core/continuum/projectId.d.ts +10 -0
- package/dist/core/continuum/projectId.d.ts.map +1 -0
- package/dist/core/continuum/projectId.js +60 -0
- package/dist/core/continuum/projectId.js.map +1 -0
- package/dist/core/continuum/store.d.ts +24 -0
- package/dist/core/continuum/store.d.ts.map +1 -0
- package/dist/core/continuum/store.js +144 -0
- package/dist/core/continuum/store.js.map +1 -0
- package/dist/core/continuum/types.d.ts +87 -0
- package/dist/core/continuum/types.d.ts.map +1 -0
- package/dist/core/continuum/types.js +9 -0
- package/dist/core/continuum/types.js.map +1 -0
- package/dist/core/dag.d.ts +21 -0
- package/dist/core/dag.d.ts.map +1 -0
- package/dist/core/dag.js +71 -0
- package/dist/core/dag.js.map +1 -0
- package/dist/core/director.d.ts +11 -0
- package/dist/core/director.d.ts.map +1 -0
- package/dist/core/director.js +37 -0
- package/dist/core/director.js.map +1 -0
- package/dist/core/hookedToolBroker.d.ts +25 -0
- package/dist/core/hookedToolBroker.d.ts.map +1 -0
- package/dist/core/hookedToolBroker.js +95 -0
- package/dist/core/hookedToolBroker.js.map +1 -0
- package/dist/core/langHint.d.ts +9 -0
- package/dist/core/langHint.d.ts.map +1 -0
- package/dist/core/langHint.js +33 -0
- package/dist/core/langHint.js.map +1 -0
- package/dist/core/mcp/mcpClient.d.ts +42 -0
- package/dist/core/mcp/mcpClient.d.ts.map +1 -0
- package/dist/core/mcp/mcpClient.js +134 -0
- package/dist/core/mcp/mcpClient.js.map +1 -0
- package/dist/core/mcp/mcpConfig.d.ts +58 -0
- package/dist/core/mcp/mcpConfig.d.ts.map +1 -0
- package/dist/core/mcp/mcpConfig.js +148 -0
- package/dist/core/mcp/mcpConfig.js.map +1 -0
- package/dist/core/mcp/mcpManager.d.ts +31 -0
- package/dist/core/mcp/mcpManager.d.ts.map +1 -0
- package/dist/core/mcp/mcpManager.js +83 -0
- package/dist/core/mcp/mcpManager.js.map +1 -0
- package/dist/core/mcpClient.d.ts +42 -0
- package/dist/core/mcpClient.d.ts.map +1 -0
- package/dist/core/mcpClient.js +134 -0
- package/dist/core/mcpClient.js.map +1 -0
- package/dist/core/mcpConfig.d.ts +24 -0
- package/dist/core/mcpConfig.d.ts.map +1 -0
- package/dist/core/mcpConfig.js +74 -0
- package/dist/core/mcpConfig.js.map +1 -0
- package/dist/core/mcpManager.d.ts +31 -0
- package/dist/core/mcpManager.d.ts.map +1 -0
- package/dist/core/mcpManager.js +83 -0
- package/dist/core/mcpManager.js.map +1 -0
- package/dist/core/memory.d.ts +22 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +102 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/omgToolManifest.d.ts +34 -0
- package/dist/core/omgToolManifest.d.ts.map +1 -0
- package/dist/core/omgToolManifest.js +59 -0
- package/dist/core/omgToolManifest.js.map +1 -0
- package/dist/core/orchestration/consensusEngine.d.ts +21 -0
- package/dist/core/orchestration/consensusEngine.d.ts.map +1 -0
- package/dist/core/orchestration/consensusEngine.js +116 -0
- package/dist/core/orchestration/consensusEngine.js.map +1 -0
- package/dist/core/orchestration/dag.d.ts +21 -0
- package/dist/core/orchestration/dag.d.ts.map +1 -0
- package/dist/core/orchestration/dag.js +71 -0
- package/dist/core/orchestration/dag.js.map +1 -0
- package/dist/core/orchestration/director.d.ts +11 -0
- package/dist/core/orchestration/director.d.ts.map +1 -0
- package/dist/core/orchestration/director.js +37 -0
- package/dist/core/orchestration/director.js.map +1 -0
- package/dist/core/orchestration/orchestrator.d.ts +32 -0
- package/dist/core/orchestration/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestration/orchestrator.js +214 -0
- package/dist/core/orchestration/orchestrator.js.map +1 -0
- package/dist/core/orchestration/roleRouter.d.ts +28 -0
- package/dist/core/orchestration/roleRouter.d.ts.map +1 -0
- package/dist/core/orchestration/roleRouter.js +64 -0
- package/dist/core/orchestration/roleRouter.js.map +1 -0
- package/dist/core/orchestration/teamRunner.d.ts +69 -0
- package/dist/core/orchestration/teamRunner.d.ts.map +1 -0
- package/dist/core/orchestration/teamRunner.js +477 -0
- package/dist/core/orchestration/teamRunner.js.map +1 -0
- package/dist/core/orchestration/types.d.ts +115 -0
- package/dist/core/orchestration/types.d.ts.map +1 -0
- package/dist/core/orchestration/types.js +71 -0
- package/dist/core/orchestration/types.js.map +1 -0
- package/dist/core/orchestrator.d.ts +32 -0
- package/dist/core/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestrator.js +214 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/permissionBroker.d.ts +7 -0
- package/dist/core/permissionBroker.d.ts.map +1 -0
- package/dist/core/permissionBroker.js +63 -0
- package/dist/core/permissionBroker.js.map +1 -0
- package/dist/core/planConfig.d.ts +15 -0
- package/dist/core/planConfig.d.ts.map +1 -0
- package/dist/core/planConfig.js +98 -0
- package/dist/core/planConfig.js.map +1 -0
- package/dist/core/presetPersistence.d.ts +4 -0
- package/dist/core/presetPersistence.d.ts.map +1 -0
- package/dist/core/presetPersistence.js +64 -0
- package/dist/core/presetPersistence.js.map +1 -0
- package/dist/core/roleRouter.d.ts +26 -0
- package/dist/core/roleRouter.d.ts.map +1 -0
- package/dist/core/roleRouter.js +62 -0
- package/dist/core/roleRouter.js.map +1 -0
- package/dist/core/sessionList.d.ts +26 -0
- package/dist/core/sessionList.d.ts.map +1 -0
- package/dist/core/sessionList.js +278 -0
- package/dist/core/sessionList.js.map +1 -0
- package/dist/core/slugify.d.ts +2 -0
- package/dist/core/slugify.d.ts.map +1 -0
- package/dist/core/slugify.js +17 -0
- package/dist/core/slugify.js.map +1 -0
- package/dist/core/socketBroker.d.ts +19 -0
- package/dist/core/socketBroker.d.ts.map +1 -0
- package/dist/core/socketBroker.js +48 -0
- package/dist/core/socketBroker.js.map +1 -0
- package/dist/core/state/agentsMdScaffold.d.ts +15 -0
- package/dist/core/state/agentsMdScaffold.d.ts.map +1 -0
- package/dist/core/state/agentsMdScaffold.js +118 -0
- package/dist/core/state/agentsMdScaffold.js.map +1 -0
- package/dist/core/state/atomicWrite.d.ts +5 -0
- package/dist/core/state/atomicWrite.d.ts.map +1 -0
- package/dist/core/state/atomicWrite.js +18 -0
- package/dist/core/state/atomicWrite.js.map +1 -0
- package/dist/core/state/handoff.d.ts +20 -0
- package/dist/core/state/handoff.d.ts.map +1 -0
- package/dist/core/state/handoff.js +71 -0
- package/dist/core/state/handoff.js.map +1 -0
- package/dist/core/state/mcpCatalog.d.ts +11 -0
- package/dist/core/state/mcpCatalog.d.ts.map +1 -0
- package/dist/core/state/mcpCatalog.js +51 -0
- package/dist/core/state/mcpCatalog.js.map +1 -0
- package/dist/core/state/mcpRecommendations.d.ts +7 -0
- package/dist/core/state/mcpRecommendations.d.ts.map +1 -0
- package/dist/core/state/mcpRecommendations.js +57 -0
- package/dist/core/state/mcpRecommendations.js.map +1 -0
- package/dist/core/state/memory.d.ts +22 -0
- package/dist/core/state/memory.d.ts.map +1 -0
- package/dist/core/state/memory.js +102 -0
- package/dist/core/state/memory.js.map +1 -0
- package/dist/core/state/planConfig.d.ts +15 -0
- package/dist/core/state/planConfig.d.ts.map +1 -0
- package/dist/core/state/planConfig.js +98 -0
- package/dist/core/state/planConfig.js.map +1 -0
- package/dist/core/state/presetPersistence.d.ts +4 -0
- package/dist/core/state/presetPersistence.d.ts.map +1 -0
- package/dist/core/state/presetPersistence.js +67 -0
- package/dist/core/state/presetPersistence.js.map +1 -0
- package/dist/core/state/sessionList.d.ts +26 -0
- package/dist/core/state/sessionList.d.ts.map +1 -0
- package/dist/core/state/sessionList.js +278 -0
- package/dist/core/state/sessionList.js.map +1 -0
- package/dist/core/state/stackDetect.d.ts +8 -0
- package/dist/core/state/stackDetect.d.ts.map +1 -0
- package/dist/core/state/stackDetect.js +40 -0
- package/dist/core/state/stackDetect.js.map +1 -0
- package/dist/core/state/tabPersistence.d.ts +29 -0
- package/dist/core/state/tabPersistence.d.ts.map +1 -0
- package/dist/core/state/tabPersistence.js +65 -0
- package/dist/core/state/tabPersistence.js.map +1 -0
- package/dist/core/tabPersistence.d.ts +29 -0
- package/dist/core/tabPersistence.d.ts.map +1 -0
- package/dist/core/tabPersistence.js +65 -0
- package/dist/core/tabPersistence.js.map +1 -0
- package/dist/core/teamRunner.d.ts +42 -0
- package/dist/core/teamRunner.d.ts.map +1 -0
- package/dist/core/teamRunner.js +248 -0
- package/dist/core/teamRunner.js.map +1 -0
- package/dist/core/toolGate.d.ts +23 -0
- package/dist/core/toolGate.d.ts.map +1 -0
- package/dist/core/toolGate.js +51 -0
- package/dist/core/toolGate.js.map +1 -0
- package/dist/core/toolInterceptor.d.ts +7 -0
- package/dist/core/toolInterceptor.d.ts.map +1 -0
- package/dist/core/toolInterceptor.js +108 -0
- package/dist/core/toolInterceptor.js.map +1 -0
- package/dist/core/tools/hookedToolBroker.d.ts +25 -0
- package/dist/core/tools/hookedToolBroker.d.ts.map +1 -0
- package/dist/core/tools/hookedToolBroker.js +95 -0
- package/dist/core/tools/hookedToolBroker.js.map +1 -0
- package/dist/core/tools/omgToolManifest.d.ts +42 -0
- package/dist/core/tools/omgToolManifest.d.ts.map +1 -0
- package/dist/core/tools/omgToolManifest.js +66 -0
- package/dist/core/tools/omgToolManifest.js.map +1 -0
- package/dist/core/tools/toolGate.d.ts +23 -0
- package/dist/core/tools/toolGate.d.ts.map +1 -0
- package/dist/core/tools/toolGate.js +51 -0
- package/dist/core/tools/toolGate.js.map +1 -0
- package/dist/core/tools/toolInterceptor.d.ts +7 -0
- package/dist/core/tools/toolInterceptor.d.ts.map +1 -0
- package/dist/core/tools/toolInterceptor.js +108 -0
- package/dist/core/tools/toolInterceptor.js.map +1 -0
- package/dist/core/tools/tools.d.ts +34 -0
- package/dist/core/tools/tools.d.ts.map +1 -0
- package/dist/core/tools/tools.js +328 -0
- package/dist/core/tools/tools.js.map +1 -0
- package/dist/core/tools.d.ts +34 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/tools.js +300 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/core/types.d.ts +107 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +55 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/usageCache.d.ts +19 -0
- package/dist/core/usageCache.d.ts.map +1 -0
- package/dist/core/usageCache.js +157 -0
- package/dist/core/usageCache.js.map +1 -0
- package/dist/core/usageWindow.d.ts +19 -0
- package/dist/core/usageWindow.d.ts.map +1 -0
- package/dist/core/usageWindow.js +73 -0
- package/dist/core/usageWindow.js.map +1 -0
- package/dist/core/util/bgProtocol.d.ts +5 -0
- package/dist/core/util/bgProtocol.d.ts.map +1 -0
- package/dist/core/util/bgProtocol.js +20 -0
- package/dist/core/util/bgProtocol.js.map +1 -0
- package/dist/core/util/clipboard.d.ts +4 -0
- package/dist/core/util/clipboard.d.ts.map +1 -0
- package/dist/core/util/clipboard.js +46 -0
- package/dist/core/util/clipboard.js.map +1 -0
- package/dist/core/util/clipboardImage.d.ts +3 -0
- package/dist/core/util/clipboardImage.d.ts.map +1 -0
- package/dist/core/util/clipboardImage.js +58 -0
- package/dist/core/util/clipboardImage.js.map +1 -0
- package/dist/core/util/langHint.d.ts +9 -0
- package/dist/core/util/langHint.d.ts.map +1 -0
- package/dist/core/util/langHint.js +33 -0
- package/dist/core/util/langHint.js.map +1 -0
- package/dist/core/util/slugify.d.ts +2 -0
- package/dist/core/util/slugify.d.ts.map +1 -0
- package/dist/core/util/slugify.js +28 -0
- package/dist/core/util/slugify.js.map +1 -0
- package/dist/hooks/hookedToolProxy.mjs +118 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc/dispatcher.d.ts +21 -0
- package/dist/ipc/dispatcher.d.ts.map +1 -0
- package/dist/ipc/dispatcher.js +160 -0
- package/dist/ipc/dispatcher.js.map +1 -0
- package/dist/ipc/events.d.ts +33 -0
- package/dist/ipc/events.d.ts.map +1 -0
- package/dist/ipc/events.js +42 -0
- package/dist/ipc/events.js.map +1 -0
- package/dist/ipc/rpc.d.ts +31 -0
- package/dist/ipc/rpc.d.ts.map +1 -0
- package/dist/ipc/rpc.js +110 -0
- package/dist/ipc/rpc.js.map +1 -0
- package/dist/ipc/stdio.d.ts +11 -0
- package/dist/ipc/stdio.d.ts.map +1 -0
- package/dist/ipc/stdio.js +52 -0
- package/dist/ipc/stdio.js.map +1 -0
- package/dist/mcp/askClient.d.ts +9 -0
- package/dist/mcp/askClient.d.ts.map +1 -0
- package/dist/mcp/askClient.js +70 -0
- package/dist/mcp/askClient.js.map +1 -0
- package/dist/mcp/constants.d.ts +6 -0
- package/dist/mcp/constants.d.ts.map +1 -0
- package/dist/mcp/constants.js +8 -0
- package/dist/mcp/constants.js.map +1 -0
- package/dist/mcp/permissionClient.d.ts +5 -0
- package/dist/mcp/permissionClient.d.ts.map +1 -0
- package/dist/mcp/permissionClient.js +71 -0
- package/dist/mcp/permissionClient.js.map +1 -0
- package/dist/mcp/schemas.d.ts +9 -0
- package/dist/mcp/schemas.d.ts.map +1 -0
- package/dist/mcp/schemas.js +121 -0
- package/dist/mcp/schemas.js.map +1 -0
- package/dist/mcp/server.d.ts +41 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +204 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/policy/loader.d.ts +27 -0
- package/dist/policy/loader.d.ts.map +1 -0
- package/dist/policy/loader.js +89 -0
- package/dist/policy/loader.js.map +1 -0
- package/dist/policy/team-claude-only.yaml +46 -0
- package/dist/policy/team-codex-only.yaml +46 -0
- package/dist/policy/team-codex.yaml +54 -0
- package/dist/policy/team.yaml +104 -0
- package/dist/toolhook/hookedToolProxy.mjs +118 -0
- package/dist/ui/components/App.d.ts +14 -0
- package/dist/ui/components/App.d.ts.map +1 -0
- package/dist/ui/components/App.js +803 -0
- package/dist/ui/components/App.js.map +1 -0
- package/dist/ui/components/AskPicker.d.ts +8 -0
- package/dist/ui/components/AskPicker.d.ts.map +1 -0
- package/dist/ui/components/AskPicker.js +202 -0
- package/dist/ui/components/AskPicker.js.map +1 -0
- package/dist/ui/components/CommandInput.d.ts +63 -0
- package/dist/ui/components/CommandInput.d.ts.map +1 -0
- package/dist/ui/components/CommandInput.js +994 -0
- package/dist/ui/components/CommandInput.js.map +1 -0
- package/dist/ui/components/DiffView.d.ts +19 -0
- package/dist/ui/components/DiffView.d.ts.map +1 -0
- package/dist/ui/components/DiffView.js +93 -0
- package/dist/ui/components/DiffView.js.map +1 -0
- package/dist/ui/components/Dock.d.ts +49 -0
- package/dist/ui/components/Dock.d.ts.map +1 -0
- package/dist/ui/components/Dock.js +52 -0
- package/dist/ui/components/Dock.js.map +1 -0
- package/dist/ui/components/EventLog.d.ts +42 -0
- package/dist/ui/components/EventLog.d.ts.map +1 -0
- package/dist/ui/components/EventLog.js +450 -0
- package/dist/ui/components/EventLog.js.map +1 -0
- package/dist/ui/components/FileSuggest.d.ts +8 -0
- package/dist/ui/components/FileSuggest.d.ts.map +1 -0
- package/dist/ui/components/FileSuggest.js +19 -0
- package/dist/ui/components/FileSuggest.js.map +1 -0
- package/dist/ui/components/HRule.d.ts +27 -0
- package/dist/ui/components/HRule.d.ts.map +1 -0
- package/dist/ui/components/HRule.js +75 -0
- package/dist/ui/components/HRule.js.map +1 -0
- package/dist/ui/components/HintBar.d.ts +2 -0
- package/dist/ui/components/HintBar.d.ts.map +1 -0
- package/dist/ui/components/HintBar.js +19 -0
- package/dist/ui/components/HintBar.js.map +1 -0
- package/dist/ui/components/MarkdownText.d.ts +13 -0
- package/dist/ui/components/MarkdownText.d.ts.map +1 -0
- package/dist/ui/components/MarkdownText.js +255 -0
- package/dist/ui/components/MarkdownText.js.map +1 -0
- package/dist/ui/components/PermissionPrompt.d.ts +8 -0
- package/dist/ui/components/PermissionPrompt.d.ts.map +1 -0
- package/dist/ui/components/PermissionPrompt.js +37 -0
- package/dist/ui/components/PermissionPrompt.js.map +1 -0
- package/dist/ui/components/SessionPicker.d.ts +16 -0
- package/dist/ui/components/SessionPicker.d.ts.map +1 -0
- package/dist/ui/components/SessionPicker.js +116 -0
- package/dist/ui/components/SessionPicker.js.map +1 -0
- package/dist/ui/components/SlashPalette.d.ts +8 -0
- package/dist/ui/components/SlashPalette.d.ts.map +1 -0
- package/dist/ui/components/SlashPalette.js +41 -0
- package/dist/ui/components/SlashPalette.js.map +1 -0
- package/dist/ui/components/Spinner.d.ts +37 -0
- package/dist/ui/components/Spinner.d.ts.map +1 -0
- package/dist/ui/components/Spinner.js +139 -0
- package/dist/ui/components/Spinner.js.map +1 -0
- package/dist/ui/components/StatusBar.d.ts +92 -0
- package/dist/ui/components/StatusBar.d.ts.map +1 -0
- package/dist/ui/components/StatusBar.js +268 -0
- package/dist/ui/components/StatusBar.js.map +1 -0
- package/dist/ui/components/TabChip.d.ts +11 -0
- package/dist/ui/components/TabChip.d.ts.map +1 -0
- package/dist/ui/components/TabChip.js +23 -0
- package/dist/ui/components/TabChip.js.map +1 -0
- package/dist/ui/components/TeamIndicator.d.ts +6 -0
- package/dist/ui/components/TeamIndicator.d.ts.map +1 -0
- package/dist/ui/components/TeamIndicator.js +17 -0
- package/dist/ui/components/TeamIndicator.js.map +1 -0
- package/dist/ui/components/TeamStatusPanel.d.ts +14 -0
- package/dist/ui/components/TeamStatusPanel.d.ts.map +1 -0
- package/dist/ui/components/TeamStatusPanel.js +65 -0
- package/dist/ui/components/TeamStatusPanel.js.map +1 -0
- package/dist/ui/components/ThinkingBlock.d.ts +10 -0
- package/dist/ui/components/ThinkingBlock.d.ts.map +1 -0
- package/dist/ui/components/ThinkingBlock.js +21 -0
- package/dist/ui/components/ThinkingBlock.js.map +1 -0
- package/dist/ui/components/TodoIndicator.d.ts +11 -0
- package/dist/ui/components/TodoIndicator.d.ts.map +1 -0
- package/dist/ui/components/TodoIndicator.js +37 -0
- package/dist/ui/components/TodoIndicator.js.map +1 -0
- package/dist/ui/components/ToolCallCard.d.ts +16 -0
- package/dist/ui/components/ToolCallCard.d.ts.map +1 -0
- package/dist/ui/components/ToolCallCard.js +195 -0
- package/dist/ui/components/ToolCallCard.js.map +1 -0
- package/dist/ui/components/Welcome.d.ts +8 -0
- package/dist/ui/components/Welcome.d.ts.map +1 -0
- package/dist/ui/components/Welcome.js +53 -0
- package/dist/ui/components/Welcome.js.map +1 -0
- package/dist/ui/cursorState.d.ts +29 -0
- package/dist/ui/cursorState.d.ts.map +1 -0
- package/dist/ui/cursorState.js +49 -0
- package/dist/ui/cursorState.js.map +1 -0
- package/dist/ui/diff.d.ts +34 -0
- package/dist/ui/diff.d.ts.map +1 -0
- package/dist/ui/diff.js +184 -0
- package/dist/ui/diff.js.map +1 -0
- package/dist/ui/diffLang.d.ts +2 -0
- package/dist/ui/diffLang.d.ts.map +1 -0
- package/dist/ui/diffLang.js +36 -0
- package/dist/ui/diffLang.js.map +1 -0
- package/dist/ui/emoji.d.ts +4 -0
- package/dist/ui/emoji.d.ts.map +1 -0
- package/dist/ui/emoji.js +73 -0
- package/dist/ui/emoji.js.map +1 -0
- package/dist/ui/fileMentions.d.ts +41 -0
- package/dist/ui/fileMentions.d.ts.map +1 -0
- package/dist/ui/fileMentions.js +135 -0
- package/dist/ui/fileMentions.js.map +1 -0
- package/dist/ui/hooks/useLineEditor.d.ts +44 -0
- package/dist/ui/hooks/useLineEditor.d.ts.map +1 -0
- package/dist/ui/hooks/useLineEditor.js +142 -0
- package/dist/ui/hooks/useLineEditor.js.map +1 -0
- package/dist/ui/inputHistory.d.ts +8 -0
- package/dist/ui/inputHistory.d.ts.map +1 -0
- package/dist/ui/inputHistory.js +56 -0
- package/dist/ui/inputHistory.js.map +1 -0
- package/dist/ui/jsonrpc.d.ts +17 -0
- package/dist/ui/jsonrpc.d.ts.map +1 -0
- package/dist/ui/jsonrpc.js +41 -0
- package/dist/ui/jsonrpc.js.map +1 -0
- package/dist/ui/launcher.d.ts +20 -0
- package/dist/ui/launcher.d.ts.map +1 -0
- package/dist/ui/launcher.js +185 -0
- package/dist/ui/launcher.js.map +1 -0
- package/dist/ui/markdown.d.ts +104 -0
- package/dist/ui/markdown.d.ts.map +1 -0
- package/dist/ui/markdown.js +449 -0
- package/dist/ui/markdown.js.map +1 -0
- package/dist/ui/mouse.d.ts +22 -0
- package/dist/ui/mouse.d.ts.map +1 -0
- package/dist/ui/mouse.js +31 -0
- package/dist/ui/mouse.js.map +1 -0
- package/dist/ui/outbound.d.ts +20 -0
- package/dist/ui/outbound.d.ts.map +1 -0
- package/dist/ui/outbound.js +49 -0
- package/dist/ui/outbound.js.map +1 -0
- package/dist/ui/screenMode.d.ts +25 -0
- package/dist/ui/screenMode.d.ts.map +1 -0
- package/dist/ui/screenMode.js +43 -0
- package/dist/ui/screenMode.js.map +1 -0
- package/dist/ui/slashCatalog.d.ts +18 -0
- package/dist/ui/slashCatalog.d.ts.map +1 -0
- package/dist/ui/slashCatalog.js +243 -0
- package/dist/ui/slashCatalog.js.map +1 -0
- package/dist/ui/syntax.d.ts +11 -0
- package/dist/ui/syntax.d.ts.map +1 -0
- package/dist/ui/syntax.js +78 -0
- package/dist/ui/syntax.js.map +1 -0
- package/dist/ui/theme.d.ts +165 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +394 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/ui/types.d.ts +203 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +53 -0
- package/dist/ui/types.js.map +1 -0
- package/package.json +104 -0
|
@@ -0,0 +1,584 @@
|
|
|
1
|
+
// Claude Code CLI adapter (Phase 17-a).
|
|
2
|
+
//
|
|
3
|
+
// Spawns `claude -p <prompt> --output-format stream-json --include-partial-
|
|
4
|
+
// messages --verbose --bare`, parses the line-delimited JSON envelope it
|
|
5
|
+
// emits, and forwards the inner `stream_event.event` payloads through
|
|
6
|
+
// translateAnthropicEvents — because Claude Code emits the same shape the
|
|
7
|
+
// Anthropic SDK does for content_block_* / message_* events.
|
|
8
|
+
//
|
|
9
|
+
// Auth: Claude Code's own OAuth session (Pro/Max plan). No API key,
|
|
10
|
+
// no per-request credit. omg never sees the token.
|
|
11
|
+
//
|
|
12
|
+
// Tools: disabled for the first phase. Claude Code has its own tool
|
|
13
|
+
// permission system; mixing it with omg's ToolRegistry needs a separate
|
|
14
|
+
// design pass (Phase 17-c). For now we run with `--disallowedTools "*"`
|
|
15
|
+
// equivalent — we tell Claude Code "you have no tools", so all reasoning
|
|
16
|
+
// stays in text, and omg's interceptor handles tool calls if omg's
|
|
17
|
+
// adapter emits any (it won't from this path).
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
import { CLAUDE_NOISE_PATTERNS } from "./cliStderr.js";
|
|
20
|
+
import { flattenConversation, lastUserAttachments, rateLimit, streamEnd, text, } from "../orchestration/types.js";
|
|
21
|
+
import { translateAnthropicEvents } from "./anthropic.js";
|
|
22
|
+
import { recordParseFailure, } from "./parseFailures.js";
|
|
23
|
+
import { runCliAdapterStream } from "./cliAdapterBase.js";
|
|
24
|
+
import { ASK_USER_NUDGE, BACKGROUND_TASK_NUDGE, RECORD_DECISION_NUDGE, } from "./nudges.js";
|
|
25
|
+
import { buildOmgServerSpec, toClaudeMcpConfig, } from "../tools/omgToolManifest.js";
|
|
26
|
+
export class ClaudeCliAdapter {
|
|
27
|
+
opts;
|
|
28
|
+
provider = "claude-cli";
|
|
29
|
+
/** Captured from the first response's system/init envelope when
|
|
30
|
+
* enableSessionResume is on. Used to add `--resume <id>` on
|
|
31
|
+
* subsequent stream() calls. */
|
|
32
|
+
sessionId = undefined;
|
|
33
|
+
/** Phase 21: live child handle so cancel() can SIGTERM it. */
|
|
34
|
+
currentChild = null;
|
|
35
|
+
/** Phase 30: when true, the next stream() call passes
|
|
36
|
+
* --fork-session so claude creates a fresh session id instead of
|
|
37
|
+
* reusing the existing one. Cleared automatically after the call.
|
|
38
|
+
*/
|
|
39
|
+
forkOnNextCall = false;
|
|
40
|
+
constructor(opts = {}) {
|
|
41
|
+
this.opts = opts;
|
|
42
|
+
}
|
|
43
|
+
/** Expose for tests / debugging. Reset by setting to undefined. */
|
|
44
|
+
get currentSessionId() {
|
|
45
|
+
return this.sessionId;
|
|
46
|
+
}
|
|
47
|
+
setCwd(cwd) {
|
|
48
|
+
this.opts.cwd = cwd;
|
|
49
|
+
}
|
|
50
|
+
restoreSession(sessionId) {
|
|
51
|
+
this.sessionId = sessionId;
|
|
52
|
+
}
|
|
53
|
+
setModel(model) {
|
|
54
|
+
this.opts.model = model;
|
|
55
|
+
}
|
|
56
|
+
resetSession() {
|
|
57
|
+
this.sessionId = undefined;
|
|
58
|
+
}
|
|
59
|
+
/** Arm a fork for the next call. No-op if no session is captured;
|
|
60
|
+
* the caller (cli.ts /fork handler) should check currentSessionId
|
|
61
|
+
* first and message the user if it's empty. */
|
|
62
|
+
forkNext() {
|
|
63
|
+
this.forkOnNextCall = true;
|
|
64
|
+
}
|
|
65
|
+
get isForkArmed() {
|
|
66
|
+
return this.forkOnNextCall;
|
|
67
|
+
}
|
|
68
|
+
cancel() {
|
|
69
|
+
if (this.currentChild && !this.currentChild.killed) {
|
|
70
|
+
this.currentChild.kill("SIGTERM");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** Resolve the prompt string sent to the CLI. With session resume
|
|
74
|
+
* active and a session id captured, we send only the last user
|
|
75
|
+
* message — the CLI rehydrates prior turns from the saved session.
|
|
76
|
+
* Otherwise we flatten the whole Conversation (or pass through the
|
|
77
|
+
* raw string). */
|
|
78
|
+
promptFor(input) {
|
|
79
|
+
if (this.opts.enableSessionResume &&
|
|
80
|
+
this.sessionId !== undefined &&
|
|
81
|
+
typeof input !== "string") {
|
|
82
|
+
const messages = input.messages;
|
|
83
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
84
|
+
const m = messages[i];
|
|
85
|
+
if (m.role === "user")
|
|
86
|
+
return m.text;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return inputToPrompt(input);
|
|
90
|
+
}
|
|
91
|
+
async *stream(input) {
|
|
92
|
+
// Phase 18 resume: if we already have a session id, send only the
|
|
93
|
+
// last user message; the CLI fetches prior turns from the saved
|
|
94
|
+
// session. Without a session id, fall back to flattening the whole
|
|
95
|
+
// input (the 17-a behavior).
|
|
96
|
+
const prompt = this.promptFor(input);
|
|
97
|
+
// Phase 340: claude-cli has no local-image flag, so attachments are
|
|
98
|
+
// injected into the prompt as a Read-tool reference (see buildArgs).
|
|
99
|
+
const args = this.buildArgs(prompt, lastUserAttachments(input));
|
|
100
|
+
// Phase 56: thread the active tab's cwd into the CLI's env so
|
|
101
|
+
// the omg-mcp-server grandchild (if --expose-omg-tools is on)
|
|
102
|
+
// picks it up via OMG_TAB_CWD.
|
|
103
|
+
// Phase 243: also thread OMG_TAB_NAME so the PreToolUse hook
|
|
104
|
+
// (hookedToolProxy.mjs) can report which tab fired an interactive
|
|
105
|
+
// tool — replaces findAskingTab's "single-inflight" guess with a
|
|
106
|
+
// deterministic per-tab route.
|
|
107
|
+
const tabName = this.opts.getTabName?.();
|
|
108
|
+
const baseEnv = { ...process.env };
|
|
109
|
+
// Phase 331: raise claude-cli's Bash tool timeout so long but BOUNDED
|
|
110
|
+
// tasks (build / test / deploy, minutes) finish in the FOREGROUND
|
|
111
|
+
// within the turn — the model then continues immediately, with no
|
|
112
|
+
// fragile run_in_background watcher to depend on. The 2-min default
|
|
113
|
+
// otherwise killed them and pushed the model onto the background path
|
|
114
|
+
// that kept leaving the user stuck. Respect any value the user set.
|
|
115
|
+
baseEnv.BASH_DEFAULT_TIMEOUT_MS ??= "600000"; // 10 min default
|
|
116
|
+
baseEnv.BASH_MAX_TIMEOUT_MS ??= "1800000"; // 30 min ceiling for slow builds
|
|
117
|
+
if (this.opts.cwd)
|
|
118
|
+
baseEnv.OMG_TAB_CWD = this.opts.cwd;
|
|
119
|
+
if (tabName)
|
|
120
|
+
baseEnv.OMG_TAB_NAME = tabName;
|
|
121
|
+
const childEnv = baseEnv;
|
|
122
|
+
try {
|
|
123
|
+
yield* runCliAdapterStream({
|
|
124
|
+
command: this.opts.command ?? "claude",
|
|
125
|
+
args,
|
|
126
|
+
cwd: this.opts.cwd,
|
|
127
|
+
env: childEnv,
|
|
128
|
+
noisePatterns: CLAUDE_NOISE_PATTERNS,
|
|
129
|
+
verboseStderr: this.opts.verboseStderr === true,
|
|
130
|
+
onThrottle: this.opts.onThrottle,
|
|
131
|
+
provider: "claude-cli",
|
|
132
|
+
translate: (rl, sh, pf) => translateClaudeCliLines(rl, sh, pf),
|
|
133
|
+
setChild: (c) => {
|
|
134
|
+
this.currentChild = c;
|
|
135
|
+
},
|
|
136
|
+
onSession: (sid) => {
|
|
137
|
+
if (this.opts.enableSessionResume && sid)
|
|
138
|
+
this.sessionId = sid;
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
// Phase 30 one-shot: clear forkOnNextCall whether the call
|
|
144
|
+
// succeeded or failed. The helper already cleared currentChild.
|
|
145
|
+
this.forkOnNextCall = false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** Public for testing — the args we hand to spawn().
|
|
149
|
+
*
|
|
150
|
+
* Notes on flag choices:
|
|
151
|
+
* - We deliberately do NOT pass --bare. --bare forces auth via
|
|
152
|
+
* ANTHROPIC_API_KEY (or apiKeyHelper) and *ignores* the user's
|
|
153
|
+
* OAuth session. Phase 17 is the subscription/OAuth path, so we
|
|
154
|
+
* leave Claude Code's default auth resolution in place.
|
|
155
|
+
* - `--tools ""` is the documented "disable all tools" form.
|
|
156
|
+
* `--disallowedTools "*"` does NOT match (the value must be a
|
|
157
|
+
* tool name, not a glob).
|
|
158
|
+
* - `--no-session-persistence` keeps the CLI from saving each call
|
|
159
|
+
* into the user's session list. omg manages its own conversation
|
|
160
|
+
* state via 16-b.
|
|
161
|
+
*/
|
|
162
|
+
buildArgs(prompt, attachments = []) {
|
|
163
|
+
// Phase 340: claude-cli has no local-image flag (unlike codex `-i`), so
|
|
164
|
+
// reference the image paths in the prompt — claude's Read tool is
|
|
165
|
+
// multimodal and views them. Interactive chat runs with `--tools
|
|
166
|
+
// default`, so Read is available.
|
|
167
|
+
const effectivePrompt = attachments.length > 0
|
|
168
|
+
? `${prompt}\n\n[Image(s) attached to this message — view them with the Read tool: ${attachments.join(", ")}]`
|
|
169
|
+
: prompt;
|
|
170
|
+
const args = [
|
|
171
|
+
"-p",
|
|
172
|
+
effectivePrompt,
|
|
173
|
+
"--output-format",
|
|
174
|
+
"stream-json",
|
|
175
|
+
"--include-partial-messages",
|
|
176
|
+
"--verbose",
|
|
177
|
+
];
|
|
178
|
+
// Session persistence is needed to make --resume work. Without
|
|
179
|
+
// resume mode, persist nothing — keeps the user's session list
|
|
180
|
+
// clean across one-shot omg --run calls.
|
|
181
|
+
if (this.opts.enableSessionResume) {
|
|
182
|
+
if (this.sessionId !== undefined) {
|
|
183
|
+
args.push("--resume", this.sessionId);
|
|
184
|
+
// Phase 30: fork the resumed session so the next system/init
|
|
185
|
+
// carries a *new* id (which we then capture as `sessionId`).
|
|
186
|
+
if (this.forkOnNextCall)
|
|
187
|
+
args.push("--fork-session");
|
|
188
|
+
}
|
|
189
|
+
// else: first call, omit --no-session-persistence so the
|
|
190
|
+
// session gets saved and a session_id is allocated.
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
args.push("--no-session-persistence");
|
|
194
|
+
}
|
|
195
|
+
if (this.opts.cliTools) {
|
|
196
|
+
// CLI executes these tools itself. omg surfaces tool_use events
|
|
197
|
+
// for visibility but does not double-execute.
|
|
198
|
+
const list = this.opts.cliTools
|
|
199
|
+
.split(/[,\s]+/)
|
|
200
|
+
.filter(Boolean)
|
|
201
|
+
.join(" ");
|
|
202
|
+
args.push("--tools", list);
|
|
203
|
+
if (this.opts.permissionMode) {
|
|
204
|
+
args.push("--permission-mode", this.opts.permissionMode);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else if (this.opts.disableTools === false) {
|
|
208
|
+
// Phase 96/100: enable claude-cli's full built-in tool set.
|
|
209
|
+
// The CLI documents three --tools forms: "" (disable all),
|
|
210
|
+
// "default" (use all), or an explicit name list. Phase 96 hand-
|
|
211
|
+
// enumerated names, but a single unrecognised name (e.g. "LS")
|
|
212
|
+
// makes claude-cli reject the whole flag and fall back to NO
|
|
213
|
+
// tools — so the model degraded right back to text-narrated
|
|
214
|
+
// "Read(...)" calls. "default" is the documented all-tools
|
|
215
|
+
// sentinel and can't go stale as the built-in set evolves.
|
|
216
|
+
// bypassPermissions keeps tools firing without an interactive
|
|
217
|
+
// prompt the JSON-RPC stream can't answer.
|
|
218
|
+
args.push("--tools", "default");
|
|
219
|
+
args.push("--permission-mode", this.opts.permissionMode ?? "bypassPermissions");
|
|
220
|
+
}
|
|
221
|
+
else if (!this.opts.omgTools) {
|
|
222
|
+
// Default safety: disable native tools unless --expose-omg-tools
|
|
223
|
+
// explicitly mounts omg's MCP set.
|
|
224
|
+
args.push("--tools", "");
|
|
225
|
+
}
|
|
226
|
+
if (this.opts.omgTools) {
|
|
227
|
+
// Phase 210: canonical manifest. Adapter only owns the
|
|
228
|
+
// `--mcp-config <json>` serialization on top of the shared spec.
|
|
229
|
+
const spec = buildOmgServerSpec(this.opts.omgTools);
|
|
230
|
+
args.push("--mcp-config", toClaudeMcpConfig(spec));
|
|
231
|
+
// The CLI prompts before running unknown tools by default. omg's
|
|
232
|
+
// tools wouldn't auto-run otherwise, which defeats the integration.
|
|
233
|
+
// Honor permissionMode if the caller set one; default to
|
|
234
|
+
// bypassPermissions since exposing omg's tools is opt-in.
|
|
235
|
+
if (this.opts.permissionMode === undefined) {
|
|
236
|
+
const pmIdx = args.indexOf("--permission-mode");
|
|
237
|
+
if (pmIdx < 0)
|
|
238
|
+
args.push("--permission-mode", "bypassPermissions");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (this.opts.model)
|
|
242
|
+
args.push("--model", this.opts.model);
|
|
243
|
+
// Phase 188 → 206: nudges fire when AskUserQuestion is registered
|
|
244
|
+
// with the hooked-tool broker (the picker actually works). Without
|
|
245
|
+
// the nudge the model would bail on commands that need interactive
|
|
246
|
+
// input. Concatenated with any user-supplied system prompt so the
|
|
247
|
+
// two compose cleanly.
|
|
248
|
+
const hookedTools = parseHookedTools(process.env.OMG_HOOKED_TOOLS);
|
|
249
|
+
const systemParts = [];
|
|
250
|
+
if (this.opts.system)
|
|
251
|
+
systemParts.push(this.opts.system);
|
|
252
|
+
if (hookedTools.includes("AskUserQuestion")) {
|
|
253
|
+
systemParts.push(ASK_USER_NUDGE);
|
|
254
|
+
systemParts.push(BACKGROUND_TASK_NUDGE);
|
|
255
|
+
}
|
|
256
|
+
// Phase 201c: when omg's MCP tools are mounted, the model has
|
|
257
|
+
// access to record_decision. Nudge it to use that for durable
|
|
258
|
+
// anchoring of abandoned approaches / settled constraints —
|
|
259
|
+
// otherwise those decisions stay buried in the transcript and
|
|
260
|
+
// a future provider switch loses them.
|
|
261
|
+
if (this.opts.omgTools) {
|
|
262
|
+
systemParts.push(RECORD_DECISION_NUDGE);
|
|
263
|
+
}
|
|
264
|
+
if (systemParts.length > 0) {
|
|
265
|
+
args.push("--append-system-prompt", systemParts.join("\n\n"));
|
|
266
|
+
}
|
|
267
|
+
// Phase 333: nudge constants moved to ./nudges.ts so the codex
|
|
268
|
+
// adapter can share them (parity). claude's variants are imported at
|
|
269
|
+
// the top of this file; the codex variants live alongside them.
|
|
270
|
+
// Phase 187 → 206: inject one PreToolUse matcher per registered
|
|
271
|
+
// hooked tool. Each matcher points at the same generic .mjs; the
|
|
272
|
+
// broker dispatches by tool_name at runtime. Without these
|
|
273
|
+
// matchers, claude-cli would fire interactive tools without omg
|
|
274
|
+
// intercepting them and the picker would fail under piped stdio.
|
|
275
|
+
if (process.env.OMG_HOOKED_TOOL_SOCKET && hookedTools.length > 0) {
|
|
276
|
+
args.push("--settings", hookedToolSettings(hookedTools));
|
|
277
|
+
}
|
|
278
|
+
if (this.opts.extraArgs)
|
|
279
|
+
args.push(...this.opts.extraArgs);
|
|
280
|
+
return args;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/** Phase 187 → 206 (277-renamed): resolves to src/toolhook/ in dev,
|
|
284
|
+
* dist/toolhook/ in built code — both sit two directories up from this
|
|
285
|
+
* adapter file. */
|
|
286
|
+
const hookedToolHookPath = fileURLToPath(new URL("../../toolhook/hookedToolProxy.mjs", import.meta.url));
|
|
287
|
+
function parseHookedTools(raw) {
|
|
288
|
+
if (!raw)
|
|
289
|
+
return [];
|
|
290
|
+
return raw
|
|
291
|
+
.split(",")
|
|
292
|
+
.map((s) => s.trim())
|
|
293
|
+
.filter((s) => s.length > 0);
|
|
294
|
+
}
|
|
295
|
+
/** Phase 206: one PreToolUse matcher per registered tool, all pointing
|
|
296
|
+
* at the same generic dispatcher. claude-cli's matcher field accepts
|
|
297
|
+
* exact tool names — we list them rather than using a wildcard so the
|
|
298
|
+
* hook doesn't fire for non-hooked tools (avoids per-call overhead
|
|
299
|
+
* + protocol confusion if the hook misroutes). */
|
|
300
|
+
// Phase 327: the hooked-tool proxy BLOCKS waiting for the user's picker
|
|
301
|
+
// answer over the broker socket. claude-cli's default hook timeout (~60s)
|
|
302
|
+
// would kill it mid-decision — the user "ran out of time" and the question
|
|
303
|
+
// resolved as "no answer". A picker is a human prompt; it must wait. Set a
|
|
304
|
+
// very large per-hook timeout (24h) so it effectively never times out; the
|
|
305
|
+
// user can always Esc the picker to answer "no answer" deliberately.
|
|
306
|
+
const HOOKED_TOOL_TIMEOUT_S = 86_400;
|
|
307
|
+
function hookedToolSettings(toolNames) {
|
|
308
|
+
return JSON.stringify({
|
|
309
|
+
hooks: {
|
|
310
|
+
PreToolUse: toolNames.map((name) => ({
|
|
311
|
+
matcher: name,
|
|
312
|
+
hooks: [
|
|
313
|
+
{
|
|
314
|
+
type: "command",
|
|
315
|
+
command: `node ${hookedToolHookPath}`,
|
|
316
|
+
timeout: HOOKED_TOOL_TIMEOUT_S,
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
})),
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function inputToPrompt(input) {
|
|
324
|
+
return typeof input === "string" ? input : flattenConversation(input);
|
|
325
|
+
}
|
|
326
|
+
/** Phase 317: a Claude rate/session-limit rejection arrives as a `result`
|
|
327
|
+
* envelope whose text reads like "You've hit your session limit · resets
|
|
328
|
+
* 10pm … /usage-credits to request more usage". Without detecting it the
|
|
329
|
+
* turn looks like it "ended with no output" and omg blamed the model
|
|
330
|
+
* alias — when the real fix is to switch provider or wait for the reset.
|
|
331
|
+
*
|
|
332
|
+
* Gated tightly so a normal reply (whose full text can land in `result`)
|
|
333
|
+
* never trips it: the distinctive "usage-credits" string is conclusive on
|
|
334
|
+
* its own; otherwise we require an error result that mentions a limit plus
|
|
335
|
+
* a reset/usage — a combination a normal answer doesn't carry. */
|
|
336
|
+
export function detectRateLimitRejection(resultText, isError) {
|
|
337
|
+
const t = resultText.toLowerCase();
|
|
338
|
+
if (t.includes("usage-credits"))
|
|
339
|
+
return true;
|
|
340
|
+
return (isError &&
|
|
341
|
+
t.includes("limit") &&
|
|
342
|
+
(t.includes("reset") || t.includes("usage")));
|
|
343
|
+
}
|
|
344
|
+
/** Transform a stream of `claude` CLI envelope lines into omg Chunks.
|
|
345
|
+
*
|
|
346
|
+
* Exported for tests: feed in a mock AsyncIterable<string> and assert
|
|
347
|
+
* the produced Chunks. The spawn-and-pipe wiring stays in `stream()`.
|
|
348
|
+
*/
|
|
349
|
+
export async function* translateClaudeCliLines(lines, sessionHolder, parseFailures) {
|
|
350
|
+
// Track stopReason from the envelope so we can attach it to the
|
|
351
|
+
// final StreamEnd. CLI streams may include multiple assistant
|
|
352
|
+
// message_start/message_stop pairs (one per turn between tool calls);
|
|
353
|
+
// we drive translateAnthropicEvents in cli mode so the per-turn
|
|
354
|
+
// message_stop is dropped, and emit a single StreamEnd here on the
|
|
355
|
+
// envelope's `result` line (or, as a fallback, when the stream ends).
|
|
356
|
+
const stopHolder = { value: "end_turn" };
|
|
357
|
+
const sidHolder = sessionHolder ?? { value: undefined };
|
|
358
|
+
// Phase 44: rate_limit_event envelopes are buffered here so we can
|
|
359
|
+
// emit RateLimitChunks alongside the regular Anthropic-event stream.
|
|
360
|
+
// They live outside the anthropic translator (which only knows about
|
|
361
|
+
// content_block_* etc.); we splice them in as our own Chunks.
|
|
362
|
+
const rateLimits = [];
|
|
363
|
+
// Phase 103: buffer of tool results parsed from `user` messages.
|
|
364
|
+
const toolEnds = [];
|
|
365
|
+
// Phase 317: filled when a `result` envelope is a rate-limit rejection.
|
|
366
|
+
const rejection = { text: "" };
|
|
367
|
+
const events = unwrapClaudeCliEnvelope(lines, stopHolder, sidHolder, rateLimits, toolEnds, parseFailures, rejection);
|
|
368
|
+
// Drain rate_limit + tool_use_end chunks at the start of each "tick"
|
|
369
|
+
// — yield any that have accumulated before the next translated chunk.
|
|
370
|
+
let i = 0;
|
|
371
|
+
let te = 0;
|
|
372
|
+
for await (const c of translateAnthropicEvents(events, {
|
|
373
|
+
endOnMessageStop: false,
|
|
374
|
+
})) {
|
|
375
|
+
while (i < rateLimits.length) {
|
|
376
|
+
const r = rateLimits[i++];
|
|
377
|
+
yield rateLimit(r.resetsAt, r.kind, r.status);
|
|
378
|
+
}
|
|
379
|
+
while (te < toolEnds.length) {
|
|
380
|
+
const e = toolEnds[te++];
|
|
381
|
+
yield {
|
|
382
|
+
type: "tool_use_end",
|
|
383
|
+
toolId: e.toolId,
|
|
384
|
+
result: { ok: e.ok, value: e.value, error: e.ok ? "" : e.value },
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
yield c;
|
|
388
|
+
}
|
|
389
|
+
while (i < rateLimits.length) {
|
|
390
|
+
const r = rateLimits[i++];
|
|
391
|
+
yield rateLimit(r.resetsAt, r.kind, r.status);
|
|
392
|
+
}
|
|
393
|
+
while (te < toolEnds.length) {
|
|
394
|
+
const e = toolEnds[te++];
|
|
395
|
+
yield {
|
|
396
|
+
type: "tool_use_end",
|
|
397
|
+
toolId: e.toolId,
|
|
398
|
+
result: { ok: e.ok, value: e.value, error: e.ok ? "" : e.value },
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
// Phase 317: surface a rate-limit rejection's text as a real chunk so the
|
|
402
|
+
// turn isn't treated as "no output" (the rejected rate_limit chunk was
|
|
403
|
+
// already drained above, via the rateLimits buffer).
|
|
404
|
+
if (rejection.text)
|
|
405
|
+
yield text(rejection.text + "\n");
|
|
406
|
+
yield streamEnd(stopHolder.value);
|
|
407
|
+
}
|
|
408
|
+
/** Read line-delimited JSON envelope objects and yield the Anthropic-
|
|
409
|
+
* shape events embedded in `stream_event` entries. Other envelope types
|
|
410
|
+
* (system/init, status, rate_limit_event, assistant, result) are
|
|
411
|
+
* observed and synthesized into Chunks where useful.
|
|
412
|
+
*/
|
|
413
|
+
async function* unwrapClaudeCliEnvelope(lines, stopHolder, sessionHolder, rateLimits,
|
|
414
|
+
// Phase 103: claude-cli runs its native tools itself and reports
|
|
415
|
+
// each result as a `user` message carrying tool_result content
|
|
416
|
+
// blocks. We buffer those here so translateClaudeCliLines can splice
|
|
417
|
+
// tool_use_end Chunks into the stream — otherwise omg's tool cards
|
|
418
|
+
// stay stuck on "running" forever (no end ever arrives).
|
|
419
|
+
toolEnds, parseFailures,
|
|
420
|
+
// Phase 317: when a `result` envelope is a rate/session-limit rejection,
|
|
421
|
+
// stash its text here so translateClaudeCliLines can emit it as a chunk.
|
|
422
|
+
rejection) {
|
|
423
|
+
let resultSeen = false;
|
|
424
|
+
// Phase 286: classify results of hooked/proxy tools (e.g.
|
|
425
|
+
// AskUserQuestion). The hooked-tool broker injects the user's answer
|
|
426
|
+
// via a PreToolUse *deny* — the only channel that feeds text back to
|
|
427
|
+
// the model — so claude-cli reports the tool as is_error. That deny is
|
|
428
|
+
// our injection mechanism, not a failure, so such results are marked ok
|
|
429
|
+
// and the UI card shows the answer instead of [FAIL]. We map tool_use
|
|
430
|
+
// id→name from content_block_start and match names against the
|
|
431
|
+
// OMG_HOOKED_TOOLS set the broker publishes.
|
|
432
|
+
const toolNames = new Map();
|
|
433
|
+
const hookedToolSet = new Set((process.env.OMG_HOOKED_TOOLS ?? "")
|
|
434
|
+
.split(",")
|
|
435
|
+
.map((s) => s.trim())
|
|
436
|
+
.filter(Boolean));
|
|
437
|
+
try {
|
|
438
|
+
for await (const line of lines) {
|
|
439
|
+
const trimmed = line.trim();
|
|
440
|
+
if (!trimmed)
|
|
441
|
+
continue;
|
|
442
|
+
let parsed;
|
|
443
|
+
try {
|
|
444
|
+
parsed = JSON.parse(trimmed);
|
|
445
|
+
}
|
|
446
|
+
catch {
|
|
447
|
+
recordParseFailure(parseFailures, trimmed);
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
const type = parsed.type;
|
|
451
|
+
if (type === "system" && parsed.subtype === "init") {
|
|
452
|
+
const sid = parsed.session_id;
|
|
453
|
+
if (typeof sid === "string" && sid)
|
|
454
|
+
sessionHolder.value = sid;
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
if (type === "stream_event") {
|
|
458
|
+
const ev = parsed.event;
|
|
459
|
+
// Capture tool_use id→name so a later tool_result can be
|
|
460
|
+
// classified against hookedToolSet (Phase 286).
|
|
461
|
+
if (ev && typeof ev === "object") {
|
|
462
|
+
const evt = ev;
|
|
463
|
+
if (evt.type === "content_block_start") {
|
|
464
|
+
const cb = evt.content_block;
|
|
465
|
+
if (cb &&
|
|
466
|
+
cb.type === "tool_use" &&
|
|
467
|
+
typeof cb.id === "string" &&
|
|
468
|
+
typeof cb.name === "string") {
|
|
469
|
+
toolNames.set(cb.id, cb.name);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
if (ev !== undefined)
|
|
474
|
+
yield ev;
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
// Phase 103: tool results land as a `user` message with
|
|
478
|
+
// tool_result content blocks. Buffer one tool_use_end per
|
|
479
|
+
// block so the UI's tool card can stop "running".
|
|
480
|
+
if (type === "user" && toolEnds) {
|
|
481
|
+
const message = parsed.message;
|
|
482
|
+
const content = message && typeof message === "object"
|
|
483
|
+
? message.content
|
|
484
|
+
: undefined;
|
|
485
|
+
if (Array.isArray(content)) {
|
|
486
|
+
for (const block of content) {
|
|
487
|
+
if (block &&
|
|
488
|
+
typeof block === "object" &&
|
|
489
|
+
block.type === "tool_result") {
|
|
490
|
+
const b = block;
|
|
491
|
+
const toolId = typeof b.tool_use_id === "string" ? b.tool_use_id : "";
|
|
492
|
+
if (!toolId)
|
|
493
|
+
continue;
|
|
494
|
+
// content is either a string or an array of {type:"text",text}.
|
|
495
|
+
let value = "";
|
|
496
|
+
if (typeof b.content === "string")
|
|
497
|
+
value = b.content;
|
|
498
|
+
else if (Array.isArray(b.content)) {
|
|
499
|
+
value = b.content
|
|
500
|
+
.map((c) => c &&
|
|
501
|
+
typeof c === "object" &&
|
|
502
|
+
typeof c.text === "string"
|
|
503
|
+
? c.text
|
|
504
|
+
: "")
|
|
505
|
+
.join("");
|
|
506
|
+
}
|
|
507
|
+
// Phase 286: a hooked/proxy tool is always "denied" by our
|
|
508
|
+
// PreToolUse hook (that's how the answer reaches the model),
|
|
509
|
+
// so its is_error result is expected — treat it as ok to
|
|
510
|
+
// avoid a false [FAIL] card.
|
|
511
|
+
const proxied = hookedToolSet.has(toolNames.get(toolId) ?? "");
|
|
512
|
+
toolEnds.push({
|
|
513
|
+
toolId,
|
|
514
|
+
ok: proxied ? true : b.is_error !== true,
|
|
515
|
+
value,
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
continue;
|
|
521
|
+
}
|
|
522
|
+
if (type === "result") {
|
|
523
|
+
const r = parsed;
|
|
524
|
+
const sr = r.stop_reason;
|
|
525
|
+
if (typeof sr === "string" && sr)
|
|
526
|
+
stopHolder.value = sr;
|
|
527
|
+
// Phase 317: surface a rate/session-limit rejection. Yielding it
|
|
528
|
+
// as text means the turn no longer looks empty (so the misleading
|
|
529
|
+
// "no output / alias may be wrong" path is skipped), and the
|
|
530
|
+
// rejected rate_limit chunk flags the tab so the chip shows it and
|
|
531
|
+
// the next turn skips a futile compaction.
|
|
532
|
+
const resultText = typeof r.result === "string" ? r.result : "";
|
|
533
|
+
const isError = r.is_error === true ||
|
|
534
|
+
(typeof r.subtype === "string" && r.subtype.startsWith("error"));
|
|
535
|
+
if (resultText && detectRateLimitRejection(resultText, isError)) {
|
|
536
|
+
// Side-channel it the same way rate_limit_events are: a rejected
|
|
537
|
+
// status (so the chip + next-turn compaction-skip see it) and the
|
|
538
|
+
// text (which translateClaudeCliLines emits as a real chunk so the
|
|
539
|
+
// turn isn't treated as empty). This generator yields Anthropic
|
|
540
|
+
// events, not omg Chunks, so we can't yield those here directly.
|
|
541
|
+
rateLimits?.push({ resetsAt: 0, kind: "session", status: "rejected" });
|
|
542
|
+
if (rejection)
|
|
543
|
+
rejection.text = resultText.trim();
|
|
544
|
+
}
|
|
545
|
+
resultSeen = true;
|
|
546
|
+
// Phase 154: `result` is the final envelope of a turn. Return now
|
|
547
|
+
// instead of reading until stdout EOF — when the agent backgrounds
|
|
548
|
+
// a long-running command (e.g. `npm start`), claude-cli stays alive
|
|
549
|
+
// managing it, so stdout never closes and the turn would otherwise
|
|
550
|
+
// hang forever waiting for an EOF that never comes.
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (type === "rate_limit_event" && rateLimits) {
|
|
554
|
+
const info = parsed.rate_limit_info;
|
|
555
|
+
if (info && typeof info === "object") {
|
|
556
|
+
const o = info;
|
|
557
|
+
const sec = Number(o.resetsAt);
|
|
558
|
+
if (Number.isFinite(sec) && sec > 0) {
|
|
559
|
+
const raw = String(o.rateLimitType ?? "");
|
|
560
|
+
const kind = raw === "five_hour"
|
|
561
|
+
? "five_hour"
|
|
562
|
+
: raw === "weekly"
|
|
563
|
+
? "weekly"
|
|
564
|
+
: raw === "session"
|
|
565
|
+
? "session"
|
|
566
|
+
: "unknown";
|
|
567
|
+
const status = typeof o.status === "string" ? o.status : undefined;
|
|
568
|
+
rateLimits.push({ resetsAt: sec * 1000, kind, status });
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
// system/status, assistant snapshots — informational only.
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
finally {
|
|
577
|
+
// resultSeen distinguishes a clean CLI exit from a truncated one.
|
|
578
|
+
// In CLI mode translateAnthropicEvents swallows message_stop, and
|
|
579
|
+
// the outer translateClaudeCliLines emits the final StreamEnd
|
|
580
|
+
// unconditionally — so we don't need to inject a synthetic event.
|
|
581
|
+
void resultSeen;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
//# sourceMappingURL=claudeCli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claudeCli.js","sourceRoot":"","sources":["../../../src/core/adapters/claudeCli.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,yEAAyE;AACzE,sEAAsE;AACtE,0EAA0E;AAC1E,6DAA6D;AAC7D,EAAE;AACF,oEAAoE;AACpE,mDAAmD;AACnD,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,mEAAmE;AACnE,+CAA+C;AAE/C,OAAO,EAAE,aAAa,EAA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AC,CAAC,CAAC,SAAS,CAAC;wBACnE,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;oBAC1D,CAAC;gBACH,CAAC;gBACD,SAAS;YACX,CAAC;YACD,2DAA2D;QAC7D,CAAC;IACH,CAAC;YAAS,CAAC;QACT,kEAAkE;QAClE,kEAAkE;QAClE,8DAA8D;QAC9D,kEAAkE;QAClE,KAAK,UAAU,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ChildProcess } from "node:child_process";
|
|
2
|
+
import type { Chunk } from "../orchestration/types.js";
|
|
3
|
+
import { type ParseFailuresHolder } from "./parseFailures.js";
|
|
4
|
+
export interface CliStreamSpec {
|
|
5
|
+
/** Binary name or absolute path. */
|
|
6
|
+
command: string;
|
|
7
|
+
args: string[];
|
|
8
|
+
cwd?: string;
|
|
9
|
+
/** Defaults to `process.env`. Pass an extended env (e.g. with
|
|
10
|
+
* OMG_TAB_CWD) when the spawned CLI expects it. */
|
|
11
|
+
env?: NodeJS.ProcessEnv;
|
|
12
|
+
/** Vendor-specific stderr noise patterns to drop. See cliStderr.ts. */
|
|
13
|
+
noisePatterns: readonly RegExp[];
|
|
14
|
+
verboseStderr: boolean;
|
|
15
|
+
onThrottle?: (info: {
|
|
16
|
+
resetMs: number;
|
|
17
|
+
reason: string;
|
|
18
|
+
}) => void;
|
|
19
|
+
/** Provider id used in stderr labels (`[<provider>] dropped …`,
|
|
20
|
+
* `<provider> CLI failed to spawn …`). */
|
|
21
|
+
provider: string;
|
|
22
|
+
/** Translates raw envelope lines into Chunks. Implementations
|
|
23
|
+
* belong to each adapter (translateClaudeCliLines, etc.); the
|
|
24
|
+
* helper just plumbs the holders through. */
|
|
25
|
+
translate: (lines: AsyncIterable<string>, sessionHolder: {
|
|
26
|
+
value: string | undefined;
|
|
27
|
+
}, parseFailures: ParseFailuresHolder) => AsyncIterable<Chunk>;
|
|
28
|
+
/** Two-call ref management: invoked with the live child after spawn
|
|
29
|
+
* so cancel() can SIGTERM it, then with null in the finally block
|
|
30
|
+
* so a late cancel() is a no-op. Adapters typically point this at
|
|
31
|
+
* `(c) => { this.currentChild = c; }`. */
|
|
32
|
+
setChild?: (child: ChildProcess | null) => void;
|
|
33
|
+
/** Called right after the translator finishes, with the session id
|
|
34
|
+
* the translator captured (if any). Adapters that honor session
|
|
35
|
+
* resume update `this.sessionId` here. */
|
|
36
|
+
onSession?: (sessionId: string | undefined) => void;
|
|
37
|
+
}
|
|
38
|
+
/** Run one CLI stream end-to-end. Yields Chunks from the translator;
|
|
39
|
+
* enforces the Phase 154 / 200e grace pattern and Phase 200d parse-
|
|
40
|
+
* failure surfacing on the way out. */
|
|
41
|
+
export declare function runCliAdapterStream(spec: CliStreamSpec): AsyncIterable<Chunk>;
|
|
42
|
+
/** Phase 219 (distribution): a missing provider binary is the #1
|
|
43
|
+
* first-run failure mode. New users typed `omg` without `claude` /
|
|
44
|
+
* `codex` / `gemini` on PATH and got an ENOENT stack trace that
|
|
45
|
+
* read like the package itself was broken. We catch that case here
|
|
46
|
+
* and surface a one-screen actionable hint instead. */
|
|
47
|
+
export declare const INSTALL_HINTS: Record<string, string>;
|
|
48
|
+
//# sourceMappingURL=cliAdapterBase.d.ts.map
|