@adhdev/daemon-core 0.9.82-rc.142 → 0.9.82-rc.144

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.
Files changed (91) hide show
  1. package/dist/boot/process-hardening.d.ts +50 -0
  2. package/dist/cli-adapters/cli-script-runner.d.ts +73 -1
  3. package/dist/cli-adapters/provider-cli-adapter.d.ts +17 -0
  4. package/dist/cli-adapters/provider-cli-shared.d.ts +6 -0
  5. package/dist/commands/handler.d.ts +66 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +2876 -403
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +2890 -424
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/ipc/local-ipc-server.d.ts +91 -0
  12. package/dist/providers/contracts.d.ts +8 -0
  13. package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -0
  14. package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
  15. package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
  16. package/dist/providers/native-history/index.d.ts +11 -0
  17. package/dist/providers/provider-loader.d.ts +19 -1
  18. package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
  19. package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +85 -0
  20. package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
  21. package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +64 -0
  22. package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +82 -0
  23. package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
  24. package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
  25. package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
  26. package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
  27. package/dist/providers/sdk/v1/index.d.ts +30 -0
  28. package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
  29. package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
  30. package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
  31. package/dist/providers/sdk/v1/types/cli/index.d.ts +268 -0
  32. package/dist/providers/sdk/v1/types/common/index.d.ts +169 -0
  33. package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
  34. package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
  35. package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
  36. package/package.json +4 -2
  37. package/src/boot/daemon-lifecycle.ts +14 -10
  38. package/src/boot/process-hardening.ts +89 -0
  39. package/src/cli-adapters/cli-script-runner.ts +289 -13
  40. package/src/cli-adapters/cli-state-engine.ts +8 -5
  41. package/src/cli-adapters/provider-cli-adapter.ts +36 -2
  42. package/src/cli-adapters/provider-cli-shared.ts +6 -0
  43. package/src/commands/chat-commands.ts +22 -1
  44. package/src/commands/cli-manager.ts +39 -0
  45. package/src/commands/handler.ts +539 -1
  46. package/src/commands/router.ts +1 -0
  47. package/src/index.ts +27 -0
  48. package/src/ipc/local-ipc-server.ts +278 -0
  49. package/src/providers/cli-provider-instance.ts +15 -0
  50. package/src/providers/contracts.ts +8 -0
  51. package/src/providers/native-history/antigravity-cli-transcript.ts +643 -0
  52. package/src/providers/native-history/claude-cli-transcript.ts +396 -0
  53. package/src/providers/native-history/codex-cli-transcript.ts +419 -0
  54. package/src/providers/native-history/index.ts +23 -0
  55. package/src/providers/provider-loader.ts +258 -17
  56. package/src/providers/provider-schema.ts +3 -0
  57. package/src/providers/sdk/README.md +49 -0
  58. package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
  59. package/src/providers/sdk/v1/builders/cli/detect-status.ts +262 -0
  60. package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
  61. package/src/providers/sdk/v1/builders/cli/parse-approval.ts +245 -0
  62. package/src/providers/sdk/v1/builders/cli/parse-session.ts +247 -0
  63. package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
  64. package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
  65. package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
  66. package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
  67. package/src/providers/sdk/v1/index.ts +151 -0
  68. package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
  69. package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
  70. package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
  71. package/src/providers/sdk/v1/schemas/cli/provider.schema.json +428 -0
  72. package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
  73. package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
  74. package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
  75. package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
  76. package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
  77. package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
  78. package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
  79. package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
  80. package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +119 -0
  81. package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
  82. package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
  83. package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
  84. package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
  85. package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
  86. package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
  87. package/src/providers/sdk/v1/types/cli/index.ts +355 -0
  88. package/src/providers/sdk/v1/types/common/index.ts +210 -0
  89. package/src/providers/sdk/v1/validators/index.ts +19 -0
  90. package/src/providers/sdk/v1/validators/manifest.ts +110 -0
  91. package/src/providers/sdk/v1/validators/taint.ts +309 -0
