@adhdev/mesh-shared 1.0.82-rc.3 → 1.0.82-rc.30
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/assistant-protocol.d.ts +140 -6
- package/dist/index.d.ts +6 -0
- package/dist/index.js +529 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +500 -110
- package/dist/index.mjs.map +1 -1
- package/dist/launch-defaults.d.ts +194 -0
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/mesh-vocabulary.d.ts +13 -4
- package/dist/node-facts.d.ts +41 -1
- package/dist/outbound-message.d.ts +7 -0
- package/dist/path-ownership.d.ts +1 -1
- package/dist/protocol/daemon-server.d.ts +9 -0
- package/dist/protocol/dashboard-daemon-p2p.d.ts +1 -1
- package/dist/protocol/dashboard-server.d.ts +10 -0
- package/dist/provider-approval.d.ts +36 -0
- package/dist/provider-question.d.ts +19 -0
- package/dist/quota-freshness.d.ts +65 -0
- package/dist/role-launch.d.ts +11 -0
- package/dist/session-launch.d.ts +3 -22
- package/dist/slot-proposal.d.ts +14 -0
- package/dist/task-source-phase.d.ts +75 -0
- package/dist/turn-evidence.d.ts +24 -12
- package/dist/turn-ipc-mission.d.ts +4 -0
- package/dist/turn-ipc-queue.d.ts +19 -0
- package/dist/turn-ipc.d.ts +2 -2
- package/dist/types.d.ts +1 -0
- package/dist/worker-protocol.d.ts +1 -1
- package/package.json +1 -1
- package/src/assistant-protocol.ts +247 -6
- package/src/daemon-normalize.ts +7 -5
- package/src/index.ts +7 -0
- package/src/keyed-doc-delta.ts +9 -1
- package/src/launch-defaults.ts +168 -0
- package/src/mesh-tool-names.ts +5 -0
- package/src/mesh-vocabulary.ts +12 -2
- package/src/node-facts.ts +36 -1
- package/src/outbound-message.ts +17 -0
- package/src/path-ownership.ts +4 -6
- package/src/protocol/daemon-server.ts +7 -2
- package/src/protocol/dashboard-server.ts +8 -2
- package/src/provider-approval.ts +59 -0
- package/src/provider-question.ts +31 -0
- package/src/quota-freshness.ts +139 -0
- package/src/role-launch.ts +51 -0
- package/src/session-launch.ts +8 -1
- package/src/slot-proposal.ts +61 -2
- package/src/task-source-phase.ts +61 -0
- package/src/turn-evidence.ts +22 -19
- package/src/turn-ipc-mission.ts +8 -2
- package/src/turn-ipc-queue.ts +29 -1
- package/src/turn-ipc-turn.ts +1 -1
- package/src/turn-ipc.ts +1 -0
- package/src/types.ts +1 -0
- package/src/worker-protocol.ts +4 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/** Daemon-local launch intent and command wire contract. P2P/local only;
|
|
2
|
+
* never include this document or its history in cloud status_report.
|
|
3
|
+
* Publication through mesh-shared's barrel is a later integration step. */
|
|
4
|
+
export declare const LAUNCH_DEFAULT_ROLES: readonly ["assistant", "coordinator"];
|
|
5
|
+
export type LaunchDefaultRole = typeof LAUNCH_DEFAULT_ROLES[number];
|
|
6
|
+
export declare const LAUNCH_DEFAULT_SOURCES: readonly ["user", "stored_default", "project_default", "provider_default"];
|
|
7
|
+
export type LaunchDefaultSource = typeof LAUNCH_DEFAULT_SOURCES[number];
|
|
8
|
+
export declare const LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
9
|
+
export declare function isLaunchDefaultRole(value: unknown): value is LaunchDefaultRole;
|
|
10
|
+
export declare function isLaunchDefaultSource(value: unknown): value is LaunchDefaultSource;
|
|
11
|
+
export interface LaunchDefaultSelection {
|
|
12
|
+
provider: string;
|
|
13
|
+
/** Omission means pass no model/thinking argument, not inherit another provider. */
|
|
14
|
+
model?: string;
|
|
15
|
+
thinkingLevel?: string;
|
|
16
|
+
}
|
|
17
|
+
export type LaunchDefaultToolRestriction = 'enforced' | 'prompt_only';
|
|
18
|
+
export type LaunchDefaultOrigin = 'owner' | 'human' | 'relay' | 'review' | 'review_tainted';
|
|
19
|
+
export interface LaunchDefaultEntry extends LaunchDefaultSelection {
|
|
20
|
+
revision: number;
|
|
21
|
+
setBy: 'owner' | 'assistant';
|
|
22
|
+
setAt: number;
|
|
23
|
+
}
|
|
24
|
+
export interface LaunchDefaultChange {
|
|
25
|
+
at: number;
|
|
26
|
+
role: LaunchDefaultRole;
|
|
27
|
+
by: 'owner' | 'assistant';
|
|
28
|
+
origin: LaunchDefaultOrigin;
|
|
29
|
+
from: LaunchDefaultEntry | null;
|
|
30
|
+
to: LaunchDefaultEntry | null;
|
|
31
|
+
}
|
|
32
|
+
export interface LaunchDefaultsDocument {
|
|
33
|
+
version: 1;
|
|
34
|
+
/** Global document token, including clears; distinct from entry revisions. */
|
|
35
|
+
revision: number;
|
|
36
|
+
assistant?: LaunchDefaultEntry;
|
|
37
|
+
coordinator?: LaunchDefaultEntry;
|
|
38
|
+
history: LaunchDefaultChange[];
|
|
39
|
+
}
|
|
40
|
+
export interface LaunchDefaultRef {
|
|
41
|
+
role: LaunchDefaultRole;
|
|
42
|
+
scope: 'global' | 'project';
|
|
43
|
+
/** Entry revision for global defaults; host project token for project defaults. */
|
|
44
|
+
revision: number;
|
|
45
|
+
projectId?: string;
|
|
46
|
+
}
|
|
47
|
+
export type LaunchDefaultField = keyof LaunchDefaultSelection;
|
|
48
|
+
export interface LaunchDefaultAxis {
|
|
49
|
+
value: string | null;
|
|
50
|
+
source: LaunchDefaultSource;
|
|
51
|
+
defaultRef?: LaunchDefaultRef;
|
|
52
|
+
}
|
|
53
|
+
export type LaunchDefaultWarning = 'catalog_unverified' | 'manual_mcp_setup_required';
|
|
54
|
+
export type LaunchDefaultValidationReason = 'invalid_schema' | 'provider_unknown' | 'provider_not_cli' | 'provider_disabled' | 'provider_not_detected' | 'provider_not_eligible' | 'provider_quota_gated' | 'model_unsupported' | 'model_provider_mismatch' | 'model_not_offered' | 'thinking_unsupported' | 'thinking_not_offered' | 'catalog_unavailable';
|
|
55
|
+
export type LaunchDefaultResolution = {
|
|
56
|
+
ok: true;
|
|
57
|
+
selection: LaunchDefaultSelection;
|
|
58
|
+
applied: Record<LaunchDefaultField, LaunchDefaultAxis>;
|
|
59
|
+
defaultRef?: LaunchDefaultRef;
|
|
60
|
+
documentRevision: number;
|
|
61
|
+
warnings: LaunchDefaultWarning[];
|
|
62
|
+
toolRestriction: LaunchDefaultToolRestriction;
|
|
63
|
+
} | {
|
|
64
|
+
ok: false;
|
|
65
|
+
code: 'launch_default_required' | 'launch_default_unavailable' | 'launch_selection_invalid';
|
|
66
|
+
role: LaunchDefaultRole;
|
|
67
|
+
field: LaunchDefaultField;
|
|
68
|
+
reason: string;
|
|
69
|
+
source?: LaunchDefaultSource;
|
|
70
|
+
value?: string | null;
|
|
71
|
+
defaultRef?: LaunchDefaultRef;
|
|
72
|
+
candidates?: readonly string[];
|
|
73
|
+
hint: string;
|
|
74
|
+
};
|
|
75
|
+
export interface LaunchDefaultsRoleView {
|
|
76
|
+
stored: LaunchDefaultEntry | null;
|
|
77
|
+
/** The existing daemon resolver's result, including loud failures. */
|
|
78
|
+
effective: LaunchDefaultResolution;
|
|
79
|
+
}
|
|
80
|
+
type Target = {
|
|
81
|
+
role: 'assistant';
|
|
82
|
+
project?: never;
|
|
83
|
+
} | {
|
|
84
|
+
role: 'coordinator';
|
|
85
|
+
project?: string;
|
|
86
|
+
};
|
|
87
|
+
export type LaunchDefaultsReadRequest = ({
|
|
88
|
+
action?: 'get';
|
|
89
|
+
} & (Target | {
|
|
90
|
+
role?: never;
|
|
91
|
+
project?: never;
|
|
92
|
+
})) | ({
|
|
93
|
+
action: 'check';
|
|
94
|
+
} & Target & LaunchDefaultSelection);
|
|
95
|
+
/** Mandatory CAS: global document token, or host project token for project writes.
|
|
96
|
+
* 0 is explicit first setup; clears advance the token and never restore fallback. */
|
|
97
|
+
export type LaunchDefaultsSetRequest = Target & {
|
|
98
|
+
expectedRevision: number;
|
|
99
|
+
} & (({
|
|
100
|
+
action: 'set';
|
|
101
|
+
} & LaunchDefaultSelection) | {
|
|
102
|
+
action: 'clear';
|
|
103
|
+
provider?: never;
|
|
104
|
+
model?: never;
|
|
105
|
+
thinkingLevel?: never;
|
|
106
|
+
});
|
|
107
|
+
/** Existing assistant routing envelope; session identity never supplies origin. */
|
|
108
|
+
export type AssistantLaunchDefaultsReadRequest = LaunchDefaultsReadRequest & {
|
|
109
|
+
assistantSessionId?: string;
|
|
110
|
+
};
|
|
111
|
+
export type AssistantLaunchDefaultsSetRequest = LaunchDefaultsSetRequest & {
|
|
112
|
+
assistantSessionId?: string;
|
|
113
|
+
};
|
|
114
|
+
export declare const LAUNCH_DEFAULT_ERROR_CODES: readonly ["invalid_args", "launch_default_required", "launch_default_unavailable", "launch_selection_invalid", "launch_default_invalid", "revision_conflict", "store_unavailable", "store_busy", "persistence_failed", "project_not_found", "project_ambiguous", "project_not_hosted", "project_storage_unavailable", "staging_unavailable", "staging_failed", "review_turn_tool_denied"];
|
|
115
|
+
export type LaunchDefaultsErrorCode = typeof LAUNCH_DEFAULT_ERROR_CODES[number];
|
|
116
|
+
export interface LaunchDefaultsError {
|
|
117
|
+
success: false;
|
|
118
|
+
code: LaunchDefaultsErrorCode;
|
|
119
|
+
error: string;
|
|
120
|
+
reason?: string;
|
|
121
|
+
role?: LaunchDefaultRole;
|
|
122
|
+
field?: LaunchDefaultField;
|
|
123
|
+
source?: LaunchDefaultSource;
|
|
124
|
+
value?: string | null;
|
|
125
|
+
defaultRef?: LaunchDefaultRef;
|
|
126
|
+
candidates?: readonly string[];
|
|
127
|
+
actualRevision?: number;
|
|
128
|
+
/** 0 for an absent global document; absent when it cannot be read. */
|
|
129
|
+
documentRevision?: number;
|
|
130
|
+
/** A persistence failure can replace intent without confirming durability.
|
|
131
|
+
* Re-read before retrying; never report applied on committed:true alone. */
|
|
132
|
+
committed?: boolean;
|
|
133
|
+
}
|
|
134
|
+
export interface LaunchDefaultsReadSuccess {
|
|
135
|
+
success: true;
|
|
136
|
+
result: 'get';
|
|
137
|
+
documentRevision: number;
|
|
138
|
+
roles: Partial<Record<LaunchDefaultRole, LaunchDefaultsRoleView>>;
|
|
139
|
+
project?: {
|
|
140
|
+
projectId: string;
|
|
141
|
+
revision: number;
|
|
142
|
+
entry: LaunchDefaultEntry | null;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
export interface LaunchDefaultsCheckSuccess {
|
|
146
|
+
success: true;
|
|
147
|
+
result: 'check';
|
|
148
|
+
role: LaunchDefaultRole;
|
|
149
|
+
selection: LaunchDefaultSelection;
|
|
150
|
+
warnings: LaunchDefaultWarning[];
|
|
151
|
+
toolRestriction: LaunchDefaultToolRestriction;
|
|
152
|
+
lowersToolLock: boolean;
|
|
153
|
+
}
|
|
154
|
+
export interface LaunchDefaultsApplied {
|
|
155
|
+
success: true;
|
|
156
|
+
result: 'applied';
|
|
157
|
+
role: LaunchDefaultRole;
|
|
158
|
+
scope: 'global' | 'project';
|
|
159
|
+
projectId?: string;
|
|
160
|
+
entry: LaunchDefaultEntry | null;
|
|
161
|
+
previous: LaunchDefaultEntry | null;
|
|
162
|
+
/** CAS token returned by the authority that performed the write. */
|
|
163
|
+
revision: number;
|
|
164
|
+
warnings: LaunchDefaultWarning[];
|
|
165
|
+
durable: true;
|
|
166
|
+
note: string;
|
|
167
|
+
}
|
|
168
|
+
export interface LaunchDefaultsStaged {
|
|
169
|
+
success: true;
|
|
170
|
+
result: 'staged';
|
|
171
|
+
role: LaunchDefaultRole;
|
|
172
|
+
stagedId: string;
|
|
173
|
+
previous: LaunchDefaultEntry | null;
|
|
174
|
+
selection: LaunchDefaultSelection | null;
|
|
175
|
+
expectedRevision: number;
|
|
176
|
+
warnings: LaunchDefaultWarning[];
|
|
177
|
+
note: string;
|
|
178
|
+
}
|
|
179
|
+
/** Existing owner Inbox adapter stores this proposal; it is not another default.
|
|
180
|
+
* Applying it must revalidate on the host and CAS via the same set handler. */
|
|
181
|
+
export interface LaunchDefaultsProposal {
|
|
182
|
+
kind: 'launch_defaults';
|
|
183
|
+
role: LaunchDefaultRole;
|
|
184
|
+
project?: string;
|
|
185
|
+
selection: LaunchDefaultSelection | null;
|
|
186
|
+
previous: LaunchDefaultEntry | null;
|
|
187
|
+
expectedRevision: number;
|
|
188
|
+
origin: LaunchDefaultOrigin;
|
|
189
|
+
callerSessionId?: string;
|
|
190
|
+
}
|
|
191
|
+
export type LaunchDefaultsReadResponse = LaunchDefaultsReadSuccess | LaunchDefaultsCheckSuccess | LaunchDefaultsError;
|
|
192
|
+
export type LaunchDefaultsSetResponse = LaunchDefaultsApplied | LaunchDefaultsStaged | LaunchDefaultsError;
|
|
193
|
+
export type LaunchDefaultsResponse = LaunchDefaultsReadResponse | LaunchDefaultsSetResponse;
|
|
194
|
+
export {};
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
* Order mirrors mcp-server `ALL_MESH_TOOLS` for easy visual diffing, but the consistency
|
|
19
19
|
* checks are set-based (order-insensitive).
|
|
20
20
|
*/
|
|
21
|
-
export declare const CANONICAL_MESH_TOOL_NAMES: readonly ["mesh_status", "mesh_route_preview", "mesh_list_nodes", "mesh_enqueue_batch", "mesh_enqueue_task", "mesh_view_queue", "mesh_queue_cancel", "mesh_queue_requeue", "mesh_send_task", "mesh_read_chat", "mesh_read_debug", "mesh_read_terminal", "mesh_send_keys", "mesh_launch_session", "mesh_git_status", "mesh_read_node_logs", "mesh_fast_forward_node", "mesh_restart_daemon", "mesh_checkpoint", "mesh_approve", "mesh_answer_question", "mesh_list_pending_approvals", "mesh_create", "mesh_add_node", "mesh_clone_node", "mesh_remove_node", "mesh_cleanup_worktree_nodes", "mesh_refine_node", "mesh_refine_batch", "mesh_config", "mesh_init", "mesh_cleanup_sessions", "mesh_task_history", "mesh_ledger_query", "mesh_note", "mesh_reconcile_ledger", "mesh_mission_upsert", "mesh_mission_list", "mesh_review_inbox", "mesh_node_slots"];
|
|
21
|
+
export declare const CANONICAL_MESH_TOOL_NAMES: readonly ["mesh_status", "mesh_route_preview", "mesh_list_nodes", "mesh_enqueue_batch", "mesh_enqueue_task", "mesh_view_queue", "mesh_queue_cancel", "mesh_queue_requeue", "mesh_queue_revise", "mesh_send_task", "mesh_read_chat", "mesh_read_debug", "mesh_read_terminal", "mesh_send_keys", "mesh_launch_session", "mesh_git_status", "mesh_read_node_logs", "mesh_fast_forward_node", "mesh_restart_daemon", "mesh_checkpoint", "mesh_approve", "mesh_answer_question", "mesh_list_pending_approvals", "mesh_create", "mesh_add_node", "mesh_attach_remote", "mesh_clone_node", "mesh_remove_node", "mesh_cleanup_worktree_nodes", "mesh_refine_node", "mesh_refine_batch", "mesh_config", "mesh_init", "mesh_cleanup_sessions", "mesh_task_history", "mesh_ledger_query", "mesh_note", "mesh_reconcile_ledger", "mesh_mission_upsert", "mesh_mission_list", "mesh_review_inbox", "mesh_node_slots", "driver_list", "driver_describe", "artifact_list"];
|
|
22
22
|
export type CanonicalMeshToolName = typeof CANONICAL_MESH_TOOL_NAMES[number];
|
|
23
23
|
/** The count the `NN tools` barrel doc comments and consistency test assert against. */
|
|
24
|
-
export declare const CANONICAL_MESH_TOOL_COUNT:
|
|
24
|
+
export declare const CANONICAL_MESH_TOOL_COUNT: 45;
|
|
25
25
|
/**
|
|
26
26
|
* Tool names retired by the 2026-09-26 tool-surface consolidation (60 → 48).
|
|
27
27
|
* Every capability behind them is still reachable: each retired name maps to the
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
* ./brain-routing.ts and are re-exported here for one-stop discovery.
|
|
16
16
|
*/
|
|
17
17
|
export { MESH_TASK_DIFFICULTIES, type MeshTaskDifficulty } from './brain-routing';
|
|
18
|
-
|
|
18
|
+
/** `blocked` ends a worker attempt pending external follow-up; only completed satisfies dependencies.
|
|
19
|
+
* Branch convergence (including blocked_review) remains an independent axis. */
|
|
20
|
+
export declare const MESH_TASK_STATUSES: readonly ["pending", "assigned", "completed", "blocked", "failed", "cancelled"];
|
|
19
21
|
export type MeshTaskStatus = typeof MESH_TASK_STATUSES[number];
|
|
20
|
-
export declare const MESH_TERMINAL_TASK_STATUSES: readonly ["completed", "failed", "cancelled"];
|
|
22
|
+
export declare const MESH_TERMINAL_TASK_STATUSES: readonly ["completed", "blocked", "failed", "cancelled"];
|
|
21
23
|
export type MeshTerminalTaskStatus = typeof MESH_TERMINAL_TASK_STATUSES[number];
|
|
22
24
|
export declare const MESH_TASK_MODES: readonly ["code_change", "validation", "live_debug_readonly", "launch_app", "convergence"];
|
|
23
25
|
export type MeshTaskMode = typeof MESH_TASK_MODES[number];
|
|
@@ -46,11 +48,18 @@ export type MeshSessionCleanupMode = typeof MESH_SESSION_CLEANUP_MODES[number];
|
|
|
46
48
|
/** Outcome a delegated worker may report through `report_completion`. */
|
|
47
49
|
export declare const WORKER_REPORT_OUTCOMES: readonly ["completed", "blocked", "failed"];
|
|
48
50
|
export type WorkerReportOutcome = typeof WORKER_REPORT_OUTCOMES[number];
|
|
51
|
+
/**
|
|
52
|
+
* Hard cap on a `report_completion` summary (characters, after trim). Over-limit
|
|
53
|
+
* summaries are REJECTED, never truncated. Declared once so the daemon validator
|
|
54
|
+
* and the mcp-server's pre-send check (which keeps an over-limit report out of the
|
|
55
|
+
* durable outbox) cannot drift apart.
|
|
56
|
+
*/
|
|
57
|
+
export declare const WORKER_REPORT_SUMMARY_MAX_CHARS = 8000;
|
|
49
58
|
/** Final branch state a worker reports (see coordinator convergence rules). */
|
|
50
59
|
export declare const WORKER_BRANCH_STATES: readonly ["merged_to_main", "pushed_feature_branch_needs_merge", "blocked_review", "cleanup_candidate", "not_mergeable"];
|
|
51
60
|
export type WorkerBranchState = typeof WORKER_BRANCH_STATES[number];
|
|
52
|
-
export declare const isMeshTaskStatus: (value: unknown) => value is "failed" | "
|
|
53
|
-
export declare const isMeshTerminalTaskStatus: (value: unknown) => value is "failed" | "completed" | "cancelled";
|
|
61
|
+
export declare const isMeshTaskStatus: (value: unknown) => value is "pending" | "failed" | "blocked" | "assigned" | "completed" | "cancelled";
|
|
62
|
+
export declare const isMeshTerminalTaskStatus: (value: unknown) => value is "failed" | "blocked" | "completed" | "cancelled";
|
|
54
63
|
export declare const isMeshTaskMode: (value: unknown) => value is "code_change" | "validation" | "live_debug_readonly" | "launch_app" | "convergence";
|
|
55
64
|
export declare const isMeshTaskPriority: (value: unknown) => value is "low" | "high" | "normal";
|
|
56
65
|
export declare const isMeshDeliveryMode: (value: unknown) => value is "when_idle" | "interrupt";
|
package/dist/node-facts.d.ts
CHANGED
|
@@ -94,6 +94,20 @@ export interface MeshNodeFactsProviderQuota {
|
|
|
94
94
|
* rather than presenting them as a freshly measured value.
|
|
95
95
|
*/
|
|
96
96
|
lastGoodWindows?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Unix ms the reporting node's NEXT scheduled retry of this transient
|
|
99
|
+
* failure is due (HTTP Retry-After wins when later). Re-stamped to the
|
|
100
|
+
* real backoff time on every failure — see daemon-core
|
|
101
|
+
* `updateFailureRetry`. Absent on persistent failures and on daemons
|
|
102
|
+
* predating the stamp.
|
|
103
|
+
*/
|
|
104
|
+
retryAtMs?: number;
|
|
105
|
+
/**
|
|
106
|
+
* True once the node has spent its bounded transient-retry budget and
|
|
107
|
+
* stopped retrying; the next look is the hourly backfill. Readers must
|
|
108
|
+
* stop calling retained numbers "refreshing" (`assessQuotaFreshness`).
|
|
109
|
+
*/
|
|
110
|
+
retryExhausted?: boolean;
|
|
97
111
|
/**
|
|
98
112
|
* Unix ms when the reporting node last ATTEMPTED a refresh of this
|
|
99
113
|
* provider — deliberately distinct from `updatedAt`, which dates the
|
|
@@ -109,6 +123,25 @@ export interface MeshNodeFactsProviderQuota {
|
|
|
109
123
|
* predating the field.
|
|
110
124
|
*/
|
|
111
125
|
fetchedAt?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Provenance of the RETAINED reading when `lastGoodWindows` is true —
|
|
128
|
+
* the source/plan/measurement time of the snapshot that produced the
|
|
129
|
+
* carried numbers, as opposed to the top-level `source`/`planType`,
|
|
130
|
+
* which describe the fresh failed attempt. See daemon-core
|
|
131
|
+
* `QuotaMetadata.lastGood`.
|
|
132
|
+
*/
|
|
133
|
+
lastGood?: {
|
|
134
|
+
measuredAt: number;
|
|
135
|
+
source?: string;
|
|
136
|
+
planType?: string | null;
|
|
137
|
+
collectorScope?: string;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* `'background-collector'` when the snapshot came from a daemon-spawned
|
|
141
|
+
* probe rather than an executing CLI session; a failure with this scope
|
|
142
|
+
* is not evidence about a running session's sign-in.
|
|
143
|
+
*/
|
|
144
|
+
collectorScope?: string;
|
|
112
145
|
[extra: string]: unknown;
|
|
113
146
|
};
|
|
114
147
|
[extra: string]: unknown;
|
|
@@ -132,6 +165,13 @@ export interface MeshNodeFactsProviderEnablement {
|
|
|
132
165
|
}
|
|
133
166
|
export interface MeshNodeFacts {
|
|
134
167
|
schemaVersion: number;
|
|
168
|
+
/** Cached CLI detection only; no paths or account data. */
|
|
169
|
+
providerInventory?: {
|
|
170
|
+
observedAt: number;
|
|
171
|
+
providers: Record<string, {
|
|
172
|
+
installed: boolean;
|
|
173
|
+
}>;
|
|
174
|
+
};
|
|
135
175
|
reportedAt: number;
|
|
136
176
|
daemonBuild?: MeshNodeFactsDaemonBuild;
|
|
137
177
|
providerVersions?: Record<string, string>;
|
|
@@ -238,7 +278,7 @@ export declare function normalizeMeshNodeFacts(raw: unknown): MeshNodeFacts | un
|
|
|
238
278
|
* the host `agy` itself uses; the unprefixed `cloudcode-pa` host 429s Google
|
|
239
279
|
* AI Pro Antigravity accounts), and its credential lives in the OS keyring,
|
|
240
280
|
* not the stale on-disk token file — see the provenance note in daemon-core
|
|
241
|
-
* `quota/fetchers/antigravity.ts`. Supported on macOS and
|
|
281
|
+
* `quota/fetchers/antigravity.ts`. Supported on macOS, Windows, and Linux; other
|
|
242
282
|
* platforms report `unsupported` rather than guess at a keyring backend
|
|
243
283
|
* nobody has verified.
|
|
244
284
|
*
|
|
@@ -203,3 +203,10 @@ export declare function isSubmitOutcome(value: unknown): value is SubmitOutcome;
|
|
|
203
203
|
export declare function isInputEnvelopeWire(value: unknown): value is InputEnvelopeWire;
|
|
204
204
|
/** Minimal structural check for the wire boundary — not a full decoder (mesh-shared stays a pure leaf; semantic validation stays with the handler that owns it). */
|
|
205
205
|
export declare function isOutboundMessage(value: unknown): value is OutboundMessage;
|
|
206
|
+
/**
|
|
207
|
+
* Drop the `<pasted_content>` envelope lines Claude Code wraps around a pasted
|
|
208
|
+
* input. Only a text that OPENS with the envelope is touched; anything else is
|
|
209
|
+
* returned unchanged. Shared across daemon transcript merge and web echo/display
|
|
210
|
+
* normalization so wrapped turns correlate identically.
|
|
211
|
+
*/
|
|
212
|
+
export declare function unwrapPastedContent(text: string): string;
|
package/dist/path-ownership.d.ts
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
/** One normalized ownership entry: a repo-relative path, optionally a `**` subtree prefix. */
|
|
35
35
|
export interface OwnedPathEntry {
|
|
36
|
-
/** Repo-relative path with forward slashes, no leading `./`, no trailing slash. */
|
|
36
|
+
/** Repo-relative path with forward slashes, no leading `./`, no trailing slash; empty for the whole-repo subtree. */
|
|
37
37
|
readonly path: string;
|
|
38
38
|
/** True when this entry was declared as `<path>/**` (owns the whole subtree). */
|
|
39
39
|
readonly subtree: boolean;
|
|
@@ -52,6 +52,9 @@ export type DaemonStatusEventWirePayload = {
|
|
|
52
52
|
elapsedSec?: number;
|
|
53
53
|
modalMessage?: string;
|
|
54
54
|
modalButtons?: string[];
|
|
55
|
+
modalKey?: string;
|
|
56
|
+
approvalEvidence?: 'live' | 'cached' | 'unavailable';
|
|
57
|
+
waitKind?: 'external';
|
|
55
58
|
surfaceHidden?: boolean;
|
|
56
59
|
muted?: boolean;
|
|
57
60
|
};
|
|
@@ -213,11 +216,15 @@ export type P2POfferWirePayload = {
|
|
|
213
216
|
sdp: string;
|
|
214
217
|
type: string;
|
|
215
218
|
peerId: string;
|
|
219
|
+
attemptId?: number;
|
|
220
|
+
attemptEpoch?: string;
|
|
216
221
|
};
|
|
217
222
|
export type P2PIceWirePayload = {
|
|
218
223
|
candidate: string;
|
|
219
224
|
mid: string;
|
|
220
225
|
peerId: string;
|
|
226
|
+
attemptId?: number;
|
|
227
|
+
attemptEpoch?: string;
|
|
221
228
|
};
|
|
222
229
|
/**
|
|
223
230
|
* A dashboard-originated signal as relayed to the daemon. `peerId` is stamped
|
|
@@ -229,6 +236,8 @@ export type P2PIceWirePayload = {
|
|
|
229
236
|
export type RelayedP2PSignalWirePayload = {
|
|
230
237
|
peerId?: string;
|
|
231
238
|
daemonId?: string;
|
|
239
|
+
attemptId?: number;
|
|
240
|
+
attemptEpoch?: string;
|
|
232
241
|
sharePermission?: string;
|
|
233
242
|
shareTargetSessionId?: string;
|
|
234
243
|
sdp?: string;
|
|
@@ -34,7 +34,7 @@ export type ChunkFrame<T extends string> = {
|
|
|
34
34
|
export declare function isChunkType(value: unknown): value is `${string}_chunk`;
|
|
35
35
|
export declare const DASHBOARD_TO_DAEMON_P2P_TYPES: readonly ["ping", "pong", "command", "input", "pty_input", "pty_resize", "screenshot_start", "screenshot_stop", "subscribe", "unsubscribe", "seqscribe_session_interest", "read", "write", "list"];
|
|
36
36
|
export type DashboardToDaemonP2PType = typeof DASHBOARD_TO_DAEMON_P2P_TYPES[number];
|
|
37
|
-
export declare const isDashboardToDaemonP2PType: (value: unknown) => value is "list" | "command" | "ping" | "pong" | "input" | "pty_input" | "pty_resize" | "screenshot_start" | "screenshot_stop" | "subscribe" | "unsubscribe" | "seqscribe_session_interest" | "
|
|
37
|
+
export declare const isDashboardToDaemonP2PType: (value: unknown) => value is "read" | "list" | "command" | "ping" | "pong" | "input" | "pty_input" | "pty_resize" | "screenshot_start" | "screenshot_stop" | "subscribe" | "unsubscribe" | "seqscribe_session_interest" | "write";
|
|
38
38
|
export type DashboardToDaemonChunkType = `${DashboardToDaemonP2PType}_chunk`;
|
|
39
39
|
export declare function isDashboardToDaemonChunkType(value: unknown): value is DashboardToDaemonChunkType;
|
|
40
40
|
export type P2PPingMsg = {
|
|
@@ -109,12 +109,16 @@ export type SystemAnnouncementWirePayload = {
|
|
|
109
109
|
export type DashboardP2POfferWirePayload = {
|
|
110
110
|
daemonId: string;
|
|
111
111
|
peerId?: string;
|
|
112
|
+
attemptId?: number;
|
|
113
|
+
attemptEpoch?: string;
|
|
112
114
|
sdp: string;
|
|
113
115
|
type: string;
|
|
114
116
|
};
|
|
115
117
|
export type DashboardP2PIceWirePayload = {
|
|
116
118
|
daemonId: string;
|
|
117
119
|
peerId?: string;
|
|
120
|
+
attemptId?: number;
|
|
121
|
+
attemptEpoch?: string;
|
|
118
122
|
candidate: string;
|
|
119
123
|
mid?: string;
|
|
120
124
|
sdpMid?: string | null;
|
|
@@ -154,16 +158,22 @@ export declare const isDashboardP2PSignalType: (value: unknown) => value is "p2p
|
|
|
154
158
|
export type DashboardP2PReadyWirePayload = {
|
|
155
159
|
daemonId: string;
|
|
156
160
|
peerId: string;
|
|
161
|
+
attemptId?: number;
|
|
162
|
+
attemptEpoch?: string;
|
|
157
163
|
};
|
|
158
164
|
export type DashboardP2PAnswerWirePayload = {
|
|
159
165
|
daemonId: string;
|
|
160
166
|
peerId: string;
|
|
161
167
|
sdp: string;
|
|
162
168
|
type: string;
|
|
169
|
+
attemptId?: number;
|
|
170
|
+
attemptEpoch?: string;
|
|
163
171
|
};
|
|
164
172
|
export type DashboardP2PLocalIceWirePayload = {
|
|
165
173
|
daemonId: string;
|
|
166
174
|
peerId: string;
|
|
175
|
+
attemptId?: number;
|
|
176
|
+
attemptEpoch?: string;
|
|
167
177
|
candidate: string;
|
|
168
178
|
sdpMid: string | null;
|
|
169
179
|
sdpMLineIndex: number | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Provider permissions are runtime decisions, never owner write ratification. */
|
|
2
|
+
export interface ProviderApproval {
|
|
3
|
+
source: 'provider_modal' | 'legacy_provider' | 'status_only' | 'ledger_approval';
|
|
4
|
+
/** Exact Inbox actions or the existing session handler; never inferred consent. */
|
|
5
|
+
compatibility?: 'exact' | 'session_only' | 'unknown';
|
|
6
|
+
type: 'tool_permission' | 'provider_setup' | 'unknown';
|
|
7
|
+
evidence: 'live' | 'cached' | 'unavailable';
|
|
8
|
+
lifecycle: 'pending' | 'resolved';
|
|
9
|
+
modalKey: string | null;
|
|
10
|
+
createdAt: number | null;
|
|
11
|
+
resolvedAt: number | null;
|
|
12
|
+
description: string;
|
|
13
|
+
runtimeDirectory?: string;
|
|
14
|
+
displayedDirectory?: string | null;
|
|
15
|
+
buttons: string[];
|
|
16
|
+
actionable: boolean;
|
|
17
|
+
providerType?: string;
|
|
18
|
+
sessionId?: string;
|
|
19
|
+
nodeId?: string | null;
|
|
20
|
+
meshId?: string | null;
|
|
21
|
+
taskId?: string | null;
|
|
22
|
+
attemptId?: string | null;
|
|
23
|
+
generation?: number | null;
|
|
24
|
+
}
|
|
25
|
+
/** Exact resource identity required by the approvals-only action path. */
|
|
26
|
+
export interface ProviderApprovalTarget {
|
|
27
|
+
modalKey: string;
|
|
28
|
+
attemptId: string | null;
|
|
29
|
+
generation: number | null;
|
|
30
|
+
}
|
|
31
|
+
/** Confirmed authority for the new Inbox path. Legacy handlers retain their own checks. */
|
|
32
|
+
export declare function isActionableProviderApproval(approval: ProviderApproval | null | undefined): boolean;
|
|
33
|
+
/** An explicit null suppresses the resource; only missing metadata uses compatibility. */
|
|
34
|
+
export declare function readProviderDecision(approval: ProviderApproval | null | undefined, waiting: boolean, hasModal?: boolean): ProviderApproval | null;
|
|
35
|
+
/** Host metadata is durable: identity and clocks only, never modal text or directories. */
|
|
36
|
+
export declare function providerApprovalSnapshot(approval: ProviderApproval | null | undefined): ProviderApproval | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Ephemeral provenance supplied by the owning daemon, never inferred from prompt text. */
|
|
2
|
+
export interface ProviderQuestionBinding {
|
|
3
|
+
transport: 'codex_rpc' | 'codex_async';
|
|
4
|
+
sessionId: string;
|
|
5
|
+
generation: string;
|
|
6
|
+
threadId: string;
|
|
7
|
+
turnId: string;
|
|
8
|
+
itemId: string;
|
|
9
|
+
requestId?: string | number;
|
|
10
|
+
}
|
|
11
|
+
export type ProviderQuestionLifecycle = 'pending' | 'submitted' | 'resolved' | 'completed' | 'cancelled' | 'expired' | 'unknown';
|
|
12
|
+
export interface ProviderQuestionEpisode {
|
|
13
|
+
blocking?: boolean;
|
|
14
|
+
binding?: ProviderQuestionBinding;
|
|
15
|
+
lifecycle?: ProviderQuestionLifecycle;
|
|
16
|
+
/** Async dismiss is product-local; it is not a native tool cancellation. */
|
|
17
|
+
support?: 'request_bound' | 'product_local' | 'uncertain';
|
|
18
|
+
}
|
|
19
|
+
export declare function isProviderQuestionBinding(value: unknown): value is ProviderQuestionBinding;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quota snapshot freshness — the ONE decision every display surface shares.
|
|
3
|
+
*
|
|
4
|
+
* Why this lives in the leaf package: the dashboard chips (web-core
|
|
5
|
+
* `quotaWindowCue`), the `adhdev quota` CLI (daemon-core `quota/cli.ts`) and the
|
|
6
|
+
* coordinator-facing `mesh_status` fold (mcp-server `summarizeNodeQuota`) each
|
|
7
|
+
* carried a hand-copied version of this rule, and a fix to one left the other
|
|
8
|
+
* two telling a different story about the same snapshot. They all call
|
|
9
|
+
* `assessQuotaFreshness` now; only the WORDING stays per-surface.
|
|
10
|
+
*
|
|
11
|
+
* Pure: plain objects in, plain object out, no clock except the `now` argument.
|
|
12
|
+
*/
|
|
13
|
+
import type { MeshNodeFactsProviderQuota } from './node-facts';
|
|
14
|
+
export type QuotaFreshnessCue = 'refreshing' | 'stale';
|
|
15
|
+
export interface QuotaFreshness {
|
|
16
|
+
/** Undefined = nothing to say (a fresh reading, or no retained numbers). */
|
|
17
|
+
cue?: QuotaFreshnessCue;
|
|
18
|
+
/**
|
|
19
|
+
* Only the USER can produce a new reading (aged-out Claude statusline;
|
|
20
|
+
* expired CLI access token — the daemon never redeems it). The surface
|
|
21
|
+
* should say what to run, not promise a self-heal.
|
|
22
|
+
*/
|
|
23
|
+
userMustAct: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Unix ms by which the daemon will have looked again, for a `stale` reading
|
|
26
|
+
* the daemon re-checks on its own. Absent when the user must act, when the
|
|
27
|
+
* reading is `refreshing` (a retry is already scheduled), or when the check
|
|
28
|
+
* is already due.
|
|
29
|
+
*/
|
|
30
|
+
nextCheckAt?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* How long past `metadata.retryAtMs` a retry still reads as "in flight". The
|
|
34
|
+
* retry timer fires at retryAtMs and the probe itself takes a few seconds; a
|
|
35
|
+
* retryAtMs well in the past with no newer attempt means no retry is coming.
|
|
36
|
+
*/
|
|
37
|
+
export declare const QUOTA_RETRY_INFLIGHT_GRACE_MS = 60000;
|
|
38
|
+
/**
|
|
39
|
+
* The daemon's backfill horizon: a snapshot is re-probed once it is this old
|
|
40
|
+
* even on an idle machine. Mirrors daemon-core `QUOTA_ROUTABLE_MAX_AGE_MS`
|
|
41
|
+
* (quota/refresh.ts); daemon-core's quota-freshness test pins the two equal.
|
|
42
|
+
*/
|
|
43
|
+
export declare const QUOTA_BACKFILL_HORIZON_MS: number;
|
|
44
|
+
/**
|
|
45
|
+
* Which freshness cue a snapshot's retained numbers should carry.
|
|
46
|
+
*
|
|
47
|
+
* - `stale` + `userMustAct` — nothing will refresh it without the user:
|
|
48
|
+
* · `no-data` on any provider EXCEPT codex (Claude's statusline aged out —
|
|
49
|
+
* a session must run). Codex's `no-data` is the daemon re-reading the
|
|
50
|
+
* rollout files itself (≈60s while a CLI is active, ≤60 min idle), so it
|
|
51
|
+
* is `stale` WITHOUT userMustAct;
|
|
52
|
+
* · `expired-token` on Grok/Kimi/antigravity — only the owning CLI
|
|
53
|
+
* renews it on use. An idle CLI has no background renewal cadence.
|
|
54
|
+
* A scheduled quota retry does not itself renew credentials.
|
|
55
|
+
* - `refreshing` — retained numbers after a transient failure with a retry
|
|
56
|
+
* actually pending. ★Honest about the end of the retry budget: once the
|
|
57
|
+
* daemon has stopped retrying (`metadata.retryExhausted`, or `retryAtMs`
|
|
58
|
+
* long past with no newer attempt) the numbers are `stale` with the next
|
|
59
|
+
* scheduled check, not "refreshing" for the up-to-60 minutes until the
|
|
60
|
+
* hourly backfill. A snapshot with NO retry bookkeeping at all (a daemon
|
|
61
|
+
* predating the stamp) keeps the old `refreshing` reading.
|
|
62
|
+
*/
|
|
63
|
+
export declare function assessQuotaFreshness(quota: MeshNodeFactsProviderQuota, now?: number): QuotaFreshness;
|
|
64
|
+
/** Whole minutes (min 1) until `nextCheckAt`, for the "next check ~Nm" wording. */
|
|
65
|
+
export declare function minutesUntilQuotaCheck(nextCheckAt: number, now?: number): number;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Persisted role-launch intent. Restart replays this selection rather than
|
|
2
|
+
* consulting newer machine defaults; restore preserves its original provenance. */
|
|
3
|
+
import { type LaunchDefaultRole, type LaunchDefaultSelection, type LaunchDefaultAxis, type LaunchDefaultRef } from './launch-defaults';
|
|
4
|
+
export interface RoleLaunchSelection {
|
|
5
|
+
role: LaunchDefaultRole;
|
|
6
|
+
selection: LaunchDefaultSelection;
|
|
7
|
+
applied: Record<keyof LaunchDefaultSelection, LaunchDefaultAxis>;
|
|
8
|
+
defaultRef?: LaunchDefaultRef;
|
|
9
|
+
documentRevision: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function parseRoleLaunchSelection(value: unknown): RoleLaunchSelection | undefined;
|
package/dist/session-launch.d.ts
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* level, and WHERE each value came from.
|
|
4
|
-
*
|
|
5
|
-
* Wiring-unification Phase E (docs/design/2026-09-23-wiring-unification.md §7,
|
|
6
|
-
* RC5). Before this record the only trace of a session's model was a display
|
|
7
|
-
* string in recent-activity (`buildLegacyModelModeSummaryMetadata`), so nobody
|
|
8
|
-
* could answer "did I pick this model, did the dashboard restore it from last
|
|
9
|
-
* time, did a mesh slot choose it, or is it just the provider default?" — and
|
|
10
|
-
* after a daemon restart not even the value survived.
|
|
11
|
-
*
|
|
12
|
-
* The daemon owns the record (daemon-core `SessionRegistry`); this file holds the
|
|
13
|
-
* shape and the pure readers so daemon-core, web-core, the server and the MCP
|
|
14
|
-
* server all read one definition. It is a dependency-free leaf, like the rest of
|
|
15
|
-
* mesh-shared.
|
|
16
|
-
*
|
|
17
|
-
* ★Server content boundary (CLAUDE.md): the full record rides P2P only. The
|
|
18
|
-
* server path carries exactly two derived fields — `model` (an identifier,
|
|
19
|
-
* passed through {@link sanitizeModelIdentifier}) and `modelSource` (an enum,
|
|
20
|
-
* passed through {@link isModelAxisSource}). Never widen that to the record.
|
|
21
|
-
*/
|
|
22
|
-
export declare const MODEL_AXIS_SOURCES: readonly ["user", "remembered", "mesh_slot", "task_override", "provider_default", "unspecified"];
|
|
1
|
+
import { type RoleLaunchSelection } from './role-launch';
|
|
2
|
+
export declare const MODEL_AXIS_SOURCES: readonly ["user", "remembered", "stored_default", "project_default", "mesh_slot", "task_override", "provider_default", "unspecified"];
|
|
23
3
|
export type ModelAxisSource = typeof MODEL_AXIS_SOURCES[number];
|
|
24
4
|
export declare function isModelAxisSource(value: unknown): value is ModelAxisSource;
|
|
25
5
|
/**
|
|
@@ -65,6 +45,7 @@ export interface ModelSelection {
|
|
|
65
45
|
history: ModelSelectionHistoryEntry[];
|
|
66
46
|
}
|
|
67
47
|
export interface SessionLaunchRecord {
|
|
48
|
+
roleLaunch?: RoleLaunchSelection;
|
|
68
49
|
sessionId: string;
|
|
69
50
|
providerType: string;
|
|
70
51
|
providerVersion?: string;
|
package/dist/slot-proposal.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ import { type MeshTaskDifficulty, type NodeCapabilitySlot } from './brain-routin
|
|
|
35
35
|
export interface CliSlotRecipe {
|
|
36
36
|
/** Optional model to pin on the slot. Best-effort at launch. */
|
|
37
37
|
model?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Optional ordered candidate models to prefer when the provider's live
|
|
40
|
+
* `modelOptions` (from model discovery) is present on `DetectedCliProvider`.
|
|
41
|
+
* The first candidate present in `modelOptions` wins; falls back to `model`
|
|
42
|
+
* when `modelOptions` is absent or contains none of the candidates.
|
|
43
|
+
*/
|
|
44
|
+
modelCandidates?: readonly string[];
|
|
38
45
|
/** Optional thinking level, in the provider's own vocabulary. */
|
|
39
46
|
thinkingLevel?: string;
|
|
40
47
|
/** Difficulty range this slot handles. Empty = general-purpose. */
|
|
@@ -76,6 +83,13 @@ export interface DetectedCliProvider {
|
|
|
76
83
|
displayName?: string;
|
|
77
84
|
/** Detected version, when known. Display only — never affects the mapping. */
|
|
78
85
|
version?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Live discovered / resolved `modelOptions` for this provider on the node,
|
|
88
|
+
* when available on the status catalog. When present and non-empty, recipes
|
|
89
|
+
* prefer the first matching model from `[recipe.model, ...recipe.modelCandidates]`
|
|
90
|
+
* that exists in `modelOptions`.
|
|
91
|
+
*/
|
|
92
|
+
modelOptions?: readonly string[];
|
|
79
93
|
}
|
|
80
94
|
/** One proposed slot plus why it was proposed. */
|
|
81
95
|
export interface ProposedSlotEntry {
|