@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/index.mjs CHANGED
@@ -194,15 +194,15 @@ function pickBestTransitGitStatus(node, options) {
194
194
  }
195
195
 
196
196
  // src/session-normalize.ts
197
- function deriveSyntheticSessionId(record) {
197
+ function deriveSyntheticSessionId(record2) {
198
198
  const parts = [
199
- readString(record.workspace),
200
- readString(record.providerType, record.provider),
201
- readString(record.role),
202
- readString(record.state, record.status),
203
- readString(record.title),
204
- readString(record.createdAt, record.created_at),
205
- readString(record.startedAt, record.started_at)
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 record = readRecord(entry);
218
- const sessionId = readString(record.sessionId, record.session_id, record.id) ?? deriveSyntheticSessionId(record);
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(record.providerType, record.provider) ? { providerType: readString(record.providerType, record.provider) } : {},
223
- ...readString(record.state, record.status) ? { state: readString(record.state, record.status) } : {},
224
- ...readString(record.chatStatus, record.chat_status) ? { chatStatus: readString(record.chatStatus, record.chat_status) } : {},
225
- ...readString(record.lifecycle) ? { lifecycle: readString(record.lifecycle) } : {},
226
- ...readString(record.surfaceKind, record.surface_kind) ? { surfaceKind: readString(record.surfaceKind, record.surface_kind) } : {},
227
- ...readString(record.recoveryState, record.recovery_state) ? { recoveryState: readString(record.recoveryState, record.recovery_state) } : {},
228
- ...readString(record.workspace) ? { workspace: readString(record.workspace) } : {},
229
- ...readString(record.title) ? { title: readString(record.title) } : {},
230
- ...readString(record.role) ? { role: readString(record.role) } : {},
231
- ...readBoolean(record.isSelfCoordinator, record.is_self_coordinator) !== void 0 ? { isSelfCoordinator: readBoolean(record.isSelfCoordinator, record.is_self_coordinator) } : {},
232
- ...readString(record.statusNote, record.status_note) ? { statusNote: readString(record.statusNote, record.status_note) } : {},
233
- ...readString(record.createdAt, record.created_at) ? { createdAt: readString(record.createdAt, record.created_at) } : {},
234
- ...readString(record.startedAt, record.started_at) ? { startedAt: readString(record.startedAt, record.started_at) } : {},
235
- ...readString(record.lastActivityAt, record.last_activity_at) ? { lastActivityAt: readString(record.lastActivityAt, record.last_activity_at) } : {},
236
- ...readBoolean(record.isCached, record.is_cached) !== void 0 ? { isCached: readBoolean(record.isCached, record.is_cached) } : {}
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 record = node && typeof node === "object" ? node : {};
243
- return readString(record.id, record.nodeId, record.node_id);
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 record = raw;
256
- const schemaVersion = Number(record.schemaVersion);
257
- const reportedAt = Number(record.reportedAt);
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 { ...record, schemaVersion, reportedAt };
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 record = readRecord(status);
418
- if (!Object.keys(record).length) return null;
419
- const submodules = Array.isArray(record.submodules) ? record.submodules.map((entry) => {
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(record.isGitRepo),
430
- workspace: readString(record.workspace) ?? null,
431
- repoRoot: readString(record.repoRoot, record.repo_root) ?? null,
432
- branch: readString(record.branch) ?? null,
433
- upstream: readString(record.upstream) ?? null,
434
- upstreamStatus: readString(record.upstreamStatus, record.upstream_status) ?? null,
435
- headCommit: readString(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
436
- ahead: readNumber(record.ahead) ?? null,
437
- behind: readNumber(record.behind) ?? null,
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(record.staged) ?? 0,
440
- modified: readNumber(record.modified) ?? 0,
441
- untracked: readNumber(record.untracked) ?? 0,
442
- deleted: readNumber(record.deleted) ?? 0,
443
- renamed: readNumber(record.renamed) ?? 0
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(record.lastCheckedAt, record.last_checked_at) ?? null,
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.1 Pro (High)",
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.model,
701
+ model: resolveRecipeModel(recipe, provider.modelOptions),
669
702
  thinkingLevel: recipe.thinkingLevel,
670
703
  difficulty: recipe.difficulty,
671
704
  maxParallel: recipe.maxParallel
@@ -755,7 +788,9 @@ 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"
759
794
  ];
760
795
  var CANONICAL_MESH_TOOL_COUNT = CANONICAL_MESH_TOOL_NAMES.length;
761
796
  var RETIRED_MESH_TOOLS = {
@@ -1430,10 +1465,10 @@ function isTerminalSessionRecordStatus(raw) {
1430
1465
  return typeof raw === "string" && TERMINAL_SESSION_RECORD_STATUSES.includes(raw.trim().toLowerCase());
1431
1466
  }
1432
1467
  function isIdleSessionState(state) {
1433
- const record = state && typeof state === "object" ? state : {};
1434
- const status = typeof record.status === "string" ? record.status.trim().toLowerCase() : "";
1468
+ const record2 = state && typeof state === "object" ? state : {};
1469
+ const status = typeof record2.status === "string" ? record2.status.trim().toLowerCase() : "";
1435
1470
  if (isTerminalSessionRecordStatus(status) || isDeadStatus(status)) return false;
1436
- return isReadyStatus(status) || record.activeChat?.status === "waiting_input";
1471
+ return isReadyStatus(status) || record2.activeChat?.status === "waiting_input";
1437
1472
  }
1438
1473
 
1439
1474
  // src/mesh-vocabulary.ts
@@ -1543,6 +1578,14 @@ function isOutboundMessage(value) {
1543
1578
  const candidate = value;
1544
1579
  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
1580
  }
1581
+ var PASTED_OPEN_RE = /^\s*<pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
1582
+ var PASTED_CLOSE_RE = /^\s*<\/pasted_content(?:\s+id="[^"]*")?\s*>\s*$/;
1583
+ function unwrapPastedContent(text) {
1584
+ const lines = text.replace(/\r\n?/g, "\n").split("\n");
1585
+ const first = lines.findIndex((line) => line.trim());
1586
+ if (first < 0 || !PASTED_OPEN_RE.test(lines[first])) return text;
1587
+ return lines.filter((line) => !PASTED_OPEN_RE.test(line) && !PASTED_CLOSE_RE.test(line)).join("\n");
1588
+ }
1546
1589
 
1547
1590
  // src/mission-brief.ts
1548
1591
  var GOAL_MAX = 500;
@@ -1628,7 +1671,10 @@ var WORKER_TOOLS = [
1628
1671
  "peer_context_pull",
1629
1672
  "git_status",
1630
1673
  "git_log",
1631
- "git_diff"
1674
+ "git_diff",
1675
+ "driver_list",
1676
+ "driver_describe",
1677
+ "driver_invoke"
1632
1678
  ];
1633
1679
  var WORKER_TOOL_SET = new Set(WORKER_TOOLS);
1634
1680
  function isWorkerTool(value) {
@@ -1727,7 +1773,9 @@ var ASSISTANT_TOOLS = [
1727
1773
  "skill_manage",
1728
1774
  "project_note",
1729
1775
  "launch_defaults",
1730
- "launch_defaults_set"
1776
+ "launch_defaults_set",
1777
+ "driver_list",
1778
+ "driver_describe"
1731
1779
  ];
1732
1780
  var ASSISTANT_TOOL_SET = new Set(ASSISTANT_TOOLS);
1733
1781
  function isAssistantTool(value) {
@@ -1735,6 +1783,8 @@ function isAssistantTool(value) {
1735
1783
  }
1736
1784
  var ASSISTANT_VERB = {
1737
1785
  // tool verbs
1786
+ driverList: "driver_list",
1787
+ driverDescribe: "driver_describe",
1738
1788
  projects: "assistant_projects",
1739
1789
  environment: "assistant_environment",
1740
1790
  action: "assistant_action",
@@ -1765,6 +1815,8 @@ var ASSISTANT_VERB = {
1765
1815
  threadClose: "assistant_thread_close"
1766
1816
  };
1767
1817
  var ASSISTANT_TOOL_VERBS = {
1818
+ driver_list: ASSISTANT_VERB.driverList,
1819
+ driver_describe: ASSISTANT_VERB.driverDescribe,
1768
1820
  projects: ASSISTANT_VERB.projects,
1769
1821
  environment: ASSISTANT_VERB.environment,
1770
1822
  assistant_action: ASSISTANT_VERB.action,
@@ -2184,17 +2236,89 @@ function projectTurnEvidenceEntry(evidence, attempt) {
2184
2236
  };
2185
2237
  }
2186
2238
 
2239
+ // src/launch-defaults.ts
2240
+ var LAUNCH_DEFAULT_ROLES = ["assistant", "coordinator"];
2241
+ var LAUNCH_DEFAULT_SOURCES = ["user", "stored_default", "project_default", "provider_default"];
2242
+ var LAUNCH_DEFAULTS_NEXT_LAUNCH_NOTE = "Applies to the next launch; running sessions are unchanged.";
2243
+ function isLaunchDefaultRole(value) {
2244
+ return typeof value === "string" && LAUNCH_DEFAULT_ROLES.includes(value);
2245
+ }
2246
+ function isLaunchDefaultSource(value) {
2247
+ return typeof value === "string" && LAUNCH_DEFAULT_SOURCES.includes(value);
2248
+ }
2249
+ var LAUNCH_DEFAULT_ERROR_CODES = [
2250
+ "invalid_args",
2251
+ "launch_default_required",
2252
+ "launch_default_unavailable",
2253
+ "launch_selection_invalid",
2254
+ "launch_default_invalid",
2255
+ "revision_conflict",
2256
+ "store_unavailable",
2257
+ "store_busy",
2258
+ "persistence_failed",
2259
+ "project_not_found",
2260
+ "project_ambiguous",
2261
+ "project_not_hosted",
2262
+ "project_storage_unavailable",
2263
+ "staging_unavailable",
2264
+ "staging_failed",
2265
+ "review_turn_tool_denied"
2266
+ ];
2267
+
2268
+ // src/role-launch.ts
2269
+ function record(value) {
2270
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
2271
+ }
2272
+ function ref(value) {
2273
+ const r = record(value);
2274
+ 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;
2275
+ return {
2276
+ role: r.role,
2277
+ scope: r.scope,
2278
+ revision: r.revision,
2279
+ ...r.scope === "project" ? { projectId: r.projectId } : {}
2280
+ };
2281
+ }
2282
+ function axis(value) {
2283
+ const a = record(value);
2284
+ if (!a || !isLaunchDefaultSource(a.source) || a.value !== null && typeof a.value !== "string") return void 0;
2285
+ const defaultRef = ref(a.defaultRef);
2286
+ 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;
2287
+ return { value: a.value, source: a.source, ...defaultRef ? { defaultRef } : {} };
2288
+ }
2289
+ function parseRoleLaunchSelection(value) {
2290
+ const r = record(value), s = record(r?.selection), a = record(r?.applied);
2291
+ 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;
2292
+ const provider = axis(a?.provider), model = axis(a?.model), thinkingLevel = axis(a?.thinkingLevel);
2293
+ 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;
2294
+ const defaultRef = ref(r.defaultRef);
2295
+ return {
2296
+ role: r.role,
2297
+ selection: {
2298
+ provider: s.provider,
2299
+ ...typeof s.model === "string" ? { model: s.model } : {},
2300
+ ...typeof s.thinkingLevel === "string" ? { thinkingLevel: s.thinkingLevel } : {}
2301
+ },
2302
+ applied: { provider, model, thinkingLevel },
2303
+ ...defaultRef ? { defaultRef } : {},
2304
+ documentRevision: r.documentRevision
2305
+ };
2306
+ }
2307
+
2187
2308
  // src/session-launch.ts
2188
2309
  var MODEL_AXIS_SOURCES = [
2189
2310
  /** Picked explicitly for this launch (dashboard dropdown, coordinator dialog). */
2190
2311
  "user",
2191
2312
  /** The dashboard dialog restored it from the last launch (browser-local memory). */
2192
2313
  "remembered",
2314
+ /** The authoritative daemon role default or host project override. */
2315
+ "stored_default",
2316
+ "project_default",
2193
2317
  /** A mesh capability slot supplied it (or a difficulty preset the slot outranked). */
2194
2318
  "mesh_slot",
2195
2319
  /** An explicit per-task model / thinking level on a mesh queue task. */
2196
2320
  "task_override",
2197
- /** Nothing was requested; the provider's default is known (discovery / manifest). */
2321
+ /** Nothing requested: the provider chooses; resolvedDefault records it when known. */
2198
2322
  "provider_default",
2199
2323
  /** A value was requested without saying where it came from, or nothing is known. */
2200
2324
  "unspecified"
@@ -2238,10 +2362,10 @@ function readFiniteNumber(value) {
2238
2362
  }
2239
2363
  function parseModelSelection(raw) {
2240
2364
  if (!raw || typeof raw !== "object") return void 0;
2241
- const record = raw;
2365
+ const record2 = raw;
2242
2366
  const history = [];
2243
- if (Array.isArray(record.history)) {
2244
- for (const entry of record.history) {
2367
+ if (Array.isArray(record2.history)) {
2368
+ for (const entry of record2.history) {
2245
2369
  if (!entry || typeof entry !== "object") continue;
2246
2370
  const e = entry;
2247
2371
  const value = readString(e.value);
@@ -2250,14 +2374,14 @@ function parseModelSelection(raw) {
2250
2374
  if (value && at !== void 0 && via) history.push({ at, value, via });
2251
2375
  }
2252
2376
  }
2253
- const requested = readString(record.requested);
2254
- const launchValue = readString(record.launchValue);
2255
- const resolvedDefault = readString(record.resolvedDefault);
2256
- const current = readString(record.current);
2257
- const observed = readString(record.observed);
2258
- const observedAt = readFiniteNumber(record.observedAt);
2377
+ const requested = readString(record2.requested);
2378
+ const launchValue = readString(record2.launchValue);
2379
+ const resolvedDefault = readString(record2.resolvedDefault);
2380
+ const current = readString(record2.current);
2381
+ const observed = readString(record2.observed);
2382
+ const observedAt = readFiniteNumber(record2.observedAt);
2259
2383
  return {
2260
- source: isModelAxisSource(record.source) ? record.source : "unspecified",
2384
+ source: isModelAxisSource(record2.source) ? record2.source : "unspecified",
2261
2385
  ...requested ? { requested } : {},
2262
2386
  ...launchValue ? { launchValue } : {},
2263
2387
  ...resolvedDefault ? { resolvedDefault } : {},
@@ -2269,22 +2393,24 @@ function parseModelSelection(raw) {
2269
2393
  }
2270
2394
  function parseSessionLaunchRecord(raw) {
2271
2395
  if (!raw || typeof raw !== "object") return void 0;
2272
- const record = raw;
2273
- const sessionId = readString(record.sessionId);
2274
- const providerType = readString(record.providerType);
2275
- const launchedAt = readFiniteNumber(record.launchedAt);
2276
- const model = parseModelSelection(record.model);
2277
- const thinkingLevel = parseModelSelection(record.thinkingLevel);
2396
+ const record2 = raw;
2397
+ const sessionId = readString(record2.sessionId);
2398
+ const providerType = readString(record2.providerType);
2399
+ const launchedAt = readFiniteNumber(record2.launchedAt);
2400
+ const model = parseModelSelection(record2.model);
2401
+ const thinkingLevel = parseModelSelection(record2.thinkingLevel);
2278
2402
  if (!sessionId || !providerType || launchedAt === void 0 || !model || !thinkingLevel) return void 0;
2279
- const providerVersion = readString(record.providerVersion);
2280
- const workspace = readString(record.workspace);
2281
- const autoApproveModeId = readString(record.autoApproveModeId);
2403
+ const providerVersion = readString(record2.providerVersion);
2404
+ const workspace = readString(record2.workspace);
2405
+ const autoApproveModeId = readString(record2.autoApproveModeId);
2406
+ const roleLaunch = parseRoleLaunchSelection(record2.roleLaunch);
2282
2407
  return {
2408
+ ...roleLaunch ? { roleLaunch } : {},
2283
2409
  sessionId,
2284
2410
  providerType,
2285
2411
  ...providerVersion ? { providerVersion } : {},
2286
- ...record.providerChannel === "stable" || record.providerChannel === "preview" ? { providerChannel: record.providerChannel } : {},
2287
- launchedBy: isSessionLaunchedBy(record.launchedBy) ? record.launchedBy : "api",
2412
+ ...record2.providerChannel === "stable" || record2.providerChannel === "preview" ? { providerChannel: record2.providerChannel } : {},
2413
+ launchedBy: isSessionLaunchedBy(record2.launchedBy) ? record2.launchedBy : "api",
2288
2414
  launchedAt,
2289
2415
  ...workspace ? { workspace } : {},
2290
2416
  model,
@@ -3548,35 +3674,6 @@ function isProviderQuestionBinding(value) {
3548
3674
  if (["sessionId", "generation", "threadId", "turnId", "itemId"].some((key) => typeof b[key] !== "string" || !b[key].trim())) return false;
3549
3675
  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
3676
  }
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
3677
  export {
3581
3678
  ASSISTANT_OWNER_VERBS,
3582
3679
  ASSISTANT_REVIEW_TURN_VERBS,
@@ -3891,6 +3988,7 @@ export {
3891
3988
  normalizeThinkingLevel,
3892
3989
  orderProvidersByBuiltinPreference,
3893
3990
  parseJsonRecord,
3991
+ parseRoleLaunchSelection,
3894
3992
  parseSemver,
3895
3993
  parseSessionLaunchRecord,
3896
3994
  pathsOverlap,
@@ -3924,6 +4022,7 @@ export {
3924
4022
  summarizeGitShape,
3925
4023
  supportsQuota,
3926
4024
  touchedFilesOutsideOwnership,
4025
+ unwrapPastedContent,
3927
4026
  withStatusProbeMarker
3928
4027
  };
3929
4028
  //# sourceMappingURL=index.mjs.map