@adhdev/mesh-shared 1.0.82-rc.11 → 1.0.82-rc.13
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 +6 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +115 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +109 -11
- package/dist/index.mjs.map +1 -1
- package/dist/mesh-vocabulary.d.ts +8 -1
- package/dist/node-facts.d.ts +26 -0
- package/dist/provider-approval.d.ts +36 -0
- package/dist/provider-question.d.ts +19 -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 +13 -1
- package/src/index.ts +2 -0
- package/src/mesh-vocabulary.ts +8 -0
- package/src/node-facts.ts +21 -0
- package/src/provider-approval.ts +59 -0
- package/src/provider-question.ts +31 -0
- package/src/quota-freshness.ts +7 -2
- package/src/turn-evidence.ts +20 -17
- package/src/types.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -307,7 +307,7 @@ function hasUsableWindow(window) {
|
|
|
307
307
|
return !!window && typeof window.usedPercent === "number" && Number.isFinite(window.usedPercent);
|
|
308
308
|
}
|
|
309
309
|
function hasReading(quota) {
|
|
310
|
-
if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly)) return true;
|
|
310
|
+
if (hasUsableWindow(quota.session) || hasUsableWindow(quota.weekly) || hasUsableWindow(quota.monthly)) return true;
|
|
311
311
|
return Array.isArray(quota.buckets) && quota.buckets.some((b) => !!b && typeof b.usedPercent === "number" && Number.isFinite(b.usedPercent));
|
|
312
312
|
}
|
|
313
313
|
function finiteMs(value) {
|
|
@@ -1438,6 +1438,7 @@ var MESH_THINKING_LEVELS = ["low", "medium", "high"];
|
|
|
1438
1438
|
var MESH_DELIVERY_MODES = ["when_idle", "interrupt"];
|
|
1439
1439
|
var MESH_SESSION_CLEANUP_MODES = ["preserve", "stop", "delete_stopped", "stop_and_delete"];
|
|
1440
1440
|
var WORKER_REPORT_OUTCOMES = ["completed", "blocked", "failed"];
|
|
1441
|
+
var WORKER_REPORT_SUMMARY_MAX_CHARS = 8e3;
|
|
1441
1442
|
var WORKER_BRANCH_STATES = [
|
|
1442
1443
|
"merged_to_main",
|
|
1443
1444
|
"pushed_feature_branch_needs_merge",
|
|
@@ -1705,6 +1706,9 @@ function renderCoordinatorWorkerSection() {
|
|
|
1705
1706
|
// src/assistant-protocol.ts
|
|
1706
1707
|
var ASSISTANT_TOOLS = [
|
|
1707
1708
|
"projects",
|
|
1709
|
+
"environment",
|
|
1710
|
+
"assistant_action",
|
|
1711
|
+
"project_watch",
|
|
1708
1712
|
"project_status",
|
|
1709
1713
|
"project_send",
|
|
1710
1714
|
"project_read",
|
|
@@ -1722,6 +1726,11 @@ function isAssistantTool(value) {
|
|
|
1722
1726
|
var ASSISTANT_VERB = {
|
|
1723
1727
|
// tool verbs
|
|
1724
1728
|
projects: "assistant_projects",
|
|
1729
|
+
environment: "assistant_environment",
|
|
1730
|
+
action: "assistant_action",
|
|
1731
|
+
watch: "assistant_project_watch",
|
|
1732
|
+
executionState: "assistant_execution_state",
|
|
1733
|
+
executionSettings: "assistant_execution_settings",
|
|
1725
1734
|
projectStatus: "assistant_project_status",
|
|
1726
1735
|
projectSend: "assistant_project_send",
|
|
1727
1736
|
projectRead: "assistant_project_read",
|
|
@@ -1741,6 +1750,9 @@ var ASSISTANT_VERB = {
|
|
|
1741
1750
|
};
|
|
1742
1751
|
var ASSISTANT_TOOL_VERBS = {
|
|
1743
1752
|
projects: ASSISTANT_VERB.projects,
|
|
1753
|
+
environment: ASSISTANT_VERB.environment,
|
|
1754
|
+
assistant_action: ASSISTANT_VERB.action,
|
|
1755
|
+
project_watch: ASSISTANT_VERB.watch,
|
|
1744
1756
|
project_status: ASSISTANT_VERB.projectStatus,
|
|
1745
1757
|
project_send: ASSISTANT_VERB.projectSend,
|
|
1746
1758
|
project_read: ASSISTANT_VERB.projectRead,
|
|
@@ -1751,8 +1763,9 @@ var ASSISTANT_TOOL_VERBS = {
|
|
|
1751
1763
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
1752
1764
|
project_note: ASSISTANT_VERB.projectNote
|
|
1753
1765
|
};
|
|
1754
|
-
var ASSISTANT_WRITE_TOOLS = ["memory", "skill_manage", "project_note", "project_send", "project_add"];
|
|
1766
|
+
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add"];
|
|
1755
1767
|
var ASSISTANT_OWNER_VERBS = [
|
|
1768
|
+
ASSISTANT_VERB.executionSettings,
|
|
1756
1769
|
ASSISTANT_VERB.stagedResolve,
|
|
1757
1770
|
ASSISTANT_VERB.storeAdmin,
|
|
1758
1771
|
ASSISTANT_VERB.importSkills
|
|
@@ -1810,8 +1823,8 @@ function sanitizeRefusalCode(value) {
|
|
|
1810
1823
|
var CONSUME_PROFILES = ["default", "native_source"];
|
|
1811
1824
|
var SESSION_REBOUND_REASONS = ["restart", "live_holder"];
|
|
1812
1825
|
var SUSPENSION_MODALS = ["approval", "choice"];
|
|
1813
|
-
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered"];
|
|
1814
|
-
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer"];
|
|
1826
|
+
var SUSPENSION_RESOLUTIONS = ["approved", "rejected", "answered", "dismissed"];
|
|
1827
|
+
var SUSPENSION_RESOLUTION_VIAS = ["modal_button", "auto_approve", "prompt_answer", "modal_disappeared"];
|
|
1815
1828
|
var TURN_END_STRENGTHS = ["genuine", "weak"];
|
|
1816
1829
|
var TURN_END_BLOCK_REASONS = [
|
|
1817
1830
|
"missing_final_assistant",
|
|
@@ -1819,9 +1832,9 @@ var TURN_END_BLOCK_REASONS = [
|
|
|
1819
1832
|
"terminal_block_hard_cap",
|
|
1820
1833
|
"decoupled_completion"
|
|
1821
1834
|
];
|
|
1822
|
-
var NATIVE_TURN_OUTCOMES = ["completed", "aborted"];
|
|
1835
|
+
var NATIVE_TURN_OUTCOMES = ["completed", "aborted", "failed"];
|
|
1823
1836
|
var LIVENESS_RESULTS = ["alive", "unknown", "read_failed", "dead"];
|
|
1824
|
-
var PROVIDER_FAILURES = ["auth_failed", "billing_failed"];
|
|
1837
|
+
var PROVIDER_FAILURES = ["auth_failed", "billing_failed", "usage_limit_exceeded", "server_overloaded", "provider_error"];
|
|
1825
1838
|
var SESSION_ERROR_REASONS = ["provider_error", "adapter_error", "spawn_failed", "auth_failed", "billing_failed", "unknown", "daemon_restart"];
|
|
1826
1839
|
var CANCEL_REASONS = ["operator_cancel", "intentional_cleanup", "task_removed", "mission_abandoned", "superseded"];
|
|
1827
1840
|
var OPERATOR_STATUSES = ["completed", "failed"];
|
|
@@ -1848,7 +1861,8 @@ var HOLD_REASONS = [
|
|
|
1848
1861
|
// — a turn_end commits the report (R9t), expiry commits it anyway (R13t) so
|
|
1849
1862
|
// a session whose FSM never shows the idle edge again does not wait for
|
|
1850
1863
|
// liveness / hard_ceiling.
|
|
1851
|
-
"await_end"
|
|
1864
|
+
"await_end",
|
|
1865
|
+
"report_correction"
|
|
1852
1866
|
];
|
|
1853
1867
|
var TURN_OUTCOMES = ["completed", "failed", "cancelled"];
|
|
1854
1868
|
var COMMIT_STRENGTHS = ["genuine", "weak", "tool_report", "operator"];
|
|
@@ -1859,9 +1873,15 @@ var TURN_REASONS = [
|
|
|
1859
1873
|
"transcript_final",
|
|
1860
1874
|
"worker_reported",
|
|
1861
1875
|
"finalization_timeout_no_response",
|
|
1876
|
+
"weak_end_liveness_unconfirmed",
|
|
1877
|
+
"weak_end_probe_unobserved",
|
|
1878
|
+
"report_correction_expired",
|
|
1862
1879
|
"session_error",
|
|
1863
1880
|
"provider_auth_failed",
|
|
1864
1881
|
"provider_billing_failed",
|
|
1882
|
+
"provider_usage_limit_exceeded",
|
|
1883
|
+
"provider_server_overloaded",
|
|
1884
|
+
"provider_error",
|
|
1865
1885
|
"operator_cancel",
|
|
1866
1886
|
"intentional_cleanup",
|
|
1867
1887
|
"task_removed",
|
|
@@ -1938,8 +1958,8 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1938
1958
|
duplicate_dispatch_refusal: { holderSessionId: id, holderAttemptId: idOpt },
|
|
1939
1959
|
session_rebound: { toSessionId: id, reason: en(SESSION_REBOUND_REASONS) },
|
|
1940
1960
|
turn_started: { retro: bool },
|
|
1941
|
-
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt },
|
|
1942
|
-
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS) },
|
|
1961
|
+
suspension: { modal: en(SUSPENSION_MODALS), modalKey: idOpt, providerSetup: boolOpt, clockUnknown: boolOpt },
|
|
1962
|
+
suspension_resolved: { resolution: en(SUSPENSION_RESOLUTIONS), via: en(SUSPENSION_RESOLUTION_VIAS), modalKey: idOpt },
|
|
1943
1963
|
turn_end: {
|
|
1944
1964
|
strength: en(TURN_END_STRENGTHS),
|
|
1945
1965
|
afterFinalizationTimeout: boolOpt,
|
|
@@ -1949,6 +1969,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1949
1969
|
releasedByHardCap: boolOpt,
|
|
1950
1970
|
nativeOutcome: enOpt(NATIVE_TURN_OUTCOMES),
|
|
1951
1971
|
live: { t: "live", optional: true },
|
|
1972
|
+
nativeMarker: { t: "native_marker", optional: true },
|
|
1952
1973
|
reportExpected: boolOpt,
|
|
1953
1974
|
providerFailure: enOpt(PROVIDER_FAILURES)
|
|
1954
1975
|
},
|
|
@@ -1962,7 +1983,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1962
1983
|
},
|
|
1963
1984
|
transcript_activity: { newestActivityAt: ms },
|
|
1964
1985
|
no_progress: { stalledMs: ms, observedStatus: en(NO_PROGRESS_OBSERVED_STATUSES), finalAssistantPresent: bool },
|
|
1965
|
-
liveness: { result: en(LIVENESS_RESULTS) },
|
|
1986
|
+
liveness: { result: en(LIVENESS_RESULTS), probeStartedAtMs: msOpt },
|
|
1966
1987
|
process_exit: { exitCode: { t: "int", nullable: true }, providerFailure: enOpt(PROVIDER_FAILURES) },
|
|
1967
1988
|
session_error: { reason: en(SESSION_ERROR_REASONS) },
|
|
1968
1989
|
worker_report: {
|
|
@@ -1972,6 +1993,7 @@ var TURN_EVIDENCE_FIELD_SPECS = {
|
|
|
1972
1993
|
branchState: enOpt(WORKER_BRANCH_STATES),
|
|
1973
1994
|
touchedFileCount: intOpt
|
|
1974
1995
|
},
|
|
1996
|
+
worker_report_correction_requested: { deliveryId: { t: "id", optional: true } },
|
|
1975
1997
|
worker_progress: { note: { t: "summary_ref", optional: true } },
|
|
1976
1998
|
git_side_effect: { dirty: bool, commitsSinceDispatch: { t: "int" }, attributable: bool },
|
|
1977
1999
|
cancel: { reason: en(CANCEL_REASONS) },
|
|
@@ -2019,7 +2041,7 @@ function isLiveTurnPending(value) {
|
|
|
2019
2041
|
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
2042
|
}
|
|
2021
2043
|
function isNativeMarkerRef(value) {
|
|
2022
|
-
return isRecord2(value) && hasOnlyKeys(value, ["outcome", "turnId"]) && NATIVE_TURN_OUTCOMES.includes(value.outcome) && (value.turnId === void 0 || isEvidenceIdentifier(value.turnId));
|
|
2044
|
+
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
2045
|
}
|
|
2024
2046
|
function isCoordinatorIdentity(value) {
|
|
2025
2047
|
return isRecord2(value) && hasOnlyKeys(value, ["daemonId", "coordinatorRunId", "sessionId"]) && isEvidenceIdentifier(value.daemonId) && isEvidenceIdentifier(value.coordinatorRunId) && (value.sessionId === void 0 || isEvidenceIdentifier(value.sessionId));
|
|
@@ -3436,6 +3458,76 @@ function stableMeshNodeRow(row) {
|
|
|
3436
3458
|
}
|
|
3437
3459
|
return out;
|
|
3438
3460
|
}
|
|
3461
|
+
|
|
3462
|
+
// src/provider-approval.ts
|
|
3463
|
+
function isActionableProviderApproval(approval) {
|
|
3464
|
+
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());
|
|
3465
|
+
}
|
|
3466
|
+
function readProviderDecision(approval, waiting, hasModal = false) {
|
|
3467
|
+
if (approval !== void 0) return approval && ["provider_modal", "legacy_provider", "status_only", "ledger_approval"].includes(approval.source) ? approval : null;
|
|
3468
|
+
if (!waiting) return null;
|
|
3469
|
+
return {
|
|
3470
|
+
source: hasModal ? "legacy_provider" : "status_only",
|
|
3471
|
+
type: "unknown",
|
|
3472
|
+
compatibility: hasModal ? "session_only" : "unknown",
|
|
3473
|
+
evidence: "unavailable",
|
|
3474
|
+
lifecycle: "pending",
|
|
3475
|
+
modalKey: null,
|
|
3476
|
+
createdAt: null,
|
|
3477
|
+
resolvedAt: null,
|
|
3478
|
+
description: "",
|
|
3479
|
+
buttons: [],
|
|
3480
|
+
actionable: false
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3483
|
+
function providerApprovalSnapshot(approval) {
|
|
3484
|
+
if (!approval) return null;
|
|
3485
|
+
const {
|
|
3486
|
+
source,
|
|
3487
|
+
type,
|
|
3488
|
+
lifecycle,
|
|
3489
|
+
modalKey,
|
|
3490
|
+
createdAt,
|
|
3491
|
+
resolvedAt,
|
|
3492
|
+
providerType,
|
|
3493
|
+
sessionId,
|
|
3494
|
+
nodeId,
|
|
3495
|
+
meshId,
|
|
3496
|
+
taskId,
|
|
3497
|
+
attemptId,
|
|
3498
|
+
generation
|
|
3499
|
+
} = approval;
|
|
3500
|
+
return {
|
|
3501
|
+
source,
|
|
3502
|
+
type,
|
|
3503
|
+
lifecycle,
|
|
3504
|
+
modalKey,
|
|
3505
|
+
createdAt,
|
|
3506
|
+
resolvedAt,
|
|
3507
|
+
providerType,
|
|
3508
|
+
sessionId,
|
|
3509
|
+
nodeId,
|
|
3510
|
+
meshId,
|
|
3511
|
+
taskId,
|
|
3512
|
+
attemptId,
|
|
3513
|
+
generation,
|
|
3514
|
+
evidence: "cached",
|
|
3515
|
+
actionable: false,
|
|
3516
|
+
description: "",
|
|
3517
|
+
buttons: []
|
|
3518
|
+
};
|
|
3519
|
+
}
|
|
3520
|
+
|
|
3521
|
+
// src/provider-question.ts
|
|
3522
|
+
function isProviderQuestionBinding(value) {
|
|
3523
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
3524
|
+
const b = value;
|
|
3525
|
+
if (b.transport !== "codex_rpc" && b.transport !== "codex_async") return false;
|
|
3526
|
+
const keys = ["transport", "sessionId", "generation", "threadId", "turnId", "itemId", ...b.transport === "codex_rpc" ? ["requestId"] : []];
|
|
3527
|
+
if (Reflect.ownKeys(b).some((key) => typeof key !== "string" || !keys.includes(key))) return false;
|
|
3528
|
+
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3529
|
+
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
3530
|
+
}
|
|
3439
3531
|
export {
|
|
3440
3532
|
ASSISTANT_OWNER_VERBS,
|
|
3441
3533
|
ASSISTANT_REVIEW_TURN_VERBS,
|
|
@@ -3561,6 +3653,7 @@ export {
|
|
|
3561
3653
|
WORKER_BRANCH_STATES,
|
|
3562
3654
|
WORKER_PROTOCOL_FOOTER_MARKER,
|
|
3563
3655
|
WORKER_REPORT_OUTCOMES,
|
|
3656
|
+
WORKER_REPORT_SUMMARY_MAX_CHARS,
|
|
3564
3657
|
WORKER_TOOLS,
|
|
3565
3658
|
appendWorkerProtocolFooter,
|
|
3566
3659
|
argsCarryStatusProbeMarker,
|
|
@@ -3645,6 +3738,7 @@ export {
|
|
|
3645
3738
|
hasGitStatusEvidence,
|
|
3646
3739
|
hasWorkerProtocolFooter,
|
|
3647
3740
|
interpolateString,
|
|
3741
|
+
isActionableProviderApproval,
|
|
3648
3742
|
isAssistantTool,
|
|
3649
3743
|
isBlockedStatus,
|
|
3650
3744
|
isBusyStatus,
|
|
@@ -3680,12 +3774,14 @@ export {
|
|
|
3680
3774
|
isMessageId,
|
|
3681
3775
|
isMissionUpsertResponse,
|
|
3682
3776
|
isModelAxisSource,
|
|
3777
|
+
isNativeMarkerRef,
|
|
3683
3778
|
isNonEmptyString,
|
|
3684
3779
|
isNotifyKind,
|
|
3685
3780
|
isOutboundMessage,
|
|
3686
3781
|
isOutboundMessageOrigin,
|
|
3687
3782
|
isP2PSignalType,
|
|
3688
3783
|
isPhantomDaemonEntry,
|
|
3784
|
+
isProviderQuestionBinding,
|
|
3689
3785
|
isRawDaemonDoId,
|
|
3690
3786
|
isReadyStatus,
|
|
3691
3787
|
isRecord,
|
|
@@ -3746,11 +3842,13 @@ export {
|
|
|
3746
3842
|
pickBestTransitGitStatus,
|
|
3747
3843
|
projectFileDiffRow,
|
|
3748
3844
|
projectTurnEvidenceEntry,
|
|
3845
|
+
providerApprovalSnapshot,
|
|
3749
3846
|
readBoolean,
|
|
3750
3847
|
readEnvelopeFields,
|
|
3751
3848
|
readGitSubmodules,
|
|
3752
3849
|
readNumber,
|
|
3753
3850
|
readOptionalRecord,
|
|
3851
|
+
readProviderDecision,
|
|
3754
3852
|
readRecord,
|
|
3755
3853
|
readString,
|
|
3756
3854
|
readStringArray,
|