@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.
- package/dist/assistant-protocol.d.ts +6 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +104 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -8
- package/dist/index.mjs.map +1 -1
- package/dist/mesh-vocabulary.d.ts +1 -1
- package/dist/node-facts.d.ts +7 -0
- package/dist/provider-approval.d.ts +36 -0
- package/dist/provider-question.d.ts +19 -0
- package/dist/turn-evidence.d.ts +14 -6
- 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/node-facts.ts +2 -0
- package/src/provider-approval.ts +59 -0
- package/src/provider-question.ts +31 -0
- package/src/turn-evidence.ts +15 -14
- package/src/types.ts +1 -0
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));
|
|
@@ -3436,6 +3452,76 @@ function stableMeshNodeRow(row) {
|
|
|
3436
3452
|
}
|
|
3437
3453
|
return out;
|
|
3438
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
|
+
}
|
|
3439
3525
|
export {
|
|
3440
3526
|
ASSISTANT_OWNER_VERBS,
|
|
3441
3527
|
ASSISTANT_REVIEW_TURN_VERBS,
|
|
@@ -3645,6 +3731,7 @@ export {
|
|
|
3645
3731
|
hasGitStatusEvidence,
|
|
3646
3732
|
hasWorkerProtocolFooter,
|
|
3647
3733
|
interpolateString,
|
|
3734
|
+
isActionableProviderApproval,
|
|
3648
3735
|
isAssistantTool,
|
|
3649
3736
|
isBlockedStatus,
|
|
3650
3737
|
isBusyStatus,
|
|
@@ -3680,12 +3767,14 @@ export {
|
|
|
3680
3767
|
isMessageId,
|
|
3681
3768
|
isMissionUpsertResponse,
|
|
3682
3769
|
isModelAxisSource,
|
|
3770
|
+
isNativeMarkerRef,
|
|
3683
3771
|
isNonEmptyString,
|
|
3684
3772
|
isNotifyKind,
|
|
3685
3773
|
isOutboundMessage,
|
|
3686
3774
|
isOutboundMessageOrigin,
|
|
3687
3775
|
isP2PSignalType,
|
|
3688
3776
|
isPhantomDaemonEntry,
|
|
3777
|
+
isProviderQuestionBinding,
|
|
3689
3778
|
isRawDaemonDoId,
|
|
3690
3779
|
isReadyStatus,
|
|
3691
3780
|
isRecord,
|
|
@@ -3746,11 +3835,13 @@ export {
|
|
|
3746
3835
|
pickBestTransitGitStatus,
|
|
3747
3836
|
projectFileDiffRow,
|
|
3748
3837
|
projectTurnEvidenceEntry,
|
|
3838
|
+
providerApprovalSnapshot,
|
|
3749
3839
|
readBoolean,
|
|
3750
3840
|
readEnvelopeFields,
|
|
3751
3841
|
readGitSubmodules,
|
|
3752
3842
|
readNumber,
|
|
3753
3843
|
readOptionalRecord,
|
|
3844
|
+
readProviderDecision,
|
|
3754
3845
|
readRecord,
|
|
3755
3846
|
readString,
|
|
3756
3847
|
readStringArray,
|