@adhdev/mesh-shared 1.0.82-rc.21 → 1.0.82-rc.23
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 +5 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +209 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +207 -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-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 +8 -3
- package/src/index.ts +2 -0
- package/src/launch-defaults.ts +1 -1
- package/src/mesh-tool-names.ts +2 -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 +3 -0
|
@@ -11,15 +11,16 @@
|
|
|
11
11
|
* - the daemon-only verbs (launch / MCP-only pull / owner actions) that have
|
|
12
12
|
* no tool.
|
|
13
13
|
*
|
|
14
|
-
* Assistant tools
|
|
15
|
-
*
|
|
16
|
-
* never publish them.
|
|
14
|
+
* Assistant-specific tools remain separate from mesh tools. Driver discovery
|
|
15
|
+
* (list/describe) is shared across all three modes; invoke remains Worker-only.
|
|
17
16
|
*/
|
|
18
|
-
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"];
|
|
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"];
|
|
19
18
|
export type AssistantTool = typeof ASSISTANT_TOOLS[number];
|
|
20
19
|
export declare function isAssistantTool(value: unknown): value is AssistantTool;
|
|
21
20
|
/** Daemon verb names (§4.4 table + the five verbs below it). */
|
|
22
21
|
export declare const ASSISTANT_VERB: {
|
|
22
|
+
readonly driverList: "driver_list";
|
|
23
|
+
readonly driverDescribe: "driver_describe";
|
|
23
24
|
readonly projects: "assistant_projects";
|
|
24
25
|
readonly environment: "assistant_environment";
|
|
25
26
|
readonly action: "assistant_action";
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -333,6 +333,7 @@ __export(index_exports, {
|
|
|
333
333
|
normalizeThinkingLevel: () => normalizeThinkingLevel,
|
|
334
334
|
orderProvidersByBuiltinPreference: () => orderProvidersByBuiltinPreference,
|
|
335
335
|
parseJsonRecord: () => parseJsonRecord,
|
|
336
|
+
parseRoleLaunchSelection: () => parseRoleLaunchSelection,
|
|
336
337
|
parseSemver: () => parseSemver,
|
|
337
338
|
parseSessionLaunchRecord: () => parseSessionLaunchRecord,
|
|
338
339
|
pathsOverlap: () => pathsOverlap,
|
|
@@ -366,6 +367,7 @@ __export(index_exports, {
|
|
|
366
367
|
summarizeGitShape: () => summarizeGitShape,
|
|
367
368
|
supportsQuota: () => supportsQuota,
|
|
368
369
|
touchedFilesOutsideOwnership: () => touchedFilesOutsideOwnership,
|
|
370
|
+
unwrapPastedContent: () => unwrapPastedContent,
|
|
369
371
|
withStatusProbeMarker: () => withStatusProbeMarker
|
|
370
372
|
});
|
|
371
373
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -566,15 +568,15 @@ function pickBestTransitGitStatus(node, options) {
|
|
|
566
568
|
}
|
|
567
569
|
|
|
568
570
|
// src/session-normalize.ts
|
|
569
|
-
function deriveSyntheticSessionId(
|
|
571
|
+
function deriveSyntheticSessionId(record2) {
|
|
570
572
|
const parts = [
|
|
571
|
-
readString(
|
|
572
|
-
readString(
|
|
573
|
-
readString(
|
|
574
|
-
readString(
|
|
575
|
-
readString(
|
|
576
|
-
readString(
|
|
577
|
-
readString(
|
|
573
|
+
readString(record2.workspace),
|
|
574
|
+
readString(record2.providerType, record2.provider),
|
|
575
|
+
readString(record2.role),
|
|
576
|
+
readString(record2.state, record2.status),
|
|
577
|
+
readString(record2.title),
|
|
578
|
+
readString(record2.createdAt, record2.created_at),
|
|
579
|
+
readString(record2.startedAt, record2.started_at)
|
|
578
580
|
].filter((part) => Boolean(part));
|
|
579
581
|
if (parts.length === 0) return void 0;
|
|
580
582
|
return `synthetic:${parts.join("|")}`;
|
|
@@ -586,33 +588,33 @@ function sessionIdsEquivalent(a, b) {
|
|
|
586
588
|
return idA === idB;
|
|
587
589
|
}
|
|
588
590
|
function normalizeMeshSessionRecord(entry) {
|
|
589
|
-
const
|
|
590
|
-
const sessionId = readString(
|
|
591
|
+
const record2 = readRecord(entry);
|
|
592
|
+
const sessionId = readString(record2.sessionId, record2.session_id, record2.id) ?? deriveSyntheticSessionId(record2);
|
|
591
593
|
if (!sessionId) return null;
|
|
592
594
|
return {
|
|
593
595
|
sessionId,
|
|
594
|
-
...readString(
|
|
595
|
-
...readString(
|
|
596
|
-
...readString(
|
|
597
|
-
...readString(
|
|
598
|
-
...readString(
|
|
599
|
-
...readString(
|
|
600
|
-
...readString(
|
|
601
|
-
...readString(
|
|
602
|
-
...readString(
|
|
603
|
-
...readBoolean(
|
|
604
|
-
...readString(
|
|
605
|
-
...readString(
|
|
606
|
-
...readString(
|
|
607
|
-
...readString(
|
|
608
|
-
...readBoolean(
|
|
596
|
+
...readString(record2.providerType, record2.provider) ? { providerType: readString(record2.providerType, record2.provider) } : {},
|
|
597
|
+
...readString(record2.state, record2.status) ? { state: readString(record2.state, record2.status) } : {},
|
|
598
|
+
...readString(record2.chatStatus, record2.chat_status) ? { chatStatus: readString(record2.chatStatus, record2.chat_status) } : {},
|
|
599
|
+
...readString(record2.lifecycle) ? { lifecycle: readString(record2.lifecycle) } : {},
|
|
600
|
+
...readString(record2.surfaceKind, record2.surface_kind) ? { surfaceKind: readString(record2.surfaceKind, record2.surface_kind) } : {},
|
|
601
|
+
...readString(record2.recoveryState, record2.recovery_state) ? { recoveryState: readString(record2.recoveryState, record2.recovery_state) } : {},
|
|
602
|
+
...readString(record2.workspace) ? { workspace: readString(record2.workspace) } : {},
|
|
603
|
+
...readString(record2.title) ? { title: readString(record2.title) } : {},
|
|
604
|
+
...readString(record2.role) ? { role: readString(record2.role) } : {},
|
|
605
|
+
...readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record2.isSelfCoordinator, record2.is_self_coordinator) } : {},
|
|
606
|
+
...readString(record2.statusNote, record2.status_note) ? { statusNote: readString(record2.statusNote, record2.status_note) } : {},
|
|
607
|
+
...readString(record2.createdAt, record2.created_at) ? { createdAt: readString(record2.createdAt, record2.created_at) } : {},
|
|
608
|
+
...readString(record2.startedAt, record2.started_at) ? { startedAt: readString(record2.startedAt, record2.started_at) } : {},
|
|
609
|
+
...readString(record2.lastActivityAt, record2.last_activity_at) ? { lastActivityAt: readString(record2.lastActivityAt, record2.last_activity_at) } : {},
|
|
610
|
+
...readBoolean(record2.isCached, record2.is_cached) !== void 0 ? { isCached: readBoolean(record2.isCached, record2.is_cached) } : {}
|
|
609
611
|
};
|
|
610
612
|
}
|
|
611
613
|
|
|
612
614
|
// src/node-normalize.ts
|
|
613
615
|
function normalizeMeshNodeId(node) {
|
|
614
|
-
const
|
|
615
|
-
return readString(
|
|
616
|
+
const record2 = node && typeof node === "object" ? node : {};
|
|
617
|
+
return readString(record2.id, record2.nodeId, record2.node_id);
|
|
616
618
|
}
|
|
617
619
|
function meshNodeIdMatches(node, candidateId) {
|
|
618
620
|
if (!candidateId) return false;
|
|
@@ -624,12 +626,12 @@ function meshNodeIdMatches(node, candidateId) {
|
|
|
624
626
|
// src/node-facts.ts
|
|
625
627
|
function normalizeMeshNodeFacts(raw) {
|
|
626
628
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
627
|
-
const
|
|
628
|
-
const schemaVersion = Number(
|
|
629
|
-
const reportedAt = Number(
|
|
629
|
+
const record2 = raw;
|
|
630
|
+
const schemaVersion = Number(record2.schemaVersion);
|
|
631
|
+
const reportedAt = Number(record2.reportedAt);
|
|
630
632
|
if (!Number.isFinite(schemaVersion) || schemaVersion < 1) return void 0;
|
|
631
633
|
if (!Number.isFinite(reportedAt) || reportedAt <= 0) return void 0;
|
|
632
|
-
return { ...
|
|
634
|
+
return { ...record2, schemaVersion, reportedAt };
|
|
633
635
|
}
|
|
634
636
|
var QUOTA_SUPPORTED_PROVIDERS = [
|
|
635
637
|
"antigravity-cli",
|
|
@@ -786,9 +788,9 @@ function expandDaemonIdForms(ids) {
|
|
|
786
788
|
|
|
787
789
|
// src/git-summarize.ts
|
|
788
790
|
function summarizeGitShape(status) {
|
|
789
|
-
const
|
|
790
|
-
if (!Object.keys(
|
|
791
|
-
const submodules = Array.isArray(
|
|
791
|
+
const record2 = readRecord(status);
|
|
792
|
+
if (!Object.keys(record2).length) return null;
|
|
793
|
+
const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
|
|
792
794
|
const sub = readRecord(entry);
|
|
793
795
|
return {
|
|
794
796
|
path: readString(sub.path) ?? null,
|
|
@@ -798,23 +800,23 @@ function summarizeGitShape(status) {
|
|
|
798
800
|
};
|
|
799
801
|
}) : [];
|
|
800
802
|
return {
|
|
801
|
-
isGitRepo: readBoolean(
|
|
802
|
-
workspace: readString(
|
|
803
|
-
repoRoot: readString(
|
|
804
|
-
branch: readString(
|
|
805
|
-
upstream: readString(
|
|
806
|
-
upstreamStatus: readString(
|
|
807
|
-
headCommit: readString(
|
|
808
|
-
ahead: readNumber(
|
|
809
|
-
behind: readNumber(
|
|
803
|
+
isGitRepo: readBoolean(record2.isGitRepo),
|
|
804
|
+
workspace: readString(record2.workspace) ?? null,
|
|
805
|
+
repoRoot: readString(record2.repoRoot, record2.repo_root) ?? null,
|
|
806
|
+
branch: readString(record2.branch) ?? null,
|
|
807
|
+
upstream: readString(record2.upstream) ?? null,
|
|
808
|
+
upstreamStatus: readString(record2.upstreamStatus, record2.upstream_status) ?? null,
|
|
809
|
+
headCommit: readString(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
|
|
810
|
+
ahead: readNumber(record2.ahead) ?? null,
|
|
811
|
+
behind: readNumber(record2.behind) ?? null,
|
|
810
812
|
dirtyCounts: {
|
|
811
|
-
staged: readNumber(
|
|
812
|
-
modified: readNumber(
|
|
813
|
-
untracked: readNumber(
|
|
814
|
-
deleted: readNumber(
|
|
815
|
-
renamed: readNumber(
|
|
813
|
+
staged: readNumber(record2.staged) ?? 0,
|
|
814
|
+
modified: readNumber(record2.modified) ?? 0,
|
|
815
|
+
untracked: readNumber(record2.untracked) ?? 0,
|
|
816
|
+
deleted: readNumber(record2.deleted) ?? 0,
|
|
817
|
+
renamed: readNumber(record2.renamed) ?? 0
|
|
816
818
|
},
|
|
817
|
-
lastCheckedAt: readNumber(
|
|
819
|
+
lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
|
|
818
820
|
submoduleCount: submodules.length,
|
|
819
821
|
submodules
|
|
820
822
|
};
|
|
@@ -980,10 +982,25 @@ var CLI_SLOT_RECIPES = Object.freeze({
|
|
|
980
982
|
],
|
|
981
983
|
"antigravity-cli": [
|
|
982
984
|
{
|
|
983
|
-
model: "Gemini 3.
|
|
985
|
+
model: "Gemini 3.8 Flash (High)",
|
|
986
|
+
modelCandidates: ["Gemini 3.8 Flash (High)", "Gemini 4 Argon (Low)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
984
987
|
difficulty: ["easy"],
|
|
985
988
|
maxParallel: 2,
|
|
986
989
|
rationale: "Cheap capacity for easy tasks."
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
model: "Gemini 4 Argon (Medium)",
|
|
993
|
+
modelCandidates: ["Gemini 4 Argon (Medium)", "Gemini 3.8 Flash (High)", "Gemini 3.7 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
994
|
+
difficulty: ["medium"],
|
|
995
|
+
maxParallel: 2,
|
|
996
|
+
rationale: "Balanced Argon tier for medium tasks."
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
model: "Gemini 4 Argon (High)",
|
|
1000
|
+
modelCandidates: ["Gemini 4 Argon (High)", "Gemini 3.8 Flash (High)", "Gemini 3.1 Pro (High)"],
|
|
1001
|
+
difficulty: ["difficult"],
|
|
1002
|
+
maxParallel: 1,
|
|
1003
|
+
rationale: "Reserved for hard tasks; capped at 1 to bound cost."
|
|
987
1004
|
}
|
|
988
1005
|
],
|
|
989
1006
|
"cursor-cli": [
|
|
@@ -1022,6 +1039,24 @@ function dedupeDetected(detected) {
|
|
|
1022
1039
|
}
|
|
1023
1040
|
return out;
|
|
1024
1041
|
}
|
|
1042
|
+
function resolveRecipeModel(recipe, modelOptions) {
|
|
1043
|
+
if (!Array.isArray(modelOptions) || modelOptions.length === 0) {
|
|
1044
|
+
return recipe.model;
|
|
1045
|
+
}
|
|
1046
|
+
const available = new Set(
|
|
1047
|
+
modelOptions.filter((m) => typeof m === "string" && m.trim().length > 0).map((m) => m.trim())
|
|
1048
|
+
);
|
|
1049
|
+
if (available.size === 0) return recipe.model;
|
|
1050
|
+
const candidates = [
|
|
1051
|
+
...recipe.model ? [recipe.model] : [],
|
|
1052
|
+
...recipe.modelCandidates ?? []
|
|
1053
|
+
];
|
|
1054
|
+
for (const candidate of candidates) {
|
|
1055
|
+
const trimmed = typeof candidate === "string" ? candidate.trim() : "";
|
|
1056
|
+
if (trimmed && available.has(trimmed)) return trimmed;
|
|
1057
|
+
}
|
|
1058
|
+
return recipe.model;
|
|
1059
|
+
}
|
|
1025
1060
|
function buildSlotProposal(detected, currentSlots = []) {
|
|
1026
1061
|
const providers = dedupeDetected(detected ?? []);
|
|
1027
1062
|
const proposedSlots = [];
|
|
@@ -1037,7 +1072,7 @@ function buildSlotProposal(detected, currentSlots = []) {
|
|
|
1037
1072
|
for (const recipe of recipes) {
|
|
1038
1073
|
const slot = normalizeNodeCapabilitySlot({
|
|
1039
1074
|
provider: provider.type,
|
|
1040
|
-
model: recipe.
|
|
1075
|
+
model: resolveRecipeModel(recipe, provider.modelOptions),
|
|
1041
1076
|
thinkingLevel: recipe.thinkingLevel,
|
|
1042
1077
|
difficulty: recipe.difficulty,
|
|
1043
1078
|
maxParallel: recipe.maxParallel
|
|
@@ -1127,7 +1162,9 @@ var CANONICAL_MESH_TOOL_NAMES = [
|
|
|
1127
1162
|
"mesh_mission_upsert",
|
|
1128
1163
|
"mesh_mission_list",
|
|
1129
1164
|
"mesh_review_inbox",
|
|
1130
|
-
"mesh_node_slots"
|
|
1165
|
+
"mesh_node_slots",
|
|
1166
|
+
"driver_list",
|
|
1167
|
+
"driver_describe"
|
|
1131
1168
|
];
|
|
1132
1169
|
var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
|
|
1133
1170
|
var RETIRED_MESH_TOOLS = {
|
|
@@ -1802,10 +1839,10 @@ function isTerminalSessionRecordStatus(raw) {
|
|
|
1802
1839
|
return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
|
|
1803
1840
|
}
|
|
1804
1841
|
function isIdleSessionState(state) {
|
|
1805
|
-
const
|
|
1806
|
-
const status = typeof
|
|
1842
|
+
const record2 = state && typeof state === "object" ? state : {};
|
|
1843
|
+
const status = typeof record2.status === "string" ? record2.status.trim().toLowerCase() : "";
|
|
1807
1844
|
if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
|
|
1808
|
-
return isReadyStatus(status) ||
|
|
1845
|
+
return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
|
|
1809
1846
|
}
|
|
1810
1847
|
|
|
1811
1848
|
// src/mesh-vocabulary.ts
|
|
@@ -1915,6 +1952,14 @@ function isOutboundMessage(value) {
|
|
|
1915
1952
|
const candidate = value;
|
|
1916
1953
|
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";
|
|
1917
1954
|
}
|
|
1955
|
+
var PASTED_OPEN_RE = /^\s*<pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
|
|
1956
|
+
var PASTED_CLOSE_RE = /^\s*<\/pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
|
|
1957
|
+
function unwrapPastedContent(text) {
|
|
1958
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n");
|
|
1959
|
+
const first = lines.findIndex((line) => line.trim());
|
|
1960
|
+
if (first < 0 || !PASTED_OPEN_RE.test(lines[first])) return text;
|
|
1961
|
+
return lines.filter((line) => !PASTED_OPEN_RE.test(line) && !PASTED_CLOSE_RE.test(line)).join("\n");
|
|
1962
|
+
}
|
|
1918
1963
|
|
|
1919
1964
|
// src/mission-brief.ts
|
|
1920
1965
|
var GOAL_MAX = 500;
|
|
@@ -2000,7 +2045,10 @@ var WORKER_TOOLS = [
|
|
|
2000
2045
|
"peer_context_pull",
|
|
2001
2046
|
"git_status",
|
|
2002
2047
|
"git_log",
|
|
2003
|
-
"git_diff"
|
|
2048
|
+
"git_diff",
|
|
2049
|
+
"driver_list",
|
|
2050
|
+
"driver_describe",
|
|
2051
|
+
"driver_invoke"
|
|
2004
2052
|
];
|
|
2005
2053
|
var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
|
|
2006
2054
|
function isWorkerTool(value) {
|
|
@@ -2099,7 +2147,9 @@ var ASSISTANT_TOOLS = [
|
|
|
2099
2147
|
"skill_manage",
|
|
2100
2148
|
"project_note",
|
|
2101
2149
|
"launch_defaults",
|
|
2102
|
-
"launch_defaults_set"
|
|
2150
|
+
"launch_defaults_set",
|
|
2151
|
+
"driver_list",
|
|
2152
|
+
"driver_describe"
|
|
2103
2153
|
];
|
|
2104
2154
|
var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
|
|
2105
2155
|
function isAssistantTool(value) {
|
|
@@ -2107,6 +2157,8 @@ function isAssistantTool(value) {
|
|
|
2107
2157
|
}
|
|
2108
2158
|
var ASSISTANT_VERB = {
|
|
2109
2159
|
// tool verbs
|
|
2160
|
+
driverList: "driver_list",
|
|
2161
|
+
driverDescribe: "driver_describe",
|
|
2110
2162
|
projects: "assistant_projects",
|
|
2111
2163
|
environment: "assistant_environment",
|
|
2112
2164
|
action: "assistant_action",
|
|
@@ -2137,6 +2189,8 @@ var ASSISTANT_VERB = {
|
|
|
2137
2189
|
threadClose: "assistant_thread_close"
|
|
2138
2190
|
};
|
|
2139
2191
|
var ASSISTANT_TOOL_VERBS = {
|
|
2192
|
+
driver_list: ASSISTANT_VERB.driverList,
|
|
2193
|
+
driver_describe: ASSISTANT_VERB.driverDescribe,
|
|
2140
2194
|
projects: ASSISTANT_VERB.projects,
|
|
2141
2195
|
environment: ASSISTANT_VERB.environment,
|
|
2142
2196
|
assistant_action: ASSISTANT_VERB.action,
|
|
@@ -2556,17 +2610,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
|
|
|
2556
2610
|
};
|
|
2557
2611
|
}
|
|
2558
2612
|
|
|
2613
|
+
// src/launch-defaults.ts
|
|
2614
|
+
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
2615
|
+
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
2616
|
+
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
2617
|
+
function isLaunchDefaultRole(value) {
|
|
2618
|
+
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
2619
|
+
}
|
|
2620
|
+
function isLaunchDefaultSource(value) {
|
|
2621
|
+
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
2622
|
+
}
|
|
2623
|
+
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
2624
|
+
"invalid_args",
|
|
2625
|
+
"launch_default_required",
|
|
2626
|
+
"launch_default_unavailable",
|
|
2627
|
+
"launch_selection_invalid",
|
|
2628
|
+
"launch_default_invalid",
|
|
2629
|
+
"revision_conflict",
|
|
2630
|
+
"store_unavailable",
|
|
2631
|
+
"store_busy",
|
|
2632
|
+
"persistence_failed",
|
|
2633
|
+
"project_not_found",
|
|
2634
|
+
"project_ambiguous",
|
|
2635
|
+
"project_not_hosted",
|
|
2636
|
+
"project_storage_unavailable",
|
|
2637
|
+
"staging_unavailable",
|
|
2638
|
+
"staging_failed",
|
|
2639
|
+
"review_turn_tool_denied"
|
|
2640
|
+
];
|
|
2641
|
+
|
|
2642
|
+
// src/role-launch.ts
|
|
2643
|
+
function record(value) {
|
|
2644
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
2645
|
+
}
|
|
2646
|
+
function ref(value) {
|
|
2647
|
+
const r = record(value);
|
|
2648
|
+
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;
|
|
2649
|
+
return {
|
|
2650
|
+
role: r.role,
|
|
2651
|
+
scope: r.scope,
|
|
2652
|
+
revision: r.revision,
|
|
2653
|
+
...r.scope === "project" ? { projectId: r.projectId } : {}
|
|
2654
|
+
};
|
|
2655
|
+
}
|
|
2656
|
+
function axis(value) {
|
|
2657
|
+
const a = record(value);
|
|
2658
|
+
if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
|
|
2659
|
+
const defaultRef = ref(a.defaultRef);
|
|
2660
|
+
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;
|
|
2661
|
+
return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
|
|
2662
|
+
}
|
|
2663
|
+
function parseRoleLaunchSelection(value) {
|
|
2664
|
+
const r = record(value), s = record(r?.selection), a = record(r?.applied);
|
|
2665
|
+
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;
|
|
2666
|
+
const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
|
|
2667
|
+
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;
|
|
2668
|
+
const defaultRef = ref(r.defaultRef);
|
|
2669
|
+
return {
|
|
2670
|
+
role: r.role,
|
|
2671
|
+
selection: {
|
|
2672
|
+
provider: s.provider,
|
|
2673
|
+
...typeof s.model === "string" ? { model: s.model } : {},
|
|
2674
|
+
...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
|
|
2675
|
+
},
|
|
2676
|
+
applied: { provider, model, thinkingLevel },
|
|
2677
|
+
...defaultRef ? { defaultRef } : {},
|
|
2678
|
+
documentRevision: r.documentRevision
|
|
2679
|
+
};
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2559
2682
|
// src/session-launch.ts
|
|
2560
2683
|
var MODEL_AXIS_SOURCES = [
|
|
2561
2684
|
/** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
|
|
2562
2685
|
"user",
|
|
2563
2686
|
/** The dashboard dialog restored it from the last launch (browser-local memory). */
|
|
2564
2687
|
"remembered",
|
|
2688
|
+
/** The authoritative daemon role default or host project override. */
|
|
2689
|
+
"stored_default",
|
|
2690
|
+
"project_default",
|
|
2565
2691
|
/** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
|
|
2566
2692
|
"mesh_slot",
|
|
2567
2693
|
/** An explicit per-task model / thinking level on a mesh queue task. */
|
|
2568
2694
|
"task_override",
|
|
2569
|
-
/** Nothing
|
|
2695
|
+
/** Nothing requested: the provider chooses; resolvedDefault records it when known. */
|
|
2570
2696
|
"provider_default",
|
|
2571
2697
|
/** A value was requested without saying where it came from, or nothing is known. */
|
|
2572
2698
|
"unspecified"
|
|
@@ -2610,10 +2736,10 @@ function readFiniteNumber(value) {
|
|
|
2610
2736
|
}
|
|
2611
2737
|
function parseModelSelection(raw) {
|
|
2612
2738
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2613
|
-
const
|
|
2739
|
+
const record2 = raw;
|
|
2614
2740
|
const history = [];
|
|
2615
|
-
if (Array.isArray(
|
|
2616
|
-
for (const entry of
|
|
2741
|
+
if (Array.isArray(record2.history)) {
|
|
2742
|
+
for (const entry of record2.history) {
|
|
2617
2743
|
if (!entry || typeof entry !== "object") continue;
|
|
2618
2744
|
const e = entry;
|
|
2619
2745
|
const value = readString(e.value);
|
|
@@ -2622,14 +2748,14 @@ function parseModelSelection(raw) {
|
|
|
2622
2748
|
if (value && at !== void 0 && via) history.push({ at, value, via });
|
|
2623
2749
|
}
|
|
2624
2750
|
}
|
|
2625
|
-
const requested = readString(
|
|
2626
|
-
const launchValue = readString(
|
|
2627
|
-
const resolvedDefault = readString(
|
|
2628
|
-
const current = readString(
|
|
2629
|
-
const observed = readString(
|
|
2630
|
-
const observedAt = readFiniteNumber(
|
|
2751
|
+
const requested = readString(record2.requested);
|
|
2752
|
+
const launchValue = readString(record2.launchValue);
|
|
2753
|
+
const resolvedDefault = readString(record2.resolvedDefault);
|
|
2754
|
+
const current = readString(record2.current);
|
|
2755
|
+
const observed = readString(record2.observed);
|
|
2756
|
+
const observedAt = readFiniteNumber(record2.observedAt);
|
|
2631
2757
|
return {
|
|
2632
|
-
source: isModelAxisSource(
|
|
2758
|
+
source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
|
|
2633
2759
|
...requested ? { requested } : {},
|
|
2634
2760
|
...launchValue ? { launchValue } : {},
|
|
2635
2761
|
...resolvedDefault ? { resolvedDefault } : {},
|
|
@@ -2641,22 +2767,24 @@ function parseModelSelection(raw) {
|
|
|
2641
2767
|
}
|
|
2642
2768
|
function parseSessionLaunchRecord(raw) {
|
|
2643
2769
|
if (!raw || typeof raw !== "object") return void 0;
|
|
2644
|
-
const
|
|
2645
|
-
const sessionId = readString(
|
|
2646
|
-
const providerType = readString(
|
|
2647
|
-
const launchedAt = readFiniteNumber(
|
|
2648
|
-
const model = parseModelSelection(
|
|
2649
|
-
const thinkingLevel = parseModelSelection(
|
|
2770
|
+
const record2 = raw;
|
|
2771
|
+
const sessionId = readString(record2.sessionId);
|
|
2772
|
+
const providerType = readString(record2.providerType);
|
|
2773
|
+
const launchedAt = readFiniteNumber(record2.launchedAt);
|
|
2774
|
+
const model = parseModelSelection(record2.model);
|
|
2775
|
+
const thinkingLevel = parseModelSelection(record2.thinkingLevel);
|
|
2650
2776
|
if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
|
|
2651
|
-
const providerVersion = readString(
|
|
2652
|
-
const workspace = readString(
|
|
2653
|
-
const autoApproveModeId = readString(
|
|
2777
|
+
const providerVersion = readString(record2.providerVersion);
|
|
2778
|
+
const workspace = readString(record2.workspace);
|
|
2779
|
+
const autoApproveModeId = readString(record2.autoApproveModeId);
|
|
2780
|
+
const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
|
|
2654
2781
|
return {
|
|
2782
|
+
...roleLaunch ? { roleLaunch } : {},
|
|
2655
2783
|
sessionId,
|
|
2656
2784
|
providerType,
|
|
2657
2785
|
...providerVersion ? { providerVersion } : {},
|
|
2658
|
-
...
|
|
2659
|
-
launchedBy: isSessionLaunchedBy(
|
|
2786
|
+
...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
|
|
2787
|
+
launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
|
|
2660
2788
|
launchedAt,
|
|
2661
2789
|
...workspace ? { workspace } : {},
|
|
2662
2790
|
model,
|
|
@@ -3920,35 +4048,6 @@ function isProviderQuestionBinding(value) {
|
|
|
3920
4048
|
if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
|
|
3921
4049
|
return b.transport === "codex_async" ? b.requestId === void 0 : typeof b.requestId === "string" && !!b.requestId.trim() || typeof b.requestId === "number" && Number.isFinite(b.requestId);
|
|
3922
4050
|
}
|
|
3923
|
-
|
|
3924
|
-
// src/launch-defaults.ts
|
|
3925
|
-
var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
|
|
3926
|
-
var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
|
|
3927
|
-
var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
|
|
3928
|
-
function isLaunchDefaultRole(value) {
|
|
3929
|
-
return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
|
|
3930
|
-
}
|
|
3931
|
-
function isLaunchDefaultSource(value) {
|
|
3932
|
-
return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
|
|
3933
|
-
}
|
|
3934
|
-
var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
3935
|
-
"invalid_args",
|
|
3936
|
-
"launch_default_required",
|
|
3937
|
-
"launch_default_unavailable",
|
|
3938
|
-
"launch_selection_invalid",
|
|
3939
|
-
"launch_default_invalid",
|
|
3940
|
-
"revision_conflict",
|
|
3941
|
-
"store_unavailable",
|
|
3942
|
-
"store_busy",
|
|
3943
|
-
"persistence_failed",
|
|
3944
|
-
"project_not_found",
|
|
3945
|
-
"project_ambiguous",
|
|
3946
|
-
"project_not_hosted",
|
|
3947
|
-
"project_storage_unavailable",
|
|
3948
|
-
"staging_unavailable",
|
|
3949
|
-
"staging_failed",
|
|
3950
|
-
"review_turn_tool_denied"
|
|
3951
|
-
];
|
|
3952
4051
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3953
4052
|
0 && (module.exports = {
|
|
3954
4053
|
ASSISTANT_OWNER_VERBS,
|
|
@@ -4264,6 +4363,7 @@ var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
|
4264
4363
|
normalizeThinkingLevel,
|
|
4265
4364
|
orderProvidersByBuiltinPreference,
|
|
4266
4365
|
parseJsonRecord,
|
|
4366
|
+
parseRoleLaunchSelection,
|
|
4267
4367
|
parseSemver,
|
|
4268
4368
|
parseSessionLaunchRecord,
|
|
4269
4369
|
pathsOverlap,
|
|
@@ -4297,6 +4397,7 @@ var LAUNCH_DEFAULT_ERROR_CODES = [
|
|
|
4297
4397
|
summarizeGitShape,
|
|
4298
4398
|
supportsQuota,
|
|
4299
4399
|
touchedFilesOutsideOwnership,
|
|
4400
|
+
unwrapPastedContent,
|
|
4300
4401
|
withStatusProbeMarker
|
|
4301
4402
|
});
|
|
4302
4403
|
//# sourceMappingURL=index.js.map
|