botmux 2.93.1 → 2.95.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/dist/adapters/backend/tmux-backend.d.ts +18 -2
- package/dist/adapters/backend/tmux-backend.d.ts.map +1 -1
- package/dist/adapters/backend/tmux-backend.js +45 -3
- package/dist/adapters/backend/tmux-backend.js.map +1 -1
- package/dist/adapters/backend/tmux-pipe-backend.js +1 -1
- package/dist/adapters/backend/tmux-pipe-backend.js.map +1 -1
- package/dist/adapters/backend/types.d.ts +8 -0
- package/dist/adapters/backend/types.d.ts.map +1 -1
- package/dist/adapters/backend/types.js.map +1 -1
- package/dist/adapters/backend/zellij-backend.js +1 -1
- package/dist/adapters/backend/zellij-backend.js.map +1 -1
- package/dist/adapters/cli/claude-code.d.ts.map +1 -1
- package/dist/adapters/cli/claude-code.js +6 -1
- package/dist/adapters/cli/claude-code.js.map +1 -1
- package/dist/bot-registry.d.ts +50 -1
- package/dist/bot-registry.d.ts.map +1 -1
- package/dist/bot-registry.js +30 -0
- package/dist/bot-registry.js.map +1 -1
- package/dist/cli/workflow.d.ts.map +1 -1
- package/dist/cli/workflow.js +11 -4
- package/dist/cli/workflow.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +146 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/command-handler.d.ts.map +1 -1
- package/dist/core/command-handler.js +28 -3
- package/dist/core/command-handler.js.map +1 -1
- package/dist/core/dashboard-ipc-server.d.ts.map +1 -1
- package/dist/core/dashboard-ipc-server.js +92 -0
- package/dist/core/dashboard-ipc-server.js.map +1 -1
- package/dist/core/inherit-peer.d.ts +5 -0
- package/dist/core/inherit-peer.d.ts.map +1 -1
- package/dist/core/inherit-peer.js +3 -0
- package/dist/core/inherit-peer.js.map +1 -1
- package/dist/core/session-discovery.d.ts +9 -0
- package/dist/core/session-discovery.d.ts.map +1 -1
- package/dist/core/session-discovery.js +24 -0
- package/dist/core/session-discovery.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +7 -6
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/terminal-url.d.ts.map +1 -1
- package/dist/core/terminal-url.js +15 -0
- package/dist/core/terminal-url.js.map +1 -1
- package/dist/core/trigger-session.js +2 -2
- package/dist/core/trigger-session.js.map +1 -1
- package/dist/core/worker-pool.d.ts.map +1 -1
- package/dist/core/worker-pool.js +30 -0
- package/dist/core/worker-pool.js.map +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +296 -23
- package/dist/daemon.js.map +1 -1
- package/dist/dashboard/aggregator.d.ts +5 -0
- package/dist/dashboard/aggregator.d.ts.map +1 -1
- package/dist/dashboard/aggregator.js +7 -0
- package/dist/dashboard/aggregator.js.map +1 -1
- package/dist/dashboard/auth.d.ts.map +1 -1
- package/dist/dashboard/auth.js +7 -1
- package/dist/dashboard/auth.js.map +1 -1
- package/dist/dashboard/bot-payload.d.ts +2 -0
- package/dist/dashboard/bot-payload.d.ts.map +1 -1
- package/dist/dashboard/bot-payload.js +2 -0
- package/dist/dashboard/bot-payload.js.map +1 -1
- package/dist/dashboard/connector-api.d.ts.map +1 -1
- package/dist/dashboard/connector-api.js +14 -3
- package/dist/dashboard/connector-api.js.map +1 -1
- package/dist/dashboard/settings-write-applier.d.ts +2 -1
- package/dist/dashboard/settings-write-applier.d.ts.map +1 -1
- package/dist/dashboard/settings-write-applier.js +7 -0
- package/dist/dashboard/settings-write-applier.js.map +1 -1
- package/dist/dashboard/v3-runs-api.d.ts +26 -0
- package/dist/dashboard/v3-runs-api.d.ts.map +1 -0
- package/dist/dashboard/v3-runs-api.js +67 -0
- package/dist/dashboard/v3-runs-api.js.map +1 -0
- package/dist/dashboard/web/app.js +21 -9
- package/dist/dashboard/web/app.js.map +1 -1
- package/dist/dashboard/web/bot-defaults.d.ts.map +1 -1
- package/dist/dashboard/web/bot-defaults.js +128 -33
- package/dist/dashboard/web/bot-defaults.js.map +1 -1
- package/dist/dashboard/web/i18n.d.ts.map +1 -1
- package/dist/dashboard/web/i18n.js +42 -6
- package/dist/dashboard/web/i18n.js.map +1 -1
- package/dist/dashboard/web/legacy-workflow-link.d.ts +2 -0
- package/dist/dashboard/web/legacy-workflow-link.d.ts.map +1 -0
- package/dist/dashboard/web/legacy-workflow-link.js +12 -0
- package/dist/dashboard/web/legacy-workflow-link.js.map +1 -0
- package/dist/dashboard/web/settings.d.ts.map +1 -1
- package/dist/dashboard/web/settings.js +11 -0
- package/dist/dashboard/web/settings.js.map +1 -1
- package/dist/dashboard/web/v3-terminal.d.ts +11 -0
- package/dist/dashboard/web/v3-terminal.d.ts.map +1 -0
- package/dist/dashboard/web/v3-terminal.js +143 -0
- package/dist/dashboard/web/v3-terminal.js.map +1 -0
- package/dist/dashboard/web/v3.d.ts +2 -0
- package/dist/dashboard/web/v3.d.ts.map +1 -0
- package/dist/dashboard/web/v3.js +564 -0
- package/dist/dashboard/web/v3.js.map +1 -0
- package/dist/dashboard/web/whiteboards.d.ts.map +1 -1
- package/dist/dashboard/web/whiteboards.js +14 -5
- package/dist/dashboard/web/whiteboards.js.map +1 -1
- package/dist/dashboard/web/workflows.d.ts.map +1 -1
- package/dist/dashboard/web/workflows.js +12 -8
- package/dist/dashboard/web/workflows.js.map +1 -1
- package/dist/dashboard-web/app.js +834 -724
- package/dist/dashboard-web/apple-touch-icon.png +0 -0
- package/dist/dashboard-web/favicon.png +0 -0
- package/dist/dashboard-web/index.html +3 -1
- package/dist/dashboard-web/style.css +223 -0
- package/dist/dashboard.js +170 -10
- package/dist/dashboard.js.map +1 -1
- package/dist/global-config.d.ts +10 -0
- package/dist/global-config.d.ts.map +1 -1
- package/dist/global-config.js +8 -0
- package/dist/global-config.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +23 -3
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +23 -3
- package/dist/i18n/zh.js.map +1 -1
- package/dist/im/lark/card-handler.d.ts +12 -0
- package/dist/im/lark/card-handler.d.ts.map +1 -1
- package/dist/im/lark/card-handler.js +28 -0
- package/dist/im/lark/card-handler.js.map +1 -1
- package/dist/im/lark/client.d.ts.map +1 -1
- package/dist/im/lark/client.js +3 -12
- package/dist/im/lark/client.js.map +1 -1
- package/dist/im/lark/event-dispatcher.d.ts +2 -1
- package/dist/im/lark/event-dispatcher.d.ts.map +1 -1
- package/dist/im/lark/event-dispatcher.js +20 -6
- package/dist/im/lark/event-dispatcher.js.map +1 -1
- package/dist/im/lark/grant-command.js +4 -4
- package/dist/im/lark/grant-command.js.map +1 -1
- package/dist/im/lark/message-parser.d.ts +29 -1
- package/dist/im/lark/message-parser.d.ts.map +1 -1
- package/dist/im/lark/message-parser.js +35 -1
- package/dist/im/lark/message-parser.js.map +1 -1
- package/dist/im/lark/v3-blocked-card-handler.d.ts +28 -0
- package/dist/im/lark/v3-blocked-card-handler.d.ts.map +1 -0
- package/dist/im/lark/v3-blocked-card-handler.js +134 -0
- package/dist/im/lark/v3-blocked-card-handler.js.map +1 -0
- package/dist/im/lark/v3-blocked-card.d.ts +75 -0
- package/dist/im/lark/v3-blocked-card.d.ts.map +1 -0
- package/dist/im/lark/v3-blocked-card.js +206 -0
- package/dist/im/lark/v3-blocked-card.js.map +1 -0
- package/dist/im/lark/v3-gate-card-handler.d.ts +31 -0
- package/dist/im/lark/v3-gate-card-handler.d.ts.map +1 -0
- package/dist/im/lark/v3-gate-card-handler.js +110 -0
- package/dist/im/lark/v3-gate-card-handler.js.map +1 -0
- package/dist/im/lark/v3-gate-card.d.ts +47 -0
- package/dist/im/lark/v3-gate-card.d.ts.map +1 -0
- package/dist/im/lark/v3-gate-card.js +119 -0
- package/dist/im/lark/v3-gate-card.js.map +1 -0
- package/dist/im/lark/v3-loop-grant-card-handler.d.ts +28 -0
- package/dist/im/lark/v3-loop-grant-card-handler.d.ts.map +1 -0
- package/dist/im/lark/v3-loop-grant-card-handler.js +90 -0
- package/dist/im/lark/v3-loop-grant-card-handler.js.map +1 -0
- package/dist/im/lark/v3-loop-grant-card.d.ts +46 -0
- package/dist/im/lark/v3-loop-grant-card.d.ts.map +1 -0
- package/dist/im/lark/v3-loop-grant-card.js +119 -0
- package/dist/im/lark/v3-loop-grant-card.js.map +1 -0
- package/dist/im/lark/v3-revisit-grant-card-handler.d.ts +29 -0
- package/dist/im/lark/v3-revisit-grant-card-handler.d.ts.map +1 -0
- package/dist/im/lark/v3-revisit-grant-card-handler.js +96 -0
- package/dist/im/lark/v3-revisit-grant-card-handler.js.map +1 -0
- package/dist/im/lark/v3-revisit-grant-card.d.ts +52 -0
- package/dist/im/lark/v3-revisit-grant-card.d.ts.map +1 -0
- package/dist/im/lark/v3-revisit-grant-card.js +123 -0
- package/dist/im/lark/v3-revisit-grant-card.js.map +1 -0
- package/dist/im/lark/workflow-cards.d.ts.map +1 -1
- package/dist/im/lark/workflow-cards.js +5 -1
- package/dist/im/lark/workflow-cards.js.map +1 -1
- package/dist/im/lark/workflow-progress-card.d.ts +1 -1
- package/dist/im/lark/workflow-progress-card.js +1 -1
- package/dist/im/lark/workflow-slash-command.d.ts +28 -0
- package/dist/im/lark/workflow-slash-command.d.ts.map +1 -1
- package/dist/im/lark/workflow-slash-command.js +61 -5
- package/dist/im/lark/workflow-slash-command.js.map +1 -1
- package/dist/platform/binding.d.ts +6 -0
- package/dist/platform/binding.d.ts.map +1 -1
- package/dist/platform/binding.js +17 -0
- package/dist/platform/binding.js.map +1 -1
- package/dist/platform/tunnel-client.d.ts +2 -0
- package/dist/platform/tunnel-client.d.ts.map +1 -1
- package/dist/platform/tunnel-client.js.map +1 -1
- package/dist/services/bot-config-store.d.ts.map +1 -1
- package/dist/services/bot-config-store.js +1 -0
- package/dist/services/bot-config-store.js.map +1 -1
- package/dist/services/card-prefs-store.d.ts +4 -0
- package/dist/services/card-prefs-store.d.ts.map +1 -1
- package/dist/services/card-prefs-store.js +19 -0
- package/dist/services/card-prefs-store.js.map +1 -1
- package/dist/services/oncall-store.d.ts +25 -0
- package/dist/services/oncall-store.d.ts.map +1 -1
- package/dist/services/oncall-store.js +56 -0
- package/dist/services/oncall-store.js.map +1 -1
- package/dist/services/transcript-resolver.d.ts.map +1 -1
- package/dist/services/transcript-resolver.js +21 -4
- package/dist/services/transcript-resolver.js.map +1 -1
- package/dist/setup/bot-config-editor.d.ts +7 -0
- package/dist/setup/bot-config-editor.d.ts.map +1 -1
- package/dist/setup/bot-config-editor.js +33 -0
- package/dist/setup/bot-config-editor.js.map +1 -1
- package/dist/skills/definitions.d.ts.map +1 -1
- package/dist/skills/definitions.js +208 -4
- package/dist/skills/definitions.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/terminal-favicon.d.ts +2 -0
- package/dist/utils/terminal-favicon.d.ts.map +1 -0
- package/dist/utils/terminal-favicon.js +5 -0
- package/dist/utils/terminal-favicon.js.map +1 -0
- package/dist/worker.js +152 -8
- package/dist/worker.js.map +1 -1
- package/dist/workflows/definition.d.ts +80 -80
- package/dist/workflows/events/payloads.d.ts +4 -4
- package/dist/workflows/events/schema.d.ts +16 -16
- package/dist/workflows/v3/architect.d.ts +37 -0
- package/dist/workflows/v3/architect.d.ts.map +1 -0
- package/dist/workflows/v3/architect.js +226 -0
- package/dist/workflows/v3/architect.js.map +1 -0
- package/dist/workflows/v3/bot-resolve.d.ts +21 -0
- package/dist/workflows/v3/bot-resolve.d.ts.map +1 -0
- package/dist/workflows/v3/bot-resolve.js +48 -0
- package/dist/workflows/v3/bot-resolve.js.map +1 -0
- package/dist/workflows/v3/cli-run.d.ts +24 -0
- package/dist/workflows/v3/cli-run.d.ts.map +1 -0
- package/dist/workflows/v3/cli-run.js +265 -0
- package/dist/workflows/v3/cli-run.js.map +1 -0
- package/dist/workflows/v3/contract.d.ts +302 -0
- package/dist/workflows/v3/contract.d.ts.map +1 -0
- package/dist/workflows/v3/contract.js +91 -0
- package/dist/workflows/v3/contract.js.map +1 -0
- package/dist/workflows/v3/daemon-run.d.ts +311 -0
- package/dist/workflows/v3/daemon-run.d.ts.map +1 -0
- package/dist/workflows/v3/daemon-run.js +775 -0
- package/dist/workflows/v3/daemon-run.js.map +1 -0
- package/dist/workflows/v3/dag.d.ts +332 -0
- package/dist/workflows/v3/dag.d.ts.map +1 -0
- package/dist/workflows/v3/dag.js +1040 -0
- package/dist/workflows/v3/dag.js.map +1 -0
- package/dist/workflows/v3/ephemeral-pool.d.ts +29 -0
- package/dist/workflows/v3/ephemeral-pool.d.ts.map +1 -0
- package/dist/workflows/v3/ephemeral-pool.js +331 -0
- package/dist/workflows/v3/ephemeral-pool.js.map +1 -0
- package/dist/workflows/v3/grill-state.d.ts +92 -0
- package/dist/workflows/v3/grill-state.d.ts.map +1 -0
- package/dist/workflows/v3/grill-state.js +151 -0
- package/dist/workflows/v3/grill-state.js.map +1 -0
- package/dist/workflows/v3/host.d.ts +88 -0
- package/dist/workflows/v3/host.d.ts.map +1 -0
- package/dist/workflows/v3/host.js +349 -0
- package/dist/workflows/v3/host.js.map +1 -0
- package/dist/workflows/v3/human-gate.d.ts +85 -0
- package/dist/workflows/v3/human-gate.d.ts.map +1 -0
- package/dist/workflows/v3/human-gate.js +153 -0
- package/dist/workflows/v3/human-gate.js.map +1 -0
- package/dist/workflows/v3/journal.d.ts +207 -0
- package/dist/workflows/v3/journal.d.ts.map +1 -0
- package/dist/workflows/v3/journal.js +74 -0
- package/dist/workflows/v3/journal.js.map +1 -0
- package/dist/workflows/v3/manifest.d.ts +17 -0
- package/dist/workflows/v3/manifest.d.ts.map +1 -0
- package/dist/workflows/v3/manifest.js +266 -0
- package/dist/workflows/v3/manifest.js.map +1 -0
- package/dist/workflows/v3/ops-projection.d.ts +110 -0
- package/dist/workflows/v3/ops-projection.d.ts.map +1 -0
- package/dist/workflows/v3/ops-projection.js +0 -0
- package/dist/workflows/v3/ops-projection.js.map +1 -0
- package/dist/workflows/v3/orchestrator.d.ts +168 -0
- package/dist/workflows/v3/orchestrator.d.ts.map +1 -0
- package/dist/workflows/v3/orchestrator.js +417 -0
- package/dist/workflows/v3/orchestrator.js.map +1 -0
- package/dist/workflows/v3/runtime.d.ts +193 -0
- package/dist/workflows/v3/runtime.d.ts.map +1 -0
- package/dist/workflows/v3/runtime.js +1284 -0
- package/dist/workflows/v3/runtime.js.map +1 -0
- package/dist/workflows/v3/spec.d.ts +32 -0
- package/dist/workflows/v3/spec.d.ts.map +1 -0
- package/dist/workflows/v3/spec.js +173 -0
- package/dist/workflows/v3/spec.js.map +1 -0
- package/dist/workflows/v3/state.d.ts +74 -0
- package/dist/workflows/v3/state.d.ts.map +1 -0
- package/dist/workflows/v3/state.js +353 -0
- package/dist/workflows/v3/state.js.map +1 -0
- package/package.json +2 -2
- package/dist/dashboard/web/workflow-catalog.d.ts +0 -2
- package/dist/dashboard/web/workflow-catalog.d.ts.map +0 -1
- package/dist/dashboard/web/workflow-catalog.js +0 -323
- package/dist/dashboard/web/workflow-catalog.js.map +0 -1
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v3 runtime ⇄ ephemeral-pool IPC contract.
|
|
3
|
+
*
|
|
4
|
+
* This is the SHARED boundary between the two halves of the v3 engine:
|
|
5
|
+
* - scheduling / persistence side (claude): `runtime.ts` calls `runNode`,
|
|
6
|
+
* consumes the returned manifest, writes the next node's `inputs.json`.
|
|
7
|
+
* - execution / IPC side (codex): `ephemeral-pool.ts` implements `runNode`
|
|
8
|
+
* (spawns a throwaway worker in goal-mode), `manifest.ts` implements the
|
|
9
|
+
* `Manifest` validator.
|
|
10
|
+
*
|
|
11
|
+
* Both sides import the *types* from here so the contract can't silently drift.
|
|
12
|
+
* Implementations live in their owners' files; this module is types + frozen
|
|
13
|
+
* string constants only (no runtime logic). See
|
|
14
|
+
* `docs/design/2026-06-01-v3-mvp-engine-split.md` §2 for prose.
|
|
15
|
+
*/
|
|
16
|
+
import type { CliId } from '../../adapters/cli/types.js';
|
|
17
|
+
import type { V3GoalNode } from './dag.js';
|
|
18
|
+
/** Enumerated, NOT free-string (design Q8 / §7). Unknown → validator rejects
|
|
19
|
+
* (or the producer downgrades to `binary`). */
|
|
20
|
+
export type ManifestFileKind = 'markdown' | 'json' | 'text' | 'code' | 'log' | 'binary' | 'directory';
|
|
21
|
+
export declare const MANIFEST_FILE_KINDS: readonly ManifestFileKind[];
|
|
22
|
+
/** Soft limits the manifest validator enforces (codex point 2). */
|
|
23
|
+
export declare const MANIFEST_SUMMARY_MAX_BYTES: number;
|
|
24
|
+
export declare const MANIFEST_PREVIEW_MAX_BYTES: number;
|
|
25
|
+
export interface ManifestFile {
|
|
26
|
+
name: string;
|
|
27
|
+
/** Relative to the node's `outputDir` — absolute paths are REJECTED by the
|
|
28
|
+
* validator (which canonicalizes `outputDir/path` and asserts it stays
|
|
29
|
+
* inside outputDir). Downstream `inputs.json` carries the resolved
|
|
30
|
+
* absolute path; the manifest author may only write relative. */
|
|
31
|
+
path: string;
|
|
32
|
+
kind: ManifestFileKind;
|
|
33
|
+
bytes: number;
|
|
34
|
+
/** sha256 of the file; the empty string is the agreed sentinel for
|
|
35
|
+
* `kind: 'directory'`. */
|
|
36
|
+
sha256: string;
|
|
37
|
+
mime: string;
|
|
38
|
+
/** Optional human-readable excerpt; validator truncates to
|
|
39
|
+
* MANIFEST_PREVIEW_MAX_BYTES. */
|
|
40
|
+
preview?: string;
|
|
41
|
+
}
|
|
42
|
+
export type ManifestStatus = 'ok' | 'fail';
|
|
43
|
+
export declare const MANIFEST_STATUSES: readonly ManifestStatus[];
|
|
44
|
+
/**
|
|
45
|
+
* Written by a goal-mode worker at `BOTMUX_GOAL_MANIFEST_PATH` before exit.
|
|
46
|
+
* Invariants (enforced by the validator on codex's side):
|
|
47
|
+
* - `status:'ok'` → `files.length >= 1`, `error` absent
|
|
48
|
+
* - `status:'fail'` → `error` required, `files` may be empty
|
|
49
|
+
*/
|
|
50
|
+
export interface Manifest {
|
|
51
|
+
schemaVersion: 1;
|
|
52
|
+
status: ManifestStatus;
|
|
53
|
+
/** Truncated to MANIFEST_SUMMARY_MAX_BYTES. */
|
|
54
|
+
summary: string;
|
|
55
|
+
error?: {
|
|
56
|
+
code: string;
|
|
57
|
+
message: string;
|
|
58
|
+
retryable?: boolean;
|
|
59
|
+
};
|
|
60
|
+
files: ManifestFile[];
|
|
61
|
+
}
|
|
62
|
+
export declare const MANIFEST_SCHEMA_VERSION: 1;
|
|
63
|
+
/**
|
|
64
|
+
* Written by the runtime at `BOTMUX_GOAL_INPUTS_PATH` for each node, resolved
|
|
65
|
+
* from the manifests of the node's upstream `inputs.from`. Unlike the
|
|
66
|
+
* manifest, the `path` here is ABSOLUTE so the consuming agent can `Read` it
|
|
67
|
+
* directly without knowing the upstream layout.
|
|
68
|
+
*/
|
|
69
|
+
export interface GoalInputs {
|
|
70
|
+
inputs: Array<{
|
|
71
|
+
from: string;
|
|
72
|
+
name: string;
|
|
73
|
+
path: string;
|
|
74
|
+
kind: ManifestFileKind;
|
|
75
|
+
preview?: string;
|
|
76
|
+
}>;
|
|
77
|
+
/** Declared inputs NOT injected: edge resolved inactive / source skipped
|
|
78
|
+
* (edge-activation design §6) or a P3 per-file selector matched nothing in
|
|
79
|
+
* the upstream manifest ('selectorMiss'). Telling the agent "this absence
|
|
80
|
+
* is known" stops it from hallucinating the missing product. */
|
|
81
|
+
omitted?: Array<{
|
|
82
|
+
from: string;
|
|
83
|
+
reason: 'edgeInactive' | 'sourceSkipped' | 'sourceCancelled' | 'earlyRelease' | 'selectorMiss';
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The fixed env keys the runtime injects into every goal-mode worker. The
|
|
88
|
+
* `botmux-goal` skill / bootstrap prompt reads these by name — keeping the
|
|
89
|
+
* names here (not magic strings scattered across files) is the contract.
|
|
90
|
+
*/
|
|
91
|
+
export declare const GOAL_ENV: {
|
|
92
|
+
/** Path to the single-sentence goal text file. */
|
|
93
|
+
readonly GOAL_PATH: "BOTMUX_GOAL_PATH";
|
|
94
|
+
/** Path to this node's resolved `GoalInputs` JSON. */
|
|
95
|
+
readonly INPUTS_PATH: "BOTMUX_GOAL_INPUTS_PATH";
|
|
96
|
+
/** Directory the worker may write products into (and ONLY here). */
|
|
97
|
+
readonly OUTPUT_DIR: "BOTMUX_GOAL_OUTPUT_DIR";
|
|
98
|
+
/** Path the worker MUST write its `Manifest` to before exiting. */
|
|
99
|
+
readonly MANIFEST_PATH: "BOTMUX_GOAL_MANIFEST_PATH";
|
|
100
|
+
/** This attempt's directory (logs, manifest, work/ live under it). */
|
|
101
|
+
readonly ATTEMPT_DIR: "BOTMUX_GOAL_ATTEMPT_DIR";
|
|
102
|
+
/** Set to '1' — marks a goal-mode run so worker chat/card/ask side effects
|
|
103
|
+
* stay silent (codex point 4). */
|
|
104
|
+
readonly V3_MARKER: "BOTMUX_V3_GOAL";
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* A goal worker that needs a human decision mid-run does NOT block in-process.
|
|
108
|
+
* Instead it writes its question to `GOAL_ASK_FILE` under the attempt
|
|
109
|
+
* dir, then exits with a fail manifest carrying `error.code = ASK_HUMAN_ERROR_CODE`
|
|
110
|
+
* and `error.retryable: true`. classifyTerminal routes that to `blocked` (the
|
|
111
|
+
* retryable half), and the daemon posts an ask card instead of a plain retry
|
|
112
|
+
* card. When the human answers, the daemon writes `GOAL_ANSWER_FILE` next to the
|
|
113
|
+
* ask and re-dispatches the node; the next attempt's GoalInputs injects the
|
|
114
|
+
* answer as `{from:'human', name:'answer'}`. No suspend machinery, no held worker — it
|
|
115
|
+
* is the ordinary blocked→retry lifecycle with question/answer payloads bolted
|
|
116
|
+
* onto the two journal events.
|
|
117
|
+
*/
|
|
118
|
+
export declare const ASK_HUMAN_ERROR_CODE = "ASK_HUMAN";
|
|
119
|
+
/** Filename (relative to the attempt dir) the goal worker writes its
|
|
120
|
+
* {@link GoalAsk} to before exiting with an ASK_HUMAN fail manifest. */
|
|
121
|
+
export declare const GOAL_ASK_FILE = "ask.json";
|
|
122
|
+
/** Filename (relative to the *asked* attempt's dir) the daemon writes the
|
|
123
|
+
* human's {@link GoalAnswer} to; the retry's GoalInputs points at this path. */
|
|
124
|
+
export declare const GOAL_ANSWER_FILE = "answer.json";
|
|
125
|
+
export type GoalAsk = {
|
|
126
|
+
/** The single question to put to the human. */
|
|
127
|
+
question: string;
|
|
128
|
+
/** 2–6 concrete options the human picks from; each becomes a card button. */
|
|
129
|
+
options: string[];
|
|
130
|
+
freeText?: false;
|
|
131
|
+
} | {
|
|
132
|
+
/** The single question to put to the human. */
|
|
133
|
+
question: string;
|
|
134
|
+
/** Ask the human to provide free-form text instead of picking an option. */
|
|
135
|
+
freeText: true;
|
|
136
|
+
options?: never;
|
|
137
|
+
};
|
|
138
|
+
export type GoalAnswer = {
|
|
139
|
+
/** The option the human selected (one of {@link GoalAsk.options}). */
|
|
140
|
+
selected: string;
|
|
141
|
+
/** open_id of the human who answered. */
|
|
142
|
+
by: string;
|
|
143
|
+
} | {
|
|
144
|
+
/** Free-form text the human provided. */
|
|
145
|
+
text: string;
|
|
146
|
+
/** open_id of the human who answered. */
|
|
147
|
+
by: string;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* v3 goal-mode is delivered via the native `/goal` command, which only Claude
|
|
151
|
+
* Code, Codex, and Seed support (老滕 directive 2026-06-01, Seed added
|
|
152
|
+
* 2026-06-02). We deliberately do NOT abstract goal delivery across every CLI
|
|
153
|
+
* — instead the feature is scoped to the CLIs whose command mechanism can host
|
|
154
|
+
* `/goal`. Seed is ByteDance's Claude Code fork (`@bytedance-seed/claude-code`,
|
|
155
|
+
* binary `seed`): identical flags, slash commands, and session layout — it
|
|
156
|
+
* reuses the entire claude-family adapter, so `/goal`, paste-detection
|
|
157
|
+
* avoidance, and the manifest watcher all behave exactly as on claude-code with
|
|
158
|
+
* zero CLI-specific branching. The runtime rejects a run whose nodes resolve
|
|
159
|
+
* to any other CLI at start time.
|
|
160
|
+
*/
|
|
161
|
+
export declare const V3_SUPPORTED_CLIS: readonly CliId[];
|
|
162
|
+
export declare function isV3SupportedCli(cliId: CliId): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* The spawn-relevant bot config, FROZEN when the run starts and persisted in
|
|
165
|
+
* the runDir. The pool spawns ephemeral workers from this snapshot rather
|
|
166
|
+
* than re-reading `bots.json` at execution time, so a retry / daemon-restart
|
|
167
|
+
* reproduces the original cliId / model / workingDir even if the live bot
|
|
168
|
+
* config drifted (codex point 1).
|
|
169
|
+
*
|
|
170
|
+
* Deliberately omits `larkAppSecret`: secrets are not written into the runDir.
|
|
171
|
+
* The pool re-reads the secret by `larkAppId` from the live registry at spawn
|
|
172
|
+
* (secret rotation is not the drift we're guarding against). If we later need
|
|
173
|
+
* fully-hermetic replay we can revisit, but not at the cost of secrets on disk.
|
|
174
|
+
*/
|
|
175
|
+
export interface BotSnapshot {
|
|
176
|
+
larkAppId: string;
|
|
177
|
+
cliId: CliId;
|
|
178
|
+
cliPathOverride?: string;
|
|
179
|
+
model?: string;
|
|
180
|
+
/** Frozen from the bot's `disableCliBypass` config — when true the CLI's
|
|
181
|
+
* permission bypass stays OFF for every node of this run. A node-level
|
|
182
|
+
* `override.permissionMode:'restricted'` can additionally set this per
|
|
183
|
+
* dispatch; nothing can clear it (no-escalation red line, P2). */
|
|
184
|
+
disableCliBypass?: boolean;
|
|
185
|
+
/** The resolved working directory for this run. */
|
|
186
|
+
workingDir: string;
|
|
187
|
+
}
|
|
188
|
+
/** Returned alongside the result so dashboard terminal / replay / resume can
|
|
189
|
+
* attach later without a contract change (codex point 1). All optional —
|
|
190
|
+
* MVP may leave it undefined. */
|
|
191
|
+
export interface WorkerSessionInfo {
|
|
192
|
+
sessionId: string;
|
|
193
|
+
webPort?: number;
|
|
194
|
+
token?: string;
|
|
195
|
+
}
|
|
196
|
+
export interface RunNodeRequest {
|
|
197
|
+
runId: string;
|
|
198
|
+
/** Stable id e.g. `research/attempts/001`, used for sessionId / log naming. */
|
|
199
|
+
attemptId: string;
|
|
200
|
+
node: V3GoalNode;
|
|
201
|
+
/** Frozen at run start; do NOT re-resolve the bot here. */
|
|
202
|
+
botSnapshot: BotSnapshot;
|
|
203
|
+
runDir: string;
|
|
204
|
+
attemptDir: string;
|
|
205
|
+
inputsPath: string;
|
|
206
|
+
outputDir: string;
|
|
207
|
+
/** Already includes the GOAL_ENV keys; pool merges into the worker env. */
|
|
208
|
+
env: Record<string, string>;
|
|
209
|
+
timeoutMs: number;
|
|
210
|
+
cancelSignal?: AbortSignal;
|
|
211
|
+
/** Called as soon as the worker web terminal is ready, before the node
|
|
212
|
+
* reaches terminal. Runtime uses this to append `nodeSessionReady` so the
|
|
213
|
+
* dashboard can attach to an in-flight node instead of waiting for
|
|
214
|
+
* RunNodeResult at completion. */
|
|
215
|
+
onSessionReady?: (info: WorkerSessionInfo & {
|
|
216
|
+
ptyLogPath?: string;
|
|
217
|
+
}) => void | Promise<void>;
|
|
218
|
+
/** Defaults to `${attemptDir}/stdout.log` when omitted. */
|
|
219
|
+
stdoutPath?: string;
|
|
220
|
+
/** Defaults to `${attemptDir}/stderr.log` when omitted. */
|
|
221
|
+
stderrPath?: string;
|
|
222
|
+
}
|
|
223
|
+
export interface RunNodeResult {
|
|
224
|
+
/** Process-level outcome. Final node verdict = this AND manifest validation
|
|
225
|
+
* (runtime validates the manifest at `manifestPath` after `runNode`
|
|
226
|
+
* resolves — codex point 4: NOT v0.2 final_output semantics). */
|
|
227
|
+
status: 'ok' | 'fail';
|
|
228
|
+
/** Where the worker wrote its manifest (defaults to attemptDir/manifest.json
|
|
229
|
+
* but returned explicitly so the layout stays the pool's choice within
|
|
230
|
+
* attemptDir). */
|
|
231
|
+
manifestPath: string;
|
|
232
|
+
sessionInfo?: WorkerSessionInfo;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Implemented by `ephemeral-pool.ts` (codex), called by `runtime.ts` (claude).
|
|
236
|
+
* Spawns one throwaway worker that runs the node's goal in goal-mode, waits
|
|
237
|
+
* for it to exit (or the timeout / cancel to fire), and resolves with the
|
|
238
|
+
* process outcome + manifest location. The pool does NOT interpret the
|
|
239
|
+
* manifest — the runtime validates it.
|
|
240
|
+
*/
|
|
241
|
+
export type RunNode = (req: RunNodeRequest) => Promise<RunNodeResult>;
|
|
242
|
+
export interface ManifestValidationResult {
|
|
243
|
+
ok: boolean;
|
|
244
|
+
/** Present when `ok` — the parsed, normalized manifest. */
|
|
245
|
+
manifest?: Manifest;
|
|
246
|
+
/** Present when `!ok` — the full problem list (mirror dag.ts's style). */
|
|
247
|
+
problems?: string[];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The runtime's view of manifest validation: read + validate the manifest at
|
|
251
|
+
* `manifestPath` against `outputDir`, returning a result object (never throws,
|
|
252
|
+
* so the dispatch loop stays branch-clean).
|
|
253
|
+
*
|
|
254
|
+
* codex's `manifest.ts` exposes the validation in a throw-based async form
|
|
255
|
+
* (`readAndValidateManifest(path, outputDir): Promise<Manifest>`); the daemon /
|
|
256
|
+
* CLI wiring adapts it to this shape at the injection boundary
|
|
257
|
+
* (try → `{ok:true, manifest}` / catch `ManifestValidationError` →
|
|
258
|
+
* `{ok:false, problems}`). Async because the underlying impl reads the file
|
|
259
|
+
* and hashes its contents.
|
|
260
|
+
*/
|
|
261
|
+
export type ValidateManifest = (manifestPath: string, outputDir: string) => Promise<ManifestValidationResult>;
|
|
262
|
+
export declare const SPEC_SCHEMA_VERSION = 1;
|
|
263
|
+
/**
|
|
264
|
+
* One prospective node in the requirement-decomposition sketch. grill writes
|
|
265
|
+
* these (the WHAT); architect turns them into formal dag.json nodes (the HOW).
|
|
266
|
+
*
|
|
267
|
+
* `input_needs` is FREE TEXT ("需要 research 阶段产出的竞品事实"), NOT a list of
|
|
268
|
+
* upstream sketchIds — grill must not draw edges; architect parses `input_needs`
|
|
269
|
+
* into the dag's `depends`. (codex review 2026-06-02.) `risk_gate` → dag.json
|
|
270
|
+
* humanGate on the corresponding node.
|
|
271
|
+
*/
|
|
272
|
+
export interface SpecNodeSketch {
|
|
273
|
+
sketchId: string;
|
|
274
|
+
goal: string;
|
|
275
|
+
input_needs: string[];
|
|
276
|
+
expected_outputs: string[];
|
|
277
|
+
acceptance: string;
|
|
278
|
+
risk_gate: boolean;
|
|
279
|
+
unknowns: string[];
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The canonical, machine-readable spec. `workflow spec-finalize` parses the
|
|
283
|
+
* fenced ```json block out of spec.md, validates it, and materializes this as
|
|
284
|
+
* `spec.json` (parse/validate failure blocks handoff — codex review 2026-06-02).
|
|
285
|
+
* architect reads `spec.json` for STRUCTURE; `spec.md` is narrative context only.
|
|
286
|
+
*
|
|
287
|
+
* Node sketch ships as fenced JSON (not YAML) — dependency-free, mirrors v0.2's
|
|
288
|
+
* JSON workflow definitions, and an LLM emits valid JSON reliably.
|
|
289
|
+
*/
|
|
290
|
+
export interface Spec {
|
|
291
|
+
schemaVersion: number;
|
|
292
|
+
runId: string;
|
|
293
|
+
title: string;
|
|
294
|
+
/** grill 收敛后的清晰需求陈述. */
|
|
295
|
+
requirement: string;
|
|
296
|
+
/** 整体验收标准(人读叙事在 spec.md,这里给 architect 的结构化副本). */
|
|
297
|
+
acceptance?: string;
|
|
298
|
+
/** 明确不做的. */
|
|
299
|
+
nonGoals?: string[];
|
|
300
|
+
nodes: SpecNodeSketch[];
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/workflows/v3/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;gDACgD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emeral-pool IPC contract.
|
|
3
|
+
*
|
|
4
|
+
* This is the SHARED boundary between the two halves of the v3 engine:
|
|
5
|
+
* - scheduling / persistence side (claude): `runtime.ts` calls `runNode`,
|
|
6
|
+
* consumes the returned manifest, writes the next node's `inputs.json`.
|
|
7
|
+
* - execution / IPC side (codex): `ephemeral-pool.ts` implements `runNode`
|
|
8
|
+
* (spawns a throwaway worker in goal-mode), `manifest.ts` implements the
|
|
9
|
+
* `Manifest` validator.
|
|
10
|
+
*
|
|
11
|
+
* Both sides import the *types* from here so the contract can't silently drift.
|
|
12
|
+
* Implementations live in their owners' files; this module is types + frozen
|
|
13
|
+
* string constants only (no runtime logic). See
|
|
14
|
+
* `docs/design/2026-06-01-v3-mvp-engine-split.md` §2 for prose.
|
|
15
|
+
*/
|
|
16
|
+
export const MANIFEST_FILE_KINDS = [
|
|
17
|
+
'markdown', 'json', 'text', 'code', 'log', 'binary', 'directory',
|
|
18
|
+
];
|
|
19
|
+
/** Soft limits the manifest validator enforces (codex point 2). */
|
|
20
|
+
export const MANIFEST_SUMMARY_MAX_BYTES = 4 * 1024;
|
|
21
|
+
export const MANIFEST_PREVIEW_MAX_BYTES = 4 * 1024;
|
|
22
|
+
export const MANIFEST_STATUSES = ['ok', 'fail'];
|
|
23
|
+
export const MANIFEST_SCHEMA_VERSION = 1;
|
|
24
|
+
// ─── goal-mode env contract (runtime fills, skill reads) ────────────────────
|
|
25
|
+
/**
|
|
26
|
+
* The fixed env keys the runtime injects into every goal-mode worker. The
|
|
27
|
+
* `botmux-goal` skill / bootstrap prompt reads these by name — keeping the
|
|
28
|
+
* names here (not magic strings scattered across files) is the contract.
|
|
29
|
+
*/
|
|
30
|
+
export const GOAL_ENV = {
|
|
31
|
+
/** Path to the single-sentence goal text file. */
|
|
32
|
+
GOAL_PATH: 'BOTMUX_GOAL_PATH',
|
|
33
|
+
/** Path to this node's resolved `GoalInputs` JSON. */
|
|
34
|
+
INPUTS_PATH: 'BOTMUX_GOAL_INPUTS_PATH',
|
|
35
|
+
/** Directory the worker may write products into (and ONLY here). */
|
|
36
|
+
OUTPUT_DIR: 'BOTMUX_GOAL_OUTPUT_DIR',
|
|
37
|
+
/** Path the worker MUST write its `Manifest` to before exiting. */
|
|
38
|
+
MANIFEST_PATH: 'BOTMUX_GOAL_MANIFEST_PATH',
|
|
39
|
+
/** This attempt's directory (logs, manifest, work/ live under it). */
|
|
40
|
+
ATTEMPT_DIR: 'BOTMUX_GOAL_ATTEMPT_DIR',
|
|
41
|
+
/** Set to '1' — marks a goal-mode run so worker chat/card/ask side effects
|
|
42
|
+
* stay silent (codex point 4). */
|
|
43
|
+
V3_MARKER: 'BOTMUX_V3_GOAL',
|
|
44
|
+
};
|
|
45
|
+
// ─── Runtime human-ask (goal worker → human, rides the blocked+retry rail) ──
|
|
46
|
+
/**
|
|
47
|
+
* A goal worker that needs a human decision mid-run does NOT block in-process.
|
|
48
|
+
* Instead it writes its question to `GOAL_ASK_FILE` under the attempt
|
|
49
|
+
* dir, then exits with a fail manifest carrying `error.code = ASK_HUMAN_ERROR_CODE`
|
|
50
|
+
* and `error.retryable: true`. classifyTerminal routes that to `blocked` (the
|
|
51
|
+
* retryable half), and the daemon posts an ask card instead of a plain retry
|
|
52
|
+
* card. When the human answers, the daemon writes `GOAL_ANSWER_FILE` next to the
|
|
53
|
+
* ask and re-dispatches the node; the next attempt's GoalInputs injects the
|
|
54
|
+
* answer as `{from:'human', name:'answer'}`. No suspend machinery, no held worker — it
|
|
55
|
+
* is the ordinary blocked→retry lifecycle with question/answer payloads bolted
|
|
56
|
+
* onto the two journal events.
|
|
57
|
+
*/
|
|
58
|
+
export const ASK_HUMAN_ERROR_CODE = 'ASK_HUMAN';
|
|
59
|
+
/** Filename (relative to the attempt dir) the goal worker writes its
|
|
60
|
+
* {@link GoalAsk} to before exiting with an ASK_HUMAN fail manifest. */
|
|
61
|
+
export const GOAL_ASK_FILE = 'ask.json';
|
|
62
|
+
/** Filename (relative to the *asked* attempt's dir) the daemon writes the
|
|
63
|
+
* human's {@link GoalAnswer} to; the retry's GoalInputs points at this path. */
|
|
64
|
+
export const GOAL_ANSWER_FILE = 'answer.json';
|
|
65
|
+
// ─── Supported CLIs ─────────────────────────────────────────────────────────
|
|
66
|
+
/**
|
|
67
|
+
* v3 goal-mode is delivered via the native `/goal` command, which only Claude
|
|
68
|
+
* Code, Codex, and Seed support (老滕 directive 2026-06-01, Seed added
|
|
69
|
+
* 2026-06-02). We deliberately do NOT abstract goal delivery across every CLI
|
|
70
|
+
* — instead the feature is scoped to the CLIs whose command mechanism can host
|
|
71
|
+
* `/goal`. Seed is ByteDance's Claude Code fork (`@bytedance-seed/claude-code`,
|
|
72
|
+
* binary `seed`): identical flags, slash commands, and session layout — it
|
|
73
|
+
* reuses the entire claude-family adapter, so `/goal`, paste-detection
|
|
74
|
+
* avoidance, and the manifest watcher all behave exactly as on claude-code with
|
|
75
|
+
* zero CLI-specific branching. The runtime rejects a run whose nodes resolve
|
|
76
|
+
* to any other CLI at start time.
|
|
77
|
+
*/
|
|
78
|
+
export const V3_SUPPORTED_CLIS = ['claude-code', 'codex', 'seed'];
|
|
79
|
+
export function isV3SupportedCli(cliId) {
|
|
80
|
+
return V3_SUPPORTED_CLIS.includes(cliId);
|
|
81
|
+
}
|
|
82
|
+
// ─── Spec (grill 产物 → architect 输入) ──────────────────────────────────────
|
|
83
|
+
export const SPEC_SCHEMA_VERSION = 1;
|
|
84
|
+
// ─── Architect seam ─────────────────────────────────────────────────────────
|
|
85
|
+
// `runArchitect(...)` + its `RunArchitectInput`/`RunArchitectResult` live in
|
|
86
|
+
// `architect.ts` (codex owns the architect goal-worker). The host controller
|
|
87
|
+
// imports them from there directly — they are NOT redefined here (one-directional
|
|
88
|
+
// host→architect call, not a bidirectional injection contract like RunNode).
|
|
89
|
+
// The host still runs loadDag/validateDag on the returned dagPath; it does NOT
|
|
90
|
+
// trust architect's self-claim of validity. (seam agreed w/ codex 2026-06-02.)
|
|
91
|
+
//# sourceMappingURL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