@adhdev/mesh-shared 1.0.82-rc.32 → 1.0.82-rc.34
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 +8 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +111 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -5
- package/dist/index.mjs.map +1 -1
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/protocol/daemon-server.d.ts +6 -0
- package/dist/protocol/dashboard-server.d.ts +8 -0
- package/dist/relay-reprobe.d.ts +52 -0
- package/dist/worker-protocol.d.ts +1 -1
- package/package.json +1 -1
- package/src/assistant-protocol.ts +11 -1
- package/src/index.ts +1 -0
- package/src/mesh-tool-names.ts +3 -0
- package/src/protocol/daemon-server.ts +6 -2
- package/src/protocol/dashboard-server.ts +7 -2
- package/src/relay-reprobe.ts +117 -0
- package/src/worker-protocol.ts +7 -0
package/dist/index.mjs
CHANGED
|
@@ -773,6 +773,7 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
773
773
|
"mesh_list_pending_approvals",
|
|
774
774
|
"mesh_create",
|
|
775
775
|
"mesh_add_node",
|
|
776
|
+
"mesh_reattach_source_parent",
|
|
776
777
|
"mesh_attach_remote",
|
|
777
778
|
"mesh_clone_node",
|
|
778
779
|
"mesh_remove_node",
|
|
@@ -796,7 +797,9 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
796
797
|
"mesh_node_slots",
|
|
797
798
|
"driver_list",
|
|
798
799
|
"driver_describe",
|
|
799
|
-
"artifact_list"
|
|
800
|
+
"artifact_list",
|
|
801
|
+
"artifact_read",
|
|
802
|
+
"artifact_register"
|
|
800
803
|
];
|
|
801
804
|
var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
|
|
802
805
|
var RETIRED_MESH_TOOLS = {
|
|
@@ -1682,7 +1685,14 @@ var WORKER_TOOLS = [
|
|
|
1682
1685
|
"driver_list",
|
|
1683
1686
|
"driver_describe",
|
|
1684
1687
|
"driver_invoke",
|
|
1685
|
-
"artifact_register"
|
|
1688
|
+
"artifact_register",
|
|
1689
|
+
"artifact_list",
|
|
1690
|
+
"artifact_read",
|
|
1691
|
+
// Contract versioning (Cut A): exact pinned-unit reads (E2), the explicit
|
|
1692
|
+
// read claim (C1) and the authoritative head/notice pull.
|
|
1693
|
+
"contract_read",
|
|
1694
|
+
"contract_observe",
|
|
1695
|
+
"contract_current"
|
|
1686
1696
|
];
|
|
1687
1697
|
var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
|
|
1688
1698
|
function isWorkerTool(value) {
|
|
@@ -1783,7 +1793,9 @@ var ASSISTANT_TOOLS = [
|
|
|
1783
1793
|
"launch_defaults",
|
|
1784
1794
|
"launch_defaults_set",
|
|
1785
1795
|
"driver_list",
|
|
1786
|
-
"driver_describe"
|
|
1796
|
+
"driver_describe",
|
|
1797
|
+
"artifact_list",
|
|
1798
|
+
"artifact_read"
|
|
1787
1799
|
];
|
|
1788
1800
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
1789
1801
|
function isAssistantTool(value) {
|
|
@@ -1811,6 +1823,8 @@ var ASSISTANT_VERB = {
|
|
|
1811
1823
|
projectNote: "assistant_project_note",
|
|
1812
1824
|
launchDefaults: "assistant_launch_defaults",
|
|
1813
1825
|
launchDefaultsSet: "assistant_launch_defaults_set",
|
|
1826
|
+
artifactList: "assistant_artifact_list",
|
|
1827
|
+
artifactRead: "assistant_artifact_read",
|
|
1814
1828
|
// assistant-side daemon verbs without a tool of the same name
|
|
1815
1829
|
launch: "launch_assistant",
|
|
1816
1830
|
pendingRelays: "assistant_pending_relays",
|
|
@@ -1840,7 +1854,9 @@ var ASSISTANT_TOOL_VERBS = {
|
|
|
1840
1854
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
1841
1855
|
project_note: ASSISTANT_VERB.projectNote,
|
|
1842
1856
|
launch_defaults: ASSISTANT_VERB.launchDefaults,
|
|
1843
|
-
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet
|
|
1857
|
+
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet,
|
|
1858
|
+
artifact_list: ASSISTANT_VERB.artifactList,
|
|
1859
|
+
artifact_read: ASSISTANT_VERB.artifactRead
|
|
1844
1860
|
};
|
|
1845
1861
|
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add", "project_attach_remote", "launch_defaults_set"];
|
|
1846
1862
|
var ASSISTANT_OWNER_VERBS = [
|
|
@@ -1863,7 +1879,7 @@ var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
|
|
|
1863
1879
|
var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
|
|
1864
1880
|
var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
|
|
1865
1881
|
var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
|
|
1866
|
-
var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send"];
|
|
1882
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send", "artifact_list", "artifact_read"];
|
|
1867
1883
|
var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
|
|
1868
1884
|
function isAssistantFollowerAllowedOp(value) {
|
|
1869
1885
|
return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
|
|
@@ -3755,6 +3771,86 @@ function isProviderQuestionBinding(value) {
|
|
|
3755
3771
|
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3756
3772
|
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
3757
3773
|
}
|
|
3774
|
+
|
|
3775
|
+
// src/relay-reprobe.ts
|
|
3776
|
+
var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
|
|
3777
|
+
var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
|
|
3778
|
+
var RELAY_REPROBE_JITTER_RATIO = 0.2;
|
|
3779
|
+
function computeRelayReprobeDelay(failures, random, timing = {}) {
|
|
3780
|
+
const base = timing.baseDelayMs ?? RELAY_REPROBE_BASE_DELAY_MS;
|
|
3781
|
+
const max = timing.maxDelayMs ?? RELAY_REPROBE_MAX_DELAY_MS;
|
|
3782
|
+
const jitter = timing.jitterRatio ?? RELAY_REPROBE_JITTER_RATIO;
|
|
3783
|
+
const grown = Math.min(max, base * 2 ** Math.max(0, failures));
|
|
3784
|
+
const factor = 1 + jitter * (Math.min(1, Math.max(0, random())) * 2 - 1);
|
|
3785
|
+
return Math.round(grown * factor);
|
|
3786
|
+
}
|
|
3787
|
+
var RelayReprobeScheduler = class {
|
|
3788
|
+
constructor(options) {
|
|
3789
|
+
this.options = options;
|
|
3790
|
+
}
|
|
3791
|
+
handle = null;
|
|
3792
|
+
running = false;
|
|
3793
|
+
inFlight = false;
|
|
3794
|
+
failureCount = 0;
|
|
3795
|
+
generation = 0;
|
|
3796
|
+
get isRunning() {
|
|
3797
|
+
return this.running;
|
|
3798
|
+
}
|
|
3799
|
+
get failures() {
|
|
3800
|
+
return this.failureCount;
|
|
3801
|
+
}
|
|
3802
|
+
get probing() {
|
|
3803
|
+
return this.inFlight;
|
|
3804
|
+
}
|
|
3805
|
+
/** Begin probing (idempotent). Call when a connection is selected as relay. */
|
|
3806
|
+
start() {
|
|
3807
|
+
if (this.running) return;
|
|
3808
|
+
this.running = true;
|
|
3809
|
+
this.failureCount = 0;
|
|
3810
|
+
this.generation++;
|
|
3811
|
+
this.schedule();
|
|
3812
|
+
}
|
|
3813
|
+
/** Stop for good (direct path found, connection closed, auth epoch changed). */
|
|
3814
|
+
stop() {
|
|
3815
|
+
this.running = false;
|
|
3816
|
+
this.generation++;
|
|
3817
|
+
if (this.handle !== null) {
|
|
3818
|
+
this.options.clearTimer(this.handle);
|
|
3819
|
+
this.handle = null;
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
schedule() {
|
|
3823
|
+
if (!this.running) return;
|
|
3824
|
+
const generation = this.generation;
|
|
3825
|
+
const delay = computeRelayReprobeDelay(this.failureCount, this.options.random, this.options);
|
|
3826
|
+
this.handle = this.options.setTimer(() => {
|
|
3827
|
+
this.handle = null;
|
|
3828
|
+
void this.tick(generation);
|
|
3829
|
+
}, delay);
|
|
3830
|
+
}
|
|
3831
|
+
async tick(generation) {
|
|
3832
|
+
if (!this.running || generation !== this.generation) return;
|
|
3833
|
+
if (this.inFlight || !this.options.shouldProbe()) {
|
|
3834
|
+
this.schedule();
|
|
3835
|
+
return;
|
|
3836
|
+
}
|
|
3837
|
+
this.inFlight = true;
|
|
3838
|
+
let outcome;
|
|
3839
|
+
try {
|
|
3840
|
+
outcome = await this.options.probe();
|
|
3841
|
+
} catch {
|
|
3842
|
+
outcome = "failed";
|
|
3843
|
+
}
|
|
3844
|
+
this.inFlight = false;
|
|
3845
|
+
if (!this.running || generation !== this.generation) return;
|
|
3846
|
+
if (outcome === "direct") {
|
|
3847
|
+
this.stop();
|
|
3848
|
+
return;
|
|
3849
|
+
}
|
|
3850
|
+
if (outcome !== "skipped") this.failureCount++;
|
|
3851
|
+
this.schedule();
|
|
3852
|
+
}
|
|
3853
|
+
};
|
|
3758
3854
|
export {
|
|
3759
3855
|
ASSISTANT_ACCOUNT_SLOT,
|
|
3760
3856
|
ASSISTANT_FOLLOWER_ALLOWED_OPS,
|
|
@@ -3848,9 +3944,13 @@ export {
|
|
|
3848
3944
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
3849
3945
|
RECENT_SESSION_BUCKETS,
|
|
3850
3946
|
RECLAIMING_SEND_REFUSALS,
|
|
3947
|
+
RELAY_REPROBE_BASE_DELAY_MS,
|
|
3948
|
+
RELAY_REPROBE_JITTER_RATIO,
|
|
3949
|
+
RELAY_REPROBE_MAX_DELAY_MS,
|
|
3851
3950
|
RELEASE_CHANNELS,
|
|
3852
3951
|
REMOVED_MESH_TOOLS,
|
|
3853
3952
|
RETIRED_MESH_TOOLS,
|
|
3953
|
+
RelayReprobeScheduler,
|
|
3854
3954
|
SEND_POLICY_MODES,
|
|
3855
3955
|
SEND_REFUSAL_REASONS,
|
|
3856
3956
|
SERVER_STATUS_EVENT_NAMES,
|
|
@@ -3900,6 +4000,7 @@ export {
|
|
|
3900
4000
|
classifySessionStatus,
|
|
3901
4001
|
compareDashboardWireVersion,
|
|
3902
4002
|
compareSemver,
|
|
4003
|
+
computeRelayReprobeDelay,
|
|
3903
4004
|
daemonIdsEquivalent,
|
|
3904
4005
|
decodeActiveWorkQueryRequest,
|
|
3905
4006
|
decodeActiveWorkQueryResponse,
|