@adhdev/mesh-shared 1.0.82-rc.11 → 1.0.82-rc.12

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.
@@ -15,12 +15,17 @@
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", "discover_repos", "memory", "skill_view", "skill_manage", "project_note"];
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";
package/dist/index.d.ts CHANGED
@@ -41,3 +41,5 @@ export * from './turn-ipc';
41
41
  export * from './path-ownership';
42
42
  export * from './mission-brief';
43
43
  export * from './keyed-doc-delta';
44
+ export * from './provider-approval';
45
+ export * from './provider-question';
package/dist/index.js CHANGED
@@ -228,6 +228,7 @@ __export(index_exports, {
228
228
  hasGitStatusEvidence: () => hasGitStatusEvidence,
229
229
  hasWorkerProtocolFooter: () => hasWorkerProtocolFooter,
230
230
  interpolateString: () => interpolateString,
231
+ isActionableProviderApproval: () => isActionableProviderApproval,
231
232
  isAssistantTool: () => isAssistantTool,
232
233
  isBlockedStatus: () => isBlockedStatus,
233
234
  isBusyStatus: () => isBusyStatus,
@@ -263,12 +264,14 @@ __export(index_exports, {
263
264
  isMessageId: () => isMessageId,
264
265
  isMissionUpsertResponse: () => isMissionUpsertResponse,
265
266
  isModelAxisSource: () => isModelAxisSource,
267
+ isNativeMarkerRef: () => isNativeMarkerRef,
266
268
  isNonEmptyString: () => isNonEmptyString,
267
269
  isNotifyKind: () => isNotifyKind,
268
270
  isOutboundMessage: () => isOutboundMessage,
269
271
  isOutboundMessageOrigin: () => isOutboundMessageOrigin,
270
272
  isP2PSignalType: () => isP2PSignalType,
271
273
  isPhantomDaemonEntry: () => isPhantomDaemonEntry,
274
+ isProviderQuestionBinding: () => isProviderQuestionBinding,
272
275
  isRawDaemonDoId: () => isRawDaemonDoId,
273
276
  isReadyStatus: () => isReadyStatus,
274
277
  isRecord: () => isRecord,
@@ -329,11 +332,13 @@ __export(index_exports, {
329
332
  pickBestTransitGitStatus: () => pickBestTransitGitStatus,
330
333
  projectFileDiffRow: () => projectFileDiffRow,
331
334
  projectTurnEvidenceEntry: () => projectTurnEvidenceEntry,
335
+ providerApprovalSnapshot: () => providerApprovalSnapshot,
332
336
  readBoolean: () => readBoolean,
333
337
  readEnvelopeFields: () => readEnvelopeFields,
334
338
  readGitSubmodules: () => readGitSubmodules,
335
339
  readNumber: () => readNumber,
336
340
  readOptionalRecord: () => readOptionalRecord,
341
+ readProviderDecision: () => readProviderDecision,
337
342
  readRecord: () => readRecord,
338
343
  readString: () => readString,
339
344
  readStringArray: () => readStringArray,
@@ -2065,6 +2070,9 @@ function renderCoordinatorWorkerSection() {
2065
2070
  // src/assistant-protocol.ts
2066
2071
  var ASSISTANT_TOOLS = [
2067
2072
  "projects",
2073
+ "environment",
2074
+ "assistant_action",
2075
+ "project_watch",
2068
2076
  "project_status",
2069
2077
  "project_send",
2070
2078
  "project_read",
@@ -2082,6 +2090,11 @@ function isAssistantTool(value) {
2082
2090
  var ASSISTANT_VERB = {
2083
2091
  // tool verbs
2084
2092
  projects: "assistant_projects",
2093
+ environment: "assistant_environment",
2094
+ action: "assistant_action",
2095
+ watch: "assistant_project_watch",
2096
+ executionState: "assistant_execution_state",
2097
+ executionSettings: "assistant_execution_settings",
2085
2098
  projectStatus: "assistant_project_status",
2086
2099
  projectSend: "assistant_project_send",
2087
2100
  projectRead: "assistant_project_read",
@@ -2101,6 +2114,9 @@ var ASSISTANT_VERB = {
2101
2114
  };
2102
2115
  var ASSISTANT_TOOL_VERBS = {
2103
2116
  projects: ASSISTANT_VERB.projects,
2117
+ environment: ASSISTANT_VERB.environment,
2118
+ assistant_action: ASSISTANT_VERB.action,
2119
+ project_watch: ASSISTANT_VERB.watch,
2104
2120
  project_status: ASSISTANT_VERB.projectStatus,
2105
2121
  project_send: ASSISTANT_VERB.projectSend,
2106
2122
  project_read: ASSISTANT_VERB.projectRead,
@@ -2111,8 +2127,9 @@ var ASSISTANT_TOOL_VERBS = {
2111
2127
  skill_manage: ASSISTANT_VERB.skillManage,
2112
2128
  project_note: ASSISTANT_VERB.projectNote
2113
2129
  };
2114
- var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
2130
+ var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add"];
2115
2131
  var ASSISTANT_OWNER_VERBS = [
2132
+ ASSISTANT_VERB.executionSettings,
2116
2133
  ASSISTANT_VERB.stagedResolve,
2117
2134
  ASSISTANT_VERB.storeAdmin,
2118
2135
  ASSISTANT_VERB.importSkills
@@ -2170,8 +2187,8 @@ function sanitizeRefusalCode(value) {
2170
2187
  var CONSUME_PROFILES = ["default", "native_source"];
2171
2188
  var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
2172
2189
  var SUSPENSION_MODALS = ["approval", "choice"];
2173
- var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
2174
- var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
2190
+ var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
2191
+ var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
2175
2192
  var TURN_END_STRENGTHS = ["genuine", "weak"];
2176
2193
  var TURN_END_BLOCK_REASONS = [
2177
2194
  "missing_final_assistant",
@@ -2179,9 +2196,9 @@ var TURN_END_BLOCK_REASONS = [
2179
2196
  "terminal_block_hard_cap",
2180
2197
  "decoupled_completion"
2181
2198
  ];
2182
- var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
2199
+ var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
2183
2200
  var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
2184
- var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
2201
+ var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
2185
2202
  var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
2186
2203
  var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
2187
2204
  var OPERATOR_STATUSES = ["completed", "failed"];
@@ -2222,6 +2239,9 @@ var TURN_REASONS = [
2222
2239
  "session_error",
2223
2240
  "provider_auth_failed",
2224
2241
  "provider_billing_failed",
2242
+ "provider_usage_limit_exceeded",
2243
+ "provider_server_overloaded",
2244
+ "provider_error",
2225
2245
  "operator_cancel",
2226
2246
  "intentional_cleanup",
2227
2247
  "task_removed",
@@ -2298,8 +2318,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2298
2318
  duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
2299
2319
  session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
2300
2320
  turn_started: { retro: bool },
2301
- suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
2302
- suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
2321
+ suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
2322
+ suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
2303
2323
  turn_end: {
2304
2324
  strength: en(TURN_END_STRENGTHS),
2305
2325
  afterFinalizationTimeout: boolOpt,
@@ -2309,6 +2329,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
2309
2329
  releasedByHardCap: boolOpt,
2310
2330
  nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
2311
2331
  live: { t: "live", optional: true },
2332
+ nativeMarker: { t: "native_marker", optional: true },
2312
2333
  reportExpected: boolOpt,
2313
2334
  providerFailure: enOpt(PROVIDER_FAILURES)
2314
2335
  },
@@ -2379,7 +2400,7 @@ function isLiveTurnPending(value) {
2379
2400
  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));
2380
2401
  }
2381
2402
  function isNativeMarkerRef(value) {
2382
- return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
2403
+ 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]));
2383
2404
  }
2384
2405
  function isCoordinatorIdentity(value) {
2385
2406
  return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
@@ -3796,6 +3817,76 @@ function stableMeshNodeRow(row) {
3796
3817
  }
3797
3818
  return out;
3798
3819
  }
3820
+
3821
+ // src/provider-approval.ts
3822
+ function isActionableProviderApproval(approval) {
3823
+ 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());
3824
+ }
3825
+ function readProviderDecision(approval, waiting, hasModal = false) {
3826
+ if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
3827
+ if (!waiting) return null;
3828
+ return {
3829
+ source: hasModal ? "legacy_provider" : "status_only",
3830
+ type: "unknown",
3831
+ compatibility: hasModal ? "session_only" : "unknown",
3832
+ evidence: "unavailable",
3833
+ lifecycle: "pending",
3834
+ modalKey: null,
3835
+ createdAt: null,
3836
+ resolvedAt: null,
3837
+ description: "",
3838
+ buttons: [],
3839
+ actionable: false
3840
+ };
3841
+ }
3842
+ function providerApprovalSnapshot(approval) {
3843
+ if (!approval) return null;
3844
+ const {
3845
+ source,
3846
+ type,
3847
+ lifecycle,
3848
+ modalKey,
3849
+ createdAt,
3850
+ resolvedAt,
3851
+ providerType,
3852
+ sessionId,
3853
+ nodeId,
3854
+ meshId,
3855
+ taskId,
3856
+ attemptId,
3857
+ generation
3858
+ } = approval;
3859
+ return {
3860
+ source,
3861
+ type,
3862
+ lifecycle,
3863
+ modalKey,
3864
+ createdAt,
3865
+ resolvedAt,
3866
+ providerType,
3867
+ sessionId,
3868
+ nodeId,
3869
+ meshId,
3870
+ taskId,
3871
+ attemptId,
3872
+ generation,
3873
+ evidence: "cached",
3874
+ actionable: false,
3875
+ description: "",
3876
+ buttons: []
3877
+ };
3878
+ }
3879
+
3880
+ // src/provider-question.ts
3881
+ function isProviderQuestionBinding(value) {
3882
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
3883
+ const b = value;
3884
+ if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
3885
+ const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
3886
+ if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
3887
+ if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
3888
+ return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
3889
+ }
3799
3890
  // Annotate the CommonJS export names for ESM import in node:
3800
3891
  0 && (module.exports = {
3801
3892
  ASSISTANT_OWNER_VERBS,
@@ -4006,6 +4097,7 @@ function stableMeshNodeRow(row) {
4006
4097
  hasGitStatusEvidence,
4007
4098
  hasWorkerProtocolFooter,
4008
4099
  interpolateString,
4100
+ isActionableProviderApproval,
4009
4101
  isAssistantTool,
4010
4102
  isBlockedStatus,
4011
4103
  isBusyStatus,
@@ -4041,12 +4133,14 @@ function stableMeshNodeRow(row) {
4041
4133
  isMessageId,
4042
4134
  isMissionUpsertResponse,
4043
4135
  isModelAxisSource,
4136
+ isNativeMarkerRef,
4044
4137
  isNonEmptyString,
4045
4138
  isNotifyKind,
4046
4139
  isOutboundMessage,
4047
4140
  isOutboundMessageOrigin,
4048
4141
  isP2PSignalType,
4049
4142
  isPhantomDaemonEntry,
4143
+ isProviderQuestionBinding,
4050
4144
  isRawDaemonDoId,
4051
4145
  isReadyStatus,
4052
4146
  isRecord,
@@ -4107,11 +4201,13 @@ function stableMeshNodeRow(row) {
4107
4201
  pickBestTransitGitStatus,
4108
4202
  projectFileDiffRow,
4109
4203
  projectTurnEvidenceEntry,
4204
+ providerApprovalSnapshot,
4110
4205
  readBoolean,
4111
4206
  readEnvelopeFields,
4112
4207
  readGitSubmodules,
4113
4208
  readNumber,
4114
4209
  readOptionalRecord,
4210
+ readProviderDecision,
4115
4211
  readRecord,
4116
4212
  readString,
4117
4213
  readStringArray,