@adhdev/daemon-core 0.9.82-rc.14 → 0.9.82-rc.141
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/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 +45 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +178 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +87 -63
- package/dist/cli-adapters/provider-cli-parse.d.ts +4 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +21 -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 +18 -6
- package/dist/index.js +10431 -2827
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10376 -2811
- package/dist/index.mjs.map +1 -1
- package/dist/installer.d.ts +1 -4
- 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/chat-message-normalization.d.ts +1 -0
- package/dist/providers/cli-provider-instance.d.ts +6 -1
- package/dist/providers/contracts.d.ts +19 -0
- package/dist/providers/read-chat-contract.d.ts +29 -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 +3 -1
- package/src/boot/daemon-lifecycle.ts +3 -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 +145 -0
- package/src/cli-adapters/cli-state-engine.ts +1083 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +630 -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 +51 -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 +1428 -50
- package/src/commands/cli-manager.ts +145 -3
- package/src/commands/handler.ts +8 -1
- package/src/commands/mesh-coordinator.ts +13 -143
- package/src/commands/router.ts +3271 -427
- 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 +45 -5
- package/src/installer.d.ts +1 -1
- package/src/installer.ts +8 -6
- 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 +799 -56
- 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 +7 -12
- package/src/providers/cli-provider-instance.ts +362 -41
- package/src/providers/contracts.ts +19 -0
- package/src/providers/ide-provider-instance.ts +17 -3
- package/src/providers/provider-loader.ts +31 -11
- package/src/providers/provider-schema.ts +12 -0
- package/src/providers/read-chat-contract.ts +76 -16
- 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
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
import type { RepoMeshDaemonRole } from '../repo-mesh-types.js';
|
|
2
|
+
import { BeadsDB } from './beads-db.js';
|
|
1
3
|
export type MeshTaskStatus = 'pending' | 'assigned' | 'completed' | 'failed' | 'cancelled';
|
|
2
4
|
export type MeshActiveTaskStatus = Extract<MeshTaskStatus, 'pending' | 'assigned'>;
|
|
3
5
|
export type MeshHistoricalTaskStatus = Extract<MeshTaskStatus, 'completed' | 'failed' | 'cancelled'>;
|
|
6
|
+
export type MeshTaskMode = 'code_change' | 'validation' | 'live_debug_readonly' | 'launch_app' | 'convergence';
|
|
4
7
|
export declare const ACTIVE_MESH_QUEUE_STATUSES: MeshActiveTaskStatus[];
|
|
5
8
|
export declare const HISTORICAL_MESH_QUEUE_STATUSES: MeshHistoricalTaskStatus[];
|
|
9
|
+
export declare const MESH_TASK_MODES: MeshTaskMode[];
|
|
10
|
+
export interface MeshTaskModeValidationResult {
|
|
11
|
+
valid: boolean;
|
|
12
|
+
taskMode?: MeshTaskMode;
|
|
13
|
+
violations: string[];
|
|
14
|
+
allowedOperations?: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function normalizeMeshTaskMode(value: unknown): MeshTaskMode | undefined;
|
|
17
|
+
export declare function validateMeshTaskModeRequest(mode: unknown, message: string): MeshTaskModeValidationResult;
|
|
6
18
|
export interface MeshWorkQueueEntry {
|
|
7
19
|
id: string;
|
|
8
20
|
meshId: string;
|
|
9
21
|
message: string;
|
|
10
22
|
status: MeshTaskStatus;
|
|
23
|
+
taskMode?: MeshTaskMode;
|
|
11
24
|
/** If specified, only this node can claim the task (used by legacy mesh_send_task) */
|
|
12
25
|
targetNodeId?: string;
|
|
13
26
|
/** If specified, only this runtime session can claim the task */
|
|
@@ -37,19 +50,24 @@ export interface MeshWorkQueueEntry {
|
|
|
37
50
|
createdAt: string;
|
|
38
51
|
updatedAt: string;
|
|
39
52
|
}
|
|
53
|
+
export interface MeshQueueMutationOptions {
|
|
54
|
+
ownerRole?: RepoMeshDaemonRole;
|
|
55
|
+
}
|
|
40
56
|
/**
|
|
41
57
|
* Add a new task to the mesh queue.
|
|
42
58
|
*/
|
|
43
59
|
export declare function enqueueTask(meshId: string, message: string, opts?: {
|
|
44
60
|
targetNodeId?: string;
|
|
45
61
|
targetSessionId?: string;
|
|
46
|
-
|
|
62
|
+
taskMode?: MeshTaskMode | string;
|
|
63
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry;
|
|
47
64
|
/**
|
|
48
65
|
* Get all tasks in the queue, optionally filtered by status.
|
|
49
66
|
*/
|
|
50
67
|
export declare function getQueue(meshId: string, opts?: {
|
|
51
68
|
status?: MeshTaskStatus[];
|
|
52
69
|
}): MeshWorkQueueEntry[];
|
|
70
|
+
export declare function getMeshQueueRevision(meshId: string): string;
|
|
53
71
|
/**
|
|
54
72
|
* Find the next pending task that this node is allowed to claim, and mark it as assigned.
|
|
55
73
|
*/
|
|
@@ -58,14 +76,14 @@ export declare function claimNextTask(meshId: string, nodeId: string, sessionId:
|
|
|
58
76
|
* Update the status of a specific task.
|
|
59
77
|
* Used when a session completes, fails, or stalls.
|
|
60
78
|
*/
|
|
61
|
-
export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus): MeshWorkQueueEntry | null;
|
|
79
|
+
export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus, opts?: MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
62
80
|
export declare function recordTaskAutoLaunch(meshId: string, taskId: string, autoLaunch: Omit<NonNullable<MeshWorkQueueEntry['autoLaunch']>, 'updatedAt'>): MeshWorkQueueEntry | null;
|
|
63
81
|
/**
|
|
64
82
|
* Mark a queue task as manually cancelled without deleting audit history.
|
|
65
83
|
*/
|
|
66
84
|
export declare function cancelTask(meshId: string, taskId: string, opts?: {
|
|
67
85
|
reason?: string;
|
|
68
|
-
}): MeshWorkQueueEntry | null;
|
|
86
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
69
87
|
/**
|
|
70
88
|
* Return a queue task to pending for retry. By default, dead session targeting
|
|
71
89
|
* and assigned ownership are cleared so stale assignments do not strand again.
|
|
@@ -76,11 +94,13 @@ export declare function requeueTask(meshId: string, taskId: string, opts?: {
|
|
|
76
94
|
targetSessionId?: string;
|
|
77
95
|
clearTargetNode?: boolean;
|
|
78
96
|
clearTargetSession?: boolean;
|
|
79
|
-
}): MeshWorkQueueEntry | null;
|
|
97
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
80
98
|
/**
|
|
81
99
|
* Update the status of the task currently assigned to a specific session.
|
|
82
100
|
*/
|
|
83
|
-
export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus
|
|
101
|
+
export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus, opts?: {
|
|
102
|
+
occurredAt?: string;
|
|
103
|
+
}): MeshWorkQueueEntry | null;
|
|
84
104
|
export interface MeshWorkQueueStats {
|
|
85
105
|
total: number;
|
|
86
106
|
active: number;
|
|
@@ -105,3 +125,22 @@ export interface MeshWorkQueueStats {
|
|
|
105
125
|
* Return aggregate queue statistics for the given mesh.
|
|
106
126
|
*/
|
|
107
127
|
export declare function getMeshQueueStats(meshId: string): MeshWorkQueueStats;
|
|
128
|
+
export declare function __replaceMeshQueueForTests(meshId: string, queue: MeshWorkQueueEntry[]): void;
|
|
129
|
+
export declare function __clearMeshQueueForTests(meshId: string): void;
|
|
130
|
+
export declare function __resetBeadsDBForTests(): void;
|
|
131
|
+
export type DirectDispatchRecord = ReturnType<BeadsDB['getActiveDirectDispatches']>[number];
|
|
132
|
+
export declare function insertDirectDispatch(meshId: string, data: {
|
|
133
|
+
taskId: string;
|
|
134
|
+
nodeId?: string;
|
|
135
|
+
sessionId?: string;
|
|
136
|
+
providerType?: string;
|
|
137
|
+
message: string;
|
|
138
|
+
taskMode?: string;
|
|
139
|
+
via: string;
|
|
140
|
+
dispatchedToIdleSession?: boolean;
|
|
141
|
+
dispatchedAt: string;
|
|
142
|
+
}): void;
|
|
143
|
+
export declare function getActiveDirectDispatches(meshId: string): DirectDispatchRecord[];
|
|
144
|
+
export declare function updateDirectDispatchStatus(meshId: string, sessionId: string, status: 'acked' | 'completed' | 'failed' | 'stale'): void;
|
|
145
|
+
export declare function cleanupTerminalDirectDispatches(olderThanMs?: number): void;
|
|
146
|
+
export declare function markStaleDirectDispatches(meshId: string, olderThanMs?: number): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type PreviewFreshnessStatus = 'fresh' | 'stale' | 'unknown' | 'not_configured';
|
|
2
|
+
export interface PreviewFreshness {
|
|
3
|
+
status: PreviewFreshnessStatus;
|
|
4
|
+
lastPreviewCommit: string | null;
|
|
5
|
+
currentMainCommit: string | null;
|
|
6
|
+
currentMainCommitSource: 'origin/main' | 'HEAD' | 'unknown';
|
|
7
|
+
recordPath: string;
|
|
8
|
+
lastDeployedAt?: string;
|
|
9
|
+
lastTarget?: string;
|
|
10
|
+
previewVersion?: string;
|
|
11
|
+
targets: Record<'npm' | 'server' | 'web', {
|
|
12
|
+
commit: string | null;
|
|
13
|
+
deployedAt?: string;
|
|
14
|
+
status: PreviewFreshnessStatus;
|
|
15
|
+
}>;
|
|
16
|
+
nextAction: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildPreviewFreshness(repoRoot: string): PreviewFreshness;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
export declare const MESH_REFINE_VALIDATION_CATEGORIES: readonly ["typecheck", "test", "lint", "build"];
|
|
2
|
+
export type MeshRefineValidationCategory = typeof MESH_REFINE_VALIDATION_CATEGORIES[number];
|
|
3
|
+
export interface RepoMeshRefineValidationCommandConfig {
|
|
4
|
+
/** Executable name or a whitespace-tokenized command string. Never executed through a shell. */
|
|
5
|
+
command: string;
|
|
6
|
+
/** Optional explicit argv. Prefer this over shell-like command strings. */
|
|
7
|
+
args?: string[];
|
|
8
|
+
category?: MeshRefineValidationCategory;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
outputLimitBytes?: number;
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface RepoMeshRefineConfig {
|
|
15
|
+
version: 1;
|
|
16
|
+
/**
|
|
17
|
+
* Narrow Refinery opt-in for monorepos with submodule gitlinks.
|
|
18
|
+
* When true, Refinery may non-force publish unreachable submodule gitlink
|
|
19
|
+
* commits to the submodule remote main branch after validation and
|
|
20
|
+
* patch-equivalence pass, then verify remote-main reachability.
|
|
21
|
+
*/
|
|
22
|
+
allowAutoPublishSubmoduleMainCommits?: boolean;
|
|
23
|
+
validation?: {
|
|
24
|
+
required?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Optional dependency/bootstrap commands that Refinery runs before
|
|
27
|
+
* validation commands. Refinery never infers installs on its own.
|
|
28
|
+
*/
|
|
29
|
+
bootstrapCommands?: RepoMeshRefineValidationCommandConfig[];
|
|
30
|
+
commands?: RepoMeshRefineValidationCommandConfig[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface MeshRefineValidationCommandPlan {
|
|
34
|
+
command: string;
|
|
35
|
+
args: string[];
|
|
36
|
+
displayCommand: string;
|
|
37
|
+
category: MeshRefineValidationCategory | 'custom';
|
|
38
|
+
source: string;
|
|
39
|
+
cwd?: string;
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
outputLimitBytes?: number;
|
|
42
|
+
env?: Record<string, string>;
|
|
43
|
+
}
|
|
44
|
+
export interface MeshRefineConfigLoadResult {
|
|
45
|
+
config?: RepoMeshRefineConfig;
|
|
46
|
+
source: string;
|
|
47
|
+
sourceType: 'mesh_policy' | 'repo_file' | 'unavailable' | 'invalid';
|
|
48
|
+
path?: string;
|
|
49
|
+
error?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface MeshRefineValidationPlan {
|
|
52
|
+
source: string;
|
|
53
|
+
sourceType: MeshRefineConfigLoadResult['sourceType'];
|
|
54
|
+
bootstrapCommands: MeshRefineValidationCommandPlan[];
|
|
55
|
+
commands: MeshRefineValidationCommandPlan[];
|
|
56
|
+
rejectedCommands: Array<Record<string, unknown>>;
|
|
57
|
+
suggestions: RepoMeshRefineValidationCommandConfig[];
|
|
58
|
+
suggestedConfig?: RepoMeshRefineConfig;
|
|
59
|
+
unavailableReason?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare const MESH_REFINE_CONFIG_LOCATIONS: string[];
|
|
62
|
+
export declare const MESH_REFINE_CONFIG_SCHEMA: {
|
|
63
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
64
|
+
readonly title: "ADHDev Repo Mesh Refinery Config";
|
|
65
|
+
readonly type: "object";
|
|
66
|
+
readonly additionalProperties: false;
|
|
67
|
+
readonly required: readonly ["version"];
|
|
68
|
+
readonly properties: {
|
|
69
|
+
readonly version: {
|
|
70
|
+
readonly const: 1;
|
|
71
|
+
};
|
|
72
|
+
readonly allowAutoPublishSubmoduleMainCommits: {
|
|
73
|
+
readonly type: "boolean";
|
|
74
|
+
readonly default: false;
|
|
75
|
+
readonly description: "When true, Refinery may non-force publish submodule gitlink commits referenced by the refined root tree to each submodule origin/main after validation and patch-equivalence pass, then verify reachability.";
|
|
76
|
+
};
|
|
77
|
+
readonly validation: {
|
|
78
|
+
readonly type: "object";
|
|
79
|
+
readonly additionalProperties: false;
|
|
80
|
+
readonly properties: {
|
|
81
|
+
readonly required: {
|
|
82
|
+
readonly type: "boolean";
|
|
83
|
+
readonly default: true;
|
|
84
|
+
};
|
|
85
|
+
readonly commands: {
|
|
86
|
+
readonly type: "array";
|
|
87
|
+
readonly minItems: 1;
|
|
88
|
+
readonly maxItems: 8;
|
|
89
|
+
readonly items: {
|
|
90
|
+
readonly type: "object";
|
|
91
|
+
readonly additionalProperties: false;
|
|
92
|
+
readonly required: readonly ["command"];
|
|
93
|
+
readonly properties: {
|
|
94
|
+
readonly command: {
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
readonly minLength: 1;
|
|
97
|
+
};
|
|
98
|
+
readonly args: {
|
|
99
|
+
readonly type: "array";
|
|
100
|
+
readonly items: {
|
|
101
|
+
readonly type: "string";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
readonly category: {
|
|
105
|
+
readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
|
|
106
|
+
};
|
|
107
|
+
readonly cwd: {
|
|
108
|
+
readonly type: "string";
|
|
109
|
+
};
|
|
110
|
+
readonly timeoutMs: {
|
|
111
|
+
readonly type: "number";
|
|
112
|
+
readonly minimum: 1000;
|
|
113
|
+
readonly maximum: 600000;
|
|
114
|
+
};
|
|
115
|
+
readonly outputLimitBytes: {
|
|
116
|
+
readonly type: "number";
|
|
117
|
+
readonly minimum: 1024;
|
|
118
|
+
readonly maximum: 1048576;
|
|
119
|
+
};
|
|
120
|
+
readonly env: {
|
|
121
|
+
readonly type: "object";
|
|
122
|
+
readonly additionalProperties: {
|
|
123
|
+
readonly type: "string";
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
readonly bootstrapCommands: {
|
|
130
|
+
readonly type: "array";
|
|
131
|
+
readonly maxItems: 4;
|
|
132
|
+
readonly items: {
|
|
133
|
+
readonly type: "object";
|
|
134
|
+
readonly additionalProperties: false;
|
|
135
|
+
readonly required: readonly ["command"];
|
|
136
|
+
readonly properties: {
|
|
137
|
+
readonly command: {
|
|
138
|
+
readonly type: "string";
|
|
139
|
+
readonly minLength: 1;
|
|
140
|
+
};
|
|
141
|
+
readonly args: {
|
|
142
|
+
readonly type: "array";
|
|
143
|
+
readonly items: {
|
|
144
|
+
readonly type: "string";
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
readonly category: {
|
|
148
|
+
readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
|
|
149
|
+
};
|
|
150
|
+
readonly cwd: {
|
|
151
|
+
readonly type: "string";
|
|
152
|
+
};
|
|
153
|
+
readonly timeoutMs: {
|
|
154
|
+
readonly type: "number";
|
|
155
|
+
readonly minimum: 1000;
|
|
156
|
+
readonly maximum: 600000;
|
|
157
|
+
};
|
|
158
|
+
readonly outputLimitBytes: {
|
|
159
|
+
readonly type: "number";
|
|
160
|
+
readonly minimum: 1024;
|
|
161
|
+
readonly maximum: 1048576;
|
|
162
|
+
};
|
|
163
|
+
readonly env: {
|
|
164
|
+
readonly type: "object";
|
|
165
|
+
readonly additionalProperties: {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
export declare function isMeshConfigRecord(value: unknown): value is Record<string, unknown>;
|
|
177
|
+
export declare function normalizeMeshCommandConfig(entry: unknown, source: string): {
|
|
178
|
+
command?: MeshRefineValidationCommandPlan;
|
|
179
|
+
rejected?: Record<string, unknown>;
|
|
180
|
+
};
|
|
181
|
+
export declare function validateMeshRefineConfig(config: unknown, source?: string): {
|
|
182
|
+
valid: boolean;
|
|
183
|
+
errors: string[];
|
|
184
|
+
bootstrapCommands: MeshRefineValidationCommandPlan[];
|
|
185
|
+
commands: MeshRefineValidationCommandPlan[];
|
|
186
|
+
rejectedCommands: Array<Record<string, unknown>>;
|
|
187
|
+
};
|
|
188
|
+
export declare function loadMeshRefineConfig(mesh: any, workspace: string): MeshRefineConfigLoadResult;
|
|
189
|
+
export declare function suggestMeshRefineConfig(mesh: any, workspace: string): {
|
|
190
|
+
suggestions: RepoMeshRefineValidationCommandConfig[];
|
|
191
|
+
suggestedConfig?: RepoMeshRefineConfig;
|
|
192
|
+
};
|
|
193
|
+
export declare function resolveMeshRefineValidationPlan(mesh: any, workspace: string): MeshRefineValidationPlan;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type MeshRefineValidationCommandPlan, type RepoMeshRefineValidationCommandConfig } from './refine-config.js';
|
|
2
|
+
import type { MeshAsyncJobLifecycle } from '../repo-mesh-types.js';
|
|
3
|
+
export type WorktreeBootstrapStatus = 'ready' | 'running' | 'failed' | 'not_configured' | 'disabled' | 'stale';
|
|
4
|
+
export interface RepoMeshWorktreeBootstrapConfig {
|
|
5
|
+
version: 1;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
runOnClone?: boolean;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
commands?: RepoMeshRefineValidationCommandConfig[];
|
|
10
|
+
staleInputs?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface WorktreeBootstrapState extends MeshAsyncJobLifecycle {
|
|
13
|
+
status: WorktreeBootstrapStatus;
|
|
14
|
+
required: boolean;
|
|
15
|
+
configSource?: string;
|
|
16
|
+
configSourceType?: 'repo_file' | 'mesh_policy' | 'unavailable' | 'invalid';
|
|
17
|
+
lastCommand?: string;
|
|
18
|
+
exitCode?: number | null;
|
|
19
|
+
commandsRun?: Array<Record<string, unknown>>;
|
|
20
|
+
staleInputs?: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface WorktreeBootstrapConfigLoadResult {
|
|
23
|
+
config?: RepoMeshWorktreeBootstrapConfig;
|
|
24
|
+
source: string;
|
|
25
|
+
sourceType: 'repo_file' | 'mesh_policy' | 'unavailable' | 'invalid';
|
|
26
|
+
path?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS: string[];
|
|
30
|
+
export declare const MESH_WORKTREE_BOOTSTRAP_CONFIG_SCHEMA: {
|
|
31
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
32
|
+
readonly title: "ADHDev Repo Mesh Worktree Bootstrap Config";
|
|
33
|
+
readonly type: "object";
|
|
34
|
+
readonly additionalProperties: false;
|
|
35
|
+
readonly required: readonly ["version"];
|
|
36
|
+
readonly properties: {
|
|
37
|
+
readonly version: {
|
|
38
|
+
readonly const: 1;
|
|
39
|
+
};
|
|
40
|
+
readonly enabled: {
|
|
41
|
+
readonly type: "boolean";
|
|
42
|
+
readonly default: true;
|
|
43
|
+
};
|
|
44
|
+
readonly runOnClone: {
|
|
45
|
+
readonly type: "boolean";
|
|
46
|
+
readonly default: true;
|
|
47
|
+
};
|
|
48
|
+
readonly required: {
|
|
49
|
+
readonly type: "boolean";
|
|
50
|
+
readonly default: true;
|
|
51
|
+
};
|
|
52
|
+
readonly staleInputs: {
|
|
53
|
+
readonly type: "array";
|
|
54
|
+
readonly maxItems: 16;
|
|
55
|
+
readonly items: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly minLength: 1;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly commands: {
|
|
61
|
+
readonly type: "array";
|
|
62
|
+
readonly minItems: 1;
|
|
63
|
+
readonly maxItems: 4;
|
|
64
|
+
readonly items: {
|
|
65
|
+
readonly type: "object";
|
|
66
|
+
readonly additionalProperties: false;
|
|
67
|
+
readonly required: readonly ["command"];
|
|
68
|
+
readonly properties: {
|
|
69
|
+
readonly command: {
|
|
70
|
+
readonly type: "string";
|
|
71
|
+
readonly minLength: 1;
|
|
72
|
+
};
|
|
73
|
+
readonly args: {
|
|
74
|
+
readonly type: "array";
|
|
75
|
+
readonly items: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly category: {
|
|
80
|
+
readonly enum: readonly ["typecheck", "test", "lint", "build", "custom"];
|
|
81
|
+
};
|
|
82
|
+
readonly cwd: {
|
|
83
|
+
readonly type: "string";
|
|
84
|
+
};
|
|
85
|
+
readonly timeoutMs: {
|
|
86
|
+
readonly type: "number";
|
|
87
|
+
readonly minimum: 1000;
|
|
88
|
+
readonly maximum: 600000;
|
|
89
|
+
};
|
|
90
|
+
readonly outputLimitBytes: {
|
|
91
|
+
readonly type: "number";
|
|
92
|
+
readonly minimum: 1024;
|
|
93
|
+
readonly maximum: 1048576;
|
|
94
|
+
};
|
|
95
|
+
readonly env: {
|
|
96
|
+
readonly type: "object";
|
|
97
|
+
readonly additionalProperties: {
|
|
98
|
+
readonly type: "string";
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export declare function validateMeshWorktreeBootstrapConfig(config: unknown, source?: string): {
|
|
107
|
+
valid: boolean;
|
|
108
|
+
errors: string[];
|
|
109
|
+
commands: MeshRefineValidationCommandPlan[];
|
|
110
|
+
rejectedCommands: Array<Record<string, unknown>>;
|
|
111
|
+
};
|
|
112
|
+
export declare function loadMeshWorktreeBootstrapConfig(mesh: any, workspace: string): WorktreeBootstrapConfigLoadResult;
|
|
113
|
+
export declare function runMeshWorktreeBootstrap(mesh: any, workspace: string): Promise<WorktreeBootstrapState>;
|
|
@@ -5,3 +5,12 @@ export declare function pickApprovalButton(buttons: string[] | null | undefined,
|
|
|
5
5
|
label: string;
|
|
6
6
|
};
|
|
7
7
|
export declare function formatAutoApprovalMessage(modalMessage?: string, buttonLabel?: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns true when the given text (e.g. last assistant message content, or
|
|
10
|
+
* the tail of the PTY screen) looks like an active approval/input prompt
|
|
11
|
+
* rather than a completed assistant response. Used to prevent false
|
|
12
|
+
* idle/completion events when Claude Code surfaces a "Do you want to proceed?"
|
|
13
|
+
* style prompt that the PTY parser captures as an assistant turn while the
|
|
14
|
+
* session is still awaiting user input.
|
|
15
|
+
*/
|
|
16
|
+
export declare function looksLikeActiveApprovalPromptText(content: string): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChatMessage } from '../types.js';
|
|
2
|
+
export declare const DEFAULT_FINAL_SUMMARY_MAX_CHARS = 4000;
|
|
2
3
|
export declare function extractFinalSummaryFromMessages(messages: ChatMessage[] | null | undefined, maxChars?: number): string;
|
|
3
4
|
export declare const BUILTIN_CHAT_MESSAGE_KINDS: readonly ["standard", "thought", "tool", "terminal", "system"];
|
|
4
5
|
export type BuiltinChatMessageKind = typeof BUILTIN_CHAT_MESSAGE_KINDS[number];
|
|
@@ -48,6 +48,7 @@ export declare class CliProviderInstance implements ProviderInstance {
|
|
|
48
48
|
private lastApprovalEventAt;
|
|
49
49
|
private autoApproveBusy;
|
|
50
50
|
private autoApproveBusyTimer;
|
|
51
|
+
private lastAutoApprovalSignature;
|
|
51
52
|
private controlValues;
|
|
52
53
|
private summaryMetadata;
|
|
53
54
|
private appliedEffectKeys;
|
|
@@ -96,14 +97,16 @@ export declare class CliProviderInstance implements ProviderInstance {
|
|
|
96
97
|
getSessionModalState(): SessionModalState;
|
|
97
98
|
updateSettings(newSettings: Record<string, any>): void;
|
|
98
99
|
onEvent(event: string, data?: any): void;
|
|
100
|
+
recordAcknowledgedUserInput(input: InputEnvelope | string): void;
|
|
99
101
|
dispose(): void;
|
|
100
102
|
private completedDebounceTimer;
|
|
101
103
|
private completedDebouncePending;
|
|
102
104
|
private enforceFreshSessionLaunchIfNeeded;
|
|
103
105
|
private completionHasFinalAssistantMessage;
|
|
106
|
+
private buildCompletedFinalizationDiagnostic;
|
|
104
107
|
private hasAdapterPendingResponse;
|
|
105
108
|
private shouldSuppressStaleParsedBusyStatus;
|
|
106
|
-
private
|
|
109
|
+
private getCompletedFinalizationBlock;
|
|
107
110
|
private scheduleCompletedDebounceFlush;
|
|
108
111
|
private flushCompletedDebounceIfFinalized;
|
|
109
112
|
private maybeAutoApproveStatus;
|
|
@@ -127,6 +130,8 @@ export declare class CliProviderInstance implements ProviderInstance {
|
|
|
127
130
|
private mergeConversationMessages;
|
|
128
131
|
private formatApprovalRequestMessage;
|
|
129
132
|
private promoteProviderSessionId;
|
|
133
|
+
private shouldHydrateExistingProviderHistory;
|
|
134
|
+
private shouldSuppressFreshLaunchStartupReplay;
|
|
130
135
|
private syncCanonicalSavedHistoryIfNeeded;
|
|
131
136
|
private restorePersistedHistoryFromCurrentSession;
|
|
132
137
|
private getProbeDirectories;
|
|
@@ -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;
|
|
@@ -590,6 +598,17 @@ export interface ProviderCanonicalHistoryConfig {
|
|
|
590
598
|
* Omitted mode defaults to 'native-source'.
|
|
591
599
|
*/
|
|
592
600
|
mode?: 'native-source' | 'materialized-mirror' | 'disabled';
|
|
601
|
+
/**
|
|
602
|
+
* Chat transcript contract version this provider's read_chat output
|
|
603
|
+
* conforms to. See transcript-v2.ts for the v2 invariants. Absent or `'1.0'`
|
|
604
|
+
* → legacy v1 payload (current behaviour). `'2.0'` → strict v2 payload
|
|
605
|
+
* (stable providerUnitKey/bubbleId/sequence, strict enums, honest coverage).
|
|
606
|
+
*
|
|
607
|
+
* A1 only surfaces this field; validators in read-chat-contract.ts route
|
|
608
|
+
* on it. A2 makes v2 the daemon-internal canonical form and rejects
|
|
609
|
+
* unrecognised values at provider load time.
|
|
610
|
+
*/
|
|
611
|
+
contractVersion?: import('./transcript-v2.js').ChatContractVersion;
|
|
593
612
|
}
|
|
594
613
|
/**
|
|
595
614
|
* Auto-implement spawn config — controls how the provider is spawned for autonomous AI-driven
|
|
@@ -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>;
|