@adhdev/daemon-core 0.9.82-rc.15 → 0.9.82-rc.151
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/boot/process-hardening.d.ts +50 -0
- package/dist/chat/source-machine.d.ts +166 -0
- package/dist/chat/source-resolver.d.ts +104 -0
- package/dist/chat/subscription-updates.d.ts +1 -0
- package/dist/cli-adapter-types.d.ts +5 -1
- package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +178 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +104 -63
- package/dist/cli-adapters/provider-cli-parse.d.ts +4 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +27 -0
- package/dist/commands/handler.d.ts +66 -0
- package/dist/commands/router.d.ts +22 -0
- package/dist/config/chat-history.d.ts +5 -0
- package/dist/config/config.d.ts +5 -0
- package/dist/config/mesh-config.d.ts +68 -1
- package/dist/git/git-commands.d.ts +5 -1
- package/dist/index.d.ts +20 -6
- package/dist/index.js +13153 -3031
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13099 -3023
- package/dist/index.mjs.map +1 -1
- package/dist/installer.d.ts +1 -4
- package/dist/ipc/local-ipc-server.d.ts +91 -0
- package/dist/launch.d.ts +1 -1
- package/dist/logging/async-batch-writer.d.ts +10 -0
- package/dist/mesh/beads-db.d.ts +72 -0
- package/dist/mesh/contracts.d.ts +164 -0
- package/dist/mesh/coordinator-registry.d.ts +25 -0
- package/dist/mesh/mesh-active-work.d.ts +90 -0
- package/dist/mesh/mesh-events.d.ts +77 -5
- package/dist/mesh/mesh-fast-forward.d.ts +39 -0
- package/dist/mesh/mesh-host-ownership.d.ts +9 -0
- package/dist/mesh/mesh-ledger.d.ts +58 -1
- package/dist/mesh/mesh-refine-status.d.ts +26 -0
- package/dist/mesh/mesh-work-queue.d.ts +44 -5
- package/dist/mesh/preview-freshness.d.ts +18 -0
- package/dist/mesh/refine-config.d.ts +193 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +113 -0
- package/dist/providers/approval-utils.d.ts +9 -0
- package/dist/providers/cli-provider-instance.d.ts +6 -1
- package/dist/providers/contracts.d.ts +50 -5
- package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -0
- package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
- package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
- package/dist/providers/native-history/index.d.ts +11 -0
- package/dist/providers/provider-loader.d.ts +19 -1
- package/dist/providers/read-chat-contract.d.ts +29 -0
- package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
- package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +85 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +64 -0
- package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
- package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
- package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
- package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
- package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
- package/dist/providers/sdk/v1/index.d.ts +30 -0
- package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
- package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
- package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
- package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
- package/dist/providers/sdk/v1/types/common/index.d.ts +169 -0
- package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
- package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
- package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
- package/dist/providers/transcript-v2.d.ts +176 -0
- package/dist/repo-mesh-types.d.ts +67 -0
- package/dist/shared-types.d.ts +12 -0
- package/dist/status/reporter.d.ts +2 -0
- package/dist/status/snapshot.d.ts +1 -0
- package/dist/types.d.ts +5 -0
- package/package.json +6 -2
- package/src/boot/daemon-lifecycle.ts +17 -10
- package/src/boot/process-hardening.ts +89 -0
- package/src/chat/source-machine.ts +534 -0
- package/src/chat/source-resolver.ts +0 -0
- package/src/chat/subscription-updates.ts +14 -1
- package/src/cli-adapter-types.d.ts +1 -0
- package/src/cli-adapter-types.ts +3 -1
- package/src/cli-adapters/cli-script-runner.ts +421 -0
- package/src/cli-adapters/cli-state-engine.ts +1086 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +664 -1137
- package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
- package/src/cli-adapters/provider-cli-parse.ts +13 -0
- package/src/cli-adapters/provider-cli-runtime.ts +3 -1
- package/src/cli-adapters/provider-cli-shared.d.ts +2 -0
- package/src/cli-adapters/provider-cli-shared.ts +57 -11
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +17 -1
- package/src/cli-adapters/terminal-backends/xterm-backend.ts +8 -1
- package/src/commands/chat-commands.ts +1451 -52
- package/src/commands/cli-manager.ts +184 -3
- package/src/commands/handler.ts +547 -2
- package/src/commands/mesh-coordinator.ts +13 -143
- package/src/commands/router.ts +3273 -428
- package/src/config/chat-history.ts +79 -24
- package/src/config/config.ts +12 -0
- package/src/config/mesh-config.ts +249 -2
- package/src/config/recent-activity.ts +8 -2
- package/src/daemon/dev-cli-debug.ts +10 -1
- package/src/detection/ide-detector.ts +26 -16
- package/src/git/git-commands.ts +17 -5
- package/src/git/git-worktree.ts +8 -1
- package/src/index.ts +72 -5
- package/src/installer.d.ts +1 -1
- package/src/installer.ts +8 -6
- package/src/ipc/local-ipc-server.ts +278 -0
- package/src/launch.d.ts +1 -1
- package/src/launch.ts +37 -28
- package/src/logging/async-batch-writer.ts +55 -0
- package/src/logging/logger.ts +2 -1
- package/src/mesh/beads-db.ts +479 -0
- package/src/mesh/contracts.ts +329 -0
- package/src/mesh/coordinator-prompt.ts +40 -22
- package/src/mesh/coordinator-registry.ts +75 -0
- package/src/mesh/mesh-active-work.ts +437 -0
- package/src/mesh/mesh-events.ts +820 -61
- package/src/mesh/mesh-fast-forward.ts +430 -0
- package/src/mesh/mesh-host-ownership.ts +73 -0
- package/src/mesh/mesh-ledger.ts +457 -104
- package/src/mesh/mesh-refine-status.ts +144 -0
- package/src/mesh/mesh-work-queue.ts +216 -158
- package/src/mesh/preview-freshness.ts +118 -0
- package/src/mesh/refine-config.ts +366 -0
- package/src/mesh/worktree-bootstrap-config.ts +247 -0
- package/src/providers/approval-utils.ts +39 -5
- package/src/providers/chat-message-normalization.ts +4 -11
- package/src/providers/cli-provider-instance.ts +380 -44
- package/src/providers/contracts.ts +52 -5
- package/src/providers/ide-provider-instance.ts +17 -3
- package/src/providers/native-history/antigravity-cli-transcript.ts +643 -0
- package/src/providers/native-history/claude-cli-transcript.ts +396 -0
- package/src/providers/native-history/codex-cli-transcript.ts +419 -0
- package/src/providers/native-history/index.ts +23 -0
- package/src/providers/provider-loader.ts +294 -28
- package/src/providers/provider-schema.ts +31 -13
- package/src/providers/read-chat-contract.ts +76 -16
- package/src/providers/sdk/README.md +49 -0
- package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
- package/src/providers/sdk/v1/builders/cli/detect-status.ts +262 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval.ts +245 -0
- package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
- package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
- package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
- package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
- package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
- package/src/providers/sdk/v1/index.ts +152 -0
- package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
- package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
- package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
- package/src/providers/sdk/v1/schemas/cli/provider.schema.json +444 -0
- package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
- package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +119 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
- package/src/providers/sdk/v1/types/cli/index.ts +365 -0
- package/src/providers/sdk/v1/types/common/index.ts +210 -0
- package/src/providers/sdk/v1/validators/index.ts +19 -0
- package/src/providers/sdk/v1/validators/manifest.ts +110 -0
- package/src/providers/sdk/v1/validators/taint.ts +309 -0
- package/src/providers/transcript-v2.ts +567 -0
- package/src/providers/version-archive.ts +38 -20
- package/src/repo-mesh-types.ts +77 -0
- package/src/shared-types.ts +9 -0
- package/src/status/builders.ts +23 -6
- package/src/status/reporter.ts +15 -0
- package/src/status/snapshot.ts +35 -11
- package/src/system/host-memory.ts +29 -12
- package/src/types.ts +5 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "adhdev:tui/spinner@1",
|
|
4
|
+
"title": "tui/spinner — v1",
|
|
5
|
+
"description": "Declares which patterns in the PTY/screen text indicate the agent is actively generating. The daemon's status state machine fires `generating` when any pattern matches inside the configured scope window. Codex's `Working (8m 56s • esc to interrupt)`, Claude's braille spinner, and Antigravity's `Thinking…` are all expressible with this primitive.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["$schema", "patterns"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": {
|
|
11
|
+
"const": "adhdev:tui/spinner@1"
|
|
12
|
+
},
|
|
13
|
+
"patterns": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"minItems": 1,
|
|
16
|
+
"description": "List of patterns. Any match within the scope window classifies the screen as generating.",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"required": ["regex"],
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"properties": {
|
|
22
|
+
"regex": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "ECMAScript regex source. Daemon compiles with the flags below."
|
|
25
|
+
},
|
|
26
|
+
"flags": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"pattern": "^[gimsuy]*$",
|
|
29
|
+
"default": "i"
|
|
30
|
+
},
|
|
31
|
+
"description": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Author-facing note explaining when this pattern fires."
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"scope": {
|
|
39
|
+
"description": "Where in the text the patterns are searched. Defaults to `live-frame-tail` which mirrors the safest production behaviour (avoids matching scrollback or earlier turns).",
|
|
40
|
+
"default": "live-frame-tail",
|
|
41
|
+
"oneOf": [
|
|
42
|
+
{
|
|
43
|
+
"const": "live-frame-tail",
|
|
44
|
+
"title": "Live frame tail",
|
|
45
|
+
"description": "Last N lines of the visible screen, where N is `scopeWindowLines` (default 8). Recommended for most providers."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"const": "whole-screen",
|
|
49
|
+
"title": "Whole screen",
|
|
50
|
+
"description": "Match anywhere in the current screen text. Use with caution; tends to false-positive on scrollback."
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"const": "recent-buffer",
|
|
54
|
+
"title": "Recent buffer",
|
|
55
|
+
"description": "Last ~1000 chars of accumulated buffer. Useful when the spinner is in raw byte stream but not in the rendered screen yet."
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"scopeWindowLines": {
|
|
60
|
+
"type": "integer",
|
|
61
|
+
"minimum": 1,
|
|
62
|
+
"maximum": 64,
|
|
63
|
+
"default": 8,
|
|
64
|
+
"description": "Number of trailing lines considered the live frame when scope is `live-frame-tail`."
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"examples": [
|
|
68
|
+
{
|
|
69
|
+
"$schema": "adhdev:tui/spinner@1",
|
|
70
|
+
"patterns": [
|
|
71
|
+
{ "regex": "(?:Thinking|Working) \\([0-9hms\\s]+", "flags": "i", "description": "Codex/Claude elapsed-time spinner" },
|
|
72
|
+
{ "regex": "esc to (?:cancel|interrupt|stop)", "flags": "i" }
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"$schema": "adhdev:tui/spinner@1",
|
|
77
|
+
"scope": "whole-screen",
|
|
78
|
+
"patterns": [
|
|
79
|
+
{ "regex": "[⠁-⣿]", "description": "Braille spinner glyphs" }
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "adhdev:tui/transcript-pty@1",
|
|
4
|
+
"title": "TUI transcript extraction (PTY screen)",
|
|
5
|
+
"description": "Declarative rules for extracting user/assistant/tool messages from a PTY screen buffer. Composed with detect-status + parse-approval to yield a full parseSession output without provider-specific JavaScript.\n\nThe extraction model: each line in the screen is classified as one of {assistant, user, tool, chrome, continuation}. Adjacent lines of the same role (or marked as continuations) get grouped into a single message. Chrome lines are skipped.\n\nWith just this primitive declared, a verified/declarative-only provider can produce a working transcript from PTY output alone, no parse_output.js required.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["assistantPrefix"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": { "const": "adhdev:tui/transcript-pty@1" },
|
|
11
|
+
"assistantPrefix": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"additionalProperties": false,
|
|
14
|
+
"required": ["regex"],
|
|
15
|
+
"description": "Regex that matches the leading character/string of an assistant message line. Capture group 1 is the rest of the line (the message content for this line). Examples: Claude `^[⏺]\\s+(.*)$`, Codex `^>\\s+(.*)$`.",
|
|
16
|
+
"properties": {
|
|
17
|
+
"regex": { "type": "string" },
|
|
18
|
+
"flags": { "type": "string", "default": "" }
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"userPrefix": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"required": ["regex"],
|
|
25
|
+
"description": "Optional: regex that matches the user's submitted prompt line on screen (post-echo). When omitted, user messages are tracked via input echo correlation only.",
|
|
26
|
+
"properties": {
|
|
27
|
+
"regex": { "type": "string" },
|
|
28
|
+
"flags": { "type": "string", "default": "" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"toolPrefix": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"required": ["regex"],
|
|
35
|
+
"description": "Optional: regex that matches lines emitted by tool calls. By default these are surfaced as `kind: 'tool'` messages. Examples: Claude `^[⎿]\\s+(.*)$`, Codex `^[•]\\s+(.*)$`.",
|
|
36
|
+
"properties": {
|
|
37
|
+
"regex": { "type": "string" },
|
|
38
|
+
"flags": { "type": "string", "default": "" },
|
|
39
|
+
"skip": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"default": false,
|
|
42
|
+
"description": "When true, tool lines are silently dropped from the transcript instead of being emitted as `kind: 'tool'` messages."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"continuationLine": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"additionalProperties": false,
|
|
49
|
+
"description": "How to recognize continuation lines (no prefix) that belong to the previous message. Default rule: any non-empty line that is not chrome and has no role prefix continues the previous message.",
|
|
50
|
+
"properties": {
|
|
51
|
+
"indented": {
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"default": false,
|
|
54
|
+
"description": "When true, only lines starting with whitespace are continuation lines. When false (default), any unprefixed non-chrome non-empty line is a continuation."
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"chromePatterns": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"required": ["regex"],
|
|
64
|
+
"properties": {
|
|
65
|
+
"regex": { "type": "string" },
|
|
66
|
+
"flags": { "type": "string", "default": "" },
|
|
67
|
+
"label": { "type": "string" }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"description": "Lines matching any of these regexes are treated as chrome and excluded from messages. Use this for shell prompts, footer hints, copyright banners, etc."
|
|
71
|
+
},
|
|
72
|
+
"stripLeadingChrome": {
|
|
73
|
+
"type": "boolean",
|
|
74
|
+
"default": true,
|
|
75
|
+
"description": "When true, leading welcome/banner lines (before the first user or assistant prefix is seen) are dropped."
|
|
76
|
+
},
|
|
77
|
+
"scope": {
|
|
78
|
+
"enum": ["screen", "buffer", "tail"],
|
|
79
|
+
"default": "buffer",
|
|
80
|
+
"description": "Which input field to parse: rendered screen text, full buffer (default), or tail string. Most providers use buffer because the screen alone loses scrollback."
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "adhdev:tui/visible-region@1",
|
|
4
|
+
"title": "TUI visible region",
|
|
5
|
+
"description": "Defines which portion of the rendered terminal screen counts as 'visible' for detectStatus / parseApproval / parseSession dispatch. Used to scope matchers away from off-screen scrollback or header chrome. Without a visible-region declaration, daemon falls back to the entire accumulator buffer.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["scope"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": { "const": "adhdev:tui/visible-region@1" },
|
|
11
|
+
"scope": {
|
|
12
|
+
"enum": ["screen", "tail", "buffer", "between-anchors"],
|
|
13
|
+
"description": "screen=current rendered viewport, tail=last N chars, buffer=full accumulated buffer, between-anchors=between most recent top/bottom anchor lines."
|
|
14
|
+
},
|
|
15
|
+
"tailChars": {
|
|
16
|
+
"type": "integer",
|
|
17
|
+
"minimum": 1,
|
|
18
|
+
"default": 4000,
|
|
19
|
+
"description": "Used when scope=tail."
|
|
20
|
+
},
|
|
21
|
+
"anchors": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"description": "Used when scope=between-anchors.",
|
|
25
|
+
"properties": {
|
|
26
|
+
"top": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"required": ["pattern"],
|
|
30
|
+
"properties": {
|
|
31
|
+
"pattern": { "type": "string" },
|
|
32
|
+
"flags": { "type": "string" }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"bottom": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"required": ["pattern"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"pattern": { "type": "string" },
|
|
41
|
+
"flags": { "type": "string" }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"selectAnchor": {
|
|
47
|
+
"enum": ["first", "last"],
|
|
48
|
+
"default": "first",
|
|
49
|
+
"description": "When multiple matches exist for the anchor pair, pick the first or last. Antigravity uses `last` to anchor on the most recent prompt separator and exclude scrollback above it; codex's similar pattern also benefits from `last`."
|
|
50
|
+
},
|
|
51
|
+
"stripCues": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"description": "Optional list of primitive $ids whose matches should be masked out of the visible region before downstream dispatch. Common: footer-chrome, welcome-screen.",
|
|
54
|
+
"items": { "type": "string" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "adhdev:tui/welcome-screen@1",
|
|
4
|
+
"title": "TUI welcome screen",
|
|
5
|
+
"description": "Declares cues that identify the cold-start welcome / splash region of a CLI agent. Daemon uses this to suppress assistant-block / message extraction during the boot phase, so the splash banner is not turned into a fake assistant message.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["cues"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": { "const": "adhdev:tui/welcome-screen@1" },
|
|
11
|
+
"cues": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"minItems": 1,
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": ["pattern"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"pattern": { "type": "string" },
|
|
20
|
+
"flags": { "type": "string" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"dismissAfter": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"description": "How the welcome state ends. Default: first prompt-marker sighting.",
|
|
28
|
+
"properties": {
|
|
29
|
+
"onPromptMarker": { "type": "boolean", "default": true },
|
|
30
|
+
"onUserEcho": { "type": "boolean", "default": true },
|
|
31
|
+
"onAssistantBlock": { "type": "boolean", "default": false }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI provider types — v1.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the contract documented in
|
|
5
|
+
* adhdev-providers/docs/provider-contract/cli/v1.md.
|
|
6
|
+
*
|
|
7
|
+
* Extracted at build time into the Apache 2.0 npm package
|
|
8
|
+
* `@adhdev/provider-types`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
SettingsDef,
|
|
13
|
+
CapabilitiesDef,
|
|
14
|
+
SpawnDef,
|
|
15
|
+
TimeoutsDef,
|
|
16
|
+
ResumeDef,
|
|
17
|
+
MeshCoordinatorDef,
|
|
18
|
+
CompatibilityEntryDef,
|
|
19
|
+
ControlDef,
|
|
20
|
+
ProviderLifecycleStatus,
|
|
21
|
+
} from '../common/index.js';
|
|
22
|
+
|
|
23
|
+
// ─── Screen snapshot types — used by all handlers ───────────────────────
|
|
24
|
+
|
|
25
|
+
export interface CliScreenLine {
|
|
26
|
+
text: string;
|
|
27
|
+
/** Number of visible columns the line occupies. */
|
|
28
|
+
width: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CliScreenSnapshot {
|
|
32
|
+
text: string;
|
|
33
|
+
lineCount: number;
|
|
34
|
+
lines: CliScreenLine[];
|
|
35
|
+
nonEmptyLines: CliScreenLine[];
|
|
36
|
+
firstNonEmptyLineIndex: number;
|
|
37
|
+
lastNonEmptyLineIndex: number;
|
|
38
|
+
firstNonEmptyLine: CliScreenLine | null;
|
|
39
|
+
lastNonEmptyLine: CliScreenLine | null;
|
|
40
|
+
promptLineIndex: number;
|
|
41
|
+
promptLine: CliScreenLine | null;
|
|
42
|
+
linesAbovePrompt: CliScreenLine[];
|
|
43
|
+
linesBelowPrompt: CliScreenLine[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ─── Chat message — output shape from parseSession.messages ────────────
|
|
47
|
+
|
|
48
|
+
export type CliChatRole = 'user' | 'assistant' | 'system' | 'tool';
|
|
49
|
+
export type CliChatKind = 'standard' | 'tool' | 'thinking' | 'system';
|
|
50
|
+
export type CliBubbleState = 'visible' | 'collapsed' | 'hidden';
|
|
51
|
+
|
|
52
|
+
export interface CliChatMessage {
|
|
53
|
+
role: CliChatRole;
|
|
54
|
+
/** Plain string is the common case; rich content (arrays / objects) is permitted but parsing differs by category. */
|
|
55
|
+
content: string | unknown;
|
|
56
|
+
timestamp?: number;
|
|
57
|
+
receivedAt?: number;
|
|
58
|
+
kind?: CliChatKind | string;
|
|
59
|
+
/** Stable id from the agent's native history when available. */
|
|
60
|
+
id?: string;
|
|
61
|
+
/** Display index, can drift. Prefer `providerUnitKey` for stable identity. */
|
|
62
|
+
index?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Stable per-message identity used by ChatSourceMachine to compare native
|
|
65
|
+
* vs PTY transcripts. When the provider supports native history, this
|
|
66
|
+
* should be derivable from the on-disk session-id + turn-number.
|
|
67
|
+
*/
|
|
68
|
+
providerUnitKey?: string;
|
|
69
|
+
bubbleId?: string;
|
|
70
|
+
bubbleState?: CliBubbleState;
|
|
71
|
+
senderName?: string;
|
|
72
|
+
meta?: Record<string, unknown>;
|
|
73
|
+
/** Provider-specific extensions are permitted; daemon ignores unknown keys. */
|
|
74
|
+
[extra: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ─── Approval modal ────────────────────────────────────────────────────
|
|
78
|
+
|
|
79
|
+
export interface CliApprovalModal {
|
|
80
|
+
message: string;
|
|
81
|
+
/** Raw button labels as the user sees them. Do not rewrite. */
|
|
82
|
+
buttons: string[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ─── Inputs ────────────────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Provided to `parseSession` and `parseOutput`. The richest input shape.
|
|
89
|
+
*/
|
|
90
|
+
export interface CliScriptInput {
|
|
91
|
+
/** Accumulated PTY output, ANSI cleaned. */
|
|
92
|
+
buffer: string;
|
|
93
|
+
/** Raw PTY bytes including ANSI sequences. */
|
|
94
|
+
rawBuffer: string;
|
|
95
|
+
/** Last ~1000 chars of buffer. */
|
|
96
|
+
recentBuffer: string;
|
|
97
|
+
/** The terminal screen as rendered by ghostty/xterm. */
|
|
98
|
+
screenText: string;
|
|
99
|
+
workspace?: string;
|
|
100
|
+
/** Same as workspace; legacy alias. */
|
|
101
|
+
workingDir?: string;
|
|
102
|
+
/** Last known provider session id. May be empty. */
|
|
103
|
+
providerSessionId?: string;
|
|
104
|
+
/** Alias used for some native-history flows. */
|
|
105
|
+
historySessionId?: string;
|
|
106
|
+
screen: CliScreenSnapshot;
|
|
107
|
+
bufferScreen: CliScreenSnapshot;
|
|
108
|
+
recentScreen: CliScreenSnapshot;
|
|
109
|
+
/** Accumulated from previous parse calls. */
|
|
110
|
+
messages: CliChatMessage[];
|
|
111
|
+
/** Current in-flight assistant text. */
|
|
112
|
+
partialResponse: string;
|
|
113
|
+
isWaitingForResponse?: boolean;
|
|
114
|
+
/** The user's prompt for the active turn. */
|
|
115
|
+
promptText?: string;
|
|
116
|
+
/** Provider settings from ~/.adhdev/config.json. */
|
|
117
|
+
settings?: Record<string, unknown>;
|
|
118
|
+
/** Command-specific args (e.g. handler invocation parameters). */
|
|
119
|
+
args?: Record<string, unknown>;
|
|
120
|
+
/** ms timestamp of process spawn. Useful for native rollover guards. */
|
|
121
|
+
spawnAt?: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Provided to `detectStatus`. Trimmed for hot-path performance.
|
|
126
|
+
*/
|
|
127
|
+
export interface CliStatusInput {
|
|
128
|
+
tail: string;
|
|
129
|
+
screenText?: string;
|
|
130
|
+
rawBuffer?: string;
|
|
131
|
+
isWaitingForResponse?: boolean;
|
|
132
|
+
screen: CliScreenSnapshot;
|
|
133
|
+
tailScreen: CliScreenSnapshot;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Provided to `parseApproval`.
|
|
138
|
+
*/
|
|
139
|
+
export interface CliApprovalInput {
|
|
140
|
+
buffer: string;
|
|
141
|
+
screenText?: string;
|
|
142
|
+
rawBuffer?: string;
|
|
143
|
+
tail: string;
|
|
144
|
+
screen: CliScreenSnapshot;
|
|
145
|
+
bufferScreen: CliScreenSnapshot;
|
|
146
|
+
tailScreen: CliScreenSnapshot;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ─── Outputs ───────────────────────────────────────────────────────────
|
|
150
|
+
|
|
151
|
+
export type CliStatus = 'idle' | 'generating' | 'waiting_approval' | 'starting' | 'error';
|
|
152
|
+
export type CliTranscriptAuthority = 'provider' | 'daemon';
|
|
153
|
+
export type CliTranscriptCoverage = 'full' | 'tail' | 'current-turn';
|
|
154
|
+
|
|
155
|
+
export interface CliParsedSession {
|
|
156
|
+
status: CliStatus;
|
|
157
|
+
messages: CliChatMessage[];
|
|
158
|
+
modal: CliApprovalModal | null;
|
|
159
|
+
parsedStatus?: string | null;
|
|
160
|
+
errorMessage?: string;
|
|
161
|
+
errorReason?: string;
|
|
162
|
+
providerSessionId?: string;
|
|
163
|
+
transcriptAuthority?: CliTranscriptAuthority;
|
|
164
|
+
coverage?: CliTranscriptCoverage;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface CliReadChatPayload {
|
|
168
|
+
id: 'cli_session' | string;
|
|
169
|
+
status: CliStatus;
|
|
170
|
+
title: string;
|
|
171
|
+
messages: CliChatMessage[];
|
|
172
|
+
activeModal: CliApprovalModal | null;
|
|
173
|
+
providerSessionId?: string;
|
|
174
|
+
transcriptAuthority?: CliTranscriptAuthority;
|
|
175
|
+
coverage?: CliTranscriptCoverage;
|
|
176
|
+
controlValues?: Record<string, unknown>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ─── Handler function signatures ───────────────────────────────────────
|
|
180
|
+
|
|
181
|
+
export type CliCreateStateFn<S = Record<string, unknown>> = () => S;
|
|
182
|
+
|
|
183
|
+
export type CliParseSessionFn<S = unknown> = (
|
|
184
|
+
state: S | undefined,
|
|
185
|
+
input: CliScriptInput,
|
|
186
|
+
) => CliParsedSession;
|
|
187
|
+
|
|
188
|
+
export type CliDetectStatusFn = (
|
|
189
|
+
input: CliStatusInput,
|
|
190
|
+
) => CliStatus | null;
|
|
191
|
+
|
|
192
|
+
export type CliParseApprovalFn = (
|
|
193
|
+
input: CliApprovalInput,
|
|
194
|
+
) => CliApprovalModal | null;
|
|
195
|
+
|
|
196
|
+
export type CliParseOutputFn<S = unknown> = (
|
|
197
|
+
state: S | undefined,
|
|
198
|
+
input: CliScriptInput,
|
|
199
|
+
) => CliReadChatPayload;
|
|
200
|
+
|
|
201
|
+
// ─── Capability handlers ───────────────────────────────────────────────
|
|
202
|
+
|
|
203
|
+
export interface CliCapabilityHandlerResult {
|
|
204
|
+
ok?: boolean;
|
|
205
|
+
writeRaw?: string;
|
|
206
|
+
sendMessage?: string;
|
|
207
|
+
result?: unknown;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export type CliCapabilityHandlerFn<S = unknown> = (
|
|
211
|
+
state: S | undefined,
|
|
212
|
+
input: CliScriptInput,
|
|
213
|
+
) => CliCapabilityHandlerResult;
|
|
214
|
+
|
|
215
|
+
// ─── Native history ────────────────────────────────────────────────────
|
|
216
|
+
|
|
217
|
+
export interface CliNativeHistoryReadInput {
|
|
218
|
+
historySessionId?: string;
|
|
219
|
+
workspace?: string;
|
|
220
|
+
/** ms timestamp of provider spawn. Use to reject pre-spawn rollovers. */
|
|
221
|
+
spawnAt?: number;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface CliNativeHistoryMessage {
|
|
225
|
+
role: CliChatRole;
|
|
226
|
+
content: unknown;
|
|
227
|
+
kind?: CliChatKind | string;
|
|
228
|
+
providerUnitKey?: string;
|
|
229
|
+
receivedAt?: number;
|
|
230
|
+
workspace?: string;
|
|
231
|
+
historySessionId?: string;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface CliNativeHistoryReadResult {
|
|
235
|
+
source: 'provider-native';
|
|
236
|
+
providerSessionId: string;
|
|
237
|
+
messages: CliNativeHistoryMessage[];
|
|
238
|
+
sourcePath: string;
|
|
239
|
+
sourceMtimeMs: number;
|
|
240
|
+
nativeHistoryCoverage: CliTranscriptCoverage;
|
|
241
|
+
workspace?: string;
|
|
242
|
+
unavailableReason?: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export type CliReadNativeHistoryFn = (
|
|
246
|
+
input: CliNativeHistoryReadInput,
|
|
247
|
+
) => CliNativeHistoryReadResult | null;
|
|
248
|
+
|
|
249
|
+
export interface CliListNativeHistoryEntry {
|
|
250
|
+
providerSessionId: string;
|
|
251
|
+
title?: string;
|
|
252
|
+
workspace?: string;
|
|
253
|
+
receivedAt?: number;
|
|
254
|
+
messageCount?: number;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export type CliListNativeHistoryFn = () => {
|
|
258
|
+
sessions: CliListNativeHistoryEntry[];
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// ─── Native history config ─────────────────────────────────────────────
|
|
262
|
+
|
|
263
|
+
export interface CliNativeHistoryDef {
|
|
264
|
+
/** Built-in adapter $schema (e.g. "adhdev:native-history/claude-jsonl@1"). */
|
|
265
|
+
$schema?: string;
|
|
266
|
+
format: string;
|
|
267
|
+
watchPath: string;
|
|
268
|
+
mode: 'native-source' | 'daemon-mirror';
|
|
269
|
+
contractVersion?: string;
|
|
270
|
+
scripts?: {
|
|
271
|
+
readSession?: string;
|
|
272
|
+
listSessions?: string;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @deprecated Use {@link CliNativeHistoryDef}. Retained as an alias for one
|
|
278
|
+
* release so SDK consumers that referenced the v0 name keep compiling.
|
|
279
|
+
*/
|
|
280
|
+
export type CliCanonicalHistoryDef = CliNativeHistoryDef;
|
|
281
|
+
|
|
282
|
+
// ─── Patterns (legacy fallback detector hints) ─────────────────────────
|
|
283
|
+
|
|
284
|
+
export interface CliPatternEntry {
|
|
285
|
+
source: string;
|
|
286
|
+
flags?: string;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface CliPatternsDef {
|
|
290
|
+
prompt?: CliPatternEntry[];
|
|
291
|
+
generating?: CliPatternEntry[];
|
|
292
|
+
approval?: CliPatternEntry[];
|
|
293
|
+
ready?: CliPatternEntry[];
|
|
294
|
+
dialog?: CliPatternEntry[];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// ─── Manifest ──────────────────────────────────────────────────────────
|
|
298
|
+
|
|
299
|
+
export interface CliProviderManifest {
|
|
300
|
+
/** Identity */
|
|
301
|
+
type: string;
|
|
302
|
+
name: string;
|
|
303
|
+
displayName?: string;
|
|
304
|
+
category: 'cli';
|
|
305
|
+
icon?: string;
|
|
306
|
+
aliases?: ReadonlyArray<string>;
|
|
307
|
+
|
|
308
|
+
/** Versioning */
|
|
309
|
+
engines?: { adhdev?: string };
|
|
310
|
+
providerVersion?: string;
|
|
311
|
+
contractVersion?: number | string;
|
|
312
|
+
status?: ProviderLifecycleStatus;
|
|
313
|
+
details?: string;
|
|
314
|
+
disableUpstream?: boolean;
|
|
315
|
+
|
|
316
|
+
/** Process spawn */
|
|
317
|
+
binary: string;
|
|
318
|
+
versionCommand?: string;
|
|
319
|
+
spawn: SpawnDef;
|
|
320
|
+
|
|
321
|
+
/** Input/output behavior */
|
|
322
|
+
sendDelayMs?: number;
|
|
323
|
+
sendKey?: string;
|
|
324
|
+
submitStrategy?: 'wait_for_echo' | 'immediate';
|
|
325
|
+
requirePromptEchoBeforeSubmit?: boolean;
|
|
326
|
+
allowInputDuringGeneration?: boolean;
|
|
327
|
+
requiresFinalAssistantBeforeIdle?: boolean;
|
|
328
|
+
augmentStaleSnapshot?: boolean;
|
|
329
|
+
transcriptAuthority?: CliTranscriptAuthority;
|
|
330
|
+
transcriptContext?: 'full' | 'tail';
|
|
331
|
+
|
|
332
|
+
/** Patterns (legacy fallback) */
|
|
333
|
+
patterns?: CliPatternsDef;
|
|
334
|
+
|
|
335
|
+
/** Approval */
|
|
336
|
+
approvalKeys?: Readonly<Record<string, string>>;
|
|
337
|
+
approvalPositiveHints?: ReadonlyArray<string>;
|
|
338
|
+
|
|
339
|
+
/** Timeouts */
|
|
340
|
+
timeouts?: TimeoutsDef;
|
|
341
|
+
|
|
342
|
+
/** Resume */
|
|
343
|
+
resume?: ResumeDef;
|
|
344
|
+
|
|
345
|
+
/** Compatibility */
|
|
346
|
+
compatibility: ReadonlyArray<CompatibilityEntryDef>;
|
|
347
|
+
defaultScriptDir?: string;
|
|
348
|
+
|
|
349
|
+
/** Capabilities advertised to the dashboard */
|
|
350
|
+
capabilities?: CapabilitiesDef;
|
|
351
|
+
|
|
352
|
+
/** Mesh coordinator setup */
|
|
353
|
+
meshCoordinator?: MeshCoordinatorDef;
|
|
354
|
+
|
|
355
|
+
/** Native history (v1 canonical field name) */
|
|
356
|
+
nativeHistory?: CliNativeHistoryDef;
|
|
357
|
+
/** @deprecated v0 alias for `nativeHistory`. */
|
|
358
|
+
canonicalHistory?: CliCanonicalHistoryDef;
|
|
359
|
+
|
|
360
|
+
/** Settings (UI toggles persisted to ~/.adhdev/config.json) */
|
|
361
|
+
settings?: SettingsDef;
|
|
362
|
+
|
|
363
|
+
/** Controls (dashboard chips/buttons) */
|
|
364
|
+
controls?: ReadonlyArray<ControlDef>;
|
|
365
|
+
}
|