@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
package/dist/index.mjs
CHANGED
|
@@ -300,6 +300,50 @@ function defaultProviderPriorityFromNodeFacts(facts) {
|
|
|
300
300
|
return orderProvidersByBuiltinPreference(detected.length ? detected : enabled);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
// src/quota-freshness.ts
|
|
304
|
+
var QUOTA_RETRY_INFLIGHT_GRACE_MS = 6e4;
|
|
305
|
+
var QUOTA_BACKFILL_HORIZON_MS = 60 * 60 * 1e3;
|
|
306
|
+
function hasUsableWindow(window) {
|
|
307
|
+
return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
|
|
308
|
+
}
|
|
309
|
+
function hasReading(quota) {
|
|
310
|
+
if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
|
|
311
|
+
return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
|
|
312
|
+
}
|
|
313
|
+
function finiteMs(value) {
|
|
314
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
|
|
315
|
+
}
|
|
316
|
+
function backfillCheckAt(quota, now) {
|
|
317
|
+
const dataDue = finiteMs(quota.updatedAt);
|
|
318
|
+
const attempted = finiteMs(quota.metadata?.fetchedAt);
|
|
319
|
+
const dueAt = Math.max(
|
|
320
|
+
dataDue === void 0 ? Number.NEGATIVE_INFINITY : dataDue + QUOTA_BACKFILL_HORIZON_MS,
|
|
321
|
+
attempted === void 0 ? Number.NEGATIVE_INFINITY : attempted + QUOTA_BACKFILL_HORIZON_MS
|
|
322
|
+
);
|
|
323
|
+
return Number.isFinite(dueAt) && dueAt > now ? dueAt : void 0;
|
|
324
|
+
}
|
|
325
|
+
function assessQuotaFreshness(quota, now = Date.now()) {
|
|
326
|
+
const meta = quota.metadata;
|
|
327
|
+
const kind = meta?.failureKind;
|
|
328
|
+
const userMustAct = kind === "no-data" && quota.provider !== "codex-cli" || kind === "expired-token" && ["grok-cli", "kimi", "antigravity-cli"].includes(quota.provider);
|
|
329
|
+
if (userMustAct) return hasReading(quota) ? { cue: "stale", userMustAct: true } : { userMustAct: true };
|
|
330
|
+
if (meta?.lastGoodWindows !== true) {
|
|
331
|
+
const measuredAt = finiteMs(quota.updatedAt);
|
|
332
|
+
if (hasReading(quota) && (measuredAt === void 0 || now - measuredAt >= QUOTA_BACKFILL_HORIZON_MS)) {
|
|
333
|
+
return { cue: "stale", userMustAct };
|
|
334
|
+
}
|
|
335
|
+
return { userMustAct };
|
|
336
|
+
}
|
|
337
|
+
const retryAtMs = finiteMs(meta?.retryAtMs);
|
|
338
|
+
const retryStopped = meta?.retryExhausted === true || retryAtMs !== void 0 && retryAtMs + QUOTA_RETRY_INFLIGHT_GRACE_MS < now;
|
|
339
|
+
if (kind !== "no-data" && !retryStopped) return { cue: "refreshing", userMustAct: false };
|
|
340
|
+
const nextCheckAt = backfillCheckAt(quota, now);
|
|
341
|
+
return nextCheckAt === void 0 ? { cue: "stale", userMustAct: false } : { cue: "stale", userMustAct: false, nextCheckAt };
|
|
342
|
+
}
|
|
343
|
+
function minutesUntilQuotaCheck(nextCheckAt, now = Date.now()) {
|
|
344
|
+
return Math.max(1, Math.round((nextCheckAt - now) / 6e4));
|
|
345
|
+
}
|
|
346
|
+
|
|
303
347
|
// src/workspace-normalize.ts
|
|
304
348
|
function normalizeMeshWorkspaceForCompare(dir) {
|
|
305
349
|
if (typeof dir !== "string") return "";
|
|
@@ -691,6 +735,7 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
691
735
|
"mesh_list_pending_approvals",
|
|
692
736
|
"mesh_create",
|
|
693
737
|
"mesh_add_node",
|
|
738
|
+
"mesh_attach_remote",
|
|
694
739
|
"mesh_clone_node",
|
|
695
740
|
"mesh_remove_node",
|
|
696
741
|
"mesh_cleanup_worktree_nodes",
|
|
@@ -1400,6 +1445,7 @@ var MESH_THINKING_LEVELS = ["low", "medium", "high"];
|
|
|
1400
1445
|
var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
|
|
1401
1446
|
var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
|
|
1402
1447
|
var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
|
|
1448
|
+
var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
|
|
1403
1449
|
var WORKER_BRANCH_STATES = [
|
|
1404
1450
|
"merged_to_main",
|
|
1405
1451
|
"pushed_feature_branch_needs_merge",
|
|
@@ -1667,15 +1713,21 @@ function renderCoordinatorWorkerSection() {
|
|
|
1667
1713
|
// src/assistant-protocol.ts
|
|
1668
1714
|
var ASSISTANT_TOOLS = [
|
|
1669
1715
|
"projects",
|
|
1716
|
+
"environment",
|
|
1717
|
+
"assistant_action",
|
|
1718
|
+
"project_watch",
|
|
1670
1719
|
"project_status",
|
|
1671
1720
|
"project_send",
|
|
1672
1721
|
"project_read",
|
|
1673
1722
|
"project_add",
|
|
1723
|
+
"project_attach_remote",
|
|
1674
1724
|
"discover_repos",
|
|
1675
1725
|
"memory",
|
|
1676
1726
|
"skill_view",
|
|
1677
1727
|
"skill_manage",
|
|
1678
|
-
"project_note"
|
|
1728
|
+
"project_note",
|
|
1729
|
+
"launch_defaults",
|
|
1730
|
+
"launch_defaults_set"
|
|
1679
1731
|
];
|
|
1680
1732
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
1681
1733
|
function isAssistantTool(value) {
|
|
@@ -1684,15 +1736,23 @@ function isAssistantTool(value) {
|
|
|
1684
1736
|
var ASSISTANT_VERB = {
|
|
1685
1737
|
// tool verbs
|
|
1686
1738
|
projects: "assistant_projects",
|
|
1739
|
+
environment: "assistant_environment",
|
|
1740
|
+
action: "assistant_action",
|
|
1741
|
+
watch: "assistant_project_watch",
|
|
1742
|
+
executionState: "assistant_execution_state",
|
|
1743
|
+
executionSettings: "assistant_execution_settings",
|
|
1687
1744
|
projectStatus: "assistant_project_status",
|
|
1688
1745
|
projectSend: "assistant_project_send",
|
|
1689
1746
|
projectRead: "assistant_project_read",
|
|
1690
1747
|
projectAdd: "assistant_project_add",
|
|
1748
|
+
projectAttachRemote: "assistant_project_attach_remote",
|
|
1691
1749
|
discoverRepos: "assistant_discover_repos",
|
|
1692
1750
|
memory: "assistant_memory",
|
|
1693
1751
|
skillView: "assistant_skill_view",
|
|
1694
1752
|
skillManage: "assistant_skill_manage",
|
|
1695
1753
|
projectNote: "assistant_project_note",
|
|
1754
|
+
launchDefaults: "assistant_launch_defaults",
|
|
1755
|
+
launchDefaultsSet: "assistant_launch_defaults_set",
|
|
1696
1756
|
// assistant-side daemon verbs without a tool of the same name
|
|
1697
1757
|
launch: "launch_assistant",
|
|
1698
1758
|
pendingRelays: "assistant_pending_relays",
|
|
@@ -1703,18 +1763,25 @@ var ASSISTANT_VERB = {
|
|
|
1703
1763
|
};
|
|
1704
1764
|
var ASSISTANT_TOOL_VERBS = {
|
|
1705
1765
|
projects: ASSISTANT_VERB.projects,
|
|
1766
|
+
environment: ASSISTANT_VERB.environment,
|
|
1767
|
+
assistant_action: ASSISTANT_VERB.action,
|
|
1768
|
+
project_watch: ASSISTANT_VERB.watch,
|
|
1706
1769
|
project_status: ASSISTANT_VERB.projectStatus,
|
|
1707
1770
|
project_send: ASSISTANT_VERB.projectSend,
|
|
1708
1771
|
project_read: ASSISTANT_VERB.projectRead,
|
|
1709
1772
|
project_add: ASSISTANT_VERB.projectAdd,
|
|
1773
|
+
project_attach_remote: ASSISTANT_VERB.projectAttachRemote,
|
|
1710
1774
|
discover_repos: ASSISTANT_VERB.discoverRepos,
|
|
1711
1775
|
memory: ASSISTANT_VERB.memory,
|
|
1712
1776
|
skill_view: ASSISTANT_VERB.skillView,
|
|
1713
1777
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
1714
|
-
project_note: ASSISTANT_VERB.projectNote
|
|
1778
|
+
project_note: ASSISTANT_VERB.projectNote,
|
|
1779
|
+
launch_defaults: ASSISTANT_VERB.launchDefaults,
|
|
1780
|
+
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet
|
|
1715
1781
|
};
|
|
1716
|
-
var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
|
|
1782
|
+
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add", "project_attach_remote", "launch_defaults_set"];
|
|
1717
1783
|
var ASSISTANT_OWNER_VERBS = [
|
|
1784
|
+
ASSISTANT_VERB.executionSettings,
|
|
1718
1785
|
ASSISTANT_VERB.stagedResolve,
|
|
1719
1786
|
ASSISTANT_VERB.storeAdmin,
|
|
1720
1787
|
ASSISTANT_VERB.importSkills
|
|
@@ -1772,8 +1839,8 @@ function sanitizeRefusalCode(value) {
|
|
|
1772
1839
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
1773
1840
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
1774
1841
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
1775
|
-
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
|
|
1776
|
-
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
|
|
1842
|
+
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
|
|
1843
|
+
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
|
|
1777
1844
|
var TURN_END_STRENGTHS = ["genuine", "weak"];
|
|
1778
1845
|
var TURN_END_BLOCK_REASONS = [
|
|
1779
1846
|
"missing_final_assistant",
|
|
@@ -1781,9 +1848,9 @@ var TURN_END_BLOCK_REASONS = [
|
|
|
1781
1848
|
"terminal_block_hard_cap",
|
|
1782
1849
|
"decoupled_completion"
|
|
1783
1850
|
];
|
|
1784
|
-
var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
|
|
1851
|
+
var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
|
|
1785
1852
|
var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
|
|
1786
|
-
var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
|
|
1853
|
+
var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
|
|
1787
1854
|
var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
|
|
1788
1855
|
var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
|
|
1789
1856
|
var OPERATOR_STATUSES = ["completed", "failed"];
|
|
@@ -1810,7 +1877,8 @@ var HOLD_REASONS = [
|
|
|
1810
1877
|
// — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
|
|
1811
1878
|
// a session whose FSM never shows the idle edge again does not wait for
|
|
1812
1879
|
// liveness / hard_ceiling.
|
|
1813
|
-
"await_end"
|
|
1880
|
+
"await_end",
|
|
1881
|
+
"report_correction"
|
|
1814
1882
|
];
|
|
1815
1883
|
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
1816
1884
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
@@ -1821,9 +1889,15 @@ var TURN_REASONS = [
|
|
|
1821
1889
|
"transcript_final",
|
|
1822
1890
|
"worker_reported",
|
|
1823
1891
|
"finalization_timeout_no_response",
|
|
1892
|
+
"weak_end_liveness_unconfirmed",
|
|
1893
|
+
"weak_end_probe_unobserved",
|
|
1894
|
+
"report_correction_expired",
|
|
1824
1895
|
"session_error",
|
|
1825
1896
|
"provider_auth_failed",
|
|
1826
1897
|
"provider_billing_failed",
|
|
1898
|
+
"provider_usage_limit_exceeded",
|
|
1899
|
+
"provider_server_overloaded",
|
|
1900
|
+
"provider_error",
|
|
1827
1901
|
"operator_cancel",
|
|
1828
1902
|
"intentional_cleanup",
|
|
1829
1903
|
"task_removed",
|
|
@@ -1900,8 +1974,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1900
1974
|
duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
|
|
1901
1975
|
session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
|
|
1902
1976
|
turn_started: { retro: bool },
|
|
1903
|
-
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
|
|
1904
|
-
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
|
|
1977
|
+
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
|
|
1978
|
+
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
|
|
1905
1979
|
turn_end: {
|
|
1906
1980
|
strength: en(TURN_END_STRENGTHS),
|
|
1907
1981
|
afterFinalizationTimeout: boolOpt,
|
|
@@ -1911,6 +1985,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1911
1985
|
releasedByHardCap: boolOpt,
|
|
1912
1986
|
nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
|
|
1913
1987
|
live: { t: "live", optional: true },
|
|
1988
|
+
nativeMarker: { t: "native_marker", optional: true },
|
|
1914
1989
|
reportExpected: boolOpt,
|
|
1915
1990
|
providerFailure: enOpt(PROVIDER_FAILURES)
|
|
1916
1991
|
},
|
|
@@ -1924,7 +1999,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1924
1999
|
},
|
|
1925
2000
|
transcript_activity: { newestActivityAt: ms },
|
|
1926
2001
|
no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
|
|
1927
|
-
liveness: { result: en(LIVENESS_RESULTS) },
|
|
2002
|
+
liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
|
|
1928
2003
|
process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
|
|
1929
2004
|
session_error: { reason: en(SESSION_ERROR_REASONS) },
|
|
1930
2005
|
worker_report: {
|
|
@@ -1934,6 +2009,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1934
2009
|
branchState: enOpt(WORKER_BRANCH_STATES),
|
|
1935
2010
|
touchedFileCount: intOpt
|
|
1936
2011
|
},
|
|
2012
|
+
worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
|
|
1937
2013
|
worker_progress: { note: { t: "summary_ref", optional: true } },
|
|
1938
2014
|
git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
|
|
1939
2015
|
cancel: { reason: en(CANCEL_REASONS) },
|
|
@@ -1981,7 +2057,7 @@ function isLiveTurnPending(value) {
|
|
|
1981
2057
|
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));
|
|
1982
2058
|
}
|
|
1983
2059
|
function isNativeMarkerRef(value) {
|
|
1984
|
-
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
|
|
2060
|
+
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]));
|
|
1985
2061
|
}
|
|
1986
2062
|
function isCoordinatorIdentity(value) {
|
|
1987
2063
|
return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
|
|
@@ -3050,14 +3126,11 @@ function normalizeOwnedPaths(input) {
|
|
|
3050
3126
|
}
|
|
3051
3127
|
function entryContains(base, path) {
|
|
3052
3128
|
if (path === base.path) return true;
|
|
3053
|
-
if (base.subtree && (path ===
|
|
3129
|
+
if (base.subtree && (base.path === "" || path.startsWith(`${base.path}/`))) return true;
|
|
3054
3130
|
return false;
|
|
3055
3131
|
}
|
|
3056
3132
|
function entriesOverlap(a, b) {
|
|
3057
|
-
|
|
3058
|
-
if (a.subtree && (b.path === a.path || b.path.startsWith(`${a.path}/`))) return true;
|
|
3059
|
-
if (b.subtree && (a.path === b.path || a.path.startsWith(`${b.path}/`))) return true;
|
|
3060
|
-
return false;
|
|
3133
|
+
return entryContains(a, b.path) || entryContains(b, a.path);
|
|
3061
3134
|
}
|
|
3062
3135
|
function pathsOverlap(a, b) {
|
|
3063
3136
|
if (a.paths.length === 0 || b.paths.length === 0) return false;
|
|
@@ -3329,7 +3402,15 @@ function foldKeyedDoc(held, delta, spec) {
|
|
|
3329
3402
|
const heldList = heldCollections.get(path);
|
|
3330
3403
|
if (change?.absent) {
|
|
3331
3404
|
const [head2, tail2] = splitPath(path);
|
|
3332
|
-
if (!tail2)
|
|
3405
|
+
if (!tail2) {
|
|
3406
|
+
delete next[head2];
|
|
3407
|
+
continue;
|
|
3408
|
+
}
|
|
3409
|
+
const parent2 = next[head2];
|
|
3410
|
+
if (!isRecord3(parent2) || !(tail2 in parent2)) continue;
|
|
3411
|
+
const copy = { ...parent2 };
|
|
3412
|
+
delete copy[tail2];
|
|
3413
|
+
next[head2] = copy;
|
|
3333
3414
|
continue;
|
|
3334
3415
|
}
|
|
3335
3416
|
if (!change && heldList === void 0) continue;
|
|
@@ -3393,6 +3474,105 @@ function stableMeshNodeRow(row) {
|
|
|
3393
3474
|
}
|
|
3394
3475
|
return out;
|
|
3395
3476
|
}
|
|
3477
|
+
|
|
3478
|
+
// src/provider-approval.ts
|
|
3479
|
+
function isActionableProviderApproval(approval) {
|
|
3480
|
+
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());
|
|
3481
|
+
}
|
|
3482
|
+
function readProviderDecision(approval, waiting, hasModal = false) {
|
|
3483
|
+
if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
|
|
3484
|
+
if (!waiting) return null;
|
|
3485
|
+
return {
|
|
3486
|
+
source: hasModal ? "legacy_provider" : "status_only",
|
|
3487
|
+
type: "unknown",
|
|
3488
|
+
compatibility: hasModal ? "session_only" : "unknown",
|
|
3489
|
+
evidence: "unavailable",
|
|
3490
|
+
lifecycle: "pending",
|
|
3491
|
+
modalKey: null,
|
|
3492
|
+
createdAt: null,
|
|
3493
|
+
resolvedAt: null,
|
|
3494
|
+
description: "",
|
|
3495
|
+
buttons: [],
|
|
3496
|
+
actionable: false
|
|
3497
|
+
};
|
|
3498
|
+
}
|
|
3499
|
+
function providerApprovalSnapshot(approval) {
|
|
3500
|
+
if (!approval) return null;
|
|
3501
|
+
const {
|
|
3502
|
+
source,
|
|
3503
|
+
type,
|
|
3504
|
+
lifecycle,
|
|
3505
|
+
modalKey,
|
|
3506
|
+
createdAt,
|
|
3507
|
+
resolvedAt,
|
|
3508
|
+
providerType,
|
|
3509
|
+
sessionId,
|
|
3510
|
+
nodeId,
|
|
3511
|
+
meshId,
|
|
3512
|
+
taskId,
|
|
3513
|
+
attemptId,
|
|
3514
|
+
generation
|
|
3515
|
+
} = approval;
|
|
3516
|
+
return {
|
|
3517
|
+
source,
|
|
3518
|
+
type,
|
|
3519
|
+
lifecycle,
|
|
3520
|
+
modalKey,
|
|
3521
|
+
createdAt,
|
|
3522
|
+
resolvedAt,
|
|
3523
|
+
providerType,
|
|
3524
|
+
sessionId,
|
|
3525
|
+
nodeId,
|
|
3526
|
+
meshId,
|
|
3527
|
+
taskId,
|
|
3528
|
+
attemptId,
|
|
3529
|
+
generation,
|
|
3530
|
+
evidence: "cached",
|
|
3531
|
+
actionable: false,
|
|
3532
|
+
description: "",
|
|
3533
|
+
buttons: []
|
|
3534
|
+
};
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
// src/provider-question.ts
|
|
3538
|
+
function isProviderQuestionBinding(value) {
|
|
3539
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
3540
|
+
const b = value;
|
|
3541
|
+
if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
|
|
3542
|
+
const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
|
|
3543
|
+
if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
|
|
3544
|
+
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3545
|
+
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3548
|
+
// src/launch-defaults.ts
|
|
3549
|
+
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
3550
|
+
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
3551
|
+
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
3552
|
+
function isLaunchDefaultRole(value) {
|
|
3553
|
+
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
3554
|
+
}
|
|
3555
|
+
function isLaunchDefaultSource(value) {
|
|
3556
|
+
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
3557
|
+
}
|
|
3558
|
+
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
3559
|
+
"invalid_args",
|
|
3560
|
+
"launch_default_required",
|
|
3561
|
+
"launch_default_unavailable",
|
|
3562
|
+
"launch_selection_invalid",
|
|
3563
|
+
"launch_default_invalid",
|
|
3564
|
+
"revision_conflict",
|
|
3565
|
+
"store_unavailable",
|
|
3566
|
+
"store_busy",
|
|
3567
|
+
"persistence_failed",
|
|
3568
|
+
"project_not_found",
|
|
3569
|
+
"project_ambiguous",
|
|
3570
|
+
"project_not_hosted",
|
|
3571
|
+
"project_storage_unavailable",
|
|
3572
|
+
"staging_unavailable",
|
|
3573
|
+
"staging_failed",
|
|
3574
|
+
"review_turn_tool_denied"
|
|
3575
|
+
];
|
|
3396
3576
|
export {
|
|
3397
3577
|
ASSISTANT_OWNER_VERBS,
|
|
3398
3578
|
ASSISTANT_REVIEW_TURN_VERBS,
|
|
@@ -3431,6 +3611,10 @@ export {
|
|
|
3431
3611
|
EVIDENCE_ENVELOPE_FIELD_SPECS,
|
|
3432
3612
|
EVIDENCE_SOURCE_IDS,
|
|
3433
3613
|
HOLD_REASONS,
|
|
3614
|
+
LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE,
|
|
3615
|
+
LAUNCH_DEFAULT_ERROR_CODES,
|
|
3616
|
+
LAUNCH_DEFAULT_ROLES,
|
|
3617
|
+
LAUNCH_DEFAULT_SOURCES,
|
|
3434
3618
|
LIVENESS_RESULTS,
|
|
3435
3619
|
MAX_MESH_RECORD_STRING,
|
|
3436
3620
|
MAX_OWNED_PATHS,
|
|
@@ -3471,6 +3655,8 @@ export {
|
|
|
3471
3655
|
OUTBOUND_MESSAGE_ORIGINS,
|
|
3472
3656
|
P2P_SIGNAL_TYPES,
|
|
3473
3657
|
PROVIDER_FAILURES,
|
|
3658
|
+
QUOTA_BACKFILL_HORIZON_MS,
|
|
3659
|
+
QUOTA_RETRY_INFLIGHT_GRACE_MS,
|
|
3474
3660
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
3475
3661
|
RECENT_SESSION_BUCKETS,
|
|
3476
3662
|
RECLAIMING_SEND_REFUSALS,
|
|
@@ -3516,9 +3702,11 @@ export {
|
|
|
3516
3702
|
WORKER_BRANCH_STATES,
|
|
3517
3703
|
WORKER_PROTOCOL_FOOTER_MARKER,
|
|
3518
3704
|
WORKER_REPORT_OUTCOMES,
|
|
3705
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
3519
3706
|
WORKER_TOOLS,
|
|
3520
3707
|
appendWorkerProtocolFooter,
|
|
3521
3708
|
argsCarryStatusProbeMarker,
|
|
3709
|
+
assessQuotaFreshness,
|
|
3522
3710
|
buildSlotProposal,
|
|
3523
3711
|
canonicalDaemonId,
|
|
3524
3712
|
classifySessionStatus,
|
|
@@ -3599,6 +3787,7 @@ export {
|
|
|
3599
3787
|
hasGitStatusEvidence,
|
|
3600
3788
|
hasWorkerProtocolFooter,
|
|
3601
3789
|
interpolateString,
|
|
3790
|
+
isActionableProviderApproval,
|
|
3602
3791
|
isAssistantTool,
|
|
3603
3792
|
isBlockedStatus,
|
|
3604
3793
|
isBusyStatus,
|
|
@@ -3620,6 +3809,8 @@ export {
|
|
|
3620
3809
|
isFiniteNumber,
|
|
3621
3810
|
isIdleSessionState,
|
|
3622
3811
|
isInputEnvelopeWire,
|
|
3812
|
+
isLaunchDefaultRole,
|
|
3813
|
+
isLaunchDefaultSource,
|
|
3623
3814
|
isMeshDeliveryMode,
|
|
3624
3815
|
isMeshIndexQueryResponse,
|
|
3625
3816
|
isMeshMissionStatusValue,
|
|
@@ -3634,12 +3825,14 @@ export {
|
|
|
3634
3825
|
isMessageId,
|
|
3635
3826
|
isMissionUpsertResponse,
|
|
3636
3827
|
isModelAxisSource,
|
|
3828
|
+
isNativeMarkerRef,
|
|
3637
3829
|
isNonEmptyString,
|
|
3638
3830
|
isNotifyKind,
|
|
3639
3831
|
isOutboundMessage,
|
|
3640
3832
|
isOutboundMessageOrigin,
|
|
3641
3833
|
isP2PSignalType,
|
|
3642
3834
|
isPhantomDaemonEntry,
|
|
3835
|
+
isProviderQuestionBinding,
|
|
3643
3836
|
isRawDaemonDoId,
|
|
3644
3837
|
isReadyStatus,
|
|
3645
3838
|
isRecord,
|
|
@@ -3677,6 +3870,7 @@ export {
|
|
|
3677
3870
|
meshUtf8ByteLength,
|
|
3678
3871
|
meshWorkspacesEquivalent,
|
|
3679
3872
|
mintMessageId,
|
|
3873
|
+
minutesUntilQuotaCheck,
|
|
3680
3874
|
normalizeAuthOkLimits,
|
|
3681
3875
|
normalizeBrainSlot,
|
|
3682
3876
|
normalizeDifficultyBrainMap,
|
|
@@ -3699,11 +3893,13 @@ export {
|
|
|
3699
3893
|
pickBestTransitGitStatus,
|
|
3700
3894
|
projectFileDiffRow,
|
|
3701
3895
|
projectTurnEvidenceEntry,
|
|
3896
|
+
providerApprovalSnapshot,
|
|
3702
3897
|
readBoolean,
|
|
3703
3898
|
readEnvelopeFields,
|
|
3704
3899
|
readGitSubmodules,
|
|
3705
3900
|
readNumber,
|
|
3706
3901
|
readOptionalRecord,
|
|
3902
|
+
readProviderDecision,
|
|
3707
3903
|
readRecord,
|
|
3708
3904
|
readString,
|
|
3709
3905
|
readStringArray,
|