@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
|
@@ -10,6 +10,14 @@ import type { ProviderSummaryMetadata } from '../shared-types.js';
|
|
|
10
10
|
import type { ChatMessageKind } from './chat-message-normalization.js';
|
|
11
11
|
export type ReadChatTurnStatus = 'open' | 'waiting_approval' | 'complete' | 'error';
|
|
12
12
|
export interface ReadChatResult {
|
|
13
|
+
/**
|
|
14
|
+
* Declared chat contract version. Absent or `'1.0'` → legacy v1 payload
|
|
15
|
+
* (current shape). `'2.0'` → v2 payload conforming to transcript-v2.ts
|
|
16
|
+
* (ReadChatResultV2). Validators in read-chat-contract.ts route on this
|
|
17
|
+
* field. A1 only adds the field; A2 will make v2 the daemon-internal
|
|
18
|
+
* canonical form and reject unrecognised versions at provider load time.
|
|
19
|
+
*/
|
|
20
|
+
contractVersion?: import('./transcript-v2.js').ChatContractVersion;
|
|
13
21
|
messages: ChatMessage[];
|
|
14
22
|
status: AgentStatus;
|
|
15
23
|
activeModal?: ModalInfo | null;
|
|
@@ -378,6 +386,14 @@ export interface ProviderModule {
|
|
|
378
386
|
extensionIdPattern_flags?: string;
|
|
379
387
|
compatibility?: ProviderCompatibilityEntry[];
|
|
380
388
|
defaultScriptDir?: string;
|
|
389
|
+
/**
|
|
390
|
+
* v1 declarative tui block (spinner/settledPrompt/modal/dispatchOrder/etc).
|
|
391
|
+
* When present, the daemon's CliScriptRunner builds canonical
|
|
392
|
+
* (input → verdict) functions from this and injects them into provider
|
|
393
|
+
* scripts as `sdk.declarativeDetectStatus` and `sdk.declarativeParseApproval`.
|
|
394
|
+
* v0 / verified-tier providers can omit this entirely.
|
|
395
|
+
*/
|
|
396
|
+
tui?: Record<string, unknown>;
|
|
381
397
|
/**
|
|
382
398
|
* Scripts that can run at the IDE main-page level (not just inside the extension webview session frame).
|
|
383
399
|
* Default: ['listModes', 'setMode', 'listModels', 'setModel'].
|
|
@@ -429,8 +445,16 @@ export interface ProviderModule {
|
|
|
429
445
|
/** History behavior config — controls message filtering and collapse during replay */
|
|
430
446
|
historyBehavior?: ProviderHistoryBehavior;
|
|
431
447
|
/**
|
|
432
|
-
*
|
|
433
|
-
* When set, daemon
|
|
448
|
+
* Native history config — for providers that maintain native history files.
|
|
449
|
+
* When set, daemon reads/lists provider-native transcripts directly. This is
|
|
450
|
+
* the canonical v1 field name; the legacy `canonicalHistory` field name is
|
|
451
|
+
* still accepted by the loader and aliased onto this field at load time.
|
|
452
|
+
*/
|
|
453
|
+
nativeHistory?: NativeHistoryConfig;
|
|
454
|
+
/**
|
|
455
|
+
* @deprecated Legacy v0 alias for {@link ProviderModule.nativeHistory}.
|
|
456
|
+
* Loader populates this from `nativeHistory` so existing internal readers
|
|
457
|
+
* keep working during the transition. Remove after one release.
|
|
434
458
|
*/
|
|
435
459
|
canonicalHistory?: ProviderCanonicalHistoryConfig;
|
|
436
460
|
/**
|
|
@@ -561,20 +585,25 @@ export interface ProviderHistoryBehavior {
|
|
|
561
585
|
* daemon-core. They let each provider own native transcript file discovery and
|
|
562
586
|
* parsing while daemon-core only validates/pages the normalized result.
|
|
563
587
|
*/
|
|
564
|
-
export interface
|
|
588
|
+
export interface NativeHistoryScriptsConfig {
|
|
565
589
|
/** Reads one native session. Default: 'readNativeHistory'. */
|
|
566
590
|
readSession?: string;
|
|
567
591
|
/** Lists native sessions with summary metadata. Default: 'listNativeHistory'. */
|
|
568
592
|
listSessions?: string;
|
|
569
593
|
}
|
|
570
594
|
/**
|
|
571
|
-
*
|
|
595
|
+
* @deprecated Use {@link NativeHistoryScriptsConfig}. Retained as an alias for
|
|
596
|
+
* one release so external consumers that referenced the old name keep compiling.
|
|
597
|
+
*/
|
|
598
|
+
export type ProviderCanonicalHistoryScriptsConfig = NativeHistoryScriptsConfig;
|
|
599
|
+
/**
|
|
600
|
+
* Native history config — for providers that maintain their own native history files.
|
|
572
601
|
*
|
|
573
602
|
* Preferred mode is provider-owned scripts via `scripts`. `format` is now an
|
|
574
603
|
* opaque provider label retained for diagnostics/backward compatibility; daemon
|
|
575
604
|
* live paths must not branch on provider-specific format values.
|
|
576
605
|
*/
|
|
577
|
-
export interface
|
|
606
|
+
export interface NativeHistoryConfig {
|
|
578
607
|
/** Opaque provider-owned history format label. */
|
|
579
608
|
format?: string;
|
|
580
609
|
/** Optional native history glob/template for diagnostics only. */
|
|
@@ -590,7 +619,23 @@ export interface ProviderCanonicalHistoryConfig {
|
|
|
590
619
|
* Omitted mode defaults to 'native-source'.
|
|
591
620
|
*/
|
|
592
621
|
mode?: 'native-source' | 'materialized-mirror' | 'disabled';
|
|
622
|
+
/**
|
|
623
|
+
* Chat transcript contract version this provider's read_chat output
|
|
624
|
+
* conforms to. See transcript-v2.ts for the v2 invariants. Absent or `'1.0'`
|
|
625
|
+
* → legacy v1 payload (current behaviour). `'2.0'` → strict v2 payload
|
|
626
|
+
* (stable providerUnitKey/bubbleId/sequence, strict enums, honest coverage).
|
|
627
|
+
*
|
|
628
|
+
* A1 only surfaces this field; validators in read-chat-contract.ts route
|
|
629
|
+
* on it. A2 makes v2 the daemon-internal canonical form and rejects
|
|
630
|
+
* unrecognised values at provider load time.
|
|
631
|
+
*/
|
|
632
|
+
contractVersion?: import('./transcript-v2.js').ChatContractVersion;
|
|
593
633
|
}
|
|
634
|
+
/**
|
|
635
|
+
* @deprecated Use {@link NativeHistoryConfig}. Retained as an alias for one
|
|
636
|
+
* release so external consumers that referenced the old name keep compiling.
|
|
637
|
+
*/
|
|
638
|
+
export type ProviderCanonicalHistoryConfig = NativeHistoryConfig;
|
|
594
639
|
/**
|
|
595
640
|
* Auto-implement spawn config — controls how the provider is spawned for autonomous AI-driven
|
|
596
641
|
* provider script implementation (dev-auto-implement.ts).
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* antigravity-cli-transcript — Daemon-side built-in native history adapter for antigravity-cli.
|
|
3
|
+
*
|
|
4
|
+
* Antigravity CLI stores conversations in multiple complementary locations:
|
|
5
|
+
*
|
|
6
|
+
* 1. ~/.gemini/antigravity-cli/history.jsonl
|
|
7
|
+
* Lightweight index of user prompts, one row per turn:
|
|
8
|
+
* { conversationId: string, display: string, workspace: string, timestamp: number }
|
|
9
|
+
*
|
|
10
|
+
* 2. ~/.gemini/antigravity-cli/brain/<uuid>/.system_generated/logs/transcript*.jsonl
|
|
11
|
+
* Per-session full transcript, one row per agent step:
|
|
12
|
+
* { source: 'USER_EXPLICIT'|'MODEL', type: string, content: string, status: 'DONE'|..., created_at: number }
|
|
13
|
+
*
|
|
14
|
+
* 3. ~/.gemini/antigravity-cli/conversations/<uuid>.pb
|
|
15
|
+
* Protobuf binary — schema not publicly documented. Adapter extracts
|
|
16
|
+
* printable UTF-8 text runs as best-effort content (no proto library needed).
|
|
17
|
+
*
|
|
18
|
+
* This adapter provides:
|
|
19
|
+
* - Full coverage when a brain transcript exists (authoritative source).
|
|
20
|
+
* - Partial coverage (user prompts only) from history.jsonl as fallback.
|
|
21
|
+
* - Best-effort raw-string extraction from .pb files when no other source exists.
|
|
22
|
+
*
|
|
23
|
+
* watchPath (from provider.v1.json):
|
|
24
|
+
* ~/.gemini/antigravity-cli/history.jsonl
|
|
25
|
+
* ~/.gemini/antigravity-cli/brain/{uuid}/.system_generated/logs/transcript*.jsonl
|
|
26
|
+
* ~/.gemini/antigravity-cli/conversations/{uuid}.pb
|
|
27
|
+
*
|
|
28
|
+
* OSS code (AGPL-3.0). Must not import from packages/ (proprietary).
|
|
29
|
+
*/
|
|
30
|
+
export type NativeHistoryRole = 'user' | 'assistant' | 'system';
|
|
31
|
+
export type NativeHistoryKind = 'standard' | 'tool' | 'session_start';
|
|
32
|
+
export interface NativeHistoryMessage {
|
|
33
|
+
ts: string;
|
|
34
|
+
receivedAt: number;
|
|
35
|
+
role: NativeHistoryRole;
|
|
36
|
+
content: string;
|
|
37
|
+
kind: NativeHistoryKind;
|
|
38
|
+
senderName?: string;
|
|
39
|
+
agent: 'antigravity-cli';
|
|
40
|
+
historySessionId: string;
|
|
41
|
+
workspace?: string;
|
|
42
|
+
/** Stable per-message identity (v2 contract). */
|
|
43
|
+
providerUnitKey?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface NativeHistorySession {
|
|
46
|
+
messages: NativeHistoryMessage[];
|
|
47
|
+
providerSessionId: string;
|
|
48
|
+
source: 'provider-native';
|
|
49
|
+
sourcePath: string;
|
|
50
|
+
sourceMtimeMs: number;
|
|
51
|
+
/**
|
|
52
|
+
* 'full' — brain transcript was available and parsed.
|
|
53
|
+
* 'partial' — only history.jsonl user-prompts are available.
|
|
54
|
+
* 'best-effort' — .pb file bytes were used for raw text extraction.
|
|
55
|
+
*/
|
|
56
|
+
nativeHistoryCoverage: 'full' | 'partial' | 'best-effort';
|
|
57
|
+
workspace?: string;
|
|
58
|
+
partialReason?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface NativeHistorySessionMeta {
|
|
61
|
+
historySessionId: string;
|
|
62
|
+
sessionId: string;
|
|
63
|
+
sourcePath: string;
|
|
64
|
+
sourceMtimeMs: number;
|
|
65
|
+
messageCount: number;
|
|
66
|
+
firstMessageAt: number;
|
|
67
|
+
lastMessageAt: number;
|
|
68
|
+
sessionTitle?: string;
|
|
69
|
+
preview?: string;
|
|
70
|
+
workspace?: string;
|
|
71
|
+
agent: 'antigravity-cli';
|
|
72
|
+
source: 'provider-native';
|
|
73
|
+
nativeHistoryCoverage: 'full' | 'partial' | 'best-effort';
|
|
74
|
+
partialReason?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Read a single Antigravity CLI session by its source file path.
|
|
78
|
+
*
|
|
79
|
+
* `sessionPath` is the absolute path to one of:
|
|
80
|
+
* - A brain transcript JSONL: ~/.gemini/antigravity-cli/brain/<uuid>/.system_generated/logs/transcript*.jsonl
|
|
81
|
+
* - The shared history.jsonl: ~/.gemini/antigravity-cli/history.jsonl
|
|
82
|
+
* - A conversation protobuf: ~/.gemini/antigravity-cli/conversations/<uuid>.pb
|
|
83
|
+
*
|
|
84
|
+
* The session UUID is inferred from the directory name (brain), filename (pb), or
|
|
85
|
+
* must be provided explicitly via `sessionId` for history.jsonl paths.
|
|
86
|
+
*
|
|
87
|
+
* Returns `null` when the file is missing, empty, or yields no parseable messages.
|
|
88
|
+
*/
|
|
89
|
+
export declare function readSession(sessionPath: string, sessionId?: string, workspace?: string): Promise<NativeHistorySession | null>;
|
|
90
|
+
/**
|
|
91
|
+
* List all Antigravity CLI sessions found across all watchPath locations.
|
|
92
|
+
*
|
|
93
|
+
* Priority:
|
|
94
|
+
* 1. Brain transcript sessions (full coverage) — preferred source.
|
|
95
|
+
* 2. History JSONL entries without a brain transcript (partial coverage).
|
|
96
|
+
* 3. .pb conversation files without any other source (best-effort).
|
|
97
|
+
*
|
|
98
|
+
* Returns summary metadata sorted by most recently updated first.
|
|
99
|
+
*/
|
|
100
|
+
export declare function listSessions(_watchPath: string): Promise<NativeHistorySessionMeta[]>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* claude-cli-transcript — Daemon-side built-in native history adapter for claude-cli.
|
|
3
|
+
*
|
|
4
|
+
* Reads Claude Code JSONL transcript files directly without shelling out to a JS override.
|
|
5
|
+
* The transcript format is one JSON object per line, where each line has:
|
|
6
|
+
* - type: 'user' | 'assistant'
|
|
7
|
+
* - message: { content: string | ContentBlock[] }
|
|
8
|
+
* - timestamp: number (ms epoch) | string (ISO)
|
|
9
|
+
* - sessionId?: string
|
|
10
|
+
* - cwd?: string
|
|
11
|
+
*
|
|
12
|
+
* OSS code (AGPL-3.0). Must not import from packages/ (proprietary).
|
|
13
|
+
*/
|
|
14
|
+
export type NativeHistoryRole = 'user' | 'assistant' | 'system';
|
|
15
|
+
export type NativeHistoryKind = 'standard' | 'tool' | 'session_start';
|
|
16
|
+
export interface NativeHistoryMessage {
|
|
17
|
+
ts: string;
|
|
18
|
+
receivedAt: number;
|
|
19
|
+
role: NativeHistoryRole;
|
|
20
|
+
content: string;
|
|
21
|
+
kind: NativeHistoryKind;
|
|
22
|
+
senderName?: string;
|
|
23
|
+
agent: 'claude-cli';
|
|
24
|
+
historySessionId: string;
|
|
25
|
+
workspace?: string;
|
|
26
|
+
/** Stable per-message identity (v2 contract). */
|
|
27
|
+
providerUnitKey?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface NativeHistorySession {
|
|
30
|
+
messages: NativeHistoryMessage[];
|
|
31
|
+
providerSessionId: string;
|
|
32
|
+
source: 'provider-native';
|
|
33
|
+
sourcePath: string;
|
|
34
|
+
sourceMtimeMs: number;
|
|
35
|
+
nativeHistoryCoverage: 'full';
|
|
36
|
+
workspace?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface NativeHistorySessionMeta {
|
|
39
|
+
historySessionId: string;
|
|
40
|
+
sessionId: string;
|
|
41
|
+
sourcePath: string;
|
|
42
|
+
sourceMtimeMs: number;
|
|
43
|
+
messageCount: number;
|
|
44
|
+
firstMessageAt: number;
|
|
45
|
+
lastMessageAt: number;
|
|
46
|
+
sessionTitle?: string;
|
|
47
|
+
preview?: string;
|
|
48
|
+
workspace?: string;
|
|
49
|
+
agent: 'claude-cli';
|
|
50
|
+
source: 'provider-native';
|
|
51
|
+
nativeHistoryCoverage: 'full';
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Read a single Claude Code session by its transcript file path.
|
|
55
|
+
*
|
|
56
|
+
* `sessionPath` is the absolute path to a `<uuid>.jsonl` file.
|
|
57
|
+
* Returns `null` when the file is missing, empty, or yields no parseable messages.
|
|
58
|
+
*/
|
|
59
|
+
export declare function readSession(sessionPath: string): Promise<NativeHistorySession | null>;
|
|
60
|
+
/**
|
|
61
|
+
* List all Claude Code sessions under the given glob-style watchPath base dir.
|
|
62
|
+
*
|
|
63
|
+
* `watchPath` is the pattern from provider.v1.json (`~/.claude/projects/**\/*.jsonl`).
|
|
64
|
+
* This implementation expands the home directory and scans `~/.claude/projects/`
|
|
65
|
+
* recursively, collecting all `.jsonl` files.
|
|
66
|
+
*
|
|
67
|
+
* Returns summary metadata for each session (no full message reads on this hot path;
|
|
68
|
+
* each file is opened only for lightweight scanning).
|
|
69
|
+
*/
|
|
70
|
+
export declare function listSessions(watchPath: string): Promise<NativeHistorySessionMeta[]>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* codex-cli-transcript — Daemon-side built-in native history adapter for codex-cli.
|
|
3
|
+
*
|
|
4
|
+
* Reads Codex CLI rollout JSONL session files directly without shelling out to a JS override.
|
|
5
|
+
* Files are stored at ~/.codex/sessions/<uuid>[-<slug>].jsonl.
|
|
6
|
+
*
|
|
7
|
+
* Format — each line is a JSON object of one of these types:
|
|
8
|
+
* { type: 'session_meta', timestamp: number, payload: { id: string, cwd: string, ... } }
|
|
9
|
+
* { type: 'response_item', timestamp: number, payload: { type: 'message', role: 'user'|'assistant', content: ... } }
|
|
10
|
+
* { type: 'response_item', timestamp: number, payload: { type: 'function_call' | 'custom_tool_call', name?: string, arguments?: string, input?: unknown } }
|
|
11
|
+
* { type: 'response_item', timestamp: number, payload: { type: 'function_call_output' | 'custom_tool_call_output', output?: string, result?: string } }
|
|
12
|
+
*
|
|
13
|
+
* watchPath (from provider.v1.json): ~/.codex/sessions
|
|
14
|
+
*
|
|
15
|
+
* OSS code (AGPL-3.0). Must not import from packages/ (proprietary).
|
|
16
|
+
*/
|
|
17
|
+
export type NativeHistoryRole = 'user' | 'assistant' | 'system';
|
|
18
|
+
export type NativeHistoryKind = 'standard' | 'tool' | 'session_start';
|
|
19
|
+
export interface NativeHistoryMessage {
|
|
20
|
+
ts: string;
|
|
21
|
+
receivedAt: number;
|
|
22
|
+
role: NativeHistoryRole;
|
|
23
|
+
content: string;
|
|
24
|
+
kind: NativeHistoryKind;
|
|
25
|
+
senderName?: string;
|
|
26
|
+
agent: 'codex-cli';
|
|
27
|
+
historySessionId: string;
|
|
28
|
+
workspace?: string;
|
|
29
|
+
/** Stable per-message identity (v2 contract). */
|
|
30
|
+
providerUnitKey?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface NativeHistorySession {
|
|
33
|
+
messages: NativeHistoryMessage[];
|
|
34
|
+
providerSessionId: string;
|
|
35
|
+
source: 'provider-native';
|
|
36
|
+
sourcePath: string;
|
|
37
|
+
sourceMtimeMs: number;
|
|
38
|
+
nativeHistoryCoverage: 'full';
|
|
39
|
+
workspace?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface NativeHistorySessionMeta {
|
|
42
|
+
historySessionId: string;
|
|
43
|
+
sessionId: string;
|
|
44
|
+
sourcePath: string;
|
|
45
|
+
sourceMtimeMs: number;
|
|
46
|
+
messageCount: number;
|
|
47
|
+
firstMessageAt: number;
|
|
48
|
+
lastMessageAt: number;
|
|
49
|
+
sessionTitle?: string;
|
|
50
|
+
preview?: string;
|
|
51
|
+
workspace?: string;
|
|
52
|
+
agent: 'codex-cli';
|
|
53
|
+
source: 'provider-native';
|
|
54
|
+
nativeHistoryCoverage: 'full';
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Read a single Codex CLI session by its JSONL file path.
|
|
58
|
+
*
|
|
59
|
+
* `sessionPath` is the absolute path to a `<uuid>[-<slug>].jsonl` file
|
|
60
|
+
* under ~/.codex/sessions/.
|
|
61
|
+
* Returns `null` when the file is missing, empty, or yields no parseable messages.
|
|
62
|
+
*/
|
|
63
|
+
export declare function readSession(sessionPath: string): Promise<NativeHistorySession | null>;
|
|
64
|
+
/**
|
|
65
|
+
* List all Codex CLI sessions under the given watchPath base dir.
|
|
66
|
+
*
|
|
67
|
+
* `watchPath` is the value from provider.v1.json (`~/.codex/sessions`).
|
|
68
|
+
* Expands the home directory and scans the directory recursively,
|
|
69
|
+
* collecting all `.jsonl` files.
|
|
70
|
+
*
|
|
71
|
+
* Returns summary metadata for each session, sorted by most recently updated first.
|
|
72
|
+
*/
|
|
73
|
+
export declare function listSessions(watchPath: string): Promise<NativeHistorySessionMeta[]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* native-history — Daemon-side built-in adapters for CLI provider native history.
|
|
3
|
+
*
|
|
4
|
+
* Each adapter reads conversation history directly from the CLI tool's on-disk
|
|
5
|
+
* storage without shelling out to a provider JS override script.
|
|
6
|
+
*
|
|
7
|
+
* OSS code (AGPL-3.0). Must not import from packages/ (proprietary).
|
|
8
|
+
*/
|
|
9
|
+
export { readSession as readClaudeCliSession, listSessions as listClaudeCliSessions, } from './claude-cli-transcript.js';
|
|
10
|
+
export { readSession as readCodexCliSession, listSessions as listCodexCliSessions, } from './codex-cli-transcript.js';
|
|
11
|
+
export { readSession as readAntigravityCliSession, listSessions as listAntigravityCliSessions, } from './antigravity-cli-transcript.js';
|
|
@@ -58,7 +58,9 @@ export declare class ProviderLoader {
|
|
|
58
58
|
/** Inject VersionArchive so resolve() can auto-detect installed versions */
|
|
59
59
|
setVersionArchive(archive: VersionArchive): void;
|
|
60
60
|
private static readonly GITHUB_TARBALL_URL;
|
|
61
|
+
private static readonly REGISTRY_BASE_URL;
|
|
61
62
|
private static readonly META_FILE;
|
|
63
|
+
private static readonly REGISTRY_META_FILE;
|
|
62
64
|
private static readonly REPO_PROVIDER_DIRNAME;
|
|
63
65
|
private static readonly SIBLING_MARKER_FILE;
|
|
64
66
|
private static readonly SIBLING_ENV_VAR;
|
|
@@ -295,6 +297,22 @@ export declare class ProviderLoader {
|
|
|
295
297
|
*
|
|
296
298
|
* @returns Whether an update occurred
|
|
297
299
|
*/
|
|
300
|
+
/**
|
|
301
|
+
* Sync providers from the ADHDev registry (registry.adhf.dev).
|
|
302
|
+
*
|
|
303
|
+
* Downloads only providers whose server checksum differs from the locally
|
|
304
|
+
* cached checksum. Falls back gracefully to the GitHub tarball path if the
|
|
305
|
+
* registry is unreachable or returns an unexpected response.
|
|
306
|
+
*
|
|
307
|
+
* Returns `{ updated: true }` when at least one provider file changed on disk,
|
|
308
|
+
* `{ updated: false }` when everything is already current, or
|
|
309
|
+
* `{ updated: false, error }` when the registry couldn't be reached and we
|
|
310
|
+
* should proceed to the GitHub tarball fallback.
|
|
311
|
+
*/
|
|
312
|
+
fetchFromRegistry(): Promise<{
|
|
313
|
+
updated: boolean;
|
|
314
|
+
error?: string;
|
|
315
|
+
}>;
|
|
298
316
|
fetchLatest(): Promise<{
|
|
299
317
|
updated: boolean;
|
|
300
318
|
error?: string;
|
|
@@ -305,7 +323,7 @@ export declare class ProviderLoader {
|
|
|
305
323
|
private copyDirRecursive;
|
|
306
324
|
/** .meta.json save */
|
|
307
325
|
private writeMeta;
|
|
308
|
-
/** Count provider files (provider.
|
|
326
|
+
/** Count provider files (provider.v1.json or provider.json — at most one per dir). */
|
|
309
327
|
private countProviders;
|
|
310
328
|
/**
|
|
311
329
|
* Get public settings schema for a provider (for dashboard UI rendering)
|
|
@@ -1,2 +1,31 @@
|
|
|
1
1
|
import type { ReadChatResult } from './contracts.js';
|
|
2
|
+
import { CHAT_CONTRACT_VERSION_V1, CHAT_CONTRACT_VERSION_V2, type ChatContractVersion, type ReadChatResultV2 } from './transcript-v2.js';
|
|
3
|
+
/**
|
|
4
|
+
* Read the producer-declared contract version from a raw read_chat payload.
|
|
5
|
+
* Returns v1 when absent or unrecognised, so legacy producers keep working
|
|
6
|
+
* through A1. A2 will tighten this to throw when an unsupported version is
|
|
7
|
+
* declared.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readPayloadContractVersion(raw: unknown): ChatContractVersion;
|
|
10
|
+
/**
|
|
11
|
+
* Validate a v2 payload. Thin wrapper around assertReadChatResultV2Payload
|
|
12
|
+
* that prefixes the contract violation with the caller's source label.
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateReadChatResultV2Payload(raw: unknown, source?: string): ReadChatResultV2;
|
|
15
|
+
/**
|
|
16
|
+
* Versioned entry point. Routes on the producer-declared contractVersion:
|
|
17
|
+
* - v2 → strict v2 validation (transcript-v2.ts invariants)
|
|
18
|
+
* - v1 (or absent) → legacy permissive validation
|
|
19
|
+
*
|
|
20
|
+
* Callers that have not yet been audited to handle v2 outputs should use
|
|
21
|
+
* validateReadChatResultPayload directly; that path stays bound to v1 shape
|
|
22
|
+
* during the A1 transition.
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateReadChatResultPayloadVersioned(raw: unknown, source?: string): {
|
|
25
|
+
version: typeof CHAT_CONTRACT_VERSION_V1;
|
|
26
|
+
payload: ReadChatResult & Record<string, unknown>;
|
|
27
|
+
} | {
|
|
28
|
+
version: typeof CHAT_CONTRACT_VERSION_V2;
|
|
29
|
+
payload: ReadChatResultV2;
|
|
30
|
+
};
|
|
2
31
|
export declare function validateReadChatResultPayload(raw: unknown, source?: string): ReadChatResult & Record<string, unknown>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildDetectStatusFromAcp
|
|
3
|
+
*
|
|
4
|
+
* Turns a declarative `acp/session-protocol@1` block into a runtime
|
|
5
|
+
* `(input: AcpStatusInput) => 'idle' | 'generating' | 'waiting_approval' | null`
|
|
6
|
+
* function.
|
|
7
|
+
*
|
|
8
|
+
* Dispatch order:
|
|
9
|
+
* 1. Not connected → null (no information available).
|
|
10
|
+
* 2. Error patterns — checked first; first match returns the declared verdict.
|
|
11
|
+
* 3. Generating pattern — `generating`.
|
|
12
|
+
* 4. Idle pattern — `idle`.
|
|
13
|
+
* 5. Default: `null` (no change — caller preserves last known status).
|
|
14
|
+
*
|
|
15
|
+
* All regex patterns are compiled once at builder time so the returned
|
|
16
|
+
* detector function is allocation-free on the hot path.
|
|
17
|
+
*/
|
|
18
|
+
interface AcpRegexPatternSpec {
|
|
19
|
+
regex: string;
|
|
20
|
+
flags?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
}
|
|
23
|
+
interface AcpErrorPatternSpec extends AcpRegexPatternSpec {
|
|
24
|
+
verdict: 'idle' | 'generating' | 'waiting_approval';
|
|
25
|
+
}
|
|
26
|
+
export interface AcpSessionSpec {
|
|
27
|
+
$schema?: 'adhdev:acp/session-protocol@1';
|
|
28
|
+
/** Pattern that matches a line emitted when the agent is idle/ready. */
|
|
29
|
+
idlePattern?: AcpRegexPatternSpec;
|
|
30
|
+
/** Pattern that matches a line emitted while the agent is actively working. */
|
|
31
|
+
generatingPattern?: AcpRegexPatternSpec;
|
|
32
|
+
/**
|
|
33
|
+
* Error/edge-case patterns. Checked in order; first match returns the
|
|
34
|
+
* declared verdict. Useful for approval prompts, fatal errors, etc.
|
|
35
|
+
*/
|
|
36
|
+
errorPatterns?: AcpErrorPatternSpec[];
|
|
37
|
+
/** Wire format; informational only at the builder level — regex matching
|
|
38
|
+
* is identical regardless of promptStyle. */
|
|
39
|
+
promptStyle?: 'json-rpc' | 'plain-text' | 'mcp';
|
|
40
|
+
/** Message delimiter used to split incoming bytes (default: newline). */
|
|
41
|
+
messageDelimiter?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface AcpStatusInput {
|
|
44
|
+
/** The most recently received line from the stdio stream. */
|
|
45
|
+
lastLine: string;
|
|
46
|
+
/**
|
|
47
|
+
* A sliding window of recent output lines (newest last).
|
|
48
|
+
* Builders may check these when a single line is not enough for context.
|
|
49
|
+
*/
|
|
50
|
+
recentLines: string[];
|
|
51
|
+
/** Whether the ACP process is currently connected and running. */
|
|
52
|
+
isConnected: boolean;
|
|
53
|
+
}
|
|
54
|
+
export type AcpDetectedStatus = 'idle' | 'generating' | 'waiting_approval' | null;
|
|
55
|
+
interface CompiledAcpSpec {
|
|
56
|
+
idle: RegExp | null;
|
|
57
|
+
generating: RegExp | null;
|
|
58
|
+
errors: Array<{
|
|
59
|
+
re: RegExp;
|
|
60
|
+
verdict: AcpDetectedStatus;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
declare function compileSpec(spec: AcpSessionSpec): CompiledAcpSpec;
|
|
64
|
+
export declare function buildDetectStatusFromAcp(spec: AcpSessionSpec): (input: AcpStatusInput) => AcpDetectedStatus;
|
|
65
|
+
export declare const __internal: {
|
|
66
|
+
compileSpec: typeof compileSpec;
|
|
67
|
+
};
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildDetectStatusFromTui
|
|
3
|
+
*
|
|
4
|
+
* Turns a manifest's declarative TUI block into a runtime
|
|
5
|
+
* `(input: CliStatusInput) => CliStatus | null` function.
|
|
6
|
+
*
|
|
7
|
+
* Inputs handled (all optional except spinner):
|
|
8
|
+
* - tui/spinner@1 → contributes `generating`
|
|
9
|
+
* - tui/settled-prompt@1 → contributes `idle`
|
|
10
|
+
* - tui/modal@1 → contributes `waiting_approval`
|
|
11
|
+
*
|
|
12
|
+
* Dispatch order (sprint-2026-06 contract):
|
|
13
|
+
* 1. Active generation cues win over idle prompt — checked first.
|
|
14
|
+
* Reason: codex/claude keep model footer visible during `Working` and
|
|
15
|
+
* `hasReadyPrompt` falsely fired idle. Audit §4.2 introduces
|
|
16
|
+
* `tui/cue-ordering` as the named primitive for this rule.
|
|
17
|
+
* 2. Modal cue (if present) is checked next — `waiting_approval`.
|
|
18
|
+
* 3. Settled-prompt cue — `idle`.
|
|
19
|
+
* 4. Default: `null` (no change).
|
|
20
|
+
*/
|
|
21
|
+
import type { CliStatusInput, CliDetectStatusFn } from '../../types/cli/index.js';
|
|
22
|
+
import { type VisibleRegionSpec } from './visible-region.js';
|
|
23
|
+
interface RegexLikeSpec {
|
|
24
|
+
regex: string;
|
|
25
|
+
flags?: string;
|
|
26
|
+
}
|
|
27
|
+
interface SpinnerPatternSpec extends RegexLikeSpec {
|
|
28
|
+
description?: string;
|
|
29
|
+
}
|
|
30
|
+
interface SpinnerSpec {
|
|
31
|
+
$schema: 'adhdev:tui/spinner@1';
|
|
32
|
+
patterns: SpinnerPatternSpec[];
|
|
33
|
+
scope?: 'live-frame-tail' | 'whole-screen' | 'recent-buffer';
|
|
34
|
+
scopeWindowLines?: number;
|
|
35
|
+
}
|
|
36
|
+
interface SettledPromptFooterSpec {
|
|
37
|
+
pattern: string;
|
|
38
|
+
kind?: 'substring' | 'regex';
|
|
39
|
+
flags?: string;
|
|
40
|
+
}
|
|
41
|
+
interface SettledPromptSpec {
|
|
42
|
+
$schema: 'adhdev:tui/settled-prompt@1';
|
|
43
|
+
regex: string;
|
|
44
|
+
flags?: string;
|
|
45
|
+
withFooter?: SettledPromptFooterSpec[];
|
|
46
|
+
scope?: 'last-n-lines' | 'whole-screen';
|
|
47
|
+
scopeWindowLines?: number;
|
|
48
|
+
}
|
|
49
|
+
interface ModalSpec {
|
|
50
|
+
$schema: 'adhdev:tui/modal@1';
|
|
51
|
+
questionPattern: string;
|
|
52
|
+
questionFlags?: string;
|
|
53
|
+
questionVariants?: Array<{
|
|
54
|
+
regex: string;
|
|
55
|
+
flags?: string;
|
|
56
|
+
label?: string;
|
|
57
|
+
}>;
|
|
58
|
+
buttonPattern: string;
|
|
59
|
+
buttonFlags?: string;
|
|
60
|
+
}
|
|
61
|
+
export type DispatchGroup = 'spinner' | 'modal' | 'settled-prompt' | 'cue-ordering' | 'error-detection' | 'approval-stitching';
|
|
62
|
+
export interface DispatchOrderSpec {
|
|
63
|
+
$schema: 'adhdev:tui/dispatch-order@1';
|
|
64
|
+
order: DispatchGroup[];
|
|
65
|
+
onNoMatch?: 'idle' | 'unknown' | 'preserve-last';
|
|
66
|
+
}
|
|
67
|
+
export interface DetectStatusTuiSpec {
|
|
68
|
+
spinner?: SpinnerSpec;
|
|
69
|
+
settledPrompt?: SettledPromptSpec;
|
|
70
|
+
modal?: ModalSpec;
|
|
71
|
+
dispatchOrder?: DispatchOrderSpec;
|
|
72
|
+
visibleRegion?: VisibleRegionSpec;
|
|
73
|
+
}
|
|
74
|
+
declare function scopeText(input: CliStatusInput, scope: SpinnerSpec['scope'] | SettledPromptSpec['scope'], windowLines: number | undefined): string;
|
|
75
|
+
declare function spinnerMatches(spec: SpinnerSpec, input: CliStatusInput): boolean;
|
|
76
|
+
declare function settledPromptMatches(spec: SettledPromptSpec, input: CliStatusInput): boolean;
|
|
77
|
+
declare function modalMatches(spec: ModalSpec, input: CliStatusInput): boolean;
|
|
78
|
+
export declare function buildDetectStatusFromTui(spec: DetectStatusTuiSpec): CliDetectStatusFn;
|
|
79
|
+
export declare const __internal: {
|
|
80
|
+
scopeText: typeof scopeText;
|
|
81
|
+
spinnerMatches: typeof spinnerMatches;
|
|
82
|
+
settledPromptMatches: typeof settledPromptMatches;
|
|
83
|
+
modalMatches: typeof modalMatches;
|
|
84
|
+
};
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildParseApprovalFromSquash
|
|
3
|
+
*
|
|
4
|
+
* Companion to buildParseApprovalFromTui. Handles the squashed-modal case:
|
|
5
|
+
* the terminal has re-flowed the approval frame so the rendered text is a
|
|
6
|
+
* single run of lowercase-alnum bytes (e.g. `doyoutrustthecontentsofthisdirectory…1yescontinue2noquit`).
|
|
7
|
+
*
|
|
8
|
+
* Author declares:
|
|
9
|
+
* - `cues` — compact substrings/regexes that identify the modal
|
|
10
|
+
* - `footers` — optional compact substrings that must also be present
|
|
11
|
+
* - `buttonRules` — compact→labels mappings used to recover button labels
|
|
12
|
+
*
|
|
13
|
+
* Returns the same shape as buildParseApprovalFromTui — a CliApprovalModal
|
|
14
|
+
* (message + buttons) or null when no rule matches. Caller composes the two
|
|
15
|
+
* builders: try the regular modal first, then fall back to squash. Codex
|
|
16
|
+
* needs both because at narrow widths the terminal renders the squash form,
|
|
17
|
+
* and at wider widths it renders the regular framed form.
|
|
18
|
+
*/
|
|
19
|
+
import type { CliApprovalInput, CliParseApprovalFn } from '../../types/cli/index.js';
|
|
20
|
+
interface SquashCueSpec {
|
|
21
|
+
compact: string;
|
|
22
|
+
kind?: 'substring' | 'regex';
|
|
23
|
+
label?: string;
|
|
24
|
+
messageWhenMatched?: string;
|
|
25
|
+
}
|
|
26
|
+
interface SquashFooterSpec {
|
|
27
|
+
compact: string;
|
|
28
|
+
kind?: 'substring' | 'regex';
|
|
29
|
+
}
|
|
30
|
+
interface SquashButtonRuleSpec {
|
|
31
|
+
compact: string;
|
|
32
|
+
kind?: 'substring' | 'regex';
|
|
33
|
+
labels: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface ApprovalSquashSpec {
|
|
36
|
+
$schema: 'adhdev:tui/approval-squash@1';
|
|
37
|
+
cues: SquashCueSpec[];
|
|
38
|
+
footers?: SquashFooterSpec[];
|
|
39
|
+
buttonRules: SquashButtonRuleSpec[];
|
|
40
|
+
scope?: 'tail-window' | 'whole-screen';
|
|
41
|
+
tailWindowLines?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The canonical normalisation. Identical to codex-cli's `compactText`:
|
|
45
|
+
* lowercase, then strip everything that is not a-z or 0-9.
|
|
46
|
+
*
|
|
47
|
+
* Exported for tests and for the (rare) provider that wants to compose this
|
|
48
|
+
* with extra normalisation steps.
|
|
49
|
+
*/
|
|
50
|
+
export declare function compactText(value: string): string;
|
|
51
|
+
declare function matchSubstringOrRegex(needle: string, kind: 'substring' | 'regex' | undefined, haystack: string): boolean;
|
|
52
|
+
declare function scopeText(spec: ApprovalSquashSpec, input: CliApprovalInput): string;
|
|
53
|
+
export declare function buildParseApprovalFromSquash(spec: ApprovalSquashSpec): CliParseApprovalFn;
|
|
54
|
+
export declare const __internal: {
|
|
55
|
+
compactText: typeof compactText;
|
|
56
|
+
matchSubstringOrRegex: typeof matchSubstringOrRegex;
|
|
57
|
+
scopeText: typeof scopeText;
|
|
58
|
+
};
|
|
59
|
+
export {};
|