@@ -0,0 +1,91 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/approval-squash@1",
4
+ "title": "tui/approval-squash — v1",
5
+ "description": "Recognises approval modals whose buttons + cues have been collapsed by the terminal renderer into a single squashed lowercase-alnum string (e.g. `1yescontinue2noquit`, `doyoutrustthecontentsofthisdirectory`). Codex is the canonical example: when the terminal re-flows the modal across narrow widths, the rendered text loses whitespace/punctuation but the byte order is preserved. The builder applies the manifest's `cues` to detect the modal, then the `buttonRules` to reconstruct labels.\n\nThe normalisation function is fixed: `String(value).toLowerCase().replace(/[^a-z0-9]+/g, '')`. Authors only declare which compact substrings count as cues and how to map known compact button runs back into labels.",
6
+ "type": "object",
7
+ "required": ["$schema", "cues", "buttonRules"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "const": "adhdev:tui/approval-squash@1" },
11
+ "cues": {
12
+ "type": "array",
13
+ "minItems": 1,
14
+ "description": "Compact substrings or regexes that, if found in the compacted text, identify this as an approval modal. Mix freely — daemon tries every cue.",
15
+ "items": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": ["compact"],
19
+ "properties": {
20
+ "compact": { "type": "string", "description": "Compacted (lowercase-alnum) substring." },
21
+ "kind": { "enum": ["substring", "regex"], "default": "substring" },
22
+ "label": { "type": "string", "description": "Optional category label, e.g. 'trust-folder'." },
23
+ "messageWhenMatched": { "type": "string", "description": "Human-readable message the modal builder returns when this cue matches. Use this to recover the original prose from the compacted form." }
24
+ }
25
+ }
26
+ },
27
+ "footers": {
28
+ "type": "array",
29
+ "description": "Optional compact substrings that must also be present in the compacted text to count as a real modal (e.g. 'pressentertocontinue'). Default: at least one cue is sufficient.",
30
+ "items": {
31
+ "type": "object",
32
+ "additionalProperties": false,
33
+ "required": ["compact"],
34
+ "properties": {
35
+ "compact": { "type": "string" },
36
+ "kind": { "enum": ["substring", "regex"], "default": "substring" }
37
+ }
38
+ },
39
+ "default": []
40
+ },
41
+ "buttonRules": {
42
+ "type": "array",
43
+ "minItems": 1,
44
+ "description": "Rules that map a recognised compact substring to the original labels. Tried in order; first match wins. Use this for the cases where the terminal collapsed both buttons into one rendering blob.",
45
+ "items": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "required": ["compact", "labels"],
49
+ "properties": {
50
+ "compact": { "type": "string", "description": "Compact substring (e.g. '1yescontinue2noquit') OR regex source when kind=regex." },
51
+ "kind": { "enum": ["substring", "regex"], "default": "substring" },
52
+ "labels": {
53
+ "type": "array",
54
+ "minItems": 1,
55
+ "items": { "type": "string" },
56
+ "description": "Original human-readable labels in display order."
57
+ }
58
+ }
59
+ }
60
+ },
61
+ "scope": {
62
+ "default": "tail-window",
63
+ "enum": ["tail-window", "whole-screen"]
64
+ },
65
+ "tailWindowLines": {
66
+ "type": "integer",
67
+ "minimum": 1,
68
+ "maximum": 64,
69
+ "default": 24
70
+ }
71
+ },
72
+ "examples": [
73
+ {
74
+ "$schema": "adhdev:tui/approval-squash@1",
75
+ "cues": [
76
+ { "compact": "doyoutrustthecontentsofthisdirectory", "label": "trust-folder", "messageWhenMatched": "Do you trust the contents of this directory?" },
77
+ { "compact": "workingwithuntrustedcontents", "label": "untrusted-content", "messageWhenMatched": "Working with untrusted contents" },
78
+ { "compact": "switchtogpt", "kind": "regex", "label": "rate-limit" }
79
+ ],
80
+ "footers": [
81
+ { "compact": "pressentertocontinue" },
82
+ { "compact": "esctocancel" }
83
+ ],
84
+ "buttonRules": [
85
+ { "compact": "1yescontinue2noquit", "labels": ["Yes, continue", "No, quit"] },
86
+ { "compact": "1approveandrun2deny", "labels": ["Approve and run", "Deny"] },
87
+ { "compact": "1alwaysapprove2approve3deny", "labels": ["Always approve", "Approve", "Deny"] }
88
+ ]
89
+ }
90
+ ]
91
+ }
@@ -0,0 +1,91 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/assistant-block@1",
4
+ "title": "tui/assistant-block — v1",
5
+ "description": "Declares how to extract assistant turns from the rendered transcript. The block starts at a marker (e.g. Claude `⏺`, Codex `Codex` heading) and ends at either the next user prompt or the next block marker. Each captured block becomes one assistant chat message.",
6
+ "type": "object",
7
+ "required": ["$schema", "startMarker"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "const": "adhdev:tui/assistant-block@1" },
11
+ "startMarker": {
12
+ "description": "Where an assistant block begins. Can be a plain substring or a regex.",
13
+ "oneOf": [
14
+ { "type": "string", "description": "Plain substring." },
15
+ {
16
+ "type": "object",
17
+ "required": ["regex"],
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "regex": { "type": "string" },
21
+ "flags": { "type": "string", "pattern": "^[gimsuy]*$", "default": "m" }
22
+ }
23
+ }
24
+ ]
25
+ },
26
+ "endMarker": {
27
+ "description": "Where the block ends. Common: next prompt marker or another startMarker. Defaults to \"next-user-prompt\".",
28
+ "default": "next-user-prompt",
29
+ "oneOf": [
30
+ { "const": "next-user-prompt", "title": "Stop at the next prompt marker line" },
31
+ { "const": "next-start-marker", "title": "Stop at the next startMarker" },
32
+ { "type": "string", "title": "Plain substring marker" },
33
+ {
34
+ "type": "object",
35
+ "required": ["regex"],
36
+ "additionalProperties": false,
37
+ "properties": {
38
+ "regex": { "type": "string" },
39
+ "flags": { "type": "string", "pattern": "^[gimsuy]*$", "default": "m" }
40
+ }
41
+ }
42
+ ]
43
+ },
44
+ "skipKinds": {
45
+ "type": "array",
46
+ "description": "Which sub-blocks to skip when classifying assistant turns. Tool calls and thinking blocks are usually classified separately via tui/tool-block and tui/thinking-block.",
47
+ "items": { "enum": ["tool", "thinking", "system"] },
48
+ "default": ["tool"]
49
+ },
50
+ "headerLines": {
51
+ "type": "integer",
52
+ "minimum": 0,
53
+ "default": 0,
54
+ "description": "Number of header lines after the startMarker to skip when extracting content (e.g. Codex's `Codex\\n<timestamp>` header)."
55
+ },
56
+ "trimEmptyLeading": {
57
+ "type": "boolean",
58
+ "default": true,
59
+ "description": "Whether to strip leading whitespace-only lines from the captured content."
60
+ },
61
+ "trimEmptyTrailing": {
62
+ "type": "boolean",
63
+ "default": true
64
+ },
65
+ "kind": {
66
+ "type": "string",
67
+ "default": "standard",
68
+ "description": "The CliChatMessage.kind value to stamp on captured blocks."
69
+ },
70
+ "minLength": {
71
+ "type": "integer",
72
+ "minimum": 1,
73
+ "default": 1,
74
+ "description": "Discard blocks whose captured content is shorter than this. Set higher if you have noisy short blocks (e.g. single-character paints)."
75
+ }
76
+ },
77
+ "examples": [
78
+ {
79
+ "$schema": "adhdev:tui/assistant-block@1",
80
+ "startMarker": "⏺",
81
+ "endMarker": "next-user-prompt",
82
+ "skipKinds": ["tool", "thinking"]
83
+ },
84
+ {
85
+ "$schema": "adhdev:tui/assistant-block@1",
86
+ "startMarker": { "regex": "^Codex\\s*$" },
87
+ "endMarker": "next-start-marker",
88
+ "headerLines": 1
89
+ }
90
+ ]
91
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/cue-ordering@1",
4
+ "title": "TUI cue ordering",
5
+ "description": "Declares the relative spatial order cues must occur in to be considered evidence of a state. Addresses the canonical 'idle-while-Working-still-visible' regression: spinner cue near bottom + settled prompt cue ABOVE spinner → still generating; spinner ABOVE settled prompt → stale.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["rules"],
9
+ "properties": {
10
+ "$schema": { "const": "adhdev:tui/cue-ordering@1" },
11
+ "rules": {
12
+ "type": "array",
13
+ "minItems": 1,
14
+ "items": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "required": ["name", "cues", "verdict"],
18
+ "properties": {
19
+ "name": { "type": "string" },
20
+ "cues": {
21
+ "type": "array",
22
+ "minItems": 2,
23
+ "items": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": ["primitive", "position"],
27
+ "properties": {
28
+ "primitive": {
29
+ "type": "string",
30
+ "description": "Reference to another primitive $id (e.g. adhdev:tui/spinner@1)."
31
+ },
32
+ "position": {
33
+ "enum": ["above", "below", "same-line", "any"],
34
+ "description": "Spatial relation to the NEXT cue in this array."
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "verdict": {
40
+ "enum": ["generating", "idle", "approval", "ignore"],
41
+ "description": "What to return when this ordering matches."
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/dispatch-order@1",
4
+ "title": "TUI dispatch order",
5
+ "description": "Declares the order in which detectStatus consults its primitive groups. Default order — spinner → modal → settled-prompt — is what fixed the sprint-2026-06 'idle while Working visible' regression and must be expressible in declarative manifests.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["order"],
9
+ "properties": {
10
+ "$schema": { "const": "adhdev:tui/dispatch-order@1" },
11
+ "order": {
12
+ "type": "array",
13
+ "minItems": 1,
14
+ "uniqueItems": true,
15
+ "description": "Ordered list of primitive group identifiers. Daemon evaluates them in this order; first matching group decides the verdict.",
16
+ "items": {
17
+ "enum": [
18
+ "spinner",
19
+ "modal",
20
+ "settled-prompt",
21
+ "cue-ordering",
22
+ "error-detection",
23
+ "approval-stitching"
24
+ ]
25
+ }
26
+ },
27
+ "onNoMatch": {
28
+ "enum": ["idle", "unknown", "preserve-last"],
29
+ "default": "idle"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/footer-chrome@1",
4
+ "title": "TUI footer chrome",
5
+ "description": "Declares the lines/regions that constitute the persistent CLI footer (input hint, model badge, token counter, etc.). Used to mask the footer out before running prompt-marker / spinner / settled-prompt matchers, so chrome text never gets misclassified as agent state.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["regions"],
9
+ "properties": {
10
+ "$schema": { "const": "adhdev:tui/footer-chrome@1" },
11
+ "regions": {
12
+ "type": "array",
13
+ "minItems": 1,
14
+ "description": "Ordered list of regions; the first match wins. Each region is identified by a sentinel + bounded line span.",
15
+ "items": {
16
+ "type": "object",
17
+ "additionalProperties": false,
18
+ "required": ["sentinel"],
19
+ "properties": {
20
+ "name": { "type": "string" },
21
+ "sentinel": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": ["pattern"],
25
+ "properties": {
26
+ "pattern": { "type": "string", "description": "Regex source." },
27
+ "flags": { "type": "string" }
28
+ }
29
+ },
30
+ "spanLinesBefore": { "type": "integer", "minimum": 0, "default": 0 },
31
+ "spanLinesAfter": { "type": "integer", "minimum": 0, "default": 0 },
32
+ "anchor": {
33
+ "enum": ["bottom", "any"],
34
+ "default": "bottom",
35
+ "description": "When 'bottom', region must be within the last N lines of the screen."
36
+ },
37
+ "bottomLookbackLines": { "type": "integer", "minimum": 1, "default": 12 }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/index-finder@1",
4
+ "title": "TUI index finder",
5
+ "description": "Locates the most-recent occurrence of a cue inside a rendered screen by line index — exposed as a helper primitive used by cue-ordering, settled-prompt, and visible-region. Authors don't reference this primitive directly in manifests; the runtime uses it internally when evaluating spatial relations.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["strategy"],
9
+ "properties": {
10
+ "$schema": { "const": "adhdev:tui/index-finder@1" },
11
+ "strategy": {
12
+ "enum": ["last-match", "first-match", "tail-window-only"],
13
+ "default": "last-match"
14
+ },
15
+ "tailWindowLines": {
16
+ "type": "integer",
17
+ "minimum": 1,
18
+ "default": 12,
19
+ "description": "Used when strategy=tail-window-only."
20
+ },
21
+ "ignoreInsideRegions": {
22
+ "type": "array",
23
+ "items": { "type": "string" },
24
+ "description": "Primitive $ids whose matched regions should be ignored (e.g. mask out footer-chrome lines before finding the cue)."
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,119 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/modal@1",
4
+ "title": "tui/modal — v1",
5
+ "description": "Declares how to extract an approval modal from the screen. Codex `Do you want to proceed?` + numbered list, Claude approval frame with explicit separators, Antigravity `agy wants to run:` are all expressible. The builder returns null when no modal is visible; daemon then keeps status non-waiting.",
6
+ "type": "object",
7
+ "required": ["$schema", "questionPattern", "buttonPattern"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "const": "adhdev:tui/modal@1" },
11
+ "questionPattern": {
12
+ "type": "string",
13
+ "description": "Regex source matching the question line that introduces the modal. Examples: `Do you want to proceed\\?`, `Do you trust the contents of this directory\\?`, `agy wants to run:`."
14
+ },
15
+ "questionFlags": {
16
+ "type": "string",
17
+ "pattern": "^[gimsuy]*$",
18
+ "default": "i"
19
+ },
20
+ "questionVariants": {
21
+ "type": "array",
22
+ "description": "Additional regex sources that count as the same approval kind. Each is tried in order; the first match wins.",
23
+ "items": {
24
+ "type": "object",
25
+ "required": ["regex"],
26
+ "additionalProperties": false,
27
+ "properties": {
28
+ "regex": { "type": "string" },
29
+ "flags": { "type": "string", "pattern": "^[gimsuy]*$", "default": "i" },
30
+ "label": { "type": "string", "description": "Optional category label, e.g. \"trust-folder\", \"tool-approval\"." }
31
+ }
32
+ },
33
+ "default": []
34
+ },
35
+ "buttonPattern": {
36
+ "type": "string",
37
+ "description": "Regex source matching a single button line. Capture group 1 is the button label. Example: `^[\\s❯>]*\\d+\\.\\s+(.+)$`."
38
+ },
39
+ "buttonFlags": {
40
+ "type": "string",
41
+ "pattern": "^[gimsuy]*$",
42
+ "default": "m"
43
+ },
44
+ "inlineButtonPattern": {
45
+ "type": "string",
46
+ "description": "Fallback regex for terminals that render all options on a single line (e.g. Antigravity's `[0] skip [1] yes [2] no [3] still using` survey). Used only when per-line extraction collects fewer than `minButtons`. The `g` flag is forced on by the builder; capture group 1 is the label."
47
+ },
48
+ "inlineButtonFlags": {
49
+ "type": "string",
50
+ "pattern": "^[gimsuy]*$",
51
+ "default": "gi"
52
+ },
53
+ "scope": {
54
+ "default": "between-last-two-separators",
55
+ "description": "Where on the screen the question + buttons must appear together.",
56
+ "oneOf": [
57
+ {
58
+ "const": "between-last-two-separators",
59
+ "title": "Between last two separators",
60
+ "description": "Most robust for Claude/Antigravity-style framed modals."
61
+ },
62
+ {
63
+ "const": "window-around-question",
64
+ "title": "Window around the question line",
65
+ "description": "Matches when the modal is announced by an explicit question line; collects buttons in the N lines below."
66
+ },
67
+ {
68
+ "const": "whole-screen",
69
+ "title": "Whole screen",
70
+ "description": "Use sparingly; tends to false-positive on numbered lists in assistant prose."
71
+ }
72
+ ]
73
+ },
74
+ "scopeWindowLines": {
75
+ "type": "integer",
76
+ "minimum": 2,
77
+ "maximum": 64,
78
+ "default": 16,
79
+ "description": "Lines of context around the question when scope is `window-around-question`."
80
+ },
81
+ "contextHeader": {
82
+ "type": "object",
83
+ "description": "Optional header line that should be included in the modal message text. Captures the tool name / command being approved.",
84
+ "additionalProperties": false,
85
+ "properties": {
86
+ "regex": { "type": "string" },
87
+ "flags": { "type": "string", "pattern": "^[gimsuy]*$", "default": "i" }
88
+ }
89
+ },
90
+ "continuationLines": {
91
+ "type": "boolean",
92
+ "default": false,
93
+ "description": "When true, indented lines immediately following a button line are concatenated to the previous label (handles wrapped long options like Antigravity's \"Yes, and always allow ...\")."
94
+ },
95
+ "minButtons": {
96
+ "type": "integer",
97
+ "minimum": 1,
98
+ "default": 2,
99
+ "description": "Minimum buttons required for the modal to be considered valid. Daemon's auto-approve gate also enforces buttons.length > 0."
100
+ }
101
+ },
102
+ "examples": [
103
+ {
104
+ "$schema": "adhdev:tui/modal@1",
105
+ "questionPattern": "Do you want to (?:proceed|allow|run)",
106
+ "buttonPattern": "^[\\s❯>]*\\d+\\.\\s+(.+)$",
107
+ "scope": "between-last-two-separators",
108
+ "minButtons": 2
109
+ },
110
+ {
111
+ "$schema": "adhdev:tui/modal@1",
112
+ "questionPattern": "agy wants to run:",
113
+ "buttonPattern": "^\\s*\\d+\\.\\s+(.+)$",
114
+ "scope": "window-around-question",
115
+ "continuationLines": true,
116
+ "contextHeader": { "regex": "agy wants to run:\\s*\\n?(.+)" }
117
+ }
118
+ ]
119
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/prompt-marker@1",
4
+ "title": "tui/prompt-marker — v1",
5
+ "description": "Declares how to recognize the line where the user types prompts. Used by builders to find the last user prompt, slice transcript after it, and detect when the agent is ready for input. Claude `❯`, Codex `>` and `>`, Antigravity `>`, Hermes `>` are all expressible with this primitive.",
6
+ "type": "object",
7
+ "required": ["$schema", "regex"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": {
11
+ "const": "adhdev:tui/prompt-marker@1"
12
+ },
13
+ "regex": {
14
+ "type": "string",
15
+ "description": "ECMAScript regex source matching the prompt marker. Common patterns: `^❯\\s`, `^>\\s`, `^[›❯>]\\s*$`."
16
+ },
17
+ "flags": {
18
+ "type": "string",
19
+ "pattern": "^[gimsuy]*$",
20
+ "default": "m"
21
+ },
22
+ "anchor": {
23
+ "description": "Where the regex must anchor. `line-start` (default) is the most common; the marker is at column 0. `line-end` is rare. `any` matches anywhere in a line.",
24
+ "default": "line-start",
25
+ "enum": ["line-start", "line-end", "any"]
26
+ },
27
+ "description": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "examples": [
32
+ {
33
+ "$schema": "adhdev:tui/prompt-marker@1",
34
+ "regex": "^❯\\s",
35
+ "anchor": "line-start",
36
+ "description": "Claude TUI prompt arrow"
37
+ },
38
+ {
39
+ "$schema": "adhdev:tui/prompt-marker@1",
40
+ "regex": "^>\\s*$",
41
+ "anchor": "line-start",
42
+ "description": "Codex empty prompt"
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "adhdev:tui/settled-prompt@1",
4
+ "title": "tui/settled-prompt — v1",
5
+ "description": "Declares the screen patterns that indicate the agent is idle and ready for a new prompt. Combined with `tui/spinner` (negated) and `tui/modal` (negated) by the builder to decide `idle`. Codex `❯ <model> · /shortcuts`, Claude `? for shortcuts` + `❯`, Antigravity `>` + `? for shortcuts` are all expressible.",
6
+ "type": "object",
7
+ "required": ["$schema", "regex"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": {
11
+ "const": "adhdev:tui/settled-prompt@1"
12
+ },
13
+ "regex": {
14
+ "type": "string",
15
+ "description": "ECMAScript regex source. Matched within the scope window."
16
+ },
17
+ "flags": {
18
+ "type": "string",
19
+ "pattern": "^[gimsuy]*$",
20
+ "default": "m"
21
+ },
22
+ "withFooter": {
23
+ "type": "array",
24
+ "description": "Optional auxiliary substrings or regex sources that must also be present in the scope window for the prompt to count as settled. Use this to disambiguate from mid-stream prompt-like text.",
25
+ "items": {
26
+ "type": "object",
27
+ "required": ["pattern"],
28
+ "additionalProperties": false,
29
+ "properties": {
30
+ "pattern": {
31
+ "type": "string",
32
+ "description": "Plain substring (when `kind` is omitted or `substring`) or regex source (when `kind` is `regex`)."
33
+ },
34
+ "kind": {
35
+ "enum": ["substring", "regex"],
36
+ "default": "substring"
37
+ },
38
+ "flags": {
39
+ "type": "string",
40
+ "pattern": "^[gimsuy]*$",
41
+ "default": "i"
42
+ }
43
+ }
44
+ }
45
+ },
46
+ "scope": {
47
+ "default": "last-n-lines",
48
+ "enum": ["last-n-lines", "whole-screen"]
49
+ },
50
+ "scopeWindowLines": {
51
+ "type": "integer",
52
+ "minimum": 1,
53
+ "maximum": 64,
54
+ "default": 8
55
+ }
56
+ },
57
+ "examples": [
58
+ {
59
+ "$schema": "adhdev:tui/settled-prompt@1",
60
+ "regex": "^[›❯>]\\s*$",
61
+ "withFooter": [
62
+ { "pattern": "? for shortcuts" }
63
+ ]
64
+ },
65
+ {
66
+ "$schema": "adhdev:tui/settled-prompt@1",
67
+ "regex": "(?:^|[›❯>]\\s*)\\b(?:gpt-|o\\d\\b|codex-)[\\w._-]*",
68
+ "scope": "last-n-lines"
69
+ }
70
+ ]
71
+ }
@@ -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
+ }