@adhdev/mesh-shared 1.0.82-rc.22 → 1.0.82-rc.24
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 +124 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +286 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +275 -108
- package/dist/index.mjs.map +1 -1
- package/dist/launch-defaults.d.ts +1 -1
- package/dist/mesh-tool-names.d.ts +2 -2
- package/dist/outbound-message.d.ts +7 -0
- package/dist/protocol/daemon-server.d.ts +6 -0
- package/dist/protocol/dashboard-daemon-p2p.d.ts +1 -1
- package/dist/protocol/dashboard-server.d.ts +10 -0
- package/dist/role-launch.d.ts +11 -0
- package/dist/session-launch.d.ts +3 -22
- package/dist/slot-proposal.d.ts +14 -0
- package/dist/worker-protocol.d.ts +1 -1
- package/package.json +1 -1
- package/src/assistant-protocol.ts +216 -5
- package/src/index.ts +2 -0
- package/src/launch-defaults.ts +1 -1
- package/src/mesh-tool-names.ts +3 -0
- package/src/outbound-message.ts +17 -0
- package/src/protocol/daemon-server.ts +4 -2
- package/src/protocol/dashboard-server.ts +8 -2
- package/src/role-launch.ts +51 -0
- package/src/session-launch.ts +8 -1
- package/src/slot-proposal.ts +61 -2
- package/src/worker-protocol.ts +4 -0
package/dist/index.mjs
CHANGED
|
@@ -194,15 +194,15 @@ function pickBestTransitGitStatus(node, options) {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
// src/session-normalize.ts
|
|
197
|
-
function deriveSyntheticSessionId(
|
|
197
|
+
function deriveSyntheticSessionId(record2) {
|
|
198
198
|
const parts = [
|
|
199
|
-
readString(
|
|
200
|
-
readString(
|
|
201
|
-
readString(
|
|
202
|
-
readString(
|
|
203
|
-
readString(
|
|
204
|
-
readString(
|
|
205
|
-
readString(
|
|
199
|
+
readString(record2.workspace),
|
|
200
|
+
readString(record2.providerType, record2.provider),
|
|
201
|
+
readString(record2.role),
|
|
202
|
+
readString(record2.state, record2.status),
|
|
203
|
+
readString(record2.title),
|
|
204
|
+
readString(record2.createdAt, record2.created_at),
|
|
205
|
+
readString(record2.startedAt, record2.started_at)
|
|
206
206
|
].filter((part) => Boolean(part));
|
|
207
207
|
if (parts.length === 0) return void 0;
|
|
208
208
|
return `synthetic:${parts.join("|")}`;
|
|
@@ -214,33 +214,33 @@ function sessionIdsEquivalent(a, b) {
|
|
|
214
214
|
return idA === idB;
|
|
215
215
|
}
|
|
216
216
|
function normalizeMeshSessionRecord(entry) {
|
|
217
|
-
const
|
|
218
|
-
const sessionId = readString(
|
|
217
|
+
const record2 = readRecord(entry);
|
|
218
|
+
const sessionId = readString(record2.sessionId, record2.session_id, record2.id) ?? deriveSyntheticSessionId(record2);
|
|
219
219
|
if (!sessionId) return null;
|
|
220
220
|
return {
|
|
221
221
|
sessionId,
|
|
222
|
-
...readString(
|
|
223
|
-
...readString(
|
|
224
|
-
...readString(
|
|
225
|
-
...readString(
|
|
226
|
-
...readString(
|
|
227
|
-
...readString(
|
|
228
|
-
...readString(
|
|
229
|
-
...readString(
|
|
230
|
-
...readString(
|
|
231
|
-
...readBoolean(
|
|
232
|
-
...readString(
|
|
233
|
-
...readString(
|
|
234
|
-
...readString(
|
|
235
|
-
...readString(
|
|
236
|
-
...readBoolean(
|
|
222
|
+
...readString(record2.providerType, record2.provider) ? { providerType: readString(record2.providerType, record2.provider) } : {},
|
|
223
|
+
...readString(record2.state, record2.status) ? { state: readString(record2.state, record2.status) } : {},
|
|
224
|
+
...readString(record2.chatStatus, record2.chat_status) ? { chatStatus: readString(record2.chatStatus, record2.chat_status) } : {},
|
|
225
|
+
...readString(record2.lifecycle) ? { lifecycle: readString(record2.lifecycle) } : {},
|
|
226
|
+
...readString(record2.surfaceKind, record2.surface_kind) ? { surfaceKind: readString(record2.surfaceKind, record2.surface_kind) } : {},
|
|
227
|
+
...readString(record2.recoveryState, record2.recovery_state) ? { recoveryState: readString(record2.recoveryState, record2.recovery_state) } : {},
|
|
228
|
+
...readString(record2.workspace) ? { workspace: readString(record2.workspace) } : {},
|
|
229
|
+
...readString(record2.title) ? { title: readString(record2.title) } : {},
|
|
230
|
+
...readString(record2.role) ? { role: readString(record2.role) } : {},
|
|
231
|
+
...readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) } : {},
|
|
232
|
+
...readString(record2.statusNote, record2.status_note) ? { statusNote: readString(record2.statusNote, record2.status_note) } : {},
|
|
233
|
+
...readString(record2.createdAt, record2.created_at) ? { createdAt: readString(record2.createdAt, record2.created_at) } : {},
|
|
234
|
+
...readString(record2.startedAt, record2.started_at) ? { startedAt: readString(record2.startedAt, record2.started_at) } : {},
|
|
235
|
+
...readString(record2.lastActivityAt, record2.last_activity_at) ? { lastActivityAt: readString(record2.lastActivityAt, record2.last_activity_at) } : {},
|
|
236
|
+
...readBoolean(record2.isCached, record2.is_cached) !== void 0 ? { isCached: readBoolean(record2.isCached, record2.is_cached) } : {}
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
// src/node-normalize.ts
|
|
241
241
|
function normalizeMeshNodeId(node) {
|
|
242
|
-
const
|
|
243
|
-
return readString(
|
|
242
|
+
const record2 = node && typeof node === "object" ? node : {};
|
|
243
|
+
return readString(record2.id, record2.nodeId, record2.node_id);
|
|
244
244
|
}
|
|
245
245
|
function meshNodeIdMatches(node, candidateId) {
|
|
246
246
|
if (!candidateId) return false;
|
|
@@ -252,12 +252,12 @@ function meshNodeIdMatches(node, candidateId) {
|
|
|
252
252
|
// src/node-facts.ts
|
|
253
253
|
function normalizeMeshNodeFacts(raw) {
|
|
254
254
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
255
|
-
const
|
|
256
|
-
const schemaVersion = Number(
|
|
257
|
-
const reportedAt = Number(
|
|
255
|
+
const record2 = raw;
|
|
256
|
+
const schemaVersion = Number(record2.schemaVersion);
|
|
257
|
+
const reportedAt = Number(record2.reportedAt);
|
|
258
258
|
if (!Number.isFinite(schemaVersion) || schemaVersion < 1) return void 0;
|
|
259
259
|
if (!Number.isFinite(reportedAt) || reportedAt <= 0) return void 0;
|
|
260
|
-
return { ...
|
|
260
|
+
return { ...record2, schemaVersion, reportedAt };
|
|
261
261
|
}
|
|
262
262
|
var QUOTA_SUPPORTED_PROVIDERS = [
|
|
263
263
|
"antigravity-cli",
|
|
@@ -414,9 +414,9 @@ function expandDaemonIdForms(ids) {
|
|
|
414
414
|
|
|
415
415
|
// src/git-summarize.ts
|
|
416
416
|
function summarizeGitShape(status) {
|
|
417
|
-
const
|
|
418
|
-
if (!Object.keys(
|
|
419
|
-
const submodules = Array.isArray(
|
|
417
|
+
const record2 = readRecord(status);
|
|
418
|
+
if (!Object.keys(record2).length) return null;
|
|
419
|
+
const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
|
|
420
420
|
const sub = readRecord(entry);
|
|
421
421
|
return {
|
|
422
422
|
path: readString(sub.path) ?? null,
|
|
@@ -426,23 +426,23 @@ function summarizeGitShape(status) {
|
|
|
426
426
|
};
|
|
427
427
|
}) : [];
|
|
428
428
|
return {
|
|
429
|
-
isGitRepo: readBoolean(
|
|
430
|
-
workspace: readString(
|
|
431
|
-
repoRoot: readString(
|
|
432
|
-
branch: readString(
|
|
433
|
-
upstream: readString(
|
|
434
|
-
upstreamStatus: readString(
|
|
435
|
-
headCommit: readString(
|
|
436
|
-
ahead: readNumber(
|
|
437
|
-
behind: readNumber(
|
|
429
|
+
isGitRepo: readBoolean(record2.isGitRepo),
|
|
430
|
+
workspace: readString(record2.workspace) ?? null,
|
|
431
|
+
repoRoot: readString(record2.repoRoot, record2.repo_root) ?? null,
|
|
432
|
+
branch: readString(record2.branch) ?? null,
|
|
433
|
+
upstream: readString(record2.upstream) ?? null,
|
|
434
|
+
upstreamStatus: readString(record2.upstreamStatus, record2.upstream_status) ?? null,
|
|
435
|
+
headCommit: readString(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
|
|
436
|
+
ahead: readNumber(record2.ahead) ?? null,
|
|
437
|
+
behind: readNumber(record2.behind) ?? null,
|
|
438
438
|
dirtyCounts: {
|
|
439
|
-
staged: readNumber(
|
|
440
|
-
modified: readNumber(
|
|
441
|
-
untracked: readNumber(
|
|
442
|
-
deleted: readNumber(
|
|
443
|
-
renamed: readNumber(
|
|
439
|
+
staged: readNumber(record2.staged) ?? 0,
|
|
440
|
+
modified: readNumber(record2.modified) ?? 0,
|
|
441
|
+
untracked: readNumber(record2.untracked) ?? 0,
|
|
442
|
+
deleted: readNumber(record2.deleted) ?? 0,
|
|
443
|
+
renamed: readNumber(record2.renamed) ?? 0
|
|
444
444
|
},
|
|
445
|
-
lastCheckedAt: readNumber(
|
|
445
|
+
lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
|
|
446
446
|
submoduleCount: submodules.length,
|
|
447
447
|
submodules
|
|
448
448
|
};
|
|
@@ -608,10 +608,25 @@ var CLI_SLOT_RECIPES = Object.freeze({
|
|
|
608
608
|
],
|
|
609
609
|
"antigravity-cli": [
|
|
610
610
|
{
|
|
611
|
-
model: "Gemini 3.
|
|
611
|
+
model: "Gemini 3.8 Flash (High)",
|
|
612
|
+
modelCandidates: ["Gemini 3.8 Flash (High)", "Gemini 4 Argon (Low)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
612
613
|
difficulty: ["easy"],
|
|
613
614
|
maxParallel: 2,
|
|
614
615
|
rationale: "Cheap capacity for easy tasks."
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
model: "Gemini 4 Argon (Medium)",
|
|
619
|
+
modelCandidates: ["Gemini 4 Argon (Medium)", "Gemini 3.8 Flash (High)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
620
|
+
difficulty: ["medium"],
|
|
621
|
+
maxParallel: 2,
|
|
622
|
+
rationale: "Balanced Argon tier for medium tasks."
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
model: "Gemini 4 Argon (High)",
|
|
626
|
+
modelCandidates: ["Gemini 4 Argon (High)", "Gemini 3.8 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
627
|
+
difficulty: ["difficult"],
|
|
628
|
+
maxParallel: 1,
|
|
629
|
+
rationale: "Reserved for hard tasks; capped at 1 to bound cost."
|
|
615
630
|
}
|
|
616
631
|
],
|
|
617
632
|
"cursor-cli": [
|
|
@@ -650,6 +665,24 @@ function dedupeDetected(detected) {
|
|
|
650
665
|
}
|
|
651
666
|
return out;
|
|
652
667
|
}
|
|
668
|
+
function resolveRecipeModel(recipe, modelOptions) {
|
|
669
|
+
if (!Array.isArray(modelOptions) || modelOptions.length === 0) {
|
|
670
|
+
return recipe.model;
|
|
671
|
+
}
|
|
672
|
+
const available = new Set(
|
|
673
|
+
modelOptions.filter((m) => typeof m === "string" && m.trim().length > 0).map((m) => m.trim())
|
|
674
|
+
);
|
|
675
|
+
if (available.size === 0) return recipe.model;
|
|
676
|
+
const candidates = [
|
|
677
|
+
...recipe.model ? [recipe.model] : [],
|
|
678
|
+
...recipe.modelCandidates ?? []
|
|
679
|
+
];
|
|
680
|
+
for (const candidate of candidates) {
|
|
681
|
+
const trimmed = typeof candidate === "string" ? candidate.trim() : "";
|
|
682
|
+
if (trimmed && available.has(trimmed)) return trimmed;
|
|
683
|
+
}
|
|
684
|
+
return recipe.model;
|
|
685
|
+
}
|
|
653
686
|
function buildSlotProposal(detected, currentSlots = []) {
|
|
654
687
|
const providers = dedupeDetected(detected ?? []);
|
|
655
688
|
const proposedSlots = [];
|
|
@@ -665,7 +698,7 @@ function buildSlotProposal(detected, currentSlots = []) {
|
|
|
665
698
|
for (const recipe of recipes) {
|
|
666
699
|
const slot = normalizeNodeCapabilitySlot({
|
|
667
700
|
provider: provider.type,
|
|
668
|
-
model: recipe.
|
|
701
|
+
model: resolveRecipeModel(recipe, provider.modelOptions),
|
|
669
702
|
thinkingLevel: recipe.thinkingLevel,
|
|
670
703
|
difficulty: recipe.difficulty,
|
|
671
704
|
maxParallel: recipe.maxParallel
|
|
@@ -755,7 +788,10 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
755
788
|
"mesh_mission_upsert",
|
|
756
789
|
"mesh_mission_list",
|
|
757
790
|
"mesh_review_inbox",
|
|
758
|
-
"mesh_node_slots"
|
|
791
|
+
"mesh_node_slots",
|
|
792
|
+
"driver_list",
|
|
793
|
+
"driver_describe",
|
|
794
|
+
"artifact_list"
|
|
759
795
|
];
|
|
760
796
|
var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
|
|
761
797
|
var RETIRED_MESH_TOOLS = {
|
|
@@ -1430,10 +1466,10 @@ function isTerminalSessionRecordStatus(raw) {
|
|
|
1430
1466
|
return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
|
|
1431
1467
|
}
|
|
1432
1468
|
function isIdleSessionState(state) {
|
|
1433
|
-
const
|
|
1434
|
-
const status = typeof
|
|
1469
|
+
const record2 = state && typeof state === "object" ? state : {};
|
|
1470
|
+
const status = typeof record2.status === "string" ? record2.status.trim().toLowerCase() : "";
|
|
1435
1471
|
if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
|
|
1436
|
-
return isReadyStatus(status) ||
|
|
1472
|
+
return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
|
|
1437
1473
|
}
|
|
1438
1474
|
|
|
1439
1475
|
// src/mesh-vocabulary.ts
|
|
@@ -1543,6 +1579,14 @@ function isOutboundMessage(value) {
|
|
|
1543
1579
|
const candidate = value;
|
|
1544
1580
|
return isMessageId(candidate.messageId) && typeof candidate.sessionId === "string" && candidate.sessionId.length > 0 && isInputEnvelopeWire(candidate.input) && isOutboundMessageOrigin(candidate.origin) && isSendPolicy(candidate.policy) && typeof candidate.createdAt === "number";
|
|
1545
1581
|
}
|
|
1582
|
+
var PASTED_OPEN_RE = /^\s*<pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
|
|
1583
|
+
var PASTED_CLOSE_RE = /^\s*<\/pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
|
|
1584
|
+
function unwrapPastedContent(text) {
|
|
1585
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n");
|
|
1586
|
+
const first = lines.findIndex((line) => line.trim());
|
|
1587
|
+
if (first < 0 || !PASTED_OPEN_RE.test(lines[first])) return text;
|
|
1588
|
+
return lines.filter((line) => !PASTED_OPEN_RE.test(line) && !PASTED_CLOSE_RE.test(line)).join("\n");
|
|
1589
|
+
}
|
|
1546
1590
|
|
|
1547
1591
|
// src/mission-brief.ts
|
|
1548
1592
|
var GOAL_MAX = 500;
|
|
@@ -1628,7 +1672,11 @@ var WORKER_TOOLS = [
|
|
|
1628
1672
|
"peer_context_pull",
|
|
1629
1673
|
"git_status",
|
|
1630
1674
|
"git_log",
|
|
1631
|
-
"git_diff"
|
|
1675
|
+
"git_diff",
|
|
1676
|
+
"driver_list",
|
|
1677
|
+
"driver_describe",
|
|
1678
|
+
"driver_invoke",
|
|
1679
|
+
"artifact_register"
|
|
1632
1680
|
];
|
|
1633
1681
|
var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
|
|
1634
1682
|
function isWorkerTool(value) {
|
|
@@ -1727,7 +1775,9 @@ var ASSISTANT_TOOLS = [
|
|
|
1727
1775
|
"skill_manage",
|
|
1728
1776
|
"project_note",
|
|
1729
1777
|
"launch_defaults",
|
|
1730
|
-
"launch_defaults_set"
|
|
1778
|
+
"launch_defaults_set",
|
|
1779
|
+
"driver_list",
|
|
1780
|
+
"driver_describe"
|
|
1731
1781
|
];
|
|
1732
1782
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
1733
1783
|
function isAssistantTool(value) {
|
|
@@ -1735,6 +1785,8 @@ function isAssistantTool(value) {
|
|
|
1735
1785
|
}
|
|
1736
1786
|
var ASSISTANT_VERB = {
|
|
1737
1787
|
// tool verbs
|
|
1788
|
+
driverList: "driver_list",
|
|
1789
|
+
driverDescribe: "driver_describe",
|
|
1738
1790
|
projects: "assistant_projects",
|
|
1739
1791
|
environment: "assistant_environment",
|
|
1740
1792
|
action: "assistant_action",
|
|
@@ -1765,6 +1817,8 @@ var ASSISTANT_VERB = {
|
|
|
1765
1817
|
threadClose: "assistant_thread_close"
|
|
1766
1818
|
};
|
|
1767
1819
|
var ASSISTANT_TOOL_VERBS = {
|
|
1820
|
+
driver_list: ASSISTANT_VERB.driverList,
|
|
1821
|
+
driver_describe: ASSISTANT_VERB.driverDescribe,
|
|
1768
1822
|
projects: ASSISTANT_VERB.projects,
|
|
1769
1823
|
environment: ASSISTANT_VERB.environment,
|
|
1770
1824
|
assistant_action: ASSISTANT_VERB.action,
|
|
@@ -1798,6 +1852,63 @@ var ASSISTANT_REVIEW_TURN_VERBS = [
|
|
|
1798
1852
|
];
|
|
1799
1853
|
var ASSISTANT_SESSION_ID_ENV = "ADHDEV_ASSISTANT_SESSION_ID";
|
|
1800
1854
|
var ASSISTANT_SESSION_ID_ARG = "assistantSessionId";
|
|
1855
|
+
var ASSISTANT_ACCOUNT_SLOT = "personal";
|
|
1856
|
+
var ASSISTANT_REMOTE_PROJECT_COMMAND = "assistant_remote_project";
|
|
1857
|
+
var ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND = "assistant_remote_project_catalog";
|
|
1858
|
+
var ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND = "assistant_remote_project_access";
|
|
1859
|
+
var ASSISTANT_REMOTE_FOLLOW_COMMAND = "assistant_remote_follow";
|
|
1860
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OPS = ["status", "read", "poll", "report", "send"];
|
|
1861
|
+
var ASSISTANT_FOLLOWER_ALLOWED_OP_SET = new Set(ASSISTANT_FOLLOWER_ALLOWED_OPS);
|
|
1862
|
+
function isAssistantFollowerAllowedOp(value) {
|
|
1863
|
+
return typeof value === "string" && ASSISTANT_FOLLOWER_ALLOWED_OP_SET.has(value);
|
|
1864
|
+
}
|
|
1865
|
+
function followedRemoteProjectKey(hostDaemonId, meshId) {
|
|
1866
|
+
const canonHost = canonicalDaemonId(hostDaemonId) ?? hostDaemonId.trim();
|
|
1867
|
+
return `${canonHost}::${meshId.trim()}`;
|
|
1868
|
+
}
|
|
1869
|
+
function sanitizeRemoteRepoIdentity(raw) {
|
|
1870
|
+
if (typeof raw !== "string") return null;
|
|
1871
|
+
const trimmed = raw.trim();
|
|
1872
|
+
if (!trimmed) return null;
|
|
1873
|
+
if (trimmed.startsWith("/") || trimmed.startsWith("./") || trimmed.startsWith("../") || trimmed.startsWith("~/") || trimmed.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(trimmed) || /^file:/i.test(trimmed)) {
|
|
1874
|
+
return null;
|
|
1875
|
+
}
|
|
1876
|
+
const withoutQuery = trimmed.replace(/[?#].*$/, "").replace(/\/+$/, "");
|
|
1877
|
+
if (!withoutQuery) return null;
|
|
1878
|
+
let host = "";
|
|
1879
|
+
let repoPath = "";
|
|
1880
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(withoutQuery)) {
|
|
1881
|
+
try {
|
|
1882
|
+
const url = new URL(withoutQuery);
|
|
1883
|
+
if (url.protocol === "file:") return null;
|
|
1884
|
+
host = url.hostname.toLowerCase();
|
|
1885
|
+
repoPath = decodeURIComponent(url.pathname).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
1886
|
+
} catch {
|
|
1887
|
+
return null;
|
|
1888
|
+
}
|
|
1889
|
+
} else {
|
|
1890
|
+
const scpMatch = withoutQuery.match(/^(?:[^@/:]+@)?(\[[^\]]+\]|[^/:]+):(.+)$/);
|
|
1891
|
+
if (scpMatch) {
|
|
1892
|
+
host = scpMatch[1].replace(/^\[|\]$/g, "").toLowerCase();
|
|
1893
|
+
repoPath = scpMatch[2].replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
1894
|
+
} else {
|
|
1895
|
+
const slash = withoutQuery.indexOf("/");
|
|
1896
|
+
if (slash > 0) {
|
|
1897
|
+
const rawHost = withoutQuery.slice(0, slash);
|
|
1898
|
+
const atIdx = rawHost.lastIndexOf("@");
|
|
1899
|
+
host = (atIdx >= 0 ? rawHost.slice(atIdx + 1) : rawHost).toLowerCase();
|
|
1900
|
+
repoPath = withoutQuery.slice(slash + 1).replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
if (!host || !repoPath) return null;
|
|
1905
|
+
if (!host.includes(".") && host !== "localhost") return null;
|
|
1906
|
+
if (/[\s@:\\]/.test(host)) return null;
|
|
1907
|
+
const segments = repoPath.split("/").filter(Boolean);
|
|
1908
|
+
if (segments.length === 0) return null;
|
|
1909
|
+
if (segments.some((seg) => seg === "." || seg === ".." || /[\s@:\\]/.test(seg))) return null;
|
|
1910
|
+
return `${host}/${segments.join("/")}`.slice(0, 200);
|
|
1911
|
+
}
|
|
1801
1912
|
|
|
1802
1913
|
// src/turn-evidence.ts
|
|
1803
1914
|
var MESH_TOPIC_PROTOCOL_VERSION = 2;
|
|
@@ -2184,17 +2295,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
|
|
|
2184
2295
|
};
|
|
2185
2296
|
}
|
|
2186
2297
|
|
|
2298
|
+
// src/launch-defaults.ts
|
|
2299
|
+
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
2300
|
+
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
2301
|
+
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
2302
|
+
function isLaunchDefaultRole(value) {
|
|
2303
|
+
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
2304
|
+
}
|
|
2305
|
+
function isLaunchDefaultSource(value) {
|
|
2306
|
+
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
2307
|
+
}
|
|
2308
|
+
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
2309
|
+
"invalid_args",
|
|
2310
|
+
"launch_default_required",
|
|
2311
|
+
"launch_default_unavailable",
|
|
2312
|
+
"launch_selection_invalid",
|
|
2313
|
+
"launch_default_invalid",
|
|
2314
|
+
"revision_conflict",
|
|
2315
|
+
"store_unavailable",
|
|
2316
|
+
"store_busy",
|
|
2317
|
+
"persistence_failed",
|
|
2318
|
+
"project_not_found",
|
|
2319
|
+
"project_ambiguous",
|
|
2320
|
+
"project_not_hosted",
|
|
2321
|
+
"project_storage_unavailable",
|
|
2322
|
+
"staging_unavailable",
|
|
2323
|
+
"staging_failed",
|
|
2324
|
+
"review_turn_tool_denied"
|
|
2325
|
+
];
|
|
2326
|
+
|
|
2327
|
+
// src/role-launch.ts
|
|
2328
|
+
function record(value) {
|
|
2329
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
2330
|
+
}
|
|
2331
|
+
function ref(value) {
|
|
2332
|
+
const r = record(value);
|
|
2333
|
+
if (!r || !isLaunchDefaultRole(r.role) || r.scope !== "global" && r.scope !== "project" || !Number.isSafeInteger(r.revision) || r.revision < 1 || r.scope === "project" && (typeof r.projectId !== "string" || !r.projectId)) return void 0;
|
|
2334
|
+
return {
|
|
2335
|
+
role: r.role,
|
|
2336
|
+
scope: r.scope,
|
|
2337
|
+
revision: r.revision,
|
|
2338
|
+
...r.scope === "project" ? { projectId: r.projectId } : {}
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
function axis(value) {
|
|
2342
|
+
const a = record(value);
|
|
2343
|
+
if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
|
|
2344
|
+
const defaultRef = ref(a.defaultRef);
|
|
2345
|
+
if (a.source === "stored_default" && defaultRef?.scope !== "global" || a.source === "project_default" && defaultRef?.scope !== "project" || (a.source === "user" || a.source === "provider_default") && a.defaultRef !== void 0) return void 0;
|
|
2346
|
+
return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
|
|
2347
|
+
}
|
|
2348
|
+
function parseRoleLaunchSelection(value) {
|
|
2349
|
+
const r = record(value), s = record(r?.selection), a = record(r?.applied);
|
|
2350
|
+
if (!r || !isLaunchDefaultRole(r.role) || !s || typeof s.provider !== "string" || !s.provider || !Number.isSafeInteger(r.documentRevision) || r.documentRevision < 1 || s.model !== void 0 && typeof s.model !== "string" || s.thinkingLevel !== void 0 && typeof s.thinkingLevel !== "string") return void 0;
|
|
2351
|
+
const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
|
|
2352
|
+
if (!provider || !model || !thinkingLevel || [provider, model, thinkingLevel].some((axis2) => axis2.defaultRef && (axis2.defaultRef.role !== r.role || axis2.defaultRef.scope === "global" && axis2.defaultRef.revision > r.documentRevision)) || provider.value !== s.provider || model.value !== (s.model ?? null) || thinkingLevel.value !== (s.thinkingLevel ?? null)) return void 0;
|
|
2353
|
+
const defaultRef = ref(r.defaultRef);
|
|
2354
|
+
return {
|
|
2355
|
+
role: r.role,
|
|
2356
|
+
selection: {
|
|
2357
|
+
provider: s.provider,
|
|
2358
|
+
...typeof s.model === "string" ? { model: s.model } : {},
|
|
2359
|
+
...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
|
|
2360
|
+
},
|
|
2361
|
+
applied: { provider, model, thinkingLevel },
|
|
2362
|
+
...defaultRef ? { defaultRef } : {},
|
|
2363
|
+
documentRevision: r.documentRevision
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2187
2367
|
// src/session-launch.ts
|
|
2188
2368
|
var MODEL_AXIS_SOURCES = [
|
|
2189
2369
|
/** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
|
|
2190
2370
|
"user",
|
|
2191
2371
|
/** The dashboard dialog restored it from the last launch (browser-local memory). */
|
|
2192
2372
|
"remembered",
|
|
2373
|
+
/** The authoritative daemon role default or host project override. */
|
|
2374
|
+
"stored_default",
|
|
2375
|
+
"project_default",
|
|
2193
2376
|
/** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
|
|
2194
2377
|
"mesh_slot",
|
|
2195
2378
|
/** An explicit per-task model / thinking level on a mesh queue task. */
|
|
2196
2379
|
"task_override",
|
|
2197
|
-
/** Nothing
|
|
2380
|
+
/** Nothing requested: the provider chooses; resolvedDefault records it when known. */
|
|
2198
2381
|
"provider_default",
|
|
2199
2382
|
/** A value was requested without saying where it came from, or nothing is known. */
|
|
2200
2383
|
"unspecified"
|
|
@@ -2238,10 +2421,10 @@ function readFiniteNumber(value) {
|
|
|
2238
2421
|
}
|
|
2239
2422
|
function parseModelSelection(raw) {
|
|
2240
2423
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2241
|
-
const
|
|
2424
|
+
const record2 = raw;
|
|
2242
2425
|
const history = [];
|
|
2243
|
-
if (Array.isArray(
|
|
2244
|
-
for (const entry of
|
|
2426
|
+
if (Array.isArray(record2.history)) {
|
|
2427
|
+
for (const entry of record2.history) {
|
|
2245
2428
|
if (!entry || typeof entry !== "object") continue;
|
|
2246
2429
|
const e = entry;
|
|
2247
2430
|
const value = readString(e.value);
|
|
@@ -2250,14 +2433,14 @@ function parseModelSelection(raw) {
|
|
|
2250
2433
|
if (value && at !== void 0 && via) history.push({ at, value, via });
|
|
2251
2434
|
}
|
|
2252
2435
|
}
|
|
2253
|
-
const requested = readString(
|
|
2254
|
-
const launchValue = readString(
|
|
2255
|
-
const resolvedDefault = readString(
|
|
2256
|
-
const current = readString(
|
|
2257
|
-
const observed = readString(
|
|
2258
|
-
const observedAt = readFiniteNumber(
|
|
2436
|
+
const requested = readString(record2.requested);
|
|
2437
|
+
const launchValue = readString(record2.launchValue);
|
|
2438
|
+
const resolvedDefault = readString(record2.resolvedDefault);
|
|
2439
|
+
const current = readString(record2.current);
|
|
2440
|
+
const observed = readString(record2.observed);
|
|
2441
|
+
const observedAt = readFiniteNumber(record2.observedAt);
|
|
2259
2442
|
return {
|
|
2260
|
-
source: isModelAxisSource(
|
|
2443
|
+
source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
|
|
2261
2444
|
...requested ? { requested } : {},
|
|
2262
2445
|
...launchValue ? { launchValue } : {},
|
|
2263
2446
|
...resolvedDefault ? { resolvedDefault } : {},
|
|
@@ -2269,22 +2452,24 @@ function parseModelSelection(raw) {
|
|
|
2269
2452
|
}
|
|
2270
2453
|
function parseSessionLaunchRecord(raw) {
|
|
2271
2454
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2272
|
-
const
|
|
2273
|
-
const sessionId = readString(
|
|
2274
|
-
const providerType = readString(
|
|
2275
|
-
const launchedAt = readFiniteNumber(
|
|
2276
|
-
const model = parseModelSelection(
|
|
2277
|
-
const thinkingLevel = parseModelSelection(
|
|
2455
|
+
const record2 = raw;
|
|
2456
|
+
const sessionId = readString(record2.sessionId);
|
|
2457
|
+
const providerType = readString(record2.providerType);
|
|
2458
|
+
const launchedAt = readFiniteNumber(record2.launchedAt);
|
|
2459
|
+
const model = parseModelSelection(record2.model);
|
|
2460
|
+
const thinkingLevel = parseModelSelection(record2.thinkingLevel);
|
|
2278
2461
|
if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
|
|
2279
|
-
const providerVersion = readString(
|
|
2280
|
-
const workspace = readString(
|
|
2281
|
-
const autoApproveModeId = readString(
|
|
2462
|
+
const providerVersion = readString(record2.providerVersion);
|
|
2463
|
+
const workspace = readString(record2.workspace);
|
|
2464
|
+
const autoApproveModeId = readString(record2.autoApproveModeId);
|
|
2465
|
+
const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
|
|
2282
2466
|
return {
|
|
2467
|
+
...roleLaunch ? { roleLaunch } : {},
|
|
2283
2468
|
sessionId,
|
|
2284
2469
|
providerType,
|
|
2285
2470
|
...providerVersion ? { providerVersion } : {},
|
|
2286
|
-
...
|
|
2287
|
-
launchedBy: isSessionLaunchedBy(
|
|
2471
|
+
...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
|
|
2472
|
+
launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
|
|
2288
2473
|
launchedAt,
|
|
2289
2474
|
...workspace ? { workspace } : {},
|
|
2290
2475
|
model,
|
|
@@ -3548,37 +3733,14 @@ function isProviderQuestionBinding(value) {
|
|
|
3548
3733
|
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3549
3734
|
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
3550
3735
|
}
|
|
3551
|
-
|
|
3552
|
-
// src/launch-defaults.ts
|
|
3553
|
-
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
3554
|
-
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
3555
|
-
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
3556
|
-
function isLaunchDefaultRole(value) {
|
|
3557
|
-
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
3558
|
-
}
|
|
3559
|
-
function isLaunchDefaultSource(value) {
|
|
3560
|
-
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
3561
|
-
}
|
|
3562
|
-
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
3563
|
-
"invalid_args",
|
|
3564
|
-
"launch_default_required",
|
|
3565
|
-
"launch_default_unavailable",
|
|
3566
|
-
"launch_selection_invalid",
|
|
3567
|
-
"launch_default_invalid",
|
|
3568
|
-
"revision_conflict",
|
|
3569
|
-
"store_unavailable",
|
|
3570
|
-
"store_busy",
|
|
3571
|
-
"persistence_failed",
|
|
3572
|
-
"project_not_found",
|
|
3573
|
-
"project_ambiguous",
|
|
3574
|
-
"project_not_hosted",
|
|
3575
|
-
"project_storage_unavailable",
|
|
3576
|
-
"staging_unavailable",
|
|
3577
|
-
"staging_failed",
|
|
3578
|
-
"review_turn_tool_denied"
|
|
3579
|
-
];
|
|
3580
3736
|
export {
|
|
3737
|
+
ASSISTANT_ACCOUNT_SLOT,
|
|
3738
|
+
ASSISTANT_FOLLOWER_ALLOWED_OPS,
|
|
3581
3739
|
ASSISTANT_OWNER_VERBS,
|
|
3740
|
+
ASSISTANT_REMOTE_FOLLOW_COMMAND,
|
|
3741
|
+
ASSISTANT_REMOTE_PROJECT_ACCESS_COMMAND,
|
|
3742
|
+
ASSISTANT_REMOTE_PROJECT_CATALOG_COMMAND,
|
|
3743
|
+
ASSISTANT_REMOTE_PROJECT_COMMAND,
|
|
3582
3744
|
ASSISTANT_REVIEW_TURN_VERBS,
|
|
3583
3745
|
ASSISTANT_SESSION_ID_ARG,
|
|
3584
3746
|
ASSISTANT_SESSION_ID_ENV,
|
|
@@ -3787,11 +3949,13 @@ export {
|
|
|
3787
3949
|
expandDaemonIdForms,
|
|
3788
3950
|
findOwnershipConflicts,
|
|
3789
3951
|
foldKeyedDoc,
|
|
3952
|
+
followedRemoteProjectKey,
|
|
3790
3953
|
formatQuotaAccount,
|
|
3791
3954
|
hasGitStatusEvidence,
|
|
3792
3955
|
hasWorkerProtocolFooter,
|
|
3793
3956
|
interpolateString,
|
|
3794
3957
|
isActionableProviderApproval,
|
|
3958
|
+
isAssistantFollowerAllowedOp,
|
|
3795
3959
|
isAssistantTool,
|
|
3796
3960
|
isBlockedStatus,
|
|
3797
3961
|
isBusyStatus,
|
|
@@ -3891,6 +4055,7 @@ export {
|
|
|
3891
4055
|
normalizeThinkingLevel,
|
|
3892
4056
|
orderProvidersByBuiltinPreference,
|
|
3893
4057
|
parseJsonRecord,
|
|
4058
|
+
parseRoleLaunchSelection,
|
|
3894
4059
|
parseSemver,
|
|
3895
4060
|
parseSessionLaunchRecord,
|
|
3896
4061
|
pathsOverlap,
|
|
@@ -3914,6 +4079,7 @@ export {
|
|
|
3914
4079
|
retiredMeshToolError,
|
|
3915
4080
|
sanitizeModelIdentifier,
|
|
3916
4081
|
sanitizeRefusalCode,
|
|
4082
|
+
sanitizeRemoteRepoIdentity,
|
|
3917
4083
|
scoreGitStatusCandidate,
|
|
3918
4084
|
scoreGitUpstreamFreshness,
|
|
3919
4085
|
sessionIdsEquivalent,
|
|
@@ -3924,6 +4090,7 @@ export {
|
|
|
3924
4090
|
summarizeGitShape,
|
|
3925
4091
|
supportsQuota,
|
|
3926
4092
|
touchedFilesOutsideOwnership,
|
|
4093
|
+
unwrapPastedContent,
|
|
3927
4094
|
withStatusProbeMarker
|
|
3928
4095
|
};
|
|
3929
4096
|
//# sourceMappingURL=index.mjs.map
|