@adhdev/mesh-shared 1.0.82-rc.10 → 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.
package/dist/index.mjs CHANGED
@@ -1705,6 +1705,9 @@ function renderCoordinatorWorkerSection() {
1705
1705
  // src/assistant-protocol.ts
1706
1706
  var ASSISTANT_TOOLS = [
1707
1707
  "projects",
1708
+ "environment",
1709
+ "assistant_action",
1710
+ "project_watch",
1708
1711
  "project_status",
1709
1712
  "project_send",
1710
1713
  "project_read",
@@ -1722,6 +1725,11 @@ function isAssistantTool(value) {
1722
1725
  var ASSISTANT_VERB = {
1723
1726
  // tool verbs
1724
1727
  projects: "assistant_projects",
1728
+ environment: "assistant_environment",
1729
+ action: "assistant_action",
1730
+ watch: "assistant_project_watch",
1731
+ executionState: "assistant_execution_state",
1732
+ executionSettings: "assistant_execution_settings",
1725
1733
  projectStatus: "assistant_project_status",
1726
1734
  projectSend: "assistant_project_send",
1727
1735
  projectRead: "assistant_project_read",
@@ -1741,6 +1749,9 @@ var ASSISTANT_VERB = {
1741
1749
  };
1742
1750
  var ASSISTANT_TOOL_VERBS = {
1743
1751
  projects: ASSISTANT_VERB.projects,
1752
+ environment: ASSISTANT_VERB.environment,
1753
+ assistant_action: ASSISTANT_VERB.action,
1754
+ project_watch: ASSISTANT_VERB.watch,
1744
1755
  project_status: ASSISTANT_VERB.projectStatus,
1745
1756
  project_send: ASSISTANT_VERB.projectSend,
1746
1757
  project_read: ASSISTANT_VERB.projectRead,
@@ -1751,8 +1762,9 @@ var ASSISTANT_TOOL_VERBS = {
1751
1762
  skill_manage: ASSISTANT_VERB.skillManage,
1752
1763
  project_note: ASSISTANT_VERB.projectNote
1753
1764
  };
1754
- var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
1765
+ var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add"];
1755
1766
  var ASSISTANT_OWNER_VERBS = [
1767
+ ASSISTANT_VERB.executionSettings,
1756
1768
  ASSISTANT_VERB.stagedResolve,
1757
1769
  ASSISTANT_VERB.storeAdmin,
1758
1770
  ASSISTANT_VERB.importSkills
@@ -1810,8 +1822,8 @@ function sanitizeRefusalCode(value) {
1810
1822
  var CONSUME_PROFILES = ["default", "native_source"];
1811
1823
  var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
1812
1824
  var SUSPENSION_MODALS = ["approval", "choice"];
1813
- var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
1814
- var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
1825
+ var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
1826
+ var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
1815
1827
  var TURN_END_STRENGTHS = ["genuine", "weak"];
1816
1828
  var TURN_END_BLOCK_REASONS = [
1817
1829
  "missing_final_assistant",
@@ -1819,9 +1831,9 @@ var TURN_END_BLOCK_REASONS = [
1819
1831
  "terminal_block_hard_cap",
1820
1832
  "decoupled_completion"
1821
1833
  ];
1822
- var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
1834
+ var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
1823
1835
  var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
1824
- var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
1836
+ var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
1825
1837
  var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
1826
1838
  var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
1827
1839
  var OPERATOR_STATUSES = ["completed", "failed"];
@@ -1862,6 +1874,9 @@ var TURN_REASONS = [
1862
1874
  "session_error",
1863
1875
  "provider_auth_failed",
1864
1876
  "provider_billing_failed",
1877
+ "provider_usage_limit_exceeded",
1878
+ "provider_server_overloaded",
1879
+ "provider_error",
1865
1880
  "operator_cancel",
1866
1881
  "intentional_cleanup",
1867
1882
  "task_removed",
@@ -1938,8 +1953,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
1938
1953
  duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
1939
1954
  session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
1940
1955
  turn_started: { retro: bool },
1941
- suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
1942
- suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
1956
+ suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
1957
+ suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
1943
1958
  turn_end: {
1944
1959
  strength: en(TURN_END_STRENGTHS),
1945
1960
  afterFinalizationTimeout: boolOpt,
@@ -1949,6 +1964,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
1949
1964
  releasedByHardCap: boolOpt,
1950
1965
  nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
1951
1966
  live: { t: "live", optional: true },
1967
+ nativeMarker: { t: "native_marker", optional: true },
1952
1968
  reportExpected: boolOpt,
1953
1969
  providerFailure: enOpt(PROVIDER_FAILURES)
1954
1970
  },
@@ -2019,7 +2035,7 @@ function isLiveTurnPending(value) {
2019
2035
  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));
2020
2036
  }
2021
2037
  function isNativeMarkerRef(value) {
2022
- return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
2038
+ 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]));
2023
2039
  }
2024
2040
  function isCoordinatorIdentity(value) {
2025
2041
  return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
@@ -3088,14 +3104,11 @@ function normalizeOwnedPaths(input) {
3088
3104
  }
3089
3105
  function entryContains(base, path) {
3090
3106
  if (path === base.path) return true;
3091
- if (base.subtree && (path === base.path || path.startsWith(`${base.path}/`))) return true;
3107
+ if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
3092
3108
  return false;
3093
3109
  }
3094
3110
  function entriesOverlap(a, b) {
3095
- if (a.path === b.path) return true;
3096
- if (a.subtree && (b.path === a.path || b.path.startsWith(`${a.path}/`))) return true;
3097
- if (b.subtree && (a.path === b.path || a.path.startsWith(`${b.path}/`))) return true;
3098
- return false;
3111
+ return entryContains(a, b.path) || entryContains(b, a.path);
3099
3112
  }
3100
3113
  function pathsOverlap(a, b) {
3101
3114
  if (a.paths.length === 0 || b.paths.length === 0) return false;
@@ -3367,7 +3380,15 @@ function foldKeyedDoc(held, delta, spec) {
3367
3380
  const heldList = heldCollections.get(path);
3368
3381
  if (change?.absent) {
3369
3382
  const [head2, tail2] = splitPath(path);
3370
- if (!tail2) delete next[head2];
3383
+ if (!tail2) {
3384
+ delete next[head2];
3385
+ continue;
3386
+ }
3387
+ const parent2 = next[head2];
3388
+ if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
3389
+ const copy = { ...parent2 };
3390
+ delete copy[tail2];
3391
+ next[head2] = copy;
3371
3392
  continue;
3372
3393
  }
3373
3394
  if (!change && heldList === void 0) continue;
@@ -3431,6 +3452,76 @@ function stableMeshNodeRow(row) {
3431
3452
  }
3432
3453
  return out;
3433
3454
  }
3455
+
3456
+ // src/provider-approval.ts
3457
+ function isActionableProviderApproval(approval) {
3458
+ 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());
3459
+ }
3460
+ function readProviderDecision(approval, waiting, hasModal = false) {
3461
+ if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
3462
+ if (!waiting) return null;
3463
+ return {
3464
+ source: hasModal ? "legacy_provider" : "status_only",
3465
+ type: "unknown",
3466
+ compatibility: hasModal ? "session_only" : "unknown",
3467
+ evidence: "unavailable",
3468
+ lifecycle: "pending",
3469
+ modalKey: null,
3470
+ createdAt: null,
3471
+ resolvedAt: null,
3472
+ description: "",
3473
+ buttons: [],
3474
+ actionable: false
3475
+ };
3476
+ }
3477
+ function providerApprovalSnapshot(approval) {
3478
+ if (!approval) return null;
3479
+ const {
3480
+ source,
3481
+ type,
3482
+ lifecycle,
3483
+ modalKey,
3484
+ createdAt,
3485
+ resolvedAt,
3486
+ providerType,
3487
+ sessionId,
3488
+ nodeId,
3489
+ meshId,
3490
+ taskId,
3491
+ attemptId,
3492
+ generation
3493
+ } = approval;
3494
+ return {
3495
+ source,
3496
+ type,
3497
+ lifecycle,
3498
+ modalKey,
3499
+ createdAt,
3500
+ resolvedAt,
3501
+ providerType,
3502
+ sessionId,
3503
+ nodeId,
3504
+ meshId,
3505
+ taskId,
3506
+ attemptId,
3507
+ generation,
3508
+ evidence: "cached",
3509
+ actionable: false,
3510
+ description: "",
3511
+ buttons: []
3512
+ };
3513
+ }
3514
+
3515
+ // src/provider-question.ts
3516
+ function isProviderQuestionBinding(value) {
3517
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
3518
+ const b = value;
3519
+ if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
3520
+ const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
3521
+ if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
3522
+ if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
3523
+ return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
3524
+ }
3434
3525
  export {
3435
3526
  ASSISTANT_OWNER_VERBS,
3436
3527
  ASSISTANT_REVIEW_TURN_VERBS,
@@ -3640,6 +3731,7 @@ export {
3640
3731
  hasGitStatusEvidence,
3641
3732
  hasWorkerProtocolFooter,
3642
3733
  interpolateString,
3734
+ isActionableProviderApproval,
3643
3735
  isAssistantTool,
3644
3736
  isBlockedStatus,
3645
3737
  isBusyStatus,
@@ -3675,12 +3767,14 @@ export {
3675
3767
  isMessageId,
3676
3768
  isMissionUpsertResponse,
3677
3769
  isModelAxisSource,
3770
+ isNativeMarkerRef,
3678
3771
  isNonEmptyString,
3679
3772
  isNotifyKind,
3680
3773
  isOutboundMessage,
3681
3774
  isOutboundMessageOrigin,
3682
3775
  isP2PSignalType,
3683
3776
  isPhantomDaemonEntry,
3777
+ isProviderQuestionBinding,
3684
3778
  isRawDaemonDoId,
3685
3779
  isReadyStatus,
3686
3780
  isRecord,
@@ -3741,11 +3835,13 @@ export {
3741
3835
  pickBestTransitGitStatus,
3742
3836
  projectFileDiffRow,
3743
3837
  projectTurnEvidenceEntry,
3838
+ providerApprovalSnapshot,
3744
3839
  readBoolean,
3745
3840
  readEnvelopeFields,
3746
3841
  readGitSubmodules,
3747
3842
  readNumber,
3748
3843
  readOptionalRecord,
3844
+ readProviderDecision,
3749
3845
  readRecord,
3750
3846
  readString,
3751
3847
  readStringArray,