@adhdev/mesh-shared 1.0.82-rc.33 → 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
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Assistant-specific tools remain separate from mesh tools. Driver discovery
|
|
15
15
|
* (list/describe) is shared across all three modes; invoke remains Worker-only.
|
|
16
16
|
*/
|
|
17
|
-
export declare const ASSISTANT_TOOLS: readonly ["projects", "environment", "assistant_action", "project_watch", "project_status", "project_send", "project_read", "project_add", "project_attach_remote", "discover_repos", "memory", "skill_view", "skill_manage", "project_note", "launch_defaults", "launch_defaults_set", "driver_list", "driver_describe"];
|
|
17
|
+
export declare const ASSISTANT_TOOLS: readonly ["projects", "environment", "assistant_action", "project_watch", "project_status", "project_send", "project_read", "project_add", "project_attach_remote", "discover_repos", "memory", "skill_view", "skill_manage", "project_note", "launch_defaults", "launch_defaults_set", "driver_list", "driver_describe", "artifact_list", "artifact_read"];
|
|
18
18
|
export type AssistantTool = typeof ASSISTANT_TOOLS[number];
|
|
19
19
|
export declare function isAssistantTool(value: unknown): value is AssistantTool;
|
|
20
20
|
/** Daemon verb names (§4.4 table + the five verbs below it). */
|
|
@@ -39,6 +39,8 @@ export declare const ASSISTANT_VERB: {
|
|
|
39
39
|
readonly projectNote: "assistant_project_note";
|
|
40
40
|
readonly launchDefaults: "assistant_launch_defaults";
|
|
41
41
|
readonly launchDefaultsSet: "assistant_launch_defaults_set";
|
|
42
|
+
readonly artifactList: "assistant_artifact_list";
|
|
43
|
+
readonly artifactRead: "assistant_artifact_read";
|
|
42
44
|
readonly launch: "launch_assistant";
|
|
43
45
|
readonly pendingRelays: "assistant_pending_relays";
|
|
44
46
|
readonly stagedResolve: "assistant_staged_resolve";
|
|
@@ -90,7 +92,7 @@ export declare const ASSISTANT_REMOTE_FOLLOW_COMMAND: "assistant_remote_follow";
|
|
|
90
92
|
* `assistant_remote_project` when the host's `assistantRemoteAccess` ACL is active.
|
|
91
93
|
* `note`, `terminal`, and `inventory` remain strictly roster-member-only.
|
|
92
94
|
*/
|
|
93
|
-
export declare const ASSISTANT_FOLLOWER_ALLOWED_OPS: readonly ["status", "read", "poll", "report", "send"];
|
|
95
|
+
export declare const ASSISTANT_FOLLOWER_ALLOWED_OPS: readonly ["status", "read", "poll", "report", "send", "artifact_list", "artifact_read"];
|
|
94
96
|
export type AssistantFollowerAllowedOp = typeof ASSISTANT_FOLLOWER_ALLOWED_OPS[number];
|
|
95
97
|
export declare function isAssistantFollowerAllowedOp(value: unknown): value is AssistantFollowerAllowedOp;
|
|
96
98
|
/**
|
|
@@ -108,6 +110,7 @@ export interface AssistantRemoteAccessBinding {
|
|
|
108
110
|
status: 'active' | 'revoked';
|
|
109
111
|
allowedOps: readonly AssistantFollowerAllowedOp[];
|
|
110
112
|
allowCoordinatorLaunch?: boolean;
|
|
113
|
+
allowArtifactRead?: boolean;
|
|
111
114
|
grantedAt: number;
|
|
112
115
|
revokedAt?: number;
|
|
113
116
|
}
|
|
@@ -144,6 +147,7 @@ export interface FollowedRemoteProjectEntry {
|
|
|
144
147
|
bindingRevision: number;
|
|
145
148
|
grantRevision: number;
|
|
146
149
|
allowCoordinatorLaunch?: boolean;
|
|
150
|
+
allowArtifactRead?: boolean;
|
|
147
151
|
state: FollowedRemoteProjectState;
|
|
148
152
|
followedAt: number | string;
|
|
149
153
|
updatedAt: number | string;
|
|
@@ -173,6 +177,7 @@ export interface RemoteProjectCatalogItem {
|
|
|
173
177
|
sanitizedRepoIdentity: string | null;
|
|
174
178
|
coordinatorState?: 'none' | 'idle' | 'working' | 'waiting' | string;
|
|
175
179
|
allowCoordinatorLaunch?: boolean;
|
|
180
|
+
allowArtifactRead?: boolean;
|
|
176
181
|
capabilities: {
|
|
177
182
|
status: true;
|
|
178
183
|
read: true;
|
|
@@ -181,6 +186,7 @@ export interface RemoteProjectCatalogItem {
|
|
|
181
186
|
send: true;
|
|
182
187
|
coordinatorPresent?: boolean;
|
|
183
188
|
allowCoordinatorLaunch?: boolean;
|
|
189
|
+
allowArtifactRead?: boolean;
|
|
184
190
|
};
|
|
185
191
|
observedAt: number | string;
|
|
186
192
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -112,9 +112,13 @@ __export(index_exports, {
|
|
|
112
112
|
QUOTA_SUPPORTED_PROVIDERS: () => QUOTA_SUPPORTED_PROVIDERS,
|
|
113
113
|
RECENT_SESSION_BUCKETS: () => RECENT_SESSION_BUCKETS,
|
|
114
114
|
RECLAIMING_SEND_REFUSALS: () => RECLAIMING_SEND_REFUSALS,
|
|
115
|
+
RELAY_REPROBE_BASE_DELAY_MS: () => RELAY_REPROBE_BASE_DELAY_MS,
|
|
116
|
+
RELAY_REPROBE_JITTER_RATIO: () => RELAY_REPROBE_JITTER_RATIO,
|
|
117
|
+
RELAY_REPROBE_MAX_DELAY_MS: () => RELAY_REPROBE_MAX_DELAY_MS,
|
|
115
118
|
RELEASE_CHANNELS: () => RELEASE_CHANNELS,
|
|
116
119
|
REMOVED_MESH_TOOLS: () => REMOVED_MESH_TOOLS,
|
|
117
120
|
RETIRED_MESH_TOOLS: () => RETIRED_MESH_TOOLS,
|
|
121
|
+
RelayReprobeScheduler: () => RelayReprobeScheduler,
|
|
118
122
|
SEND_POLICY_MODES: () => SEND_POLICY_MODES,
|
|
119
123
|
SEND_REFUSAL_REASONS: () => SEND_REFUSAL_REASONS,
|
|
120
124
|
SERVER_STATUS_EVENT_NAMES: () => SERVER_STATUS_EVENT_NAMES,
|
|
@@ -164,6 +168,7 @@ __export(index_exports, {
|
|
|
164
168
|
classifySessionStatus: () => classifySessionStatus,
|
|
165
169
|
compareDashboardWireVersion: () => compareDashboardWireVersion,
|
|
166
170
|
compareSemver: () => compareSemver,
|
|
171
|
+
computeRelayReprobeDelay: () => computeRelayReprobeDelay,
|
|
167
172
|
daemonIdsEquivalent: () => daemonIdsEquivalent,
|
|
168
173
|
decodeActiveWorkQueryRequest: () => decodeActiveWorkQueryRequest,
|
|
169
174
|
decodeActiveWorkQueryResponse: () => decodeActiveWorkQueryResponse,
|
|
@@ -1158,6 +1163,7 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
1158
1163
|
"mesh_list_pending_approvals",
|
|
1159
1164
|
"mesh_create",
|
|
1160
1165
|
"mesh_add_node",
|
|
1166
|
+
"mesh_reattach_source_parent",
|
|
1161
1167
|
"mesh_attach_remote",
|
|
1162
1168
|
"mesh_clone_node",
|
|
1163
1169
|
"mesh_remove_node",
|
|
@@ -1181,7 +1187,9 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
1181
1187
|
"mesh_node_slots",
|
|
1182
1188
|
"driver_list",
|
|
1183
1189
|
"driver_describe",
|
|
1184
|
-
"artifact_list"
|
|
1190
|
+
"artifact_list",
|
|
1191
|
+
"artifact_read",
|
|
1192
|
+
"artifact_register"
|
|
1185
1193
|
];
|
|
1186
1194
|
var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
|
|
1187
1195
|
var RETIRED_MESH_TOOLS = {
|
|
@@ -2067,7 +2075,14 @@ var WORKER_TOOLS = [
|
|
|
2067
2075
|
"driver_list",
|
|
2068
2076
|
"driver_describe",
|
|
2069
2077
|
"driver_invoke",
|
|
2070
|
-
"artifact_register"
|
|
2078
|
+
"artifact_register",
|
|
2079
|
+
"artifact_list",
|
|
2080
|
+
"artifact_read",
|
|
2081
|
+
// Contract versioning (Cut A): exact pinned-unit reads (E2), the explicit
|
|
2082
|
+
// read claim (C1) and the authoritative head/notice pull.
|
|
2083
|
+
"contract_read",
|
|
2084
|
+
"contract_observe",
|
|
2085
|
+
"contract_current"
|
|
2071
2086
|
];
|
|
2072
2087
|
var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
|
|
2073
2088
|
function isWorkerTool(value) {
|
|
@@ -2168,7 +2183,9 @@ var ASSISTANT_TOOLS = [
|
|
|
2168
2183
|
"launch_defaults",
|
|
2169
2184
|
"launch_defaults_set",
|
|
2170
2185
|
"driver_list",
|
|
2171
|
-
"driver_describe"
|
|
2186
|
+
"driver_describe",
|
|
2187
|
+
"artifact_list",
|
|
2188
|
+
"artifact_read"
|
|
2172
2189
|
];
|
|
2173
2190
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
2174
2191
|
function isAssistantTool(value) {
|
|
@@ -2196,6 +2213,8 @@ var ASSISTANT_VERB = {
|
|
|
2196
2213
|
projectNote: "assistant_project_note",
|
|
2197
2214
|
launchDefaults: "assistant_launch_defaults",
|
|
2198
2215
|
launchDefaultsSet: "assistant_launch_defaults_set",
|
|
2216
|
+
artifactList: "assistant_artifact_list",
|
|
2217
|
+
artifactRead: "assistant_artifact_read",
|
|
2199
2218
|
// assistant-side daemon verbs without a tool of the same name
|
|
2200
2219
|
launch: "launch_assistant",
|
|
2201
2220
|
pendingRelays: "assistant_pending_relays",
|
|
@@ -2225,7 +2244,9 @@ var ASSISTANT_TOOL_VERBS = {
|
|
|
2225
2244
|
skill_manage: ASSISTANT_VERB.skillManage,
|
|
2226
2245
|
project_note: ASSISTANT_VERB.projectNote,
|
|
2227
2246
|
launch_defaults: ASSISTANT_VERB.launchDefaults,
|
|
2228
|
-
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet
|
|
2247
|
+
launch_defaults_set: ASSISTANT_VERB.launchDefaultsSet,
|
|
2248
|
+
artifact_list: ASSISTANT_VERB.artifactList,
|
|
2249
|
+
artifact_read: ASSISTANT_VERB.artifactRead
|
|
2229
2250
|
};
|
|
2230
2251
|
var ASSISTANT_WRITE_TOOLS = ["project_watch", "assistant_action", "memory", "skill_manage", "project_note", "project_send", "project_add", "project_attach_remote", "launch_defaults_set"];
|
|
2231
2252
|
var ASSISTANT_OWNER_VERBS = [
|
|
@@ -2248,7 +2269,7 @@ var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
|
|
|
2248
2269
|
var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
|
|
2249
2270
|
var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
|
|
2250
2271
|
var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
|
|
2251
|
-
var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send"];
|
|
2272
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send", "artifact_list", "artifact_read"];
|
|
2252
2273
|
var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
|
|
2253
2274
|
function isAssistantFollowerAllowedOp(value) {
|
|
2254
2275
|
return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
|
|
@@ -4140,6 +4161,86 @@ function isProviderQuestionBinding(value) {
|
|
|
4140
4161
|
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
4141
4162
|
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
4142
4163
|
}
|
|
4164
|
+
|
|
4165
|
+
// src/relay-reprobe.ts
|
|
4166
|
+
var RELAY_REPROBE_BASE_DELAY_MS = 6e4;
|
|
4167
|
+
var RELAY_REPROBE_MAX_DELAY_MS = 5 * 6e4;
|
|
4168
|
+
var RELAY_REPROBE_JITTER_RATIO = 0.2;
|
|
4169
|
+
function computeRelayReprobeDelay(failures, random, timing = {}) {
|
|
4170
|
+
const base = timing.baseDelayMs ?? RELAY_REPROBE_BASE_DELAY_MS;
|
|
4171
|
+
const max = timing.maxDelayMs ?? RELAY_REPROBE_MAX_DELAY_MS;
|
|
4172
|
+
const jitter = timing.jitterRatio ?? RELAY_REPROBE_JITTER_RATIO;
|
|
4173
|
+
const grown = Math.min(max, base * 2 ** Math.max(0, failures));
|
|
4174
|
+
const factor = 1 + jitter * (Math.min(1, Math.max(0, random())) * 2 - 1);
|
|
4175
|
+
return Math.round(grown * factor);
|
|
4176
|
+
}
|
|
4177
|
+
var RelayReprobeScheduler = class {
|
|
4178
|
+
constructor(options) {
|
|
4179
|
+
this.options = options;
|
|
4180
|
+
}
|
|
4181
|
+
handle = null;
|
|
4182
|
+
running = false;
|
|
4183
|
+
inFlight = false;
|
|
4184
|
+
failureCount = 0;
|
|
4185
|
+
generation = 0;
|
|
4186
|
+
get isRunning() {
|
|
4187
|
+
return this.running;
|
|
4188
|
+
}
|
|
4189
|
+
get failures() {
|
|
4190
|
+
return this.failureCount;
|
|
4191
|
+
}
|
|
4192
|
+
get probing() {
|
|
4193
|
+
return this.inFlight;
|
|
4194
|
+
}
|
|
4195
|
+
/** Begin probing (idempotent). Call when a connection is selected as relay. */
|
|
4196
|
+
start() {
|
|
4197
|
+
if (this.running) return;
|
|
4198
|
+
this.running = true;
|
|
4199
|
+
this.failureCount = 0;
|
|
4200
|
+
this.generation++;
|
|
4201
|
+
this.schedule();
|
|
4202
|
+
}
|
|
4203
|
+
/** Stop for good (direct path found, connection closed, auth epoch changed). */
|
|
4204
|
+
stop() {
|
|
4205
|
+
this.running = false;
|
|
4206
|
+
this.generation++;
|
|
4207
|
+
if (this.handle !== null) {
|
|
4208
|
+
this.options.clearTimer(this.handle);
|
|
4209
|
+
this.handle = null;
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4212
|
+
schedule() {
|
|
4213
|
+
if (!this.running) return;
|
|
4214
|
+
const generation = this.generation;
|
|
4215
|
+
const delay = computeRelayReprobeDelay(this.failureCount, this.options.random, this.options);
|
|
4216
|
+
this.handle = this.options.setTimer(() => {
|
|
4217
|
+
this.handle = null;
|
|
4218
|
+
void this.tick(generation);
|
|
4219
|
+
}, delay);
|
|
4220
|
+
}
|
|
4221
|
+
async tick(generation) {
|
|
4222
|
+
if (!this.running || generation !== this.generation) return;
|
|
4223
|
+
if (this.inFlight || !this.options.shouldProbe()) {
|
|
4224
|
+
this.schedule();
|
|
4225
|
+
return;
|
|
4226
|
+
}
|
|
4227
|
+
this.inFlight = true;
|
|
4228
|
+
let outcome;
|
|
4229
|
+
try {
|
|
4230
|
+
outcome = await this.options.probe();
|
|
4231
|
+
} catch {
|
|
4232
|
+
outcome = "failed";
|
|
4233
|
+
}
|
|
4234
|
+
this.inFlight = false;
|
|
4235
|
+
if (!this.running || generation !== this.generation) return;
|
|
4236
|
+
if (outcome === "direct") {
|
|
4237
|
+
this.stop();
|
|
4238
|
+
return;
|
|
4239
|
+
}
|
|
4240
|
+
if (outcome !== "skipped") this.failureCount++;
|
|
4241
|
+
this.schedule();
|
|
4242
|
+
}
|
|
4243
|
+
};
|
|
4143
4244
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4144
4245
|
0 && (module.exports = {
|
|
4145
4246
|
ASSISTANT_ACCOUNT_SLOT,
|
|
@@ -4234,9 +4335,13 @@ function isProviderQuestionBinding(value) {
|
|
|
4234
4335
|
QUOTA_SUPPORTED_PROVIDERS,
|
|
4235
4336
|
RECENT_SESSION_BUCKETS,
|
|
4236
4337
|
RECLAIMING_SEND_REFUSALS,
|
|
4338
|
+
RELAY_REPROBE_BASE_DELAY_MS,
|
|
4339
|
+
RELAY_REPROBE_JITTER_RATIO,
|
|
4340
|
+
RELAY_REPROBE_MAX_DELAY_MS,
|
|
4237
4341
|
RELEASE_CHANNELS,
|
|
4238
4342
|
REMOVED_MESH_TOOLS,
|
|
4239
4343
|
RETIRED_MESH_TOOLS,
|
|
4344
|
+
RelayReprobeScheduler,
|
|
4240
4345
|
SEND_POLICY_MODES,
|
|
4241
4346
|
SEND_REFUSAL_REASONS,
|
|
4242
4347
|
SERVER_STATUS_EVENT_NAMES,
|
|
@@ -4286,6 +4391,7 @@ function isProviderQuestionBinding(value) {
|
|
|
4286
4391
|
classifySessionStatus,
|
|
4287
4392
|
compareDashboardWireVersion,
|
|
4288
4393
|
compareSemver,
|
|
4394
|
+
computeRelayReprobeDelay,
|
|
4289
4395
|
daemonIdsEquivalent,
|
|
4290
4396
|
decodeActiveWorkQueryRequest,
|
|
4291
4397
|
decodeActiveWorkQueryResponse,
|