@gajae-code/coding-agent 0.17.2 → 0.17.4
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 +194 -0
- package/dist/types/cli/daemon-cli.d.ts +3 -1
- package/dist/types/cli/github-release.d.ts +17 -0
- package/dist/types/cli/public-command-entry.d.ts +56 -0
- package/dist/types/cli/public-command-errors.d.ts +126 -0
- package/dist/types/cli/public-command-evidence.d.ts +99 -0
- package/dist/types/cli/public-command-help.d.ts +65 -0
- package/dist/types/cli/public-command-registry.d.ts +69 -0
- package/dist/types/cli/session-picker.d.ts +1 -1
- package/dist/types/cli/setup-cli.d.ts +1 -0
- package/dist/types/cli/skills-cli.d.ts +5 -0
- package/dist/types/cli.d.ts +3 -0
- package/dist/types/commands/daemon.d.ts +4 -50
- package/dist/types/commands/sdk.d.ts +20 -37
- package/dist/types/commands/setup.d.ts +3 -0
- package/dist/types/commands/skills.d.ts +9 -0
- package/dist/types/config/autorouting-tier-map.d.ts +18 -0
- package/dist/types/config/file-lock.d.ts +9 -1
- package/dist/types/config/model-profile-activation.d.ts +45 -1
- package/dist/types/config/model-registry.d.ts +11 -2
- package/dist/types/config/settings-schema.d.ts +11 -0
- package/dist/types/coordinator-mcp/question-state.d.ts +6 -1
- package/dist/types/daemon/operator-contract.d.ts +5 -1
- package/dist/types/eval/js/worker-protocol.d.ts +2 -0
- package/dist/types/extensibility/extensions/types.d.ts +12 -0
- package/dist/types/extensibility/gjc-plugins/registry.d.ts +4 -0
- package/dist/types/extensibility/runtime-skill-discovery.d.ts +18 -0
- package/dist/types/extensibility/shared-events.d.ts +3 -1
- package/dist/types/gjc-runtime/session-state-lock.d.ts +61 -0
- package/dist/types/internal-urls/embedded-protocol.d.ts +9 -0
- package/dist/types/internal-urls/index.d.ts +1 -0
- package/dist/types/internal-urls/parse.d.ts +9 -1
- package/dist/types/main.d.ts +22 -0
- package/dist/types/modes/acp/acp-agent.d.ts +55 -1
- package/dist/types/modes/acp/startup-provenance.d.ts +16 -0
- package/dist/types/modes/components/custom-provider-wizard.d.ts +19 -1
- package/dist/types/modes/components/session-selector.d.ts +5 -2
- package/dist/types/modes/components/user-message-selector.d.ts +5 -2
- package/dist/types/modes/controllers/command-controller.d.ts +1 -1
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
- package/dist/types/modes/interactive-mode.d.ts +1 -1
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +11 -1
- package/dist/types/modes/shared/agent-wire/workflow-gate-types.d.ts +14 -1
- package/dist/types/modes/types.d.ts +2 -2
- package/dist/types/runtime/process-lifecycle.d.ts +2 -0
- package/dist/types/runtime-mcp/manager.d.ts +56 -0
- package/dist/types/runtime-mcp/pool.d.ts +17 -0
- package/dist/types/runtime-mcp/redaction.d.ts +20 -0
- package/dist/types/runtime-mcp/startup-policy.d.ts +6 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +9 -0
- package/dist/types/runtime-mcp/transports/http.d.ts +11 -0
- package/dist/types/sdk/broker/broker.d.ts +13 -2
- package/dist/types/sdk/broker/identity.d.ts +3 -1
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +23 -3
- package/dist/types/sdk/broker/lifecycle.d.ts +15 -8
- package/dist/types/sdk/broker/runtime.d.ts +1 -1
- package/dist/types/sdk/broker/session-index.d.ts +22 -3
- package/dist/types/sdk/broker/spawn-authority.d.ts +4 -0
- package/dist/types/sdk/broker/stderr-drainer.d.ts +13 -0
- package/dist/types/sdk/bus/index.d.ts +19 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +3 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +5 -0
- package/dist/types/sdk/cli/master-cli.d.ts +6 -10
- package/dist/types/sdk/cli/rows.d.ts +19 -1
- package/dist/types/sdk/cli/session-cli.d.ts +22 -5
- package/dist/types/sdk/client/client.d.ts +2 -0
- package/dist/types/sdk/guides/cli.d.ts +3 -4
- package/dist/types/sdk/guides/verify.d.ts +2 -0
- package/dist/types/sdk/host/host.d.ts +9 -0
- package/dist/types/sdk/host/session-runtime.d.ts +31 -0
- package/dist/types/sdk/host/types.d.ts +10 -0
- package/dist/types/sdk/index.d.ts +1 -0
- package/dist/types/sdk/prompt-deadline-flush.d.ts +83 -0
- package/dist/types/sdk/prompt-deadline-manager.d.ts +37 -0
- package/dist/types/sdk/prompt-tool-boundary.d.ts +73 -0
- package/dist/types/sdk/router/session-router.d.ts +2 -0
- package/dist/types/sdk/startup-capability.d.ts +2 -0
- package/dist/types/sdk/transport/relay.d.ts +1 -0
- package/dist/types/sdk/transport/serve-cli.d.ts +48 -4
- package/dist/types/sdk/transport/stdio.d.ts +5 -1
- package/dist/types/session/agent-session.d.ts +168 -21
- package/dist/types/session/fallback-chain-controller.d.ts +6 -6
- package/dist/types/session/fold-coordinator.d.ts +17 -3
- package/dist/types/session/internal/managed-session-storage.d.ts +7 -1
- package/dist/types/session/session-manager.d.ts +64 -1
- package/dist/types/session/session-work-lease.d.ts +14 -0
- package/dist/types/setup/model-onboarding-guidance.d.ts +1 -1
- package/dist/types/setup/provider-onboarding.d.ts +81 -1
- package/dist/types/tools/bash.d.ts +37 -11
- package/dist/types/tools/job.d.ts +1 -1
- package/dist/types/tools/steer-fold.d.ts +31 -0
- package/dist/types/utils/git.d.ts +28 -2
- package/dist/types/utils/mupdf-embedded.d.ts +2 -0
- package/dist/types/utils/mupdf.d.ts +4 -0
- package/dist/types/utils/session-title-generation.d.ts +6 -0
- package/dist/types/utils/title-generator.d.ts +11 -2
- package/dist/types/web/scrapers/types.d.ts +3 -0
- package/package.json +18 -10
- package/scripts/build-binary.ts +9 -3
- package/scripts/compile-args.ts +0 -9
- package/scripts/embed-mupdf.ts +52 -0
- package/scripts/generate-sdk-operation-inventory.ts +31 -1
- package/scripts/vendor-markit.ts +196 -0
- package/src/async/job-manager.ts +22 -1
- package/src/cli/daemon-cli.ts +53 -18
- package/src/cli/github-release.ts +87 -5
- package/src/cli/mcp-cli.ts +38 -4
- package/src/cli/public-command-entry.ts +450 -0
- package/src/cli/public-command-errors.ts +581 -0
- package/src/cli/public-command-evidence.ts +717 -0
- package/src/cli/public-command-help.ts +360 -0
- package/src/cli/public-command-registry.ts +535 -0
- package/src/cli/session-picker.ts +2 -1
- package/src/cli/setup-cli.ts +9 -1
- package/src/cli/skills-cli.ts +46 -2
- package/src/cli.ts +61 -1
- package/src/commands/daemon.ts +65 -69
- package/src/commands/sdk.ts +175 -117
- package/src/commands/setup.ts +2 -0
- package/src/commands/skills.ts +11 -0
- package/src/config/autorouting-tier-map.ts +14 -0
- package/src/config/file-lock.ts +147 -51
- package/src/config/model-profile-activation.ts +334 -43
- package/src/config/model-registry.ts +183 -25
- package/src/config/settings-schema.ts +26 -2
- package/src/coordinator-mcp/policy.ts +10 -5
- package/src/coordinator-mcp/question-gate-codec.ts +17 -0
- package/src/coordinator-mcp/question-state.ts +175 -8
- package/src/coordinator-mcp/server.ts +507 -81
- package/src/coordinator-mcp/session-reaper.ts +6 -4
- package/src/crash/record-loader.ts +6 -2
- package/src/daemon/operator-contract.ts +26 -12
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +1 -1
- package/src/eval/js/context-manager.ts +8 -8
- package/src/eval/js/worker-core.ts +9 -4
- package/src/eval/js/worker-protocol.ts +2 -0
- package/src/extensibility/extensions/runner.ts +52 -4
- package/src/extensibility/extensions/types.ts +10 -0
- package/src/extensibility/gjc-plugins/registry.ts +196 -37
- package/src/extensibility/runtime-skill-discovery.ts +61 -3
- package/src/extensibility/shared-events.ts +3 -1
- package/src/gjc-runtime/session-state-lock.ts +165 -24
- package/src/gjc-runtime/ultragoal-succession.ts +31 -3
- package/src/internal-urls/docs-index.generated.ts +20 -19
- package/src/internal-urls/embedded-protocol.ts +83 -0
- package/src/internal-urls/index.ts +1 -0
- package/src/internal-urls/parse.ts +21 -1
- package/src/internal-urls/router.ts +4 -2
- package/src/main.ts +123 -55
- package/src/modes/acp/acp-agent.ts +408 -35
- package/src/modes/acp/startup-provenance.ts +59 -0
- package/src/modes/components/custom-provider-wizard.ts +308 -7
- package/src/modes/components/oauth-selector.ts +9 -0
- package/src/modes/components/session-selector.ts +47 -4
- package/src/modes/components/user-message-selector.ts +57 -15
- package/src/modes/controllers/command-controller.ts +58 -32
- package/src/modes/controllers/extension-ui-controller.ts +33 -7
- package/src/modes/controllers/input-controller.ts +4 -0
- package/src/modes/controllers/selector-controller.ts +161 -15
- package/src/modes/interactive-mode.ts +21 -7
- package/src/modes/runtime-init.ts +1 -0
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +124 -7
- package/src/modes/shared/agent-wire/workflow-gate-types.ts +16 -2
- package/src/modes/types.ts +2 -2
- package/src/prompts/agent-fragments/browser-aside.md +1 -0
- package/src/prompts/system/title-system.md +1 -1
- package/src/prompts/tools/bash.md +1 -1
- package/src/prompts/tools/job.md +1 -1
- package/src/prompts/tools/read.md +2 -0
- package/src/runtime/network-prewarm-service.test.ts +36 -1
- package/src/runtime/network-prewarm-service.ts +28 -3
- package/src/runtime/process-lifecycle.ts +22 -11
- package/src/runtime-mcp/config.ts +16 -1
- package/src/runtime-mcp/manager.ts +689 -55
- package/src/runtime-mcp/pool.test.ts +31 -0
- package/src/runtime-mcp/pool.ts +304 -28
- package/src/runtime-mcp/redaction.ts +42 -0
- package/src/runtime-mcp/startup-policy.ts +7 -0
- package/src/runtime-mcp/tool-bridge.ts +71 -0
- package/src/runtime-mcp/transports/http.ts +108 -25
- package/src/sdk/acp/adapter.ts +27 -8
- package/src/sdk/broker/broker.ts +378 -52
- package/src/sdk/broker/identity.ts +9 -1
- package/src/sdk/broker/lifecycle-ledger.ts +95 -31
- package/src/sdk/broker/lifecycle.ts +690 -141
- package/src/sdk/broker/runtime.ts +1 -1
- package/src/sdk/broker/session-index.ts +97 -4
- package/src/sdk/broker/spawn-authority.ts +35 -7
- package/src/sdk/broker/stderr-drainer.ts +59 -0
- package/src/sdk/bus/chat-daemon-control.ts +2 -2
- package/src/sdk/bus/chat-daemon-runtime.ts +1 -0
- package/src/sdk/bus/index.ts +690 -80
- package/src/sdk/bus/telegram-daemon-cli.ts +31 -2
- package/src/sdk/bus/telegram-daemon-contract.ts +3 -1
- package/src/sdk/bus/telegram-daemon.ts +10 -3
- package/src/sdk/cli/master-cli.ts +47 -36
- package/src/sdk/cli/rows.ts +30 -7
- package/src/sdk/cli/session-cli.ts +687 -184
- package/src/sdk/client/client.ts +18 -0
- package/src/sdk/guides/catalog.ts +2 -2
- package/src/sdk/guides/cli.ts +20 -62
- package/src/sdk/guides/verify.ts +14 -0
- package/src/sdk/host/host.ts +49 -5
- package/src/sdk/host/session-runtime.test.ts +138 -2
- package/src/sdk/host/session-runtime.ts +311 -97
- package/src/sdk/host/types.ts +12 -1
- package/src/sdk/host/websocket-transport.lifecycle.test.ts +84 -0
- package/src/sdk/host/websocket-transport.ts +40 -6
- package/src/sdk/index.ts +11 -0
- package/src/sdk/prompt-deadline-flush.ts +334 -0
- package/src/sdk/prompt-deadline-manager.ts +133 -1
- package/src/sdk/prompt-tool-boundary.ts +121 -0
- package/src/sdk/protocol/operation-inventory.generated.json +106 -0
- package/src/sdk/router/session-router.ts +9 -1
- package/src/sdk/session.ts +182 -7
- package/src/sdk/startup-capability.ts +1 -1
- package/src/sdk/transport/relay.ts +71 -6
- package/src/sdk/transport/serve-cli.ts +397 -42
- package/src/sdk/transport/socket.ts +12 -11
- package/src/sdk/transport/stdio.ts +7 -3
- package/src/session/agent-session.ts +2437 -400
- package/src/session/fallback-chain-controller.ts +6 -7
- package/src/session/fold-coordinator.ts +24 -5
- package/src/session/internal/managed-session-scope.ts +58 -18
- package/src/session/internal/managed-session-storage.ts +304 -11
- package/src/session/session-manager.ts +382 -44
- package/src/session/session-work-lease.ts +34 -0
- package/src/setup/model-onboarding-guidance.ts +1 -1
- package/src/setup/provider-onboarding.ts +397 -24
- package/src/slash-commands/builtin-registry.ts +258 -14
- package/src/task/index.ts +14 -2
- package/src/tools/bash.ts +98 -78
- package/src/tools/fetch.ts +119 -20
- package/src/tools/job.ts +151 -25
- package/src/tools/output-meta.ts +15 -2
- package/src/tools/path-utils.ts +27 -3
- package/src/tools/read.ts +3 -3
- package/src/tools/steer-fold.ts +107 -0
- package/src/tools/tool-catalog.generated.ts +29 -2
- package/src/tools/tool-errors.ts +4 -0
- package/src/utils/git.ts +53 -3
- package/src/utils/markit.ts +55 -41
- package/src/utils/mupdf-assets.d.ts +4 -0
- package/src/utils/mupdf-embedded.ts +4 -0
- package/src/utils/mupdf.ts +129 -0
- package/src/utils/session-title-generation.ts +29 -0
- package/src/utils/title-generator.ts +46 -2
- package/src/web/scrapers/types.ts +24 -3
- package/vendor/markit-ai/LICENSE +21 -0
- package/vendor/markit-ai/MANIFEST.json +412 -0
- package/vendor/markit-ai/dist/commands/config.d.ts +4 -0
- package/vendor/markit-ai/dist/commands/config.js +139 -0
- package/vendor/markit-ai/dist/commands/convert.d.ts +6 -0
- package/vendor/markit-ai/dist/commands/convert.js +113 -0
- package/vendor/markit-ai/dist/commands/formats.d.ts +2 -0
- package/vendor/markit-ai/dist/commands/formats.js +92 -0
- package/vendor/markit-ai/dist/commands/init.d.ts +2 -0
- package/vendor/markit-ai/dist/commands/init.js +29 -0
- package/vendor/markit-ai/dist/commands/onboard.d.ts +2 -0
- package/vendor/markit-ai/dist/commands/onboard.js +61 -0
- package/vendor/markit-ai/dist/commands/plugin.d.ts +4 -0
- package/vendor/markit-ai/dist/commands/plugin.js +58 -0
- package/vendor/markit-ai/dist/config.d.ts +26 -0
- package/vendor/markit-ai/dist/config.js +42 -0
- package/vendor/markit-ai/dist/converters/audio.d.ts +7 -0
- package/vendor/markit-ai/dist/converters/audio.js +104 -0
- package/vendor/markit-ai/dist/converters/csv.d.ts +7 -0
- package/vendor/markit-ai/dist/converters/csv.js +83 -0
- package/vendor/markit-ai/dist/converters/docx.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/docx.js +57 -0
- package/vendor/markit-ai/dist/converters/epub.d.ts +8 -0
- package/vendor/markit-ai/dist/converters/epub.js +128 -0
- package/vendor/markit-ai/dist/converters/github.d.ts +18 -0
- package/vendor/markit-ai/dist/converters/github.js +148 -0
- package/vendor/markit-ai/dist/converters/html.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/html.js +30 -0
- package/vendor/markit-ai/dist/converters/image.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/image.js +124 -0
- package/vendor/markit-ai/dist/converters/ipynb.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/ipynb.js +75 -0
- package/vendor/markit-ai/dist/converters/iwork.d.ts +20 -0
- package/vendor/markit-ai/dist/converters/iwork.js +391 -0
- package/vendor/markit-ai/dist/converters/json.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/json.js +21 -0
- package/vendor/markit-ai/dist/converters/pdf/columns.d.ts +35 -0
- package/vendor/markit-ai/dist/converters/pdf/columns.js +93 -0
- package/vendor/markit-ai/dist/converters/pdf/extract.d.ts +19 -0
- package/vendor/markit-ai/dist/converters/pdf/extract.js +514 -0
- package/vendor/markit-ai/dist/converters/pdf/grid.d.ts +25 -0
- package/vendor/markit-ai/dist/converters/pdf/grid.js +795 -0
- package/vendor/markit-ai/dist/converters/pdf/headers.d.ts +24 -0
- package/vendor/markit-ai/dist/converters/pdf/headers.js +108 -0
- package/vendor/markit-ai/dist/converters/pdf/index.d.ts +19 -0
- package/vendor/markit-ai/dist/converters/pdf/index.js +136 -0
- package/vendor/markit-ai/dist/converters/pdf/mupdf-loader.js +9 -0
- package/vendor/markit-ai/dist/converters/pdf/render.d.ts +24 -0
- package/vendor/markit-ai/dist/converters/pdf/render.js +513 -0
- package/vendor/markit-ai/dist/converters/pdf/types.d.ts +75 -0
- package/vendor/markit-ai/dist/converters/pdf/types.js +1 -0
- package/vendor/markit-ai/dist/converters/plain-text.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/plain-text.js +87 -0
- package/vendor/markit-ai/dist/converters/pptx.d.ts +8 -0
- package/vendor/markit-ai/dist/converters/pptx.js +289 -0
- package/vendor/markit-ai/dist/converters/rss.d.ts +11 -0
- package/vendor/markit-ai/dist/converters/rss.js +138 -0
- package/vendor/markit-ai/dist/converters/wikipedia.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/wikipedia.js +33 -0
- package/vendor/markit-ai/dist/converters/xlsx.d.ts +8 -0
- package/vendor/markit-ai/dist/converters/xlsx.js +147 -0
- package/vendor/markit-ai/dist/converters/xml.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/xml.js +18 -0
- package/vendor/markit-ai/dist/converters/yaml.d.ts +6 -0
- package/vendor/markit-ai/dist/converters/yaml.js +17 -0
- package/vendor/markit-ai/dist/converters/zip.d.ts +8 -0
- package/vendor/markit-ai/dist/converters/zip.js +57 -0
- package/vendor/markit-ai/dist/index.d.ts +30 -0
- package/vendor/markit-ai/dist/index.js +26 -0
- package/vendor/markit-ai/dist/main.d.ts +2 -0
- package/vendor/markit-ai/dist/main.js +191 -0
- package/vendor/markit-ai/dist/markit.d.ts +45 -0
- package/vendor/markit-ai/dist/markit.js +267 -0
- package/vendor/markit-ai/dist/plugins/api.d.ts +7 -0
- package/vendor/markit-ai/dist/plugins/api.js +42 -0
- package/vendor/markit-ai/dist/plugins/index.d.ts +4 -0
- package/vendor/markit-ai/dist/plugins/index.js +3 -0
- package/vendor/markit-ai/dist/plugins/installer.d.ts +25 -0
- package/vendor/markit-ai/dist/plugins/installer.js +176 -0
- package/vendor/markit-ai/dist/plugins/loader.d.ts +6 -0
- package/vendor/markit-ai/dist/plugins/loader.js +61 -0
- package/vendor/markit-ai/dist/plugins/types.d.ts +25 -0
- package/vendor/markit-ai/dist/plugins/types.js +1 -0
- package/vendor/markit-ai/dist/providers/anthropic.d.ts +2 -0
- package/vendor/markit-ai/dist/providers/anthropic.js +47 -0
- package/vendor/markit-ai/dist/providers/index.d.ts +21 -0
- package/vendor/markit-ai/dist/providers/index.js +56 -0
- package/vendor/markit-ai/dist/providers/openai.d.ts +2 -0
- package/vendor/markit-ai/dist/providers/openai.js +76 -0
- package/vendor/markit-ai/dist/providers/types.d.ts +26 -0
- package/vendor/markit-ai/dist/providers/types.js +1 -0
- package/vendor/markit-ai/dist/types.d.ts +36 -0
- package/vendor/markit-ai/dist/types.js +1 -0
- package/vendor/markit-ai/dist/utils/exit-codes.d.ts +4 -0
- package/vendor/markit-ai/dist/utils/exit-codes.js +4 -0
- package/vendor/markit-ai/dist/utils/output.d.ts +22 -0
- package/vendor/markit-ai/dist/utils/output.js +31 -0
- package/vendor/markit-ai/dist/utils/turndown.d.ts +8 -0
- package/vendor/markit-ai/dist/utils/turndown.js +70 -0
- package/vendor/markit-ai/package.json +74 -0
- package/vendor/markit-ai.patch +49 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
import type { ArgDescriptor, FlagDescriptor } from "@gajae-code/utils/cli";
|
|
2
|
+
import { DAEMON_ACTION_TOKENS, resolveDaemonAction } from "../daemon/operator-contract";
|
|
3
|
+
import { OPERATIONS, type Operation, type OperationKind } from "../sdk/protocol/operation-registry";
|
|
4
|
+
|
|
5
|
+
export const PUBLIC_HELP_SECTIONS = [
|
|
6
|
+
"overview",
|
|
7
|
+
"usage",
|
|
8
|
+
"children",
|
|
9
|
+
"arguments",
|
|
10
|
+
"options",
|
|
11
|
+
"examples",
|
|
12
|
+
"recovery",
|
|
13
|
+
] as const;
|
|
14
|
+
export type PublicHelpSection = (typeof PUBLIC_HELP_SECTIONS)[number];
|
|
15
|
+
export type PublicCommandFamily = "sdk" | "daemon";
|
|
16
|
+
export type PublicDisruption = "none" | "interrupts-work" | "force-kill";
|
|
17
|
+
export interface PublicRecovery {
|
|
18
|
+
description: string;
|
|
19
|
+
disruption: PublicDisruption;
|
|
20
|
+
requiresConfirmation: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface PublicFlagDescriptor extends FlagDescriptor {
|
|
23
|
+
description: string;
|
|
24
|
+
/** Boundary options are stripped before operation parsing. */
|
|
25
|
+
boundary?: "help" | "mode" | "retrieval";
|
|
26
|
+
conflicts?: readonly string[];
|
|
27
|
+
requires?: readonly string[];
|
|
28
|
+
risk?: string;
|
|
29
|
+
validation?: "positive-safe-integer" | "sha256" | "error-id" | "search-limit" | "pending-ceiling";
|
|
30
|
+
/** Serve's existing operation parser accepts separate operands only. */
|
|
31
|
+
valueSyntax?: "separate" | "separate-or-equals";
|
|
32
|
+
}
|
|
33
|
+
export interface PublicArgumentDescriptor extends ArgDescriptor {
|
|
34
|
+
description: string;
|
|
35
|
+
}
|
|
36
|
+
export interface PublicCommandDescriptor {
|
|
37
|
+
command: readonly string[];
|
|
38
|
+
canonicalCommand: readonly string[];
|
|
39
|
+
parent: readonly string[] | null;
|
|
40
|
+
description: string;
|
|
41
|
+
/** Effective local grammar, not a union of sibling options. Keys have no leading --. */
|
|
42
|
+
flags: Readonly<Record<string, PublicFlagDescriptor>>;
|
|
43
|
+
/** Insertion order is positional order; child tokens are not arguments. */
|
|
44
|
+
args: Readonly<Record<string, PublicArgumentDescriptor>>;
|
|
45
|
+
children: readonly string[];
|
|
46
|
+
usage: readonly { syntax: string; executable: false }[];
|
|
47
|
+
examples: readonly { syntax: string; executable: false }[];
|
|
48
|
+
recovery: readonly PublicRecovery[];
|
|
49
|
+
risk?: string;
|
|
50
|
+
defaultChild?: string;
|
|
51
|
+
exactlyOneOf?: readonly (readonly string[])[];
|
|
52
|
+
/** Semantic conditions remain runtime-owned (e.g. proof-bound retirement). */
|
|
53
|
+
constraints: readonly string[];
|
|
54
|
+
operationKind?: Exclude<OperationKind, "reverse">;
|
|
55
|
+
}
|
|
56
|
+
export interface PublicCommandResolution {
|
|
57
|
+
descriptor: PublicCommandDescriptor;
|
|
58
|
+
/** Number of path tokens consumed, including the family. No argv scanning is performed. */
|
|
59
|
+
consumed: number;
|
|
60
|
+
remaining: readonly string[];
|
|
61
|
+
exact: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const stringFlag = (description: string, extra: Partial<PublicFlagDescriptor> = {}): PublicFlagDescriptor => ({
|
|
65
|
+
kind: "string",
|
|
66
|
+
description,
|
|
67
|
+
valueSyntax: "separate-or-equals",
|
|
68
|
+
...extra,
|
|
69
|
+
});
|
|
70
|
+
const booleanFlag = (description: string, extra: Partial<PublicFlagDescriptor> = {}): PublicFlagDescriptor => ({
|
|
71
|
+
kind: "boolean",
|
|
72
|
+
description,
|
|
73
|
+
...extra,
|
|
74
|
+
});
|
|
75
|
+
const positive = (description: string): PublicFlagDescriptor =>
|
|
76
|
+
stringFlag(description, { validation: "positive-safe-integer" });
|
|
77
|
+
const argument = (description: string, extra: Partial<PublicArgumentDescriptor> = {}): PublicArgumentDescriptor => ({
|
|
78
|
+
kind: "string",
|
|
79
|
+
description,
|
|
80
|
+
required: true,
|
|
81
|
+
...extra,
|
|
82
|
+
});
|
|
83
|
+
const agentDir = stringFlag("SDK broker/state directory (default: the configured agent directory).");
|
|
84
|
+
const repo = stringFlag("Workspace directory for scope or saved-session resolution (default: current directory).");
|
|
85
|
+
const timeout = positive("Request or live-follow timeout in milliseconds; send uses this for its --wait window.");
|
|
86
|
+
const idempotency = stringFlag(
|
|
87
|
+
"Caller idempotency key; retain it when reconciling an uncertain mutation, never blindly replay.",
|
|
88
|
+
);
|
|
89
|
+
const jsonNames = ["json-input", "json-input-file", "json-input-stdin"];
|
|
90
|
+
const jsonInput: Record<string, PublicFlagDescriptor> = {
|
|
91
|
+
"json-input": stringFlag("Request JSON object; secret values must instead use the secure file or stdin source.", {
|
|
92
|
+
conflicts: jsonNames.slice(1),
|
|
93
|
+
}),
|
|
94
|
+
"json-input-file": stringFlag("Read a request JSON object from a regular 0600 file.", {
|
|
95
|
+
conflicts: ["json-input", "json-input-stdin"],
|
|
96
|
+
}),
|
|
97
|
+
"json-input-stdin": booleanFlag("Read a request JSON object from standard input.", {
|
|
98
|
+
conflicts: jsonNames.slice(0, 2),
|
|
99
|
+
}),
|
|
100
|
+
};
|
|
101
|
+
export const PUBLIC_BOUNDARY_FLAGS: Readonly<Record<string, PublicFlagDescriptor>> = {
|
|
102
|
+
help: booleanFlag("Show inert command-local help; no operation is executed.", { char: "h", boundary: "help" }),
|
|
103
|
+
json: booleanFlag("Use JSON for help and ordinary failures; existing successful output contracts are unchanged.", {
|
|
104
|
+
boundary: "mode",
|
|
105
|
+
}),
|
|
106
|
+
"help-section": stringFlag("Select a static help section.", {
|
|
107
|
+
boundary: "help",
|
|
108
|
+
options: PUBLIC_HELP_SECTIONS,
|
|
109
|
+
default: "overview",
|
|
110
|
+
requires: ["help"],
|
|
111
|
+
}),
|
|
112
|
+
"help-page": stringFlag("Select a positive decimal help page.", {
|
|
113
|
+
boundary: "help",
|
|
114
|
+
validation: "positive-safe-integer",
|
|
115
|
+
default: "1",
|
|
116
|
+
requires: ["help"],
|
|
117
|
+
}),
|
|
118
|
+
"help-revision": stringFlag("Pin help traversal to a descriptor SHA256 revision.", {
|
|
119
|
+
boundary: "help",
|
|
120
|
+
validation: "sha256",
|
|
121
|
+
requires: ["help"],
|
|
122
|
+
}),
|
|
123
|
+
};
|
|
124
|
+
export const PUBLIC_RETRIEVAL_FLAGS: Readonly<Record<string, PublicFlagDescriptor>> = {
|
|
125
|
+
"error-ref": stringFlag(
|
|
126
|
+
"Retrieve retained sanitized error evidence by 32-character lowercase hex ID; available only within its 24-hour retention lifetime.",
|
|
127
|
+
{ boundary: "retrieval", validation: "error-id", requires: ["error-sha256"], conflicts: ["help"] },
|
|
128
|
+
),
|
|
129
|
+
"error-sha256": stringFlag("Verify the retained record's 64-character lowercase SHA256 digest.", {
|
|
130
|
+
boundary: "retrieval",
|
|
131
|
+
validation: "sha256",
|
|
132
|
+
requires: ["error-ref"],
|
|
133
|
+
conflicts: ["help"],
|
|
134
|
+
}),
|
|
135
|
+
"error-page": stringFlag("Retrieve a positive decimal evidence page without replaying the original operation.", {
|
|
136
|
+
boundary: "retrieval",
|
|
137
|
+
validation: "positive-safe-integer",
|
|
138
|
+
default: "1",
|
|
139
|
+
requires: ["error-ref", "error-sha256"],
|
|
140
|
+
}),
|
|
141
|
+
"error-agent-dir": stringFlag("Use only this evidence-store agent directory; never search alternative roots.", {
|
|
142
|
+
boundary: "retrieval",
|
|
143
|
+
requires: ["error-ref", "error-sha256"],
|
|
144
|
+
}),
|
|
145
|
+
};
|
|
146
|
+
const safeRecovery: PublicRecovery[] = [
|
|
147
|
+
{
|
|
148
|
+
description:
|
|
149
|
+
"Use command-local --help to correct syntax. After an uncertain mutation, preserve complete references and reconcile before retrying; no recovery is executed automatically.",
|
|
150
|
+
disruption: "none",
|
|
151
|
+
requiresConfirmation: false,
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
const mutationRecovery: PublicRecovery[] = [
|
|
155
|
+
...safeRecovery,
|
|
156
|
+
{
|
|
157
|
+
description:
|
|
158
|
+
"Confirm the target and inspect available outcome evidence before any disruptive recovery. Retirement requires actual dead-host proof and is not a status query.",
|
|
159
|
+
disruption: "interrupts-work",
|
|
160
|
+
requiresConfirmation: true,
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
const sessionArg = { sessionId: argument("Exact SDK session ID.") };
|
|
164
|
+
|
|
165
|
+
type NodeInput = Pick<PublicCommandDescriptor, "description"> &
|
|
166
|
+
Partial<Omit<PublicCommandDescriptor, "command" | "parent" | "description" | "usage" | "examples">> & {
|
|
167
|
+
syntax?: string;
|
|
168
|
+
example?: string;
|
|
169
|
+
};
|
|
170
|
+
function node(path: string, input: NodeInput): PublicCommandDescriptor {
|
|
171
|
+
const command = path.split(" ");
|
|
172
|
+
const { syntax, example, ...metadata } = input;
|
|
173
|
+
return {
|
|
174
|
+
command,
|
|
175
|
+
canonicalCommand: command,
|
|
176
|
+
parent: command.length === 1 ? null : command.slice(0, -1),
|
|
177
|
+
args: {},
|
|
178
|
+
children: [],
|
|
179
|
+
constraints: [],
|
|
180
|
+
recovery: safeRecovery,
|
|
181
|
+
...metadata,
|
|
182
|
+
flags: { ...PUBLIC_BOUNDARY_FLAGS, ...(command.length === 1 ? PUBLIC_RETRIEVAL_FLAGS : {}), ...input.flags },
|
|
183
|
+
usage: [{ syntax: `gjc ${path}${syntax ? ` ${syntax}` : ""}`, executable: false }],
|
|
184
|
+
examples: [{ syntax: example ?? `gjc ${path} --help --json`, executable: false }],
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const sessionFlags = { "agent-dir": agentDir };
|
|
188
|
+
const observeDaemonFlags = {
|
|
189
|
+
all: booleanFlag("Target all registered daemon kinds."),
|
|
190
|
+
verbose: booleanFlag("Show runtime detail and the full roots list.", { char: "v" }),
|
|
191
|
+
};
|
|
192
|
+
const daemonRisk =
|
|
193
|
+
"Stopping or restarting interrupts daemon work; --force permits SIGKILL escalation and can lose in-flight work.";
|
|
194
|
+
const mutateDaemonFlags = {
|
|
195
|
+
all: observeDaemonFlags.all,
|
|
196
|
+
force: booleanFlag("Allow SIGKILL escalation after graceful stop times out.", { risk: daemonRisk }),
|
|
197
|
+
"graceful-timeout-ms": positive("Cooperative stop timeout before escalation."),
|
|
198
|
+
"kill-timeout-ms": positive("Wait for old PID death after SIGKILL."),
|
|
199
|
+
};
|
|
200
|
+
const daemonArgs = {
|
|
201
|
+
kind: argument("Daemon kinds (default: telegram); these are not SDK broker kinds.", {
|
|
202
|
+
required: false,
|
|
203
|
+
multiple: true,
|
|
204
|
+
options: ["telegram", "discord", "slack"],
|
|
205
|
+
}),
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/** Static descriptors only: no settings, theme, broker, transport, filesystem or process initialization. */
|
|
209
|
+
export const PUBLIC_COMMANDS: readonly PublicCommandDescriptor[] = [
|
|
210
|
+
node("sdk", {
|
|
211
|
+
description: "Discover SDK transports, sessions, search, spawn and advisory guides.",
|
|
212
|
+
children: ["serve", "search", "spawn", "session", "guides"],
|
|
213
|
+
syntax: "<command>",
|
|
214
|
+
constraints: [
|
|
215
|
+
"A public child command is required unless requesting help or root evidence retrieval.",
|
|
216
|
+
"Evidence retrieval is exclusive with help, operation arguments and operation flags; duplicate selectors are invalid.",
|
|
217
|
+
],
|
|
218
|
+
}),
|
|
219
|
+
node("sdk serve", {
|
|
220
|
+
description: "Relay SDK frames over stdio or a Unix socket.",
|
|
221
|
+
syntax: "(--stdio | --socket <path>) [--session <id>] [--pending-ceiling <bytes>]",
|
|
222
|
+
flags: {
|
|
223
|
+
stdio: booleanFlag("Serve frames over standard input/output.", { conflicts: ["socket"] }),
|
|
224
|
+
socket: stringFlag("Unix socket path (unavailable on Windows).", {
|
|
225
|
+
conflicts: ["stdio"],
|
|
226
|
+
valueSyntax: "separate",
|
|
227
|
+
}),
|
|
228
|
+
session: stringFlag("Attach to a specific live SDK session.", { valueSyntax: "separate" }),
|
|
229
|
+
"pending-ceiling": stringFlag(
|
|
230
|
+
"Queued relay bytes per direction; minimum 262144. Flag overrides GJC_SDK_SERVE_PENDING_CEILING_BYTES, otherwise 8388608.",
|
|
231
|
+
{ validation: "pending-ceiling", valueSyntax: "separate" },
|
|
232
|
+
),
|
|
233
|
+
},
|
|
234
|
+
exactlyOneOf: [["stdio", "socket"]],
|
|
235
|
+
constraints: [
|
|
236
|
+
"Operation flags may occur only once and use separate operands.",
|
|
237
|
+
"Without --session exactly one live session must be available.",
|
|
238
|
+
"After relay ownership, protocol frames retain their existing contract; --json controls only preflight failures.",
|
|
239
|
+
],
|
|
240
|
+
example: "gjc sdk serve --stdio",
|
|
241
|
+
}),
|
|
242
|
+
node("sdk search", {
|
|
243
|
+
description: "Search broker-visible sessions in an exact repo, pwd or global scope.",
|
|
244
|
+
syntax: "[--scope repo|pwd|global] [--repo <dir>] [--limit <N>] [--cursor <cursor>]",
|
|
245
|
+
flags: {
|
|
246
|
+
...sessionFlags,
|
|
247
|
+
repo,
|
|
248
|
+
scope: stringFlag("Exact search scope.", { options: ["repo", "pwd", "global"], default: "repo" }),
|
|
249
|
+
limit: { kind: "integer", description: "Search page size, 1 through 100.", validation: "search-limit" },
|
|
250
|
+
cursor: stringFlag("Frozen scoped search continuation cursor."),
|
|
251
|
+
json: booleanFlag("Render the SdkSearchResultV1 success envelope and JSON failures.", { boundary: "mode" }),
|
|
252
|
+
},
|
|
253
|
+
constraints: ["Not-in-git-worktree is a successful search result, not an unavailable error."],
|
|
254
|
+
example: "gjc sdk search --scope repo --json",
|
|
255
|
+
}),
|
|
256
|
+
node("sdk spawn", {
|
|
257
|
+
description: "Spawn a task-seeded background child from a live local interactive master.",
|
|
258
|
+
syntax: "--cwd <dir> --prompt <task> [--model <selector>] [--profile <name>]",
|
|
259
|
+
flags: {
|
|
260
|
+
...sessionFlags,
|
|
261
|
+
cwd: stringFlag("Child working directory.", { required: true }),
|
|
262
|
+
prompt: stringFlag("Seed task delivered once to the child.", { required: true }),
|
|
263
|
+
model: stringFlag("Child model selector."),
|
|
264
|
+
profile: stringFlag("Child model profile."),
|
|
265
|
+
"idempotency-key": idempotency,
|
|
266
|
+
json: booleanFlag("Render the safe spawn result and ordinary failures as JSON.", { boundary: "mode" }),
|
|
267
|
+
},
|
|
268
|
+
risk: "Creates background work; an uncertain spawn may already have created a child.",
|
|
269
|
+
recovery: mutationRecovery,
|
|
270
|
+
constraints: [
|
|
271
|
+
"Requires a live local interactive master capability and current master attestation.",
|
|
272
|
+
"Do not expose master credentials; preserve the idempotency key and returned references before considering replay.",
|
|
273
|
+
],
|
|
274
|
+
}),
|
|
275
|
+
node("sdk session", {
|
|
276
|
+
description: "Manage broker-bound credential-free sessions.",
|
|
277
|
+
children: ["list", "inspect", "send", "status", "tail", "retire", "raw"],
|
|
278
|
+
syntax: "<command>",
|
|
279
|
+
}),
|
|
280
|
+
node("sdk session list", {
|
|
281
|
+
description: "List sessions within the selected workspace scope.",
|
|
282
|
+
flags: {
|
|
283
|
+
...sessionFlags,
|
|
284
|
+
repo,
|
|
285
|
+
scope: stringFlag("Session list scope; all ignores workspace selection.", {
|
|
286
|
+
options: ["repo", "cwd", "worktree", "all"],
|
|
287
|
+
default: "repo",
|
|
288
|
+
}),
|
|
289
|
+
},
|
|
290
|
+
syntax: "[--scope repo|cwd|worktree|all] [--repo <dir>]",
|
|
291
|
+
constraints: ["repo/worktree outside Git fail; they never silently broaden to all."],
|
|
292
|
+
example: "gjc sdk session list --scope cwd",
|
|
293
|
+
}),
|
|
294
|
+
node("sdk session inspect", {
|
|
295
|
+
description: "Inspect a session without exposing endpoint credentials.",
|
|
296
|
+
args: sessionArg,
|
|
297
|
+
flags: sessionFlags,
|
|
298
|
+
syntax: "<sessionId>",
|
|
299
|
+
}),
|
|
300
|
+
node("sdk session send", {
|
|
301
|
+
description: "Submit a prompt with a durable operation reference; optionally await its result.",
|
|
302
|
+
args: sessionArg,
|
|
303
|
+
flags: {
|
|
304
|
+
...sessionFlags,
|
|
305
|
+
...jsonInput,
|
|
306
|
+
text: stringFlag("Prompt text, alternative to nonempty JSON input."),
|
|
307
|
+
"op-ref": stringFlag(
|
|
308
|
+
"Prompt clientRef (default: generated ULID); must match JSON clientRef when both are supplied.",
|
|
309
|
+
),
|
|
310
|
+
wait: booleanFlag("Poll turn.result kind=prompt until terminal or the wait window expires."),
|
|
311
|
+
"timeout-ms": timeout,
|
|
312
|
+
},
|
|
313
|
+
syntax:
|
|
314
|
+
"<sessionId> (--text <prompt> | --json-input <object> | --json-input-file <file> | --json-input-stdin) [--wait]",
|
|
315
|
+
constraints: [
|
|
316
|
+
"Prompt text is required, either directly or in the JSON object.",
|
|
317
|
+
"--text conflicts with a nonempty JSON object, not an empty object.",
|
|
318
|
+
"--timeout-ms affects --wait only (default wait window: 30000ms).",
|
|
319
|
+
"JSON input sources are mutually exclusive.",
|
|
320
|
+
],
|
|
321
|
+
risk: "Submits agent work; a wait timeout after acceptance is not permission to submit again.",
|
|
322
|
+
recovery: mutationRecovery,
|
|
323
|
+
}),
|
|
324
|
+
node("sdk session status", {
|
|
325
|
+
description: "Read the durable prompt result for a known operation reference.",
|
|
326
|
+
args: { ...sessionArg, opRef: argument("Exact operation reference returned or supplied by send.") },
|
|
327
|
+
flags: { ...sessionFlags, "timeout-ms": timeout },
|
|
328
|
+
syntax: "<sessionId> <opRef>",
|
|
329
|
+
}),
|
|
330
|
+
node("sdk session tail", {
|
|
331
|
+
description: "Read retained history and follow live session events into one accumulated result.",
|
|
332
|
+
args: sessionArg,
|
|
333
|
+
flags: {
|
|
334
|
+
...sessionFlags,
|
|
335
|
+
repo,
|
|
336
|
+
cursor: stringFlag("Saved checkpoint token for continuation."),
|
|
337
|
+
"after-transcript-id": stringFlag(
|
|
338
|
+
"Transcript row boundary for resumed tails; omit rows through this id when --cursor is supplied.",
|
|
339
|
+
),
|
|
340
|
+
strict: booleanFlag("Fail closed on retention gaps."),
|
|
341
|
+
"until-idle": booleanFlag("Exit after an observed terminal turn state."),
|
|
342
|
+
"all-events": booleanFlag("Include every event-ring kind."),
|
|
343
|
+
"timeout-ms": timeout,
|
|
344
|
+
},
|
|
345
|
+
syntax: "<sessionId> [--cursor <checkpoint>] [--strict] [--until-idle]",
|
|
346
|
+
constraints: ["Live follow defaults to 10000ms; saved-session resolution uses --repo."],
|
|
347
|
+
}),
|
|
348
|
+
node("sdk session retire", {
|
|
349
|
+
description: "Retire an indexed terminalUncertain create effect using actual dead-host proof.",
|
|
350
|
+
args: sessionArg,
|
|
351
|
+
flags: { ...sessionFlags, ...jsonInput, "idempotency-key": { ...idempotency, required: true } },
|
|
352
|
+
syntax: "<sessionId> --idempotency-key <key> [--json-input-file <proof-file>]",
|
|
353
|
+
risk: "Proof-bound lifecycle mutation, not read-only reconciliation or status. Confirm intent before execution.",
|
|
354
|
+
recovery: mutationRecovery,
|
|
355
|
+
constraints: [
|
|
356
|
+
"Runs session.reconcile_uncertain with the selected sessionId; any JSON sessionId must match.",
|
|
357
|
+
"The lifecycle service validates the complete dead-host proof. No --confirm flag is required by the existing retirement grammar.",
|
|
358
|
+
"JSON input sources are mutually exclusive.",
|
|
359
|
+
],
|
|
360
|
+
}),
|
|
361
|
+
node("sdk session raw", {
|
|
362
|
+
description: "Explicit raw control, query and global operation hatch.",
|
|
363
|
+
children: ["control", "query", "global"],
|
|
364
|
+
syntax: "<control|query|global>",
|
|
365
|
+
constraints: ["Operation IDs are option values, never child command paths."],
|
|
366
|
+
}),
|
|
367
|
+
node("sdk session raw control", {
|
|
368
|
+
description: "Submit a permitted session control operation.",
|
|
369
|
+
args: sessionArg,
|
|
370
|
+
operationKind: "control",
|
|
371
|
+
flags: {
|
|
372
|
+
...sessionFlags,
|
|
373
|
+
...jsonInput,
|
|
374
|
+
op: stringFlag("Control operation ID; adapter dispositions restrict availability.", { required: true }),
|
|
375
|
+
confirm: booleanFlag("Confirm a destructive local control; terminal abort requires confirmation.", {
|
|
376
|
+
risk: "May interrupt or replace active work.",
|
|
377
|
+
}),
|
|
378
|
+
"idempotency-key": idempotency,
|
|
379
|
+
"timeout-ms": timeout,
|
|
380
|
+
},
|
|
381
|
+
syntax: "<sessionId> --op <operation> [--json-input <object>]",
|
|
382
|
+
risk: "Controls can mutate or interrupt work; terminal turn.abort requires --confirm and --idempotency-key.",
|
|
383
|
+
recovery: mutationRecovery,
|
|
384
|
+
constraints: [
|
|
385
|
+
"JSON input sources are mutually exclusive.",
|
|
386
|
+
"Terminal abort scope must be turn or owned and uses the operator abort path.",
|
|
387
|
+
],
|
|
388
|
+
}),
|
|
389
|
+
node("sdk session raw query", {
|
|
390
|
+
description: "Read a permitted session query with an optional continuation cursor.",
|
|
391
|
+
args: sessionArg,
|
|
392
|
+
operationKind: "query",
|
|
393
|
+
flags: {
|
|
394
|
+
...sessionFlags,
|
|
395
|
+
...jsonInput,
|
|
396
|
+
query: stringFlag("Query ID (including registered query aliases).", { required: true }),
|
|
397
|
+
cursor: stringFlag("Raw query continuation cursor."),
|
|
398
|
+
"timeout-ms": timeout,
|
|
399
|
+
},
|
|
400
|
+
syntax: "<sessionId> --query <query> [--cursor <cursor>]",
|
|
401
|
+
constraints: ["JSON input sources are mutually exclusive."],
|
|
402
|
+
}),
|
|
403
|
+
node("sdk session raw global", {
|
|
404
|
+
description: "Run a permitted broker-global operation without a session positional.",
|
|
405
|
+
operationKind: "global",
|
|
406
|
+
flags: {
|
|
407
|
+
...sessionFlags,
|
|
408
|
+
...jsonInput,
|
|
409
|
+
op: stringFlag("Global operation ID; session.spawn and session.get_endpoint are unavailable here.", {
|
|
410
|
+
required: true,
|
|
411
|
+
}),
|
|
412
|
+
"idempotency-key": idempotency,
|
|
413
|
+
page: booleanFlag("Return exactly one broker session.list page instead of draining continuation pages."),
|
|
414
|
+
limit: {
|
|
415
|
+
kind: "integer",
|
|
416
|
+
description: "Raw session.list page size, 1 through 100.",
|
|
417
|
+
validation: "search-limit",
|
|
418
|
+
},
|
|
419
|
+
cursor: stringFlag("Raw session.list continuation cursor."),
|
|
420
|
+
},
|
|
421
|
+
syntax:
|
|
422
|
+
"--op <operation> [--json-input <object>] [--idempotency-key <key>] [--page] [--limit <N>] [--cursor <cursor>]",
|
|
423
|
+
risk: "Lifecycle globals can create, close, delete or retire sessions; inspect uncertain results before replay.",
|
|
424
|
+
recovery: mutationRecovery,
|
|
425
|
+
constraints: [
|
|
426
|
+
"Lifecycle mutations require --idempotency-key; session.list does not.",
|
|
427
|
+
"Lifecycle timeout is derived from operation input, not --timeout-ms.",
|
|
428
|
+
"JSON input sources are mutually exclusive.",
|
|
429
|
+
],
|
|
430
|
+
}),
|
|
431
|
+
node("sdk guides", {
|
|
432
|
+
description: "Manage verified advisory SDK guides.",
|
|
433
|
+
children: ["refresh", "list", "show", "status", "trust"],
|
|
434
|
+
syntax: "<command>",
|
|
435
|
+
}),
|
|
436
|
+
node("sdk guides refresh", {
|
|
437
|
+
description: "Fetch and verify an allowlisted HTTPS guide manifest and advisory cache.",
|
|
438
|
+
flags: {
|
|
439
|
+
...sessionFlags,
|
|
440
|
+
url: stringFlag("HTTPS allowlisted manifest URL.", { required: true }),
|
|
441
|
+
"timeout-ms": positive("Bounded refresh timeout in milliseconds."),
|
|
442
|
+
},
|
|
443
|
+
syntax: "--url <https-url> [--timeout-ms <N>]",
|
|
444
|
+
constraints: [
|
|
445
|
+
"A fallback cache or bundled selection is an operational refresh failure, not online refresh success.",
|
|
446
|
+
],
|
|
447
|
+
}),
|
|
448
|
+
node("sdk guides list", { description: "List guides from the verified advisory selection.", flags: sessionFlags }),
|
|
449
|
+
node("sdk guides show", {
|
|
450
|
+
description: "Read a verified guide by ID.",
|
|
451
|
+
args: { guideId: argument("Exact guide ID from guides list.") },
|
|
452
|
+
flags: sessionFlags,
|
|
453
|
+
syntax: "<guideId>",
|
|
454
|
+
}),
|
|
455
|
+
node("sdk guides status", { description: "Report guide cache and selection status.", flags: sessionFlags }),
|
|
456
|
+
node("sdk guides trust", { description: "Show the static guide trust policy; no refresh or cache mutation." }),
|
|
457
|
+
node("daemon", {
|
|
458
|
+
description: "Manage Telegram, Discord and Slack background daemons, not the SDK broker.",
|
|
459
|
+
children: DAEMON_ACTION_TOKENS,
|
|
460
|
+
defaultChild: "status",
|
|
461
|
+
args: daemonArgs,
|
|
462
|
+
flags: observeDaemonFlags,
|
|
463
|
+
syntax: "[status] [<kind>...] [--all]",
|
|
464
|
+
constraints: [
|
|
465
|
+
"No action defaults to status; no kind defaults to telegram.",
|
|
466
|
+
"Evidence retrieval is exclusive with help, operation arguments and operation flags; duplicate selectors are invalid.",
|
|
467
|
+
],
|
|
468
|
+
}),
|
|
469
|
+
...DAEMON_ACTION_TOKENS.map(action => {
|
|
470
|
+
const canonical = resolveDaemonAction(action)!;
|
|
471
|
+
const mutation = canonical === "stop" || canonical === "restart";
|
|
472
|
+
return node(`daemon ${action}`, {
|
|
473
|
+
description:
|
|
474
|
+
canonical === "restart"
|
|
475
|
+
? "Reload a running daemon, spawning an owner if none is running."
|
|
476
|
+
: canonical === "stop"
|
|
477
|
+
? "Stop selected daemon owners."
|
|
478
|
+
: "Read status for selected daemon kinds.",
|
|
479
|
+
canonicalCommand: ["daemon", canonical],
|
|
480
|
+
args: daemonArgs,
|
|
481
|
+
flags: mutation
|
|
482
|
+
? {
|
|
483
|
+
...mutateDaemonFlags,
|
|
484
|
+
...(canonical === "restart"
|
|
485
|
+
? {
|
|
486
|
+
"spawn-if-stopped": booleanFlag(
|
|
487
|
+
"Spawn on restart when no daemon is running (existing restart default).",
|
|
488
|
+
),
|
|
489
|
+
}
|
|
490
|
+
: {}),
|
|
491
|
+
}
|
|
492
|
+
: observeDaemonFlags,
|
|
493
|
+
syntax: "[<kind>...] [--all] [--json]",
|
|
494
|
+
risk: mutation ? daemonRisk : undefined,
|
|
495
|
+
recovery: mutation ? mutationRecovery : safeRecovery,
|
|
496
|
+
constraints: [
|
|
497
|
+
"Known kinds: telegram, discord, slack. No kind defaults to telegram; --all selects all registered kinds.",
|
|
498
|
+
...(action === "reload" ? ["reload is an alias of restart, not a distinct operation."] : []),
|
|
499
|
+
],
|
|
500
|
+
example: `gjc daemon ${action} telegram --json`,
|
|
501
|
+
});
|
|
502
|
+
}),
|
|
503
|
+
];
|
|
504
|
+
|
|
505
|
+
/** Exact full public path lookup; private workers and function-only verbs are absent. */
|
|
506
|
+
export function getPublicCommand(command: readonly string[]): PublicCommandDescriptor | undefined {
|
|
507
|
+
return PUBLIC_COMMANDS.find(
|
|
508
|
+
node => node.command.length === command.length && node.command.every((token, index) => token === command[index]),
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
export function getPublicCommandChildren(descriptor: PublicCommandDescriptor): readonly PublicCommandDescriptor[] {
|
|
512
|
+
return descriptor.children.map(token => getPublicCommand([...descriptor.command, token])!);
|
|
513
|
+
}
|
|
514
|
+
/** Resolve path tokens only. The entry scanner must first respect flag operands and --. */
|
|
515
|
+
export function resolvePublicCommand(tokens: readonly string[]): PublicCommandResolution | undefined {
|
|
516
|
+
let descriptor = getPublicCommand(tokens.slice(0, 1));
|
|
517
|
+
if (!descriptor) return undefined;
|
|
518
|
+
let consumed = 1;
|
|
519
|
+
while (consumed < tokens.length && descriptor.children.includes(tokens[consumed]!)) {
|
|
520
|
+
descriptor = getPublicCommand([...descriptor.command, tokens[consumed]!])!;
|
|
521
|
+
consumed++;
|
|
522
|
+
}
|
|
523
|
+
return { descriptor, consumed, remaining: tokens.slice(consumed), exact: consumed === tokens.length };
|
|
524
|
+
}
|
|
525
|
+
/** Operation metadata is reused, not promoted to command paths or usage-level enum rejection. */
|
|
526
|
+
export function getPublicRawOperations(kind: Exclude<OperationKind, "reverse">): readonly Operation[] {
|
|
527
|
+
return OPERATIONS.filter(
|
|
528
|
+
operation =>
|
|
529
|
+
operation.kind === kind &&
|
|
530
|
+
operation.adapterDispositions.daemonCli !== "prohibited" &&
|
|
531
|
+
operation.adapterDispositions.daemonCli !== "provider_only" &&
|
|
532
|
+
operation.sdkId !== "session.get_endpoint" &&
|
|
533
|
+
operation.sdkId !== "session.spawn",
|
|
534
|
+
);
|
|
535
|
+
}
|
|
@@ -17,7 +17,7 @@ export async function deleteSessionPickerCandidate(sessionPath: string, explicit
|
|
|
17
17
|
await new FileSessionStorage().deleteSessionWithArtifacts(target);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/** Show the
|
|
20
|
+
/** Show the session picker and return the user's resume consent intent. */
|
|
21
21
|
export async function selectSession(
|
|
22
22
|
sessions: SessionInfo[],
|
|
23
23
|
explicitSessionDir?: string,
|
|
@@ -43,6 +43,7 @@ export async function selectSession(
|
|
|
43
43
|
},
|
|
44
44
|
SessionManager.inspectSessionTailReadOnly,
|
|
45
45
|
settle,
|
|
46
|
+
(session, starred) => SessionManager.setSessionStarredForPicker(session, starred, explicitSessionDir),
|
|
46
47
|
);
|
|
47
48
|
selector.setOnRequestRender(() => ui.requestRender());
|
|
48
49
|
ui.addChild(selector);
|
package/src/cli/setup-cli.ts
CHANGED
|
@@ -69,6 +69,7 @@ export interface SetupCommandArgs {
|
|
|
69
69
|
baseUrl?: string;
|
|
70
70
|
apiKeyEnv?: string;
|
|
71
71
|
model?: string[];
|
|
72
|
+
discover?: boolean;
|
|
72
73
|
modelsPath?: string;
|
|
73
74
|
smoke?: boolean;
|
|
74
75
|
install?: boolean;
|
|
@@ -166,6 +167,7 @@ function hasProviderSetupFlags(flags: SetupCommandArgs["flags"]): boolean {
|
|
|
166
167
|
flags.baseUrl !== undefined ||
|
|
167
168
|
flags.apiKeyEnv !== undefined ||
|
|
168
169
|
flags.model !== undefined ||
|
|
170
|
+
flags.discover !== undefined ||
|
|
169
171
|
flags.modelsPath !== undefined
|
|
170
172
|
);
|
|
171
173
|
}
|
|
@@ -264,6 +266,8 @@ export function parseSetupArgs(args: string[]): SetupCommandArgs | undefined {
|
|
|
264
266
|
flags.apiKeyEnv = args[++i];
|
|
265
267
|
} else if (arg === "--model" || arg === "--models") {
|
|
266
268
|
flags.model = [...(flags.model ?? []), args[++i] ?? ""];
|
|
269
|
+
} else if (arg === "--discover") {
|
|
270
|
+
flags.discover = true;
|
|
267
271
|
} else if (arg === "--models-path") {
|
|
268
272
|
flags.modelsPath = args[++i];
|
|
269
273
|
} else if (arg === "--remove") {
|
|
@@ -425,6 +429,7 @@ async function handleProviderSetup(flags: {
|
|
|
425
429
|
apiKeyEnv?: string;
|
|
426
430
|
model?: string[];
|
|
427
431
|
modelsPath?: string;
|
|
432
|
+
discover?: boolean;
|
|
428
433
|
}): Promise<void> {
|
|
429
434
|
try {
|
|
430
435
|
const missing: string[] = [];
|
|
@@ -433,7 +438,7 @@ async function handleProviderSetup(flags: {
|
|
|
433
438
|
if (!flags.provider) missing.push("--provider");
|
|
434
439
|
if (!flags.baseUrl) missing.push("--base-url");
|
|
435
440
|
if (!flags.apiKeyEnv) missing.push("--api-key-env");
|
|
436
|
-
if (!flags.model || flags.model.length === 0) missing.push("--model");
|
|
441
|
+
if ((!flags.model || flags.model.length === 0) && !flags.discover) missing.push("--model or --discover");
|
|
437
442
|
}
|
|
438
443
|
if (missing.length > 0) {
|
|
439
444
|
throw new Error(
|
|
@@ -449,6 +454,7 @@ async function handleProviderSetup(flags: {
|
|
|
449
454
|
models: flags.model,
|
|
450
455
|
modelsPath: flags.modelsPath,
|
|
451
456
|
force: flags.force,
|
|
457
|
+
discover: flags.discover,
|
|
452
458
|
});
|
|
453
459
|
if (flags.json) {
|
|
454
460
|
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
@@ -932,6 +938,7 @@ ${chalk.bold("Provider example:")}
|
|
|
932
938
|
${APP_NAME} setup provider --preset litellm --base-url https://litellm.example.com/v1
|
|
933
939
|
${APP_NAME} setup provider --preset openai-compatible-proxy --base-url https://gateway.example.com/v1
|
|
934
940
|
MY_PROVIDER_KEY=sk-... ${APP_NAME} setup provider --compat openai --provider my-oai --base-url https://api.example.com/v1 --api-key-env MY_PROVIDER_KEY --model gpt-example
|
|
941
|
+
MY_PROVIDER_KEY=sk-... ${APP_NAME} setup provider --compat openai --provider my-oai --base-url https://api.example.com/v1 --api-key-env MY_PROVIDER_KEY --discover [--model gpt-example]
|
|
935
942
|
|
|
936
943
|
${chalk.bold("Hermes example:")}
|
|
937
944
|
${APP_NAME} setup hermes --root /path/to/repo
|
|
@@ -953,6 +960,7 @@ ${chalk.bold("Options:")}
|
|
|
953
960
|
--base-url Provider API base URL (required for proxy presets: litellm, openai-compatible-proxy)
|
|
954
961
|
--api-key-env Read provider API key from this environment variable
|
|
955
962
|
--model, --models Model id to add (repeat or comma-separate)
|
|
963
|
+
--discover Discover models from the provider OpenAI /v1/models endpoint (OpenAI-compatible custom providers; makes --model optional, merges with the live catalog)
|
|
956
964
|
--models-path Override models config path
|
|
957
965
|
--smoke Run Hermes MCP setup smoke checks
|
|
958
966
|
--install Install generated Hermes setup files
|