@adhdev/mesh-shared 1.0.82-rc.2 → 1.0.82-rc.20
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 +9 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +230 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -18
- 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 +8 -1
- package/dist/node-facts.d.ts +40 -0
- package/dist/path-ownership.d.ts +1 -1
- 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/turn-evidence.d.ts +20 -8
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/assistant-protocol.ts +22 -1
- package/src/index.ts +4 -0
- package/src/keyed-doc-delta.ts +9 -1
- package/src/launch-defaults.ts +168 -0
- package/src/mesh-tool-names.ts +1 -0
- package/src/mesh-vocabulary.ts +8 -0
- package/src/node-facts.ts +35 -0
- package/src/path-ownership.ts +4 -6
- package/src/provider-approval.ts +59 -0
- package/src/provider-question.ts +31 -0
- package/src/quota-freshness.ts +136 -0
- package/src/turn-evidence.ts +20 -17
- package/src/types.ts +1 -0
|
@@ -15,21 +15,29 @@
|
|
|
15
15
|
* belongs in `CANONICAL_MESH_TOOL_NAMES`, and the coordinator/worker MCP modes
|
|
16
16
|
* never publish them.
|
|
17
17
|
*/
|
|
18
|
-
export declare const ASSISTANT_TOOLS: readonly ["projects", "project_status", "project_send", "project_read", "project_add", "discover_repos", "memory", "skill_view", "skill_manage", "project_note"];
|
|
18
|
+
export declare const ASSISTANT_TOOLS: readonly ["projects", "environment", "assistant_action", "project_watch", "project_status", "project_send", "project_read", "project_add", "project_attach_remote", "discover_repos", "memory", "skill_view", "skill_manage", "project_note", "launch_defaults", "launch_defaults_set"];
|
|
19
19
|
export type AssistantTool = typeof ASSISTANT_TOOLS[number];
|
|
20
20
|
export declare function isAssistantTool(value: unknown): value is AssistantTool;
|
|
21
21
|
/** Daemon verb names (§4.4 table + the five verbs below it). */
|
|
22
22
|
export declare const ASSISTANT_VERB: {
|
|
23
23
|
readonly projects: "assistant_projects";
|
|
24
|
+
readonly environment: "assistant_environment";
|
|
25
|
+
readonly action: "assistant_action";
|
|
26
|
+
readonly watch: "assistant_project_watch";
|
|
27
|
+
readonly executionState: "assistant_execution_state";
|
|
28
|
+
readonly executionSettings: "assistant_execution_settings";
|
|
24
29
|
readonly projectStatus: "assistant_project_status";
|
|
25
30
|
readonly projectSend: "assistant_project_send";
|
|
26
31
|
readonly projectRead: "assistant_project_read";
|
|
27
32
|
readonly projectAdd: "assistant_project_add";
|
|
33
|
+
readonly projectAttachRemote: "assistant_project_attach_remote";
|
|
28
34
|
readonly discoverRepos: "assistant_discover_repos";
|
|
29
35
|
readonly memory: "assistant_memory";
|
|
30
36
|
readonly skillView: "assistant_skill_view";
|
|
31
37
|
readonly skillManage: "assistant_skill_manage";
|
|
32
38
|
readonly projectNote: "assistant_project_note";
|
|
39
|
+
readonly launchDefaults: "assistant_launch_defaults";
|
|
40
|
+
readonly launchDefaultsSet: "assistant_launch_defaults_set";
|
|
33
41
|
readonly launch: "launch_assistant";
|
|
34
42
|
readonly pendingRelays: "assistant_pending_relays";
|
|
35
43
|
readonly stagedResolve: "assistant_staged_resolve";
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './git-normalize';
|
|
|
15
15
|
export * from './session-normalize';
|
|
16
16
|
export * from './node-normalize';
|
|
17
17
|
export * from './node-facts';
|
|
18
|
+
export * from './quota-freshness';
|
|
18
19
|
export * from './workspace-normalize';
|
|
19
20
|
export * from './daemon-normalize';
|
|
20
21
|
export * from './git-summarize';
|
|
@@ -40,3 +41,6 @@ export * from './turn-ipc';
|
|
|
40
41
|
export * from './path-ownership';
|
|
41
42
|
export * from './mission-brief';
|
|
42
43
|
export * from './keyed-doc-delta';
|
|
44
|
+
export * from './provider-approval';
|
|
45
|
+
export * from './provider-question';
|
|
46
|
+
export * from './launch-defaults';
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,10 @@ __export(index_exports, {
|
|
|
57
57
|
EVIDENCE_ENVELOPE_FIELD_SPECS: () => EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
58
58
|
EVIDENCE_SOURCE_IDS: () => EVIDENCE_SOURCE_IDS,
|
|
59
59
|
HOLD_REASONS: () => HOLD_REASONS,
|
|
60
|
+
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE: () => LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
61
|
+
LAUNCH_DEFAULT_ERROR_CODES: () => LAUNCH_DEFAULT_ERROR_CODES,
|
|
62
|
+
LAUNCH_DEFAULT_ROLES: () => LAUNCH_DEFAULT_ROLES,
|
|
63
|
+
LAUNCH_DEFAULT_SOURCES: () => LAUNCH_DEFAULT_SOURCES,
|
|
60
64
|
LIVENESS_RESULTS: () => LIVENESS_RESULTS,
|
|
61
65
|
MAX_MESH_RECORD_STRING: () => MAX_MESH_RECORD_STRING,
|
|
62
66
|
MAX_OWNED_PATHS: () => MAX_OWNED_PATHS,
|
|
@@ -97,6 +101,8 @@ __export(index_exports, {
|
|
|
97
101
|
OUTBOUND_MESSAGE_ORIGINS: () => OUTBOUND_MESSAGE_ORIGINS,
|
|
98
102
|
P2P_SIGNAL_TYPES: () => P2P_SIGNAL_TYPES,
|
|
99
103
|
PROVIDER_FAILURES: () => PROVIDER_FAILURES,
|
|
104
|
+
QUOTA_BACKFILL_HORIZON_MS: () => QUOTA_BACKFILL_HORIZON_MS,
|
|
105
|
+
QUOTA_RETRY_INFLIGHT_GRACE_MS: () => QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
100
106
|
QUOTA_SUPPORTED_PROVIDERS: () => QUOTA_SUPPORTED_PROVIDERS,
|
|
101
107
|
RECENT_SESSION_BUCKETS: () => RECENT_SESSION_BUCKETS,
|
|
102
108
|
RECLAIMING_SEND_REFUSALS: () => RECLAIMING_SEND_REFUSALS,
|
|
@@ -142,9 +148,11 @@ __export(index_exports, {
|
|
|
142
148
|
WORKER_BRANCH_STATES: () => WORKER_BRANCH_STATES,
|
|
143
149
|
WORKER_PROTOCOL_FOOTER_MARKER: () => WORKER_PROTOCOL_FOOTER_MARKER,
|
|
144
150
|
WORKER_REPORT_OUTCOMES: () => WORKER_REPORT_OUTCOMES,
|
|
151
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS: () => WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
145
152
|
WORKER_TOOLS: () => WORKER_TOOLS,
|
|
146
153
|
appendWorkerProtocolFooter: () => appendWorkerProtocolFooter,
|
|
147
154
|
argsCarryStatusProbeMarker: () => argsCarryStatusProbeMarker,
|
|
155
|
+
assessQuotaFreshness: () => assessQuotaFreshness,
|
|
148
156
|
buildSlotProposal: () => buildSlotProposal,
|
|
149
157
|
canonicalDaemonId: () => canonicalDaemonId,
|
|
150
158
|
classifySessionStatus: () => classifySessionStatus,
|
|
@@ -225,6 +233,7 @@ __export(index_exports, {
|
|
|
225
233
|
hasGitStatusEvidence: () => hasGitStatusEvidence,
|
|
226
234
|
hasWorkerProtocolFooter: () => hasWorkerProtocolFooter,
|
|
227
235
|
interpolateString: () => interpolateString,
|
|
236
|
+
isActionableProviderApproval: () => isActionableProviderApproval,
|
|
228
237
|
isAssistantTool: () => isAssistantTool,
|
|
229
238
|
isBlockedStatus: () => isBlockedStatus,
|
|
230
239
|
isBusyStatus: () => isBusyStatus,
|
|
@@ -246,6 +255,8 @@ __export(index_exports, {
|
|
|
246
255
|
isFiniteNumber: () => isFiniteNumber,
|
|
247
256
|
isIdleSessionState: () => isIdleSessionState,
|
|
248
257
|
isInputEnvelopeWire: () => isInputEnvelopeWire,
|
|
258
|
+
isLaunchDefaultRole: () => isLaunchDefaultRole,
|
|
259
|
+
isLaunchDefaultSource: () => isLaunchDefaultSource,
|
|
249
260
|
isMeshDeliveryMode: () => isMeshDeliveryMode,
|
|
250
261
|
isMeshIndexQueryResponse: () => isMeshIndexQueryResponse,
|
|
251
262
|
isMeshMissionStatusValue: () => isMeshMissionStatusValue,
|
|
@@ -260,12 +271,14 @@ __export(index_exports, {
|
|
|
260
271
|
isMessageId: () => isMessageId,
|
|
261
272
|
isMissionUpsertResponse: () => isMissionUpsertResponse,
|
|
262
273
|
isModelAxisSource: () => isModelAxisSource,
|
|
274
|
+
isNativeMarkerRef: () => isNativeMarkerRef,
|
|
263
275
|
isNonEmptyString: () => isNonEmptyString,
|
|
264
276
|
isNotifyKind: () => isNotifyKind,
|
|
265
277
|
isOutboundMessage: () => isOutboundMessage,
|
|
266
278
|
isOutboundMessageOrigin: () => isOutboundMessageOrigin,
|
|
267
279
|
isP2PSignalType: () => isP2PSignalType,
|
|
268
280
|
isPhantomDaemonEntry: () => isPhantomDaemonEntry,
|
|
281
|
+
isProviderQuestionBinding: () => isProviderQuestionBinding,
|
|
269
282
|
isRawDaemonDoId: () => isRawDaemonDoId,
|
|
270
283
|
isReadyStatus: () => isReadyStatus,
|
|
271
284
|
isRecord: () => isRecord,
|
|
@@ -303,6 +316,7 @@ __export(index_exports, {
|
|
|
303
316
|
meshUtf8ByteLength: () => meshUtf8ByteLength,
|
|
304
317
|
meshWorkspacesEquivalent: () => meshWorkspacesEquivalent,
|
|
305
318
|
mintMessageId: () => mintMessageId,
|
|
319
|
+
minutesUntilQuotaCheck: () => minutesUntilQuotaCheck,
|
|
306
320
|
normalizeAuthOkLimits: () => normalizeAuthOkLimits,
|
|
307
321
|
normalizeBrainSlot: () => normalizeBrainSlot,
|
|
308
322
|
normalizeDifficultyBrainMap: () => normalizeDifficultyBrainMap,
|
|
@@ -325,11 +339,13 @@ __export(index_exports, {
|
|
|
325
339
|
pickBestTransitGitStatus: () => pickBestTransitGitStatus,
|
|
326
340
|
projectFileDiffRow: () => projectFileDiffRow,
|
|
327
341
|
projectTurnEvidenceEntry: () => projectTurnEvidenceEntry,
|
|
342
|
+
providerApprovalSnapshot: () => providerApprovalSnapshot,
|
|
328
343
|
readBoolean: () => readBoolean,
|
|
329
344
|
readEnvelopeFields: () => readEnvelopeFields,
|
|
330
345
|
readGitSubmodules: () => readGitSubmodules,
|
|
331
346
|
readNumber: () => readNumber,
|
|
332
347
|
readOptionalRecord: () => readOptionalRecord,
|
|
348
|
+
readProviderDecision: () => readProviderDecision,
|
|
333
349
|
readRecord: () => readRecord,
|
|
334
350
|
readString: () => readString,
|
|
335
351
|
readStringArray: () => readStringArray,
|
|
@@ -656,6 +672,50 @@ function defaultProviderPriorityFromNodeFacts(facts) {
|
|
|
656
672
|
return orderProvidersByBuiltinPreference(detected.length ? detected : enabled);
|
|
657
673
|
}
|
|
658
674
|
|
|
675
|
+
// src/quota-freshness.ts
|
|
676
|
+
var QUOTA_RETRY_INFLIGHT_GRACE_MS = 6e4;
|
|
677
|
+
var QUOTA_BACKFILL_HORIZON_MS = 60 * 60 * 1e3;
|
|
678
|
+
function hasUsableWindow(window) {
|
|
679
|
+
return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
|
|
680
|
+
}
|
|
681
|
+
function hasReading(quota) {
|
|
682
|
+
if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
|
|
683
|
+
return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
|
|
684
|
+
}
|
|
685
|
+
function finiteMs(value) {
|
|
686
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
687
|
+
}
|
|
688
|
+
function backfillCheckAt(quota, now) {
|
|
689
|
+
const dataDue = finiteMs(quota.updatedAt);
|
|
690
|
+
const attempted = finiteMs(quota.metadata?.fetchedAt);
|
|
691
|
+
const dueAt = Math.max(
|
|
692
|
+
dataDue === void 0 ? Number.NEGATIVE_INFINITY : dataDue + QUOTA_BACKFILL_HORIZON_MS,
|
|
693
|
+
attempted === void 0 ? Number.NEGATIVE_INFINITY : attempted + QUOTA_BACKFILL_HORIZON_MS
|
|
694
|
+
);
|
|
695
|
+
return Number.isFinite(dueAt) && dueAt > now ? dueAt : void 0;
|
|
696
|
+
}
|
|
697
|
+
function assessQuotaFreshness(quota, now = Date.now()) {
|
|
698
|
+
const meta = quota.metadata;
|
|
699
|
+
const kind = meta?.failureKind;
|
|
700
|
+
const userMustAct = kind === "no-data" && quota.provider !== "codex-cli" || kind === "expired-token" && ["grok-cli", "kimi", "antigravity-cli"].includes(quota.provider);
|
|
701
|
+
if (userMustAct) return hasReading(quota) ? { cue: "stale", userMustAct: true } : { userMustAct: true };
|
|
702
|
+
if (meta?.lastGoodWindows !== true) {
|
|
703
|
+
const measuredAt = finiteMs(quota.updatedAt);
|
|
704
|
+
if (hasReading(quota) && (measuredAt === void 0 || now - measuredAt >= QUOTA_BACKFILL_HORIZON_MS)) {
|
|
705
|
+
return { cue: "stale", userMustAct };
|
|
706
|
+
}
|
|
707
|
+
return { userMustAct };
|
|
708
|
+
}
|
|
709
|
+
const retryAtMs = finiteMs(meta?.retryAtMs);
|
|
710
|
+
const retryStopped = meta?.retryExhausted === true || retryAtMs !== void 0 && retryAtMs + QUOTA_RETRY_INFLIGHT_GRACE_MS < now;
|
|
711
|
+
if (kind !== "no-data" && !retryStopped) return { cue: "refreshing", userMustAct: false };
|
|
712
|
+
const nextCheckAt = backfillCheckAt(quota, now);
|
|
713
|
+
return nextCheckAt === void 0 ? { cue: "stale", userMustAct: false } : { cue: "stale", userMustAct: false, nextCheckAt };
|
|
714
|
+
}
|
|
715
|
+
function minutesUntilQuotaCheck(nextCheckAt, now = Date.now()) {
|
|
716
|
+
return Math.max(1, Math.round((nextCheckAt - now) / 6e4));
|
|
717
|
+
}
|
|
718
|
+
|
|
659
719
|
// src/workspace-normalize.ts
|
|
660
720
|
function normalizeMeshWorkspaceForCompare(dir) {
|
|
661
721
|
if (typeof dir !== "string") return "";
|
|
@@ -1047,6 +1107,7 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
1047
1107
|
"mesh_list_pending_approvals",
|
|
1048
1108
|
"mesh_create",
|
|
1049
1109
|
"mesh_add_node",
|
|
1110
|
+
"mesh_attach_remote",
|
|
1050
1111
|
"mesh_clone_node",
|
|
1051
1112
|
"mesh_remove_node",
|
|
1052
1113
|
"mesh_cleanup_worktree_nodes",
|
|
@@ -1756,6 +1817,7 @@ var MESH_THINKING_LEVELS = ["low", "medium", "high"];
|
|
|
1756
1817
|
var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
|
|
1757
1818
|
var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
|
|
1758
1819
|
var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
|
|
1820
|
+
var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
|
|
1759
1821
|
var WORKER_BRANCH_STATES = [
|
|
1760
1822
|
"merged_to_main",
|
|
1761
1823
|
"pushed_feature_branch_needs_merge",
|
|
@@ -2023,15 +2085,21 @@ function renderCoordinatorWorkerSection() {
|
|
|
2023
2085
|
// src/assistant-protocol.ts
|
|
2024
2086
|
var ASSISTANT_TOOLS = [
|
|
2025
2087
|
"projects",
|
|
2088
|
+
"environment",
|
|
2089
|
+
"assistant_action",
|
|
2090
|
+
"project_watch",
|
|
2026
2091
|
"project_status",
|
|
2027
2092
|
"project_send",
|
|
2028
2093
|
"project_read",
|
|
2029
2094
|
"project_add",
|
|
2095
|
+
"project_attach_remote",
|
|
2030
2096
|
"discover_repos",
|
|
2031
2097
|
"memory",
|
|
2032
2098
|
"skill_view",
|
|
2033
2099
|
"skill_manage",
|
|
2034
|
-
"project_note"
|
|
2100
|
+
"project_note",
|
|
2101
|
+
"launch_defaults",
|
|
2102
|
+
"launch_defaults_set"
|
|
2035
2103
|
];
|
|
2036
2104
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
2037
2105
|
function isAssistantTool(value) {
|
|
@@ -2040,15 +2108,23 @@ function isAssistantTool(value) {
|
|
|
2040
2108
|
var ASSISTANT_VERB = {
|
|
2041
2109
|
// tool verbs
|
|
2042
2110
|
projects: "assistant_projects",
|
|
2111
|
+
environment: "assistant_environment",
|
|
2112
|
+
action: "assistant_action",
|
|
2113
|
+
watch: "assistant_project_watch",
|
|
2114
|
+
executionState: "assistant_execution_state",
|
|
2115
|
+
executionSettings: "assistant_execution_settings",
|
|
2043
2116
|
projectStatus: "assistant_project_status",
|
|
2044
2117
|
projectSend: "assistant_project_send",
|
|
2045
2118
|
projectRead: "assistant_project_read",
|
|
2046
2119
|
projectAdd: "assistant_project_add",
|
|
2120
|
+
projectAttachRemote: "assistant_project_attach_remote",
|
|
2047
2121
|
discoverRepos: "assistant_discover_repos",
|
|
2048
2122
|
memory: "assistant_memory",
|
|
2049
2123
|
skillView: "assistant_skill_view",
|
|
2050
2124
|
skillManage: "assistant_skill_manage",
|
|
2051
2125
|
projectNote: "assistant_project_note",
|
|
2126
|
+
launchDefaults: "assistant_launch_defaults",
|
|
2127
|
+
launchDefaultsSet: "assistant_launch_defaults_set",
|
|
2052
2128
|
// assistant-side daemon verbs without a tool of the same name
|
|
2053
2129
|
launch: "launch_assistant",
|
|
2054
2130
|
pendingRelays: "assistant_pending_relays",
|
|
@@ -2059,18 +2135,25 @@ var ASSISTANT_VERB = {
|
|
|
2059
2135
|
};
|
|
2060
2136
|
var ASSISTANT_TOOL_VERBS = {
|
|
2061
2137
|
projects: ASSISTANT_VERB.projects,
|
|
2138
|
+
environment: ASSISTANT_VERB.environment,
|
|
2139
|
+
assistant_action: ASSISTANT_VERB.action,
|
|
2140
|
+
project_watch: ASSISTANT_VERB.watch,
|
|
2062
2141
|
project_status: ASSISTANT_VERB.projectStatus,
|
|
2063
2142
|
project_send: ASSISTANT_VERB.projectSend,
|
|
2064
2143
|
project_read: ASSISTANT_VERB.projectRead,
|
|
2065
2144
|
project_add: ASSISTANT_VERB.projectAdd,
|
|
2145
|
+
project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
|
|
2066
2146
|
discover_repos: ASSISTANT_VERB.discoverRepos,
|
|
2067
2147
|
memory: ASSISTANT_VERB.memory,
|
|
2068
2148
|
skill_view: ASSISTANT_VERB.skillView,
|
|
2069
2149
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
2070
|
-
project_note: ASSISTANT_VERB.projectNote
|
|
2150
|
+
project_note: ASSISTANT_VERB.projectNote,
|
|
2151
|
+
launch_defaults: ASSISTANT_VERB.launchDefaults,
|
|
2152
|
+
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet
|
|
2071
2153
|
};
|
|
2072
|
-
var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
|
|
2154
|
+
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add", "project_attach_remote", "launch_defaults_set"];
|
|
2073
2155
|
var ASSISTANT_OWNER_VERBS = [
|
|
2156
|
+
ASSISTANT_VERB.executionSettings,
|
|
2074
2157
|
ASSISTANT_VERB.stagedResolve,
|
|
2075
2158
|
ASSISTANT_VERB.storeAdmin,
|
|
2076
2159
|
ASSISTANT_VERB.importSkills
|
|
@@ -2128,8 +2211,8 @@ function sanitizeRefusalCode(value) {
|
|
|
2128
2211
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
2129
2212
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
2130
2213
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
2131
|
-
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
|
|
2132
|
-
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
|
|
2214
|
+
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
|
|
2215
|
+
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
|
|
2133
2216
|
var TURN_END_STRENGTHS = ["genuine", "weak"];
|
|
2134
2217
|
var TURN_END_BLOCK_REASONS = [
|
|
2135
2218
|
"missing_final_assistant",
|
|
@@ -2137,9 +2220,9 @@ var TURN_END_BLOCK_REASONS = [
|
|
|
2137
2220
|
"terminal_block_hard_cap",
|
|
2138
2221
|
"decoupled_completion"
|
|
2139
2222
|
];
|
|
2140
|
-
var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
|
|
2223
|
+
var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
|
|
2141
2224
|
var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
|
|
2142
|
-
var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
|
|
2225
|
+
var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
|
|
2143
2226
|
var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
|
|
2144
2227
|
var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
|
|
2145
2228
|
var OPERATOR_STATUSES = ["completed", "failed"];
|
|
@@ -2166,7 +2249,8 @@ var HOLD_REASONS = [
|
|
|
2166
2249
|
// — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
|
|
2167
2250
|
// a session whose FSM never shows the idle edge again does not wait for
|
|
2168
2251
|
// liveness / hard_ceiling.
|
|
2169
|
-
"await_end"
|
|
2252
|
+
"await_end",
|
|
2253
|
+
"report_correction"
|
|
2170
2254
|
];
|
|
2171
2255
|
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
2172
2256
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
@@ -2177,9 +2261,15 @@ var TURN_REASONS = [
|
|
|
2177
2261
|
"transcript_final",
|
|
2178
2262
|
"worker_reported",
|
|
2179
2263
|
"finalization_timeout_no_response",
|
|
2264
|
+
"weak_end_liveness_unconfirmed",
|
|
2265
|
+
"weak_end_probe_unobserved",
|
|
2266
|
+
"report_correction_expired",
|
|
2180
2267
|
"session_error",
|
|
2181
2268
|
"provider_auth_failed",
|
|
2182
2269
|
"provider_billing_failed",
|
|
2270
|
+
"provider_usage_limit_exceeded",
|
|
2271
|
+
"provider_server_overloaded",
|
|
2272
|
+
"provider_error",
|
|
2183
2273
|
"operator_cancel",
|
|
2184
2274
|
"intentional_cleanup",
|
|
2185
2275
|
"task_removed",
|
|
@@ -2256,8 +2346,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2256
2346
|
duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
|
|
2257
2347
|
session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
|
|
2258
2348
|
turn_started: { retro: bool },
|
|
2259
|
-
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
|
|
2260
|
-
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
|
|
2349
|
+
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
|
|
2350
|
+
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
|
|
2261
2351
|
turn_end: {
|
|
2262
2352
|
strength: en(TURN_END_STRENGTHS),
|
|
2263
2353
|
afterFinalizationTimeout: boolOpt,
|
|
@@ -2267,6 +2357,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2267
2357
|
releasedByHardCap: boolOpt,
|
|
2268
2358
|
nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
|
|
2269
2359
|
live: { t: "live", optional: true },
|
|
2360
|
+
nativeMarker: { t: "native_marker", optional: true },
|
|
2270
2361
|
reportExpected: boolOpt,
|
|
2271
2362
|
providerFailure: enOpt(PROVIDER_FAILURES)
|
|
2272
2363
|
},
|
|
@@ -2280,7 +2371,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2280
2371
|
},
|
|
2281
2372
|
transcript_activity: { newestActivityAt: ms },
|
|
2282
2373
|
no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
|
|
2283
|
-
liveness: { result: en(LIVENESS_RESULTS) },
|
|
2374
|
+
liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
|
|
2284
2375
|
process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
|
|
2285
2376
|
session_error: { reason: en(SESSION_ERROR_REASONS) },
|
|
2286
2377
|
worker_report: {
|
|
@@ -2290,6 +2381,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2290
2381
|
branchState: enOpt(WORKER_BRANCH_STATES),
|
|
2291
2382
|
touchedFileCount: intOpt
|
|
2292
2383
|
},
|
|
2384
|
+
worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
|
|
2293
2385
|
worker_progress: { note: { t: "summary_ref", optional: true } },
|
|
2294
2386
|
git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
|
|
2295
2387
|
cancel: { reason: en(CANCEL_REASONS) },
|
|
@@ -2337,7 +2429,7 @@ function isLiveTurnPending(value) {
|
|
|
2337
2429
|
return isRecord2(value) && hasOnlyKeys(value, ["modal", "adapterPending", "trailingTool", "newestActivityAt"]) && typeof value.modal === "boolean" && typeof value.adapterPending === "boolean" && typeof value.trailingTool === "boolean" && (value.newestActivityAt === void 0 || isFiniteNumber2(value.newestActivityAt));
|
|
2338
2430
|
}
|
|
2339
2431
|
function isNativeMarkerRef(value) {
|
|
2340
|
-
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
|
|
2432
|
+
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId", "receivedAt", "startedAt", "errorAt"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId)) && ["receivedAt", "startedAt", "errorAt"].every((key) => value[key] === void 0 || isFiniteNumber2(value[key]));
|
|
2341
2433
|
}
|
|
2342
2434
|
function isCoordinatorIdentity(value) {
|
|
2343
2435
|
return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
|
|
@@ -3406,14 +3498,11 @@ function normalizeOwnedPaths(input) {
|
|
|
3406
3498
|
}
|
|
3407
3499
|
function entryContains(base, path) {
|
|
3408
3500
|
if (path === base.path) return true;
|
|
3409
|
-
if (base.subtree && (path ===
|
|
3501
|
+
if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
|
|
3410
3502
|
return false;
|
|
3411
3503
|
}
|
|
3412
3504
|
function entriesOverlap(a, b) {
|
|
3413
|
-
|
|
3414
|
-
if (a.subtree && (b.path === a.path || b.path.startsWith(`${a.path}/`))) return true;
|
|
3415
|
-
if (b.subtree && (a.path === b.path || a.path.startsWith(`${b.path}/`))) return true;
|
|
3416
|
-
return false;
|
|
3505
|
+
return entryContains(a, b.path) || entryContains(b, a.path);
|
|
3417
3506
|
}
|
|
3418
3507
|
function pathsOverlap(a, b) {
|
|
3419
3508
|
if (a.paths.length === 0 || b.paths.length === 0) return false;
|
|
@@ -3685,7 +3774,15 @@ function foldKeyedDoc(held, delta, spec) {
|
|
|
3685
3774
|
const heldList = heldCollections.get(path);
|
|
3686
3775
|
if (change?.absent) {
|
|
3687
3776
|
const [head2, tail2] = splitPath(path);
|
|
3688
|
-
if (!tail2)
|
|
3777
|
+
if (!tail2) {
|
|
3778
|
+
delete next[head2];
|
|
3779
|
+
continue;
|
|
3780
|
+
}
|
|
3781
|
+
const parent2 = next[head2];
|
|
3782
|
+
if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
|
|
3783
|
+
const copy = { ...parent2 };
|
|
3784
|
+
delete copy[tail2];
|
|
3785
|
+
next[head2] = copy;
|
|
3689
3786
|
continue;
|
|
3690
3787
|
}
|
|
3691
3788
|
if (!change && heldList === void 0) continue;
|
|
@@ -3749,6 +3846,105 @@ function stableMeshNodeRow(row) {
|
|
|
3749
3846
|
}
|
|
3750
3847
|
return out;
|
|
3751
3848
|
}
|
|
3849
|
+
|
|
3850
|
+
// src/provider-approval.ts
|
|
3851
|
+
function isActionableProviderApproval(approval) {
|
|
3852
|
+
return !!approval && approval.source === "provider_modal" && approval.type === "tool_permission" && approval.lifecycle === "pending" && approval.evidence === "live" && approval.actionable && !!approval.modalKey && Array.isArray(approval.buttons) && approval.buttons.some((button) => typeof button === "string" && !!button.trim());
|
|
3853
|
+
}
|
|
3854
|
+
function readProviderDecision(approval, waiting, hasModal = false) {
|
|
3855
|
+
if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
|
|
3856
|
+
if (!waiting) return null;
|
|
3857
|
+
return {
|
|
3858
|
+
source: hasModal ? "legacy_provider" : "status_only",
|
|
3859
|
+
type: "unknown",
|
|
3860
|
+
compatibility: hasModal ? "session_only" : "unknown",
|
|
3861
|
+
evidence: "unavailable",
|
|
3862
|
+
lifecycle: "pending",
|
|
3863
|
+
modalKey: null,
|
|
3864
|
+
createdAt: null,
|
|
3865
|
+
resolvedAt: null,
|
|
3866
|
+
description: "",
|
|
3867
|
+
buttons: [],
|
|
3868
|
+
actionable: false
|
|
3869
|
+
};
|
|
3870
|
+
}
|
|
3871
|
+
function providerApprovalSnapshot(approval) {
|
|
3872
|
+
if (!approval) return null;
|
|
3873
|
+
const {
|
|
3874
|
+
source,
|
|
3875
|
+
type,
|
|
3876
|
+
lifecycle,
|
|
3877
|
+
modalKey,
|
|
3878
|
+
createdAt,
|
|
3879
|
+
resolvedAt,
|
|
3880
|
+
providerType,
|
|
3881
|
+
sessionId,
|
|
3882
|
+
nodeId,
|
|
3883
|
+
meshId,
|
|
3884
|
+
taskId,
|
|
3885
|
+
attemptId,
|
|
3886
|
+
generation
|
|
3887
|
+
} = approval;
|
|
3888
|
+
return {
|
|
3889
|
+
source,
|
|
3890
|
+
type,
|
|
3891
|
+
lifecycle,
|
|
3892
|
+
modalKey,
|
|
3893
|
+
createdAt,
|
|
3894
|
+
resolvedAt,
|
|
3895
|
+
providerType,
|
|
3896
|
+
sessionId,
|
|
3897
|
+
nodeId,
|
|
3898
|
+
meshId,
|
|
3899
|
+
taskId,
|
|
3900
|
+
attemptId,
|
|
3901
|
+
generation,
|
|
3902
|
+
evidence: "cached",
|
|
3903
|
+
actionable: false,
|
|
3904
|
+
description: "",
|
|
3905
|
+
buttons: []
|
|
3906
|
+
};
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3909
|
+
// src/provider-question.ts
|
|
3910
|
+
function isProviderQuestionBinding(value) {
|
|
3911
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
3912
|
+
const b = value;
|
|
3913
|
+
if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
|
|
3914
|
+
const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
|
|
3915
|
+
if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
|
|
3916
|
+
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3917
|
+
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
3918
|
+
}
|
|
3919
|
+
|
|
3920
|
+
// src/launch-defaults.ts
|
|
3921
|
+
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
3922
|
+
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
3923
|
+
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
3924
|
+
function isLaunchDefaultRole(value) {
|
|
3925
|
+
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
3926
|
+
}
|
|
3927
|
+
function isLaunchDefaultSource(value) {
|
|
3928
|
+
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
3929
|
+
}
|
|
3930
|
+
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
3931
|
+
"invalid_args",
|
|
3932
|
+
"launch_default_required",
|
|
3933
|
+
"launch_default_unavailable",
|
|
3934
|
+
"launch_selection_invalid",
|
|
3935
|
+
"launch_default_invalid",
|
|
3936
|
+
"revision_conflict",
|
|
3937
|
+
"store_unavailable",
|
|
3938
|
+
"store_busy",
|
|
3939
|
+
"persistence_failed",
|
|
3940
|
+
"project_not_found",
|
|
3941
|
+
"project_ambiguous",
|
|
3942
|
+
"project_not_hosted",
|
|
3943
|
+
"project_storage_unavailable",
|
|
3944
|
+
"staging_unavailable",
|
|
3945
|
+
"staging_failed",
|
|
3946
|
+
"review_turn_tool_denied"
|
|
3947
|
+
];
|
|
3752
3948
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3753
3949
|
0 && (module.exports = {
|
|
3754
3950
|
ASSISTANT_OWNER_VERBS,
|
|
@@ -3788,6 +3984,10 @@ function stableMeshNodeRow(row) {
|
|
|
3788
3984
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
3789
3985
|
EVIDENCE_SOURCE_IDS,
|
|
3790
3986
|
HOLD_REASONS,
|
|
3987
|
+
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
3988
|
+
LAUNCH_DEFAULT_ERROR_CODES,
|
|
3989
|
+
LAUNCH_DEFAULT_ROLES,
|
|
3990
|
+
LAUNCH_DEFAULT_SOURCES,
|
|
3791
3991
|
LIVENESS_RESULTS,
|
|
3792
3992
|
MAX_MESH_RECORD_STRING,
|
|
3793
3993
|
MAX_OWNED_PATHS,
|
|
@@ -3828,6 +4028,8 @@ function stableMeshNodeRow(row) {
|
|
|
3828
4028
|
OUTBOUND_MESSAGE_ORIGINS,
|
|
3829
4029
|
P2P_SIGNAL_TYPES,
|
|
3830
4030
|
PROVIDER_FAILURES,
|
|
4031
|
+
QUOTA_BACKFILL_HORIZON_MS,
|
|
4032
|
+
QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
3831
4033
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
3832
4034
|
RECENT_SESSION_BUCKETS,
|
|
3833
4035
|
RECLAIMING_SEND_REFUSALS,
|
|
@@ -3873,9 +4075,11 @@ function stableMeshNodeRow(row) {
|
|
|
3873
4075
|
WORKER_BRANCH_STATES,
|
|
3874
4076
|
WORKER_PROTOCOL_FOOTER_MARKER,
|
|
3875
4077
|
WORKER_REPORT_OUTCOMES,
|
|
4078
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
3876
4079
|
WORKER_TOOLS,
|
|
3877
4080
|
appendWorkerProtocolFooter,
|
|
3878
4081
|
argsCarryStatusProbeMarker,
|
|
4082
|
+
assessQuotaFreshness,
|
|
3879
4083
|
buildSlotProposal,
|
|
3880
4084
|
canonicalDaemonId,
|
|
3881
4085
|
classifySessionStatus,
|
|
@@ -3956,6 +4160,7 @@ function stableMeshNodeRow(row) {
|
|
|
3956
4160
|
hasGitStatusEvidence,
|
|
3957
4161
|
hasWorkerProtocolFooter,
|
|
3958
4162
|
interpolateString,
|
|
4163
|
+
isActionableProviderApproval,
|
|
3959
4164
|
isAssistantTool,
|
|
3960
4165
|
isBlockedStatus,
|
|
3961
4166
|
isBusyStatus,
|
|
@@ -3977,6 +4182,8 @@ function stableMeshNodeRow(row) {
|
|
|
3977
4182
|
isFiniteNumber,
|
|
3978
4183
|
isIdleSessionState,
|
|
3979
4184
|
isInputEnvelopeWire,
|
|
4185
|
+
isLaunchDefaultRole,
|
|
4186
|
+
isLaunchDefaultSource,
|
|
3980
4187
|
isMeshDeliveryMode,
|
|
3981
4188
|
isMeshIndexQueryResponse,
|
|
3982
4189
|
isMeshMissionStatusValue,
|
|
@@ -3991,12 +4198,14 @@ function stableMeshNodeRow(row) {
|
|
|
3991
4198
|
isMessageId,
|
|
3992
4199
|
isMissionUpsertResponse,
|
|
3993
4200
|
isModelAxisSource,
|
|
4201
|
+
isNativeMarkerRef,
|
|
3994
4202
|
isNonEmptyString,
|
|
3995
4203
|
isNotifyKind,
|
|
3996
4204
|
isOutboundMessage,
|
|
3997
4205
|
isOutboundMessageOrigin,
|
|
3998
4206
|
isP2PSignalType,
|
|
3999
4207
|
isPhantomDaemonEntry,
|
|
4208
|
+
isProviderQuestionBinding,
|
|
4000
4209
|
isRawDaemonDoId,
|
|
4001
4210
|
isReadyStatus,
|
|
4002
4211
|
isRecord,
|
|
@@ -4034,6 +4243,7 @@ function stableMeshNodeRow(row) {
|
|
|
4034
4243
|
meshUtf8ByteLength,
|
|
4035
4244
|
meshWorkspacesEquivalent,
|
|
4036
4245
|
mintMessageId,
|
|
4246
|
+
minutesUntilQuotaCheck,
|
|
4037
4247
|
normalizeAuthOkLimits,
|
|
4038
4248
|
normalizeBrainSlot,
|
|
4039
4249
|
normalizeDifficultyBrainMap,
|
|
@@ -4056,11 +4266,13 @@ function stableMeshNodeRow(row) {
|
|
|
4056
4266
|
pickBestTransitGitStatus,
|
|
4057
4267
|
projectFileDiffRow,
|
|
4058
4268
|
projectTurnEvidenceEntry,
|
|
4269
|
+
providerApprovalSnapshot,
|
|
4059
4270
|
readBoolean,
|
|
4060
4271
|
readEnvelopeFields,
|
|
4061
4272
|
readGitSubmodules,
|
|
4062
4273
|
readNumber,
|
|
4063
4274
|
readOptionalRecord,
|
|
4275
|
+
readProviderDecision,
|
|
4064
4276
|
readRecord,
|
|
4065
4277
|
readString,
|
|
4066
4278
|
readStringArray,
|