@adhdev/mesh-shared 1.0.82-rc.2 → 1.0.82-rc.21
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 +12 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +236 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +220 -20
- 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 +26 -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,26 +15,37 @@
|
|
|
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";
|
|
36
44
|
readonly storeAdmin: "assistant_store_admin";
|
|
37
45
|
readonly importSkills: "assistant_import_skills";
|
|
46
|
+
/** Projects the assistant is following (open relay threads) — list / stop following. */
|
|
47
|
+
readonly threads: "assistant_threads";
|
|
48
|
+
readonly threadClose: "assistant_thread_close";
|
|
38
49
|
};
|
|
39
50
|
export type AssistantVerb = typeof ASSISTANT_VERB[keyof typeof ASSISTANT_VERB];
|
|
40
51
|
/** The daemon verb each assistant tool calls. */
|
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,40 +2108,59 @@ 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",
|
|
2055
2131
|
// owner verbs (dashboard only)
|
|
2056
2132
|
stagedResolve: "assistant_staged_resolve",
|
|
2057
2133
|
storeAdmin: "assistant_store_admin",
|
|
2058
|
-
importSkills: "assistant_import_skills"
|
|
2134
|
+
importSkills: "assistant_import_skills",
|
|
2135
|
+
/** Projects the assistant is following (open relay threads) — list / stop following. */
|
|
2136
|
+
threads: "assistant_threads",
|
|
2137
|
+
threadClose: "assistant_thread_close"
|
|
2059
2138
|
};
|
|
2060
2139
|
var ASSISTANT_TOOL_VERBS = {
|
|
2061
2140
|
projects: ASSISTANT_VERB.projects,
|
|
2141
|
+
environment: ASSISTANT_VERB.environment,
|
|
2142
|
+
assistant_action: ASSISTANT_VERB.action,
|
|
2143
|
+
project_watch: ASSISTANT_VERB.watch,
|
|
2062
2144
|
project_status: ASSISTANT_VERB.projectStatus,
|
|
2063
2145
|
project_send: ASSISTANT_VERB.projectSend,
|
|
2064
2146
|
project_read: ASSISTANT_VERB.projectRead,
|
|
2065
2147
|
project_add: ASSISTANT_VERB.projectAdd,
|
|
2148
|
+
project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
|
|
2066
2149
|
discover_repos: ASSISTANT_VERB.discoverRepos,
|
|
2067
2150
|
memory: ASSISTANT_VERB.memory,
|
|
2068
2151
|
skill_view: ASSISTANT_VERB.skillView,
|
|
2069
2152
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
2070
|
-
project_note: ASSISTANT_VERB.projectNote
|
|
2153
|
+
project_note: ASSISTANT_VERB.projectNote,
|
|
2154
|
+
launch_defaults: ASSISTANT_VERB.launchDefaults,
|
|
2155
|
+
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet
|
|
2071
2156
|
};
|
|
2072
|
-
var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
|
|
2157
|
+
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add", "project_attach_remote", "launch_defaults_set"];
|
|
2073
2158
|
var ASSISTANT_OWNER_VERBS = [
|
|
2159
|
+
ASSISTANT_VERB.executionSettings,
|
|
2074
2160
|
ASSISTANT_VERB.stagedResolve,
|
|
2075
2161
|
ASSISTANT_VERB.storeAdmin,
|
|
2076
|
-
ASSISTANT_VERB.importSkills
|
|
2162
|
+
ASSISTANT_VERB.importSkills,
|
|
2163
|
+
ASSISTANT_VERB.threadClose
|
|
2077
2164
|
];
|
|
2078
2165
|
var ASSISTANT_REVIEW_TURN_VERBS = [
|
|
2079
2166
|
ASSISTANT_VERB.memory,
|
|
@@ -2128,8 +2215,8 @@ function sanitizeRefusalCode(value) {
|
|
|
2128
2215
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
2129
2216
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
2130
2217
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
2131
|
-
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
|
|
2132
|
-
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
|
|
2218
|
+
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
|
|
2219
|
+
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
|
|
2133
2220
|
var TURN_END_STRENGTHS = ["genuine", "weak"];
|
|
2134
2221
|
var TURN_END_BLOCK_REASONS = [
|
|
2135
2222
|
"missing_final_assistant",
|
|
@@ -2137,9 +2224,9 @@ var TURN_END_BLOCK_REASONS = [
|
|
|
2137
2224
|
"terminal_block_hard_cap",
|
|
2138
2225
|
"decoupled_completion"
|
|
2139
2226
|
];
|
|
2140
|
-
var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
|
|
2227
|
+
var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
|
|
2141
2228
|
var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
|
|
2142
|
-
var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
|
|
2229
|
+
var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
|
|
2143
2230
|
var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
|
|
2144
2231
|
var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
|
|
2145
2232
|
var OPERATOR_STATUSES = ["completed", "failed"];
|
|
@@ -2166,7 +2253,8 @@ var HOLD_REASONS = [
|
|
|
2166
2253
|
// — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
|
|
2167
2254
|
// a session whose FSM never shows the idle edge again does not wait for
|
|
2168
2255
|
// liveness / hard_ceiling.
|
|
2169
|
-
"await_end"
|
|
2256
|
+
"await_end",
|
|
2257
|
+
"report_correction"
|
|
2170
2258
|
];
|
|
2171
2259
|
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
2172
2260
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
@@ -2177,9 +2265,15 @@ var TURN_REASONS = [
|
|
|
2177
2265
|
"transcript_final",
|
|
2178
2266
|
"worker_reported",
|
|
2179
2267
|
"finalization_timeout_no_response",
|
|
2268
|
+
"weak_end_liveness_unconfirmed",
|
|
2269
|
+
"weak_end_probe_unobserved",
|
|
2270
|
+
"report_correction_expired",
|
|
2180
2271
|
"session_error",
|
|
2181
2272
|
"provider_auth_failed",
|
|
2182
2273
|
"provider_billing_failed",
|
|
2274
|
+
"provider_usage_limit_exceeded",
|
|
2275
|
+
"provider_server_overloaded",
|
|
2276
|
+
"provider_error",
|
|
2183
2277
|
"operator_cancel",
|
|
2184
2278
|
"intentional_cleanup",
|
|
2185
2279
|
"task_removed",
|
|
@@ -2256,8 +2350,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2256
2350
|
duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
|
|
2257
2351
|
session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
|
|
2258
2352
|
turn_started: { retro: bool },
|
|
2259
|
-
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
|
|
2260
|
-
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
|
|
2353
|
+
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
|
|
2354
|
+
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
|
|
2261
2355
|
turn_end: {
|
|
2262
2356
|
strength: en(TURN_END_STRENGTHS),
|
|
2263
2357
|
afterFinalizationTimeout: boolOpt,
|
|
@@ -2267,6 +2361,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2267
2361
|
releasedByHardCap: boolOpt,
|
|
2268
2362
|
nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
|
|
2269
2363
|
live: { t: "live", optional: true },
|
|
2364
|
+
nativeMarker: { t: "native_marker", optional: true },
|
|
2270
2365
|
reportExpected: boolOpt,
|
|
2271
2366
|
providerFailure: enOpt(PROVIDER_FAILURES)
|
|
2272
2367
|
},
|
|
@@ -2280,7 +2375,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2280
2375
|
},
|
|
2281
2376
|
transcript_activity: { newestActivityAt: ms },
|
|
2282
2377
|
no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
|
|
2283
|
-
liveness: { result: en(LIVENESS_RESULTS) },
|
|
2378
|
+
liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
|
|
2284
2379
|
process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
|
|
2285
2380
|
session_error: { reason: en(SESSION_ERROR_REASONS) },
|
|
2286
2381
|
worker_report: {
|
|
@@ -2290,6 +2385,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
2290
2385
|
branchState: enOpt(WORKER_BRANCH_STATES),
|
|
2291
2386
|
touchedFileCount: intOpt
|
|
2292
2387
|
},
|
|
2388
|
+
worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
|
|
2293
2389
|
worker_progress: { note: { t: "summary_ref", optional: true } },
|
|
2294
2390
|
git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
|
|
2295
2391
|
cancel: { reason: en(CANCEL_REASONS) },
|
|
@@ -2337,7 +2433,7 @@ function isLiveTurnPending(value) {
|
|
|
2337
2433
|
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
2434
|
}
|
|
2339
2435
|
function isNativeMarkerRef(value) {
|
|
2340
|
-
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
|
|
2436
|
+
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
2437
|
}
|
|
2342
2438
|
function isCoordinatorIdentity(value) {
|
|
2343
2439
|
return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
|
|
@@ -3406,14 +3502,11 @@ function normalizeOwnedPaths(input) {
|
|
|
3406
3502
|
}
|
|
3407
3503
|
function entryContains(base, path) {
|
|
3408
3504
|
if (path === base.path) return true;
|
|
3409
|
-
if (base.subtree && (path ===
|
|
3505
|
+
if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
|
|
3410
3506
|
return false;
|
|
3411
3507
|
}
|
|
3412
3508
|
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;
|
|
3509
|
+
return entryContains(a, b.path) || entryContains(b, a.path);
|
|
3417
3510
|
}
|
|
3418
3511
|
function pathsOverlap(a, b) {
|
|
3419
3512
|
if (a.paths.length === 0 || b.paths.length === 0) return false;
|
|
@@ -3685,7 +3778,15 @@ function foldKeyedDoc(held, delta, spec) {
|
|
|
3685
3778
|
const heldList = heldCollections.get(path);
|
|
3686
3779
|
if (change?.absent) {
|
|
3687
3780
|
const [head2, tail2] = splitPath(path);
|
|
3688
|
-
if (!tail2)
|
|
3781
|
+
if (!tail2) {
|
|
3782
|
+
delete next[head2];
|
|
3783
|
+
continue;
|
|
3784
|
+
}
|
|
3785
|
+
const parent2 = next[head2];
|
|
3786
|
+
if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
|
|
3787
|
+
const copy = { ...parent2 };
|
|
3788
|
+
delete copy[tail2];
|
|
3789
|
+
next[head2] = copy;
|
|
3689
3790
|
continue;
|
|
3690
3791
|
}
|
|
3691
3792
|
if (!change && heldList === void 0) continue;
|
|
@@ -3749,6 +3850,105 @@ function stableMeshNodeRow(row) {
|
|
|
3749
3850
|
}
|
|
3750
3851
|
return out;
|
|
3751
3852
|
}
|
|
3853
|
+
|
|
3854
|
+
// src/provider-approval.ts
|
|
3855
|
+
function isActionableProviderApproval(approval) {
|
|
3856
|
+
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());
|
|
3857
|
+
}
|
|
3858
|
+
function readProviderDecision(approval, waiting, hasModal = false) {
|
|
3859
|
+
if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
|
|
3860
|
+
if (!waiting) return null;
|
|
3861
|
+
return {
|
|
3862
|
+
source: hasModal ? "legacy_provider" : "status_only",
|
|
3863
|
+
type: "unknown",
|
|
3864
|
+
compatibility: hasModal ? "session_only" : "unknown",
|
|
3865
|
+
evidence: "unavailable",
|
|
3866
|
+
lifecycle: "pending",
|
|
3867
|
+
modalKey: null,
|
|
3868
|
+
createdAt: null,
|
|
3869
|
+
resolvedAt: null,
|
|
3870
|
+
description: "",
|
|
3871
|
+
buttons: [],
|
|
3872
|
+
actionable: false
|
|
3873
|
+
};
|
|
3874
|
+
}
|
|
3875
|
+
function providerApprovalSnapshot(approval) {
|
|
3876
|
+
if (!approval) return null;
|
|
3877
|
+
const {
|
|
3878
|
+
source,
|
|
3879
|
+
type,
|
|
3880
|
+
lifecycle,
|
|
3881
|
+
modalKey,
|
|
3882
|
+
createdAt,
|
|
3883
|
+
resolvedAt,
|
|
3884
|
+
providerType,
|
|
3885
|
+
sessionId,
|
|
3886
|
+
nodeId,
|
|
3887
|
+
meshId,
|
|
3888
|
+
taskId,
|
|
3889
|
+
attemptId,
|
|
3890
|
+
generation
|
|
3891
|
+
} = approval;
|
|
3892
|
+
return {
|
|
3893
|
+
source,
|
|
3894
|
+
type,
|
|
3895
|
+
lifecycle,
|
|
3896
|
+
modalKey,
|
|
3897
|
+
createdAt,
|
|
3898
|
+
resolvedAt,
|
|
3899
|
+
providerType,
|
|
3900
|
+
sessionId,
|
|
3901
|
+
nodeId,
|
|
3902
|
+
meshId,
|
|
3903
|
+
taskId,
|
|
3904
|
+
attemptId,
|
|
3905
|
+
generation,
|
|
3906
|
+
evidence: "cached",
|
|
3907
|
+
actionable: false,
|
|
3908
|
+
description: "",
|
|
3909
|
+
buttons: []
|
|
3910
|
+
};
|
|
3911
|
+
}
|
|
3912
|
+
|
|
3913
|
+
// src/provider-question.ts
|
|
3914
|
+
function isProviderQuestionBinding(value) {
|
|
3915
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
3916
|
+
const b = value;
|
|
3917
|
+
if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
|
|
3918
|
+
const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
|
|
3919
|
+
if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
|
|
3920
|
+
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3921
|
+
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
3922
|
+
}
|
|
3923
|
+
|
|
3924
|
+
// src/launch-defaults.ts
|
|
3925
|
+
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
3926
|
+
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
3927
|
+
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
3928
|
+
function isLaunchDefaultRole(value) {
|
|
3929
|
+
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
3930
|
+
}
|
|
3931
|
+
function isLaunchDefaultSource(value) {
|
|
3932
|
+
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
3933
|
+
}
|
|
3934
|
+
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
3935
|
+
"invalid_args",
|
|
3936
|
+
"launch_default_required",
|
|
3937
|
+
"launch_default_unavailable",
|
|
3938
|
+
"launch_selection_invalid",
|
|
3939
|
+
"launch_default_invalid",
|
|
3940
|
+
"revision_conflict",
|
|
3941
|
+
"store_unavailable",
|
|
3942
|
+
"store_busy",
|
|
3943
|
+
"persistence_failed",
|
|
3944
|
+
"project_not_found",
|
|
3945
|
+
"project_ambiguous",
|
|
3946
|
+
"project_not_hosted",
|
|
3947
|
+
"project_storage_unavailable",
|
|
3948
|
+
"staging_unavailable",
|
|
3949
|
+
"staging_failed",
|
|
3950
|
+
"review_turn_tool_denied"
|
|
3951
|
+
];
|
|
3752
3952
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3753
3953
|
0 && (module.exports = {
|
|
3754
3954
|
ASSISTANT_OWNER_VERBS,
|
|
@@ -3788,6 +3988,10 @@ function stableMeshNodeRow(row) {
|
|
|
3788
3988
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
3789
3989
|
EVIDENCE_SOURCE_IDS,
|
|
3790
3990
|
HOLD_REASONS,
|
|
3991
|
+
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
3992
|
+
LAUNCH_DEFAULT_ERROR_CODES,
|
|
3993
|
+
LAUNCH_DEFAULT_ROLES,
|
|
3994
|
+
LAUNCH_DEFAULT_SOURCES,
|
|
3791
3995
|
LIVENESS_RESULTS,
|
|
3792
3996
|
MAX_MESH_RECORD_STRING,
|
|
3793
3997
|
MAX_OWNED_PATHS,
|
|
@@ -3828,6 +4032,8 @@ function stableMeshNodeRow(row) {
|
|
|
3828
4032
|
OUTBOUND_MESSAGE_ORIGINS,
|
|
3829
4033
|
P2P_SIGNAL_TYPES,
|
|
3830
4034
|
PROVIDER_FAILURES,
|
|
4035
|
+
QUOTA_BACKFILL_HORIZON_MS,
|
|
4036
|
+
QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
3831
4037
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
3832
4038
|
RECENT_SESSION_BUCKETS,
|
|
3833
4039
|
RECLAIMING_SEND_REFUSALS,
|
|
@@ -3873,9 +4079,11 @@ function stableMeshNodeRow(row) {
|
|
|
3873
4079
|
WORKER_BRANCH_STATES,
|
|
3874
4080
|
WORKER_PROTOCOL_FOOTER_MARKER,
|
|
3875
4081
|
WORKER_REPORT_OUTCOMES,
|
|
4082
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
3876
4083
|
WORKER_TOOLS,
|
|
3877
4084
|
appendWorkerProtocolFooter,
|
|
3878
4085
|
argsCarryStatusProbeMarker,
|
|
4086
|
+
assessQuotaFreshness,
|
|
3879
4087
|
buildSlotProposal,
|
|
3880
4088
|
canonicalDaemonId,
|
|
3881
4089
|
classifySessionStatus,
|
|
@@ -3956,6 +4164,7 @@ function stableMeshNodeRow(row) {
|
|
|
3956
4164
|
hasGitStatusEvidence,
|
|
3957
4165
|
hasWorkerProtocolFooter,
|
|
3958
4166
|
interpolateString,
|
|
4167
|
+
isActionableProviderApproval,
|
|
3959
4168
|
isAssistantTool,
|
|
3960
4169
|
isBlockedStatus,
|
|
3961
4170
|
isBusyStatus,
|
|
@@ -3977,6 +4186,8 @@ function stableMeshNodeRow(row) {
|
|
|
3977
4186
|
isFiniteNumber,
|
|
3978
4187
|
isIdleSessionState,
|
|
3979
4188
|
isInputEnvelopeWire,
|
|
4189
|
+
isLaunchDefaultRole,
|
|
4190
|
+
isLaunchDefaultSource,
|
|
3980
4191
|
isMeshDeliveryMode,
|
|
3981
4192
|
isMeshIndexQueryResponse,
|
|
3982
4193
|
isMeshMissionStatusValue,
|
|
@@ -3991,12 +4202,14 @@ function stableMeshNodeRow(row) {
|
|
|
3991
4202
|
isMessageId,
|
|
3992
4203
|
isMissionUpsertResponse,
|
|
3993
4204
|
isModelAxisSource,
|
|
4205
|
+
isNativeMarkerRef,
|
|
3994
4206
|
isNonEmptyString,
|
|
3995
4207
|
isNotifyKind,
|
|
3996
4208
|
isOutboundMessage,
|
|
3997
4209
|
isOutboundMessageOrigin,
|
|
3998
4210
|
isP2PSignalType,
|
|
3999
4211
|
isPhantomDaemonEntry,
|
|
4212
|
+
isProviderQuestionBinding,
|
|
4000
4213
|
isRawDaemonDoId,
|
|
4001
4214
|
isReadyStatus,
|
|
4002
4215
|
isRecord,
|
|
@@ -4034,6 +4247,7 @@ function stableMeshNodeRow(row) {
|
|
|
4034
4247
|
meshUtf8ByteLength,
|
|
4035
4248
|
meshWorkspacesEquivalent,
|
|
4036
4249
|
mintMessageId,
|
|
4250
|
+
minutesUntilQuotaCheck,
|
|
4037
4251
|
normalizeAuthOkLimits,
|
|
4038
4252
|
normalizeBrainSlot,
|
|
4039
4253
|
normalizeDifficultyBrainMap,
|
|
@@ -4056,11 +4270,13 @@ function stableMeshNodeRow(row) {
|
|
|
4056
4270
|
pickBestTransitGitStatus,
|
|
4057
4271
|
projectFileDiffRow,
|
|
4058
4272
|
projectTurnEvidenceEntry,
|
|
4273
|
+
providerApprovalSnapshot,
|
|
4059
4274
|
readBoolean,
|
|
4060
4275
|
readEnvelopeFields,
|
|
4061
4276
|
readGitSubmodules,
|
|
4062
4277
|
readNumber,
|
|
4063
4278
|
readOptionalRecord,
|
|
4279
|
+
readProviderDecision,
|
|
4064
4280
|
readRecord,
|
|
4065
4281
|
readString,
|
|
4066
4282
|
readStringArray,
|