lody 0.86.0 → 0.86.2

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.
@@ -80,7 +80,7 @@ let __tla = Promise.all([
80
80
  }
81
81
  })()
82
82
  ]).then(async () => {
83
- const reviewViewerVersion = "0.86.0";
83
+ const reviewViewerVersion = "0.86.2";
84
84
  const reviewViewerSha256 = "dc9c7fc1dde49bb39c5fe86392d69219b469c0cab4fd492d8b562045e7f676e4";
85
85
  const reviewViewerFileName = "standalone.html";
86
86
  const DEFAULT_CDN_BASES = [
package/dist/index.js CHANGED
@@ -4325,7 +4325,7 @@ Upgrade Node, then re-run: npx lody@latest`;
4325
4325
  }
4326
4326
  const name$2 = "lody";
4327
4327
  const name$1 = "@lody/cli-cloud";
4328
- const version$9 = "0.86.0";
4328
+ const version$9 = "0.86.2";
4329
4329
  const type$2 = "module";
4330
4330
  const scripts = {
4331
4331
  "dev": "node dev.mjs",
@@ -10942,9 +10942,6 @@ Requirements:
10942
10942
  taskToolsEnabled: schema.Boolean({
10943
10943
  required: false
10944
10944
  }),
10945
- agentRoleInvocations: schema.Any({
10946
- required: false
10947
- }),
10948
10945
  chainDepth: schema.Number({
10949
10946
  required: false
10950
10947
  })
@@ -11489,6 +11486,30 @@ Requirements:
11489
11486
  return `${MISSING_EMAIL_PREFIX}+${safeProvider}-${safeId}@${MISSING_EMAIL_DOMAIN}`;
11490
11487
  };
11491
11488
  const isMissingEmail = (email) => Boolean(email) && email.endsWith(`@${MISSING_EMAIL_DOMAIN}`);
11489
+ const RPC_SECRET_PUBLIC_KEY_TYPE = "rpc-secret-public-key-v1";
11490
+ const RPC_SECRET_ENVELOPE_TYPE = "rpc-secret-envelope-v1";
11491
+ const RPC_SECRET_ALGORITHM = "ECDH-P256-AES-256-GCM";
11492
+ const Base64UrlSchema = string$1().trim().min(1).max(16384).regex(/^[A-Za-z0-9_-]+$/);
11493
+ const RpcSecretEcPublicJwkSchema = object$1({
11494
+ kty: literal$1("EC"),
11495
+ crv: literal$1("P-256"),
11496
+ x: Base64UrlSchema.max(128),
11497
+ y: Base64UrlSchema.max(128)
11498
+ }).strict();
11499
+ const RpcSecretPublicKeySchema = object$1({
11500
+ type: literal$1(RPC_SECRET_PUBLIC_KEY_TYPE),
11501
+ algorithm: literal$1(RPC_SECRET_ALGORITHM),
11502
+ keyId: Base64UrlSchema.max(128),
11503
+ publicKey: RpcSecretEcPublicJwkSchema
11504
+ }).strict();
11505
+ const RpcSecretEnvelopeSchema = object$1({
11506
+ type: literal$1(RPC_SECRET_ENVELOPE_TYPE),
11507
+ algorithm: literal$1(RPC_SECRET_ALGORITHM),
11508
+ keyId: Base64UrlSchema.max(128),
11509
+ ephemeralPublicKey: RpcSecretEcPublicJwkSchema,
11510
+ iv: Base64UrlSchema.max(64),
11511
+ ciphertext: Base64UrlSchema
11512
+ }).strict();
11492
11513
  const isMcpTransport = (value) => value === "stdio" || value === "http";
11493
11514
  const ENV_VAR_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
11494
11515
  const ENV_VAR_PATTERN = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
@@ -11761,146 +11782,6 @@ Requirements:
11761
11782
  normalizeSessionPreparationRunConfigForDedup(input2.runConfig)
11762
11783
  ]);
11763
11784
  }
11764
- const AGENT_ROLE_VERSION = 1;
11765
- const isRecord$d = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
11766
- const isNonEmptyString$2 = (value) => typeof value === "string" && value.trim().length > 0;
11767
- const isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
11768
- const isAgentRoleVisibility = (value) => value === "private" || value === "workspace";
11769
- const AGENT_ROLE_MENTION_SLUG_MAX_LENGTH = 40;
11770
- const AGENT_ROLE_EMOJI_MAX_LENGTH = 8;
11771
- const getAgentRoleMentionSlug = (role) => normalizeAgentRoleMentionSlug(role.name);
11772
- const normalizeAgentRoleMentionSlug = (value) => {
11773
- const collapsed = value.trim().replace(/^@+/u, "").replace(new RegExp("\\p{Cc}", "gu"), "").replace(/\s+/gu, "-").replace(/-{2,}/gu, "-").replace(/^-+|-+$/gu, "");
11774
- return Array.from(collapsed).slice(0, AGENT_ROLE_MENTION_SLUG_MAX_LENGTH).join("");
11775
- };
11776
- const normalizeAgentRoleEmoji = (value) => {
11777
- if (typeof value !== "string") return void 0;
11778
- const stripped = value.replace(new RegExp("\\p{Cc}", "gu"), "").replace(/\s+/gu, "");
11779
- const capped = Array.from(stripped).slice(0, AGENT_ROLE_EMOJI_MAX_LENGTH).join("");
11780
- return capped || void 0;
11781
- };
11782
- const EXTRA_SENSITIVE_ROLE_OPTION_KEY_PATTERN = /(?:\bkey\b|cookie|session[_-]?id|private)/i;
11783
- const isSensitiveAgentRoleConfigOptionKey = (key2) => isSensitiveAcpConfigOptionId(key2) || EXTRA_SENSITIVE_ROLE_OPTION_KEY_PATTERN.test(key2);
11784
- const normalizeAgentRoleConfigOptionValues = (value) => {
11785
- if (!isRecord$d(value)) return void 0;
11786
- const normalized = {};
11787
- for (const [key2, entry] of Object.entries(value)) {
11788
- const trimmedKey = key2.trim();
11789
- if (!trimmedKey || isSensitiveAgentRoleConfigOptionKey(trimmedKey)) continue;
11790
- if (typeof entry === "boolean") {
11791
- normalized[trimmedKey] = entry;
11792
- continue;
11793
- }
11794
- if (typeof entry === "string") {
11795
- normalized[trimmedKey] = entry;
11796
- }
11797
- }
11798
- return Object.keys(normalized).length > 0 ? normalized : void 0;
11799
- };
11800
- const normalizeAgentRoleRunConfig = (value) => {
11801
- if (!isRecord$d(value)) return {};
11802
- const modeId = typeof value.modeId === "string" ? value.modeId.trim() : "";
11803
- const modelId = typeof value.modelId === "string" ? value.modelId.trim() : "";
11804
- const configOptionValues = normalizeAgentRoleConfigOptionValues(value.configOptionValues);
11805
- return {
11806
- ...modeId ? {
11807
- modeId
11808
- } : {},
11809
- ...modelId ? {
11810
- modelId
11811
- } : {},
11812
- ...configOptionValues ? {
11813
- configOptionValues
11814
- } : {}
11815
- };
11816
- };
11817
- const isAgentRole = (value) => {
11818
- if (!isRecord$d(value) || value.v !== AGENT_ROLE_VERSION || !isNonEmptyString$2(value.id) || !isNonEmptyString$2(value.ownerUserId) || !isAgentRoleVisibility(value.visibility) || !isNonEmptyString$2(value.name) || !isNonEmptyString$2(value.machineId) || !isNonEmptyString$2(value.agentConfigId) || !isFiniteNumber(value.revision) || !isFiniteNumber(value.createdAt) || !isFiniteNumber(value.updatedAt)) {
11819
- return false;
11820
- }
11821
- if (value.emoji !== void 0 && typeof value.emoji !== "string") return false;
11822
- if (value.promptPrefix !== void 0 && typeof value.promptPrefix !== "string") return false;
11823
- if (value.runConfig !== void 0 && !isRecord$d(value.runConfig)) return false;
11824
- return getAgentRoleMentionSlug({
11825
- name: value.name.trim()
11826
- }).length > 0;
11827
- };
11828
- const normalizeAgentRole = (value) => {
11829
- if (!isAgentRole(value)) return void 0;
11830
- const emoji = normalizeAgentRoleEmoji(value.emoji);
11831
- const promptPrefix = value.promptPrefix?.trim();
11832
- return {
11833
- v: AGENT_ROLE_VERSION,
11834
- id: value.id.trim(),
11835
- ownerUserId: value.ownerUserId.trim(),
11836
- visibility: value.visibility,
11837
- name: value.name.trim(),
11838
- ...emoji ? {
11839
- emoji
11840
- } : {},
11841
- machineId: value.machineId.trim(),
11842
- agentConfigId: value.agentConfigId.trim(),
11843
- runConfig: normalizeAgentRoleRunConfig(value.runConfig),
11844
- ...promptPrefix ? {
11845
- promptPrefix
11846
- } : {},
11847
- revision: Math.max(1, Math.trunc(value.revision)),
11848
- createdAt: value.createdAt,
11849
- updatedAt: value.updatedAt
11850
- };
11851
- };
11852
- const normalizeAgentRoleInvocationSnapshot = (value) => {
11853
- if (!isRecord$d(value) || !isNonEmptyString$2(value.roleId) || !isNonEmptyString$2(value.roleName) || !isNonEmptyString$2(value.machineId) || !isNonEmptyString$2(value.agentConfigId) || !isFiniteNumber(value.roleRevision)) {
11854
- return void 0;
11855
- }
11856
- const promptPrefix = typeof value.promptPrefix === "string" ? value.promptPrefix.trim() : "";
11857
- return {
11858
- roleId: value.roleId.trim(),
11859
- roleRevision: Math.max(1, Math.trunc(value.roleRevision)),
11860
- roleName: value.roleName.trim(),
11861
- machineId: value.machineId.trim(),
11862
- agentConfigId: value.agentConfigId.trim(),
11863
- runConfig: normalizeAgentRoleRunConfig(value.runConfig),
11864
- ...promptPrefix ? {
11865
- promptPrefix
11866
- } : {}
11867
- };
11868
- };
11869
- const normalizeAgentRoleInvocationSnapshots = (value) => {
11870
- if (!Array.isArray(value) || value.length === 0) return void 0;
11871
- const byRoleId = /* @__PURE__ */ new Map();
11872
- for (const entry of value) {
11873
- const snapshot = normalizeAgentRoleInvocationSnapshot(entry);
11874
- if (snapshot && !byRoleId.has(snapshot.roleId)) byRoleId.set(snapshot.roleId, snapshot);
11875
- }
11876
- return byRoleId.size > 0 ? [
11877
- ...byRoleId.values()
11878
- ] : void 0;
11879
- };
11880
- const RPC_SECRET_PUBLIC_KEY_TYPE = "rpc-secret-public-key-v1";
11881
- const RPC_SECRET_ENVELOPE_TYPE = "rpc-secret-envelope-v1";
11882
- const RPC_SECRET_ALGORITHM = "ECDH-P256-AES-256-GCM";
11883
- const Base64UrlSchema = string$1().trim().min(1).max(16384).regex(/^[A-Za-z0-9_-]+$/);
11884
- const RpcSecretEcPublicJwkSchema = object$1({
11885
- kty: literal$1("EC"),
11886
- crv: literal$1("P-256"),
11887
- x: Base64UrlSchema.max(128),
11888
- y: Base64UrlSchema.max(128)
11889
- }).strict();
11890
- const RpcSecretPublicKeySchema = object$1({
11891
- type: literal$1(RPC_SECRET_PUBLIC_KEY_TYPE),
11892
- algorithm: literal$1(RPC_SECRET_ALGORITHM),
11893
- keyId: Base64UrlSchema.max(128),
11894
- publicKey: RpcSecretEcPublicJwkSchema
11895
- }).strict();
11896
- const RpcSecretEnvelopeSchema = object$1({
11897
- type: literal$1(RPC_SECRET_ENVELOPE_TYPE),
11898
- algorithm: literal$1(RPC_SECRET_ALGORITHM),
11899
- keyId: Base64UrlSchema.max(128),
11900
- ephemeralPublicKey: RpcSecretEcPublicJwkSchema,
11901
- iv: Base64UrlSchema.max(64),
11902
- ciphertext: Base64UrlSchema
11903
- }).strict();
11904
11785
  const SessionIdSchema$1 = string$1().transform((value) => value);
11905
11786
  const MachineIdSchema$1 = string$1();
11906
11787
  const WorkspaceIdSchema = string$1();
@@ -12157,7 +12038,6 @@ Requirements:
12157
12038
  configOptionValues: AcpConfigOptionValuesSchema.optional(),
12158
12039
  mcpServerIds: array$2(string$1()).optional(),
12159
12040
  taskToolsEnabled: boolean().optional(),
12160
- agentRoleInvocations: array$2(unknown()).optional(),
12161
12041
  issuePRMentions: array$2(IssuePRMentionSchema).optional(),
12162
12042
  resume: ACPSessionIdSchema.optional(),
12163
12043
  chainDepth: number$4().int().nonnegative().optional()
@@ -12174,7 +12054,6 @@ Requirements:
12174
12054
  configOptionValues: AcpConfigOptionValuesSchema.optional(),
12175
12055
  mcpServerIds: array$2(string$1()).optional(),
12176
12056
  taskToolsEnabled: boolean().optional(),
12177
- agentRoleInvocations: array$2(unknown()).optional(),
12178
12057
  issuePRMentions: array$2(IssuePRMentionSchema).optional(),
12179
12058
  resume: ACPSessionIdSchema.optional(),
12180
12059
  chainDepth: number$4().int().nonnegative().optional()
@@ -12246,10 +12125,6 @@ Requirements:
12246
12125
  if (taskToolsEnabled !== void 0) {
12247
12126
  normalized.taskToolsEnabled = taskToolsEnabled;
12248
12127
  }
12249
- const agentRoleInvocations = normalizeAgentRoleInvocationSnapshots(record2.agentRoleInvocations);
12250
- if (agentRoleInvocations) {
12251
- normalized.agentRoleInvocations = agentRoleInvocations;
12252
- }
12253
12128
  const issuePRMentions = maybeParseField(array$2(IssuePRMentionSchema), record2.issuePRMentions);
12254
12129
  if (issuePRMentions) {
12255
12130
  normalized.issuePRMentions = issuePRMentions;
@@ -14321,7 +14196,7 @@ Requirements:
14321
14196
  "claude",
14322
14197
  "codex"
14323
14198
  ]);
14324
- function isRecord$c(value) {
14199
+ function isRecord$d(value) {
14325
14200
  return typeof value === "object" && value !== null;
14326
14201
  }
14327
14202
  function getTrimmedString(value) {
@@ -14338,7 +14213,7 @@ Requirements:
14338
14213
  return value === "builtin" || value === "registry" || value === "custom";
14339
14214
  }
14340
14215
  function normalizeLegacyProjectRef(value) {
14341
- if (!isRecord$c(value)) {
14216
+ if (!isRecord$d(value)) {
14342
14217
  return value;
14343
14218
  }
14344
14219
  const kind = value.kind;
@@ -14354,13 +14229,13 @@ Requirements:
14354
14229
  normalized.branch = existingBranch;
14355
14230
  } else {
14356
14231
  const legacyBranchFromString = getTrimmedString(legacyProject);
14357
- const legacyBranchFromObject = isRecord$c(legacyProject) ? getTrimmedString(legacyProject.branch) ?? getTrimmedString(legacyProject.project) : void 0;
14232
+ const legacyBranchFromObject = isRecord$d(legacyProject) ? getTrimmedString(legacyProject.branch) ?? getTrimmedString(legacyProject.project) : void 0;
14358
14233
  const resolvedBranch = legacyBranchFromString ?? legacyBranchFromObject;
14359
14234
  if (resolvedBranch) {
14360
14235
  normalized.branch = resolvedBranch;
14361
14236
  }
14362
14237
  }
14363
- if (isRecord$c(legacyProject)) {
14238
+ if (isRecord$d(legacyProject)) {
14364
14239
  if (kind === "github" && !getTrimmedString(normalized.repoFullName)) {
14365
14240
  const repoFullName = getTrimmedString(legacyProject.repoFullName);
14366
14241
  if (repoFullName) {
@@ -14397,7 +14272,7 @@ Requirements:
14397
14272
  };
14398
14273
  normalized.project = normalizeLegacyProjectRef(normalized.project);
14399
14274
  const currentProject = normalized.project;
14400
- const projectRecord = isRecord$c(currentProject) ? currentProject : void 0;
14275
+ const projectRecord = isRecord$d(currentProject) ? currentProject : void 0;
14401
14276
  const explicitBranch = getTrimmedString(normalized.branch) ?? getTrimmedString(currentProject) ?? (projectRecord ? getTrimmedString(projectRecord.branch) ?? getTrimmedString(projectRecord.project) : void 0);
14402
14277
  const repoFullName = (projectRecord ? getTrimmedString(projectRecord.repoFullName) : void 0) ?? getTrimmedString(normalized.repoFullName) ?? getTrimmedString(normalized.githubRepo);
14403
14278
  const localProjectId = (projectRecord ? getTrimmedString(projectRecord.localProjectId) : void 0) ?? getTrimmedString(normalized.localProjectId);
@@ -14440,7 +14315,7 @@ Requirements:
14440
14315
  return normalized;
14441
14316
  }
14442
14317
  function normalizeLegacyAcpSessionConfig(value) {
14443
- if (!isRecord$c(value)) {
14318
+ if (!isRecord$d(value)) {
14444
14319
  return value;
14445
14320
  }
14446
14321
  const normalized = {
@@ -14475,13 +14350,13 @@ Requirements:
14475
14350
  return normalized;
14476
14351
  }
14477
14352
  function normalizeLegacySessionMessage(parsed) {
14478
- if (!isRecord$c(parsed)) {
14353
+ if (!isRecord$d(parsed)) {
14479
14354
  return parsed;
14480
14355
  }
14481
14356
  const messageType = parsed.type;
14482
14357
  if (messageType === "session/create" || messageType === "session/chat") {
14483
14358
  const normalized = normalizeLegacySessionProject(parsed);
14484
- if (!isRecord$c(normalized)) {
14359
+ if (!isRecord$d(normalized)) {
14485
14360
  return normalized;
14486
14361
  }
14487
14362
  normalized.acpSessionConfig = normalizeLegacyAcpSessionConfig(normalized.acpSessionConfig);
@@ -15661,7 +15536,7 @@ Requirements:
15661
15536
  if (!parsed.success) return void 0;
15662
15537
  return parsed.data.claudeCode?.toolName;
15663
15538
  };
15664
- function isRecord$b(value) {
15539
+ function isRecord$c(value) {
15665
15540
  return typeof value === "object" && value !== null;
15666
15541
  }
15667
15542
  const LODY_CLAUDE_TASK_LIFECYCLE_RAW_INPUT_KEY = "lodyClaudeTaskLifecycle";
@@ -15734,7 +15609,7 @@ Requirements:
15734
15609
  skipTranscript: boolean().optional()
15735
15610
  });
15736
15611
  const parseLodyTaskMeta = (meta) => {
15737
- if (!isRecord$b(meta) || !isRecord$b(meta.lody)) return null;
15612
+ if (!isRecord$c(meta) || !isRecord$c(meta.lody)) return null;
15738
15613
  const parsed = LodyTaskMetaSchema.safeParse(meta.lody.task);
15739
15614
  if (!parsed.success) return null;
15740
15615
  const task = parsed.data;
@@ -15782,9 +15657,9 @@ Requirements:
15782
15657
  };
15783
15658
  };
15784
15659
  const parseSubagentTaskWire = (rawInput) => {
15785
- if (!isRecord$b(rawInput)) return null;
15660
+ if (!isRecord$c(rawInput)) return null;
15786
15661
  const carrier = rawInput[LODY_SUBAGENT_TASK_LIFECYCLE_RAW_INPUT_KEY] ?? rawInput[LODY_CLAUDE_TASK_LIFECYCLE_RAW_INPUT_KEY];
15787
- if (!isRecord$b(carrier)) return null;
15662
+ if (!isRecord$c(carrier)) return null;
15788
15663
  const parsed = SubagentTaskPayloadSchema.safeParse(carrier);
15789
15664
  return parsed.success ? parsed.data : null;
15790
15665
  };
@@ -17806,27 +17681,27 @@ ${outputTail}` : blockTail.output;
17806
17681
  droppedNotifications
17807
17682
  };
17808
17683
  }
17809
- const isRecord$a = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
17684
+ const isRecord$b = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
17810
17685
  const getBooleanField = (value, camelCaseKey, snakeCaseKey) => value[camelCaseKey] === true || value[snakeCaseKey] === true;
17811
17686
  const getClaudeCodeMeta = (meta) => {
17812
- if (!isRecord$a(meta)) return null;
17687
+ if (!isRecord$b(meta)) return null;
17813
17688
  const claudeCode = meta.claudeCode;
17814
- return isRecord$a(claudeCode) ? claudeCode : null;
17689
+ return isRecord$b(claudeCode) ? claudeCode : null;
17815
17690
  };
17816
17691
  const getCodexMeta = (meta) => {
17817
- if (!isRecord$a(meta)) return null;
17692
+ if (!isRecord$b(meta)) return null;
17818
17693
  const codex = meta.codex;
17819
- return isRecord$a(codex) ? codex : null;
17694
+ return isRecord$b(codex) ? codex : null;
17820
17695
  };
17821
17696
  const getLodyMeta = (meta) => {
17822
- if (!isRecord$a(meta)) return null;
17697
+ if (!isRecord$b(meta)) return null;
17823
17698
  const lody = meta.lody;
17824
- return isRecord$a(lody) ? lody : null;
17699
+ return isRecord$b(lody) ? lody : null;
17825
17700
  };
17826
17701
  const getLodyElicitationMeta = (meta) => {
17827
17702
  const lody = getLodyMeta(meta);
17828
17703
  const elicitation = lody?.elicitation;
17829
- return isRecord$a(elicitation) && elicitation.version === 1 ? elicitation : null;
17704
+ return isRecord$b(elicitation) && elicitation.version === 1 ? elicitation : null;
17830
17705
  };
17831
17706
  function parseAskUserQuestionPermissionMeta(meta) {
17832
17707
  const lody = getLodyMeta(meta);
@@ -17846,7 +17721,7 @@ ${outputTail}` : blockTail.output;
17846
17721
  }
17847
17722
  function parseLodyElicitationPermissionMeta(lody) {
17848
17723
  const raw2 = lody.elicitation;
17849
- if (!isRecord$a(raw2) || raw2.version !== 1 || !Array.isArray(raw2.questions)) return null;
17724
+ if (!isRecord$b(raw2) || raw2.version !== 1 || !Array.isArray(raw2.questions)) return null;
17850
17725
  const questions = parsePermissionQuestions(raw2.questions);
17851
17726
  if (!questions) return null;
17852
17727
  return {
@@ -17865,14 +17740,14 @@ ${outputTail}` : blockTail.output;
17865
17740
  if (rawQuestions.length === 0) return null;
17866
17741
  const questions = [];
17867
17742
  for (const rawQuestion of rawQuestions) {
17868
- if (!isRecord$a(rawQuestion)) return null;
17743
+ if (!isRecord$b(rawQuestion)) return null;
17869
17744
  if (typeof rawQuestion.question !== "string" || typeof rawQuestion.header !== "string") {
17870
17745
  return null;
17871
17746
  }
17872
17747
  if (!Array.isArray(rawQuestion.options)) return null;
17873
17748
  const options = [];
17874
17749
  for (const rawOption of rawQuestion.options) {
17875
- if (!isRecord$a(rawOption) || typeof rawOption.label !== "string") return null;
17750
+ if (!isRecord$b(rawOption) || typeof rawOption.label !== "string") return null;
17876
17751
  options.push({
17877
17752
  label: rawOption.label,
17878
17753
  ...typeof rawOption.description === "string" ? {
@@ -17903,18 +17778,18 @@ ${outputTail}` : blockTail.output;
17903
17778
  }
17904
17779
  function parseClaudeAskUserQuestionPermissionMeta(claudeCode) {
17905
17780
  const raw2 = claudeCode.askUserQuestion;
17906
- if (!isRecord$a(raw2)) return null;
17781
+ if (!isRecord$b(raw2)) return null;
17907
17782
  const rawQuestions = raw2.questions;
17908
17783
  if (!Array.isArray(rawQuestions) || rawQuestions.length === 0) return null;
17909
17784
  const questions = [];
17910
17785
  for (const rawQuestion of rawQuestions) {
17911
- if (!isRecord$a(rawQuestion)) return null;
17786
+ if (!isRecord$b(rawQuestion)) return null;
17912
17787
  if (typeof rawQuestion.question !== "string") return null;
17913
17788
  if (typeof rawQuestion.header !== "string") return null;
17914
17789
  if (!Array.isArray(rawQuestion.options)) return null;
17915
17790
  const options = [];
17916
17791
  for (const rawOption of rawQuestion.options) {
17917
- if (!isRecord$a(rawOption)) return null;
17792
+ if (!isRecord$b(rawOption)) return null;
17918
17793
  if (typeof rawOption.label !== "string") return null;
17919
17794
  options.push({
17920
17795
  label: rawOption.label,
@@ -17942,12 +17817,12 @@ ${outputTail}` : blockTail.output;
17942
17817
  }
17943
17818
  function parseCodexRequestUserInputPermissionMeta(codex) {
17944
17819
  const raw2 = codex.requestUserInput;
17945
- if (!isRecord$a(raw2)) return null;
17820
+ if (!isRecord$b(raw2)) return null;
17946
17821
  const rawQuestions = raw2.questions;
17947
17822
  if (!Array.isArray(rawQuestions) || rawQuestions.length === 0) return null;
17948
17823
  const questions = [];
17949
17824
  for (const rawQuestion of rawQuestions) {
17950
- if (!isRecord$a(rawQuestion)) return null;
17825
+ if (!isRecord$b(rawQuestion)) return null;
17951
17826
  if (typeof rawQuestion.id !== "string") return null;
17952
17827
  if (typeof rawQuestion.question !== "string") return null;
17953
17828
  if (typeof rawQuestion.header !== "string") return null;
@@ -17956,7 +17831,7 @@ ${outputTail}` : blockTail.output;
17956
17831
  if (rawOptions !== void 0) {
17957
17832
  if (!Array.isArray(rawOptions)) return null;
17958
17833
  for (const rawOption of rawOptions) {
17959
- if (!isRecord$a(rawOption)) return null;
17834
+ if (!isRecord$b(rawOption)) return null;
17960
17835
  if (typeof rawOption.label !== "string") return null;
17961
17836
  options.push({
17962
17837
  label: rawOption.label,
@@ -18021,21 +17896,21 @@ ${outputTail}` : blockTail.output;
18021
17896
  }
18022
17897
  const getCodexOutcomeAnswers = (outcomeMeta) => {
18023
17898
  const codex = getCodexMeta(outcomeMeta);
18024
- const requestUserInput = codex && isRecord$a(codex.requestUserInput) ? codex.requestUserInput : null;
18025
- return requestUserInput && isRecord$a(requestUserInput.answers) ? requestUserInput.answers : null;
17899
+ const requestUserInput = codex && isRecord$b(codex.requestUserInput) ? codex.requestUserInput : null;
17900
+ return requestUserInput && isRecord$b(requestUserInput.answers) ? requestUserInput.answers : null;
18026
17901
  };
18027
17902
  const getClaudeOutcomeAnswers = (outcomeMeta) => {
18028
17903
  const claudeCode = getClaudeCodeMeta(outcomeMeta);
18029
- const askUserQuestion = claudeCode && isRecord$a(claudeCode.askUserQuestion) ? claudeCode.askUserQuestion : null;
18030
- return askUserQuestion && isRecord$a(askUserQuestion.answers) ? askUserQuestion.answers : null;
17904
+ const askUserQuestion = claudeCode && isRecord$b(claudeCode.askUserQuestion) ? claudeCode.askUserQuestion : null;
17905
+ return askUserQuestion && isRecord$b(askUserQuestion.answers) ? askUserQuestion.answers : null;
18031
17906
  };
18032
17907
  const getLodyOutcomeAnswers = (outcomeMeta) => {
18033
17908
  const lody = getLodyMeta(outcomeMeta);
18034
- const elicitation = lody && isRecord$a(lody.elicitation) ? lody.elicitation : null;
18035
- return elicitation && isRecord$a(elicitation.answers) ? elicitation.answers : null;
17909
+ const elicitation = lody && isRecord$b(lody.elicitation) ? lody.elicitation : null;
17910
+ return elicitation && isRecord$b(elicitation.answers) ? elicitation.answers : null;
18036
17911
  };
18037
17912
  function extractAskUserQuestionAnswersFromOutcome(meta, outcome) {
18038
- if (!outcome || !isRecord$a(outcome._meta)) return null;
17913
+ if (!outcome || !isRecord$b(outcome._meta)) return null;
18039
17914
  const rawAnswers = meta.source === "lody" ? getLodyOutcomeAnswers(outcome._meta) : meta.source === "codex" ? getCodexOutcomeAnswers(outcome._meta) : getClaudeOutcomeAnswers(outcome._meta);
18040
17915
  if (!rawAnswers) return null;
18041
17916
  const result = {};
@@ -18044,7 +17919,7 @@ ${outputTail}` : blockTail.output;
18044
17919
  const raw2 = rawAnswers[key2];
18045
17920
  if (raw2 === void 0) continue;
18046
17921
  if (meta.source === "codex") {
18047
- if (!isRecord$a(raw2)) continue;
17922
+ if (!isRecord$b(raw2)) continue;
18048
17923
  const inner = raw2.answers;
18049
17924
  if (!Array.isArray(inner)) continue;
18050
17925
  const values = inner.filter((value) => typeof value === "string");
@@ -18060,20 +17935,20 @@ ${outputTail}` : blockTail.output;
18060
17935
  }
18061
17936
  return Object.keys(result).length > 0 ? result : null;
18062
17937
  }
18063
- const isEnumOption = (value) => isRecord$a(value) && typeof value.const === "string";
17938
+ const isEnumOption = (value) => isRecord$b(value) && typeof value.const === "string";
18064
17939
  const getEnumOptionSource = (prop) => {
18065
17940
  if (Array.isArray(prop.oneOf)) return prop.oneOf;
18066
17941
  if (Array.isArray(prop.enum)) return prop.enum;
18067
17942
  const items2 = prop.items;
18068
- if (isRecord$a(items2)) {
17943
+ if (isRecord$b(items2)) {
18069
17944
  if (Array.isArray(items2.anyOf)) return items2.anyOf;
18070
17945
  if (Array.isArray(items2.enum)) return items2.enum;
18071
17946
  }
18072
17947
  return null;
18073
17948
  };
18074
- const isQuestionProperty = (prop) => isRecord$a(prop) && getEnumOptionSource(prop) !== null;
18075
- const isFreeTextProperty = (prop) => isRecord$a(prop) && prop.type === "string" && !Array.isArray(prop.oneOf) && !Array.isArray(prop.enum);
18076
- const isMultiSelectProperty = (prop) => prop.type === "array" || isRecord$a(prop.items);
17949
+ const isQuestionProperty = (prop) => isRecord$b(prop) && getEnumOptionSource(prop) !== null;
17950
+ const isFreeTextProperty = (prop) => isRecord$b(prop) && prop.type === "string" && !Array.isArray(prop.oneOf) && !Array.isArray(prop.enum);
17951
+ const isMultiSelectProperty = (prop) => prop.type === "array" || isRecord$b(prop.items);
18077
17952
  const parseElicitationOptions = (source) => {
18078
17953
  const options = [];
18079
17954
  for (const entry of source) {
@@ -18102,14 +17977,14 @@ ${outputTail}` : blockTail.output;
18102
17977
  return options;
18103
17978
  };
18104
17979
  function parseAskUserQuestionElicitationRequest(request2) {
18105
- if (!isRecord$a(request2) || request2.mode !== "form") return null;
17980
+ if (!isRecord$b(request2) || request2.mode !== "form") return null;
18106
17981
  const schema2 = request2.requestedSchema;
18107
- if (!isRecord$a(schema2) || !isRecord$a(schema2.properties)) return null;
17982
+ if (!isRecord$b(schema2) || !isRecord$b(schema2.properties)) return null;
18108
17983
  const entries = Object.entries(schema2.properties);
18109
17984
  const requestMeta = getLodyElicitationMeta(request2._meta);
18110
17985
  const customFieldKeyByQuestionId = /* @__PURE__ */ new Map();
18111
17986
  for (const [key2, prop] of entries) {
18112
- if (!isRecord$a(prop)) continue;
17987
+ if (!isRecord$b(prop)) continue;
18113
17988
  const meta = getLodyElicitationMeta(prop._meta);
18114
17989
  if (typeof meta?.customAnswerFor === "string" && meta.customAnswerFor.length > 0) {
18115
17990
  customFieldKeyByQuestionId.set(meta.customAnswerFor, key2);
@@ -18117,19 +17992,19 @@ ${outputTail}` : blockTail.output;
18117
17992
  }
18118
17993
  const isLodyForm = requestMeta !== null || customFieldKeyByQuestionId.size > 0;
18119
17994
  const questionEntries = entries.filter(([, prop]) => {
18120
- if (!isRecord$a(prop)) return false;
17995
+ if (!isRecord$b(prop)) return false;
18121
17996
  if (getLodyElicitationMeta(prop._meta)?.customAnswerFor) return false;
18122
17997
  return isQuestionProperty(prop) || isLodyForm && isFreeTextProperty(prop);
18123
17998
  });
18124
17999
  if (questionEntries.length === 0) return null;
18125
18000
  const singleQuestion = questionEntries.length === 1;
18126
- const allowCustomAnswer = isLodyForm ? questionEntries.some(([key2, prop]) => isRecord$a(prop) && (getEnumOptionSource(prop) === null || customFieldKeyByQuestionId.has(key2))) : entries.some(([, prop]) => isFreeTextProperty(prop));
18001
+ const allowCustomAnswer = isLodyForm ? questionEntries.some(([key2, prop]) => isRecord$b(prop) && (getEnumOptionSource(prop) === null || customFieldKeyByQuestionId.has(key2))) : entries.some(([, prop]) => isFreeTextProperty(prop));
18127
18002
  const message = typeof request2.message === "string" ? request2.message : "";
18128
18003
  const questions = [];
18129
18004
  const fieldKeys = [];
18130
18005
  const customFieldKeys = [];
18131
18006
  for (const [key2, prop] of questionEntries) {
18132
- if (!isRecord$a(prop)) continue;
18007
+ if (!isRecord$b(prop)) continue;
18133
18008
  const source = getEnumOptionSource(prop);
18134
18009
  const header = typeof prop.title === "string" ? prop.title : "";
18135
18010
  const description2 = typeof prop.description === "string" ? prop.description : "";
@@ -18177,7 +18052,7 @@ ${outputTail}` : blockTail.output;
18177
18052
  };
18178
18053
  }
18179
18054
  const answers = extractAskUserQuestionAnswersFromOutcome(elicitation.meta, {
18180
- _meta: isRecord$a(outcome._meta) ? outcome._meta : null
18055
+ _meta: isRecord$b(outcome._meta) ? outcome._meta : null
18181
18056
  });
18182
18057
  if (!answers) {
18183
18058
  return {
@@ -18203,7 +18078,7 @@ ${outputTail}` : blockTail.output;
18203
18078
  }
18204
18079
  const FIVE_HOURS_SECONDS = 5 * 60 * 60;
18205
18080
  const SEVEN_DAYS_SECONDS = 7 * 24 * 60 * 60;
18206
- function isRecord$9(value) {
18081
+ function isRecord$a(value) {
18207
18082
  return typeof value === "object" && value !== null && !Array.isArray(value);
18208
18083
  }
18209
18084
  function optionalString(value) {
@@ -18228,7 +18103,7 @@ ${outputTail}` : blockTail.output;
18228
18103
  };
18229
18104
  }
18230
18105
  function legacyWallet(value) {
18231
- if (!isRecord$9(value)) return void 0;
18106
+ if (!isRecord$a(value)) return void 0;
18232
18107
  const fields = [
18233
18108
  "balanceCents",
18234
18109
  "totalCents",
@@ -18249,9 +18124,9 @@ ${outputTail}` : blockTail.output;
18249
18124
  };
18250
18125
  }
18251
18126
  function normalizePersistedRateLimit(provider, keyLimitId, value) {
18252
- if (!isRecord$9(value)) return null;
18127
+ if (!isRecord$a(value)) return null;
18253
18128
  const currentWindows = value.windows;
18254
- if (typeof value.limitId === "string" && isRecord$9(value.scope) && typeof value.scope.providerId === "string" && Array.isArray(currentWindows) && currentWindows.every((window2) => isRecord$9(window2) && typeof window2.usedPercent === "number" && (typeof window2.windowDurationSeconds === "number" || window2.windowDurationSeconds === null) && (typeof window2.resetsAtEpochSeconds === "number" || window2.resetsAtEpochSeconds === null))) {
18129
+ if (typeof value.limitId === "string" && isRecord$a(value.scope) && typeof value.scope.providerId === "string" && Array.isArray(currentWindows) && currentWindows.every((window2) => isRecord$a(window2) && typeof window2.usedPercent === "number" && (typeof window2.windowDurationSeconds === "number" || window2.windowDurationSeconds === null) && (typeof window2.resetsAtEpochSeconds === "number" || window2.resetsAtEpochSeconds === null))) {
18255
18130
  return value;
18256
18131
  }
18257
18132
  const legacy2 = value;
@@ -21029,7 +20904,6 @@ ${tailedOutput}` : null;
21029
20904
  ...args2.taskToolsEnabled !== void 0 ? {
21030
20905
  taskToolsEnabled: args2.taskToolsEnabled === true
21031
20906
  } : {},
21032
- agentRoleInvocations: normalizeAgentRoleInvocationSnapshots(args2.agentRoleInvocations),
21033
20907
  issuePRMentions: args2.issuePRMentions,
21034
20908
  resume: args2.resume
21035
20909
  };
@@ -23054,7 +22928,7 @@ ${context2.authorReply.trim()}
23054
22928
  ];
23055
22929
  const buildPreviewTunnelRefreshPath = (tunnelId) => `${PREVIEW_TUNNELS_API_PATH}/${encodeURIComponent(tunnelId)}/refresh`;
23056
22930
  const buildPreviewTunnelRevokePath = (tunnelId) => `${PREVIEW_TUNNELS_API_PATH}/${encodeURIComponent(tunnelId)}/revoke`;
23057
- const isRecord$8 = (value) => typeof value === "object" && value !== null;
22931
+ const isRecord$9 = (value) => typeof value === "object" && value !== null;
23058
22932
  const isString$2 = (value) => typeof value === "string";
23059
22933
  const isOptionalNumber = (value) => value === void 0 || typeof value === "number";
23060
22934
  const isOptionalBoolean = (value) => value === void 0 || typeof value === "boolean";
@@ -23062,11 +22936,11 @@ ${context2.authorReply.trim()}
23062
22936
  const isStringArray = (value) => Array.isArray(value) && value.every((item) => typeof item === "string");
23063
22937
  const isHeaderEntries = (value) => Array.isArray(value) && value.every((entry) => Array.isArray(entry) && entry.length === 2 && typeof entry[0] === "string" && typeof entry[1] === "string");
23064
22938
  const isPreviewTunnelBinaryPayloadStream = (value) => value === "request-body" || value === "response-body" || value === "websocket-frame";
23065
- const isPreviewResourceLimits = (value) => isRecord$8(value) && isPositiveInteger(value.maxRequestBodyBytes) && isPositiveInteger(value.maxResponseBodyBytes) && isPositiveInteger(value.maxRequestDurationMs);
22939
+ const isPreviewResourceLimits = (value) => isRecord$9(value) && isPositiveInteger(value.maxRequestBodyBytes) && isPositiveInteger(value.maxResponseBodyBytes) && isPositiveInteger(value.maxRequestDurationMs);
23066
22940
  const parseJsonRecord = (raw2) => {
23067
22941
  try {
23068
22942
  const parsed = JSON.parse(raw2);
23069
- return isRecord$8(parsed) ? parsed : null;
22943
+ return isRecord$9(parsed) ? parsed : null;
23070
22944
  } catch {
23071
22945
  return null;
23072
22946
  }
@@ -23105,8 +22979,8 @@ ${context2.authorReply.trim()}
23105
22979
  const parsed = parseJsonRecord(raw2);
23106
22980
  return parsed && isPreviewTunnelServerMessage(parsed) ? parsed : null;
23107
22981
  };
23108
- const isPreviewTunnelCreateResponse = (value) => isRecord$8(value) && isString$2(value.tunnelId) && isString$2(value.publicUrl) && isString$2(value.websocketUrl) && isString$2(value.sessionToken) && typeof value.expiresAt === "number" && (value.resourceLimits === void 0 || isPreviewResourceLimits(value.resourceLimits));
23109
- const isPreviewTunnelRefreshResponse = (value) => isRecord$8(value) && isString$2(value.websocketUrl) && isString$2(value.sessionToken) && typeof value.expiresAt === "number";
22982
+ const isPreviewTunnelCreateResponse = (value) => isRecord$9(value) && isString$2(value.tunnelId) && isString$2(value.publicUrl) && isString$2(value.websocketUrl) && isString$2(value.sessionToken) && typeof value.expiresAt === "number" && (value.resourceLimits === void 0 || isPreviewResourceLimits(value.resourceLimits));
22983
+ const isPreviewTunnelRefreshResponse = (value) => isRecord$9(value) && isString$2(value.websocketUrl) && isString$2(value.sessionToken) && typeof value.expiresAt === "number";
23110
22984
  const stripIpv6Brackets = (host) => {
23111
22985
  const normalized = host.trim().toLowerCase().replace(/\.$/, "");
23112
22986
  return normalized.startsWith("[") && normalized.endsWith("]") ? normalized.slice(1, -1) : normalized;
@@ -23397,7 +23271,7 @@ ${context2.authorReply.trim()}
23397
23271
  key: machineFlockKeys.dotlodyPath()
23398
23272
  };
23399
23273
  }
23400
- if (key2.length === 3 && key2[0] === "cmd" && key2[1] === "archiveSession" && isNonEmptyString$1(key2[2])) {
23274
+ if (key2.length === 3 && key2[0] === "cmd" && key2[1] === "archiveSession" && isNonEmptyString$2(key2[2])) {
23401
23275
  const sessionId = key2[2];
23402
23276
  return {
23403
23277
  kind: "archiveSessionCommand",
@@ -23405,7 +23279,7 @@ ${context2.authorReply.trim()}
23405
23279
  sessionId
23406
23280
  };
23407
23281
  }
23408
- if (key2.length === 3 && key2[0] === "cmd" && key2[1] === "deleteSession" && isNonEmptyString$1(key2[2])) {
23282
+ if (key2.length === 3 && key2[0] === "cmd" && key2[1] === "deleteSession" && isNonEmptyString$2(key2[2])) {
23409
23283
  const sessionId = key2[2];
23410
23284
  return {
23411
23285
  kind: "deleteSessionCommand",
@@ -23413,7 +23287,7 @@ ${context2.authorReply.trim()}
23413
23287
  sessionId
23414
23288
  };
23415
23289
  }
23416
- if (key2.length === 3 && key2[0] === "cmd" && key2[1] === "deleteLocalProject" && isNonEmptyString$1(key2[2])) {
23290
+ if (key2.length === 3 && key2[0] === "cmd" && key2[1] === "deleteLocalProject" && isNonEmptyString$2(key2[2])) {
23417
23291
  const localProjectId = key2[2];
23418
23292
  return {
23419
23293
  kind: "deleteLocalProjectCommand",
@@ -23421,7 +23295,7 @@ ${context2.authorReply.trim()}
23421
23295
  localProjectId
23422
23296
  };
23423
23297
  }
23424
- if (key2.length === 2 && key2[0] === "localProject" && isNonEmptyString$1(key2[1])) {
23298
+ if (key2.length === 2 && key2[0] === "localProject" && isNonEmptyString$2(key2[1])) {
23425
23299
  const localProjectId = key2[1];
23426
23300
  return {
23427
23301
  kind: "localProject",
@@ -23429,7 +23303,7 @@ ${context2.authorReply.trim()}
23429
23303
  localProjectId
23430
23304
  };
23431
23305
  }
23432
- if (key2.length === 2 && key2[0] === "agentConfig" && isNonEmptyString$1(key2[1])) {
23306
+ if (key2.length === 2 && key2[0] === "agentConfig" && isNonEmptyString$2(key2[1])) {
23433
23307
  const agentConfigId = key2[1];
23434
23308
  return {
23435
23309
  kind: "agentConfig",
@@ -23437,7 +23311,7 @@ ${context2.authorReply.trim()}
23437
23311
  agentConfigId
23438
23312
  };
23439
23313
  }
23440
- if (key2.length === 2 && key2[0] === "providerSetup" && isNonEmptyString$1(key2[1])) {
23314
+ if (key2.length === 2 && key2[0] === "providerSetup" && isNonEmptyString$2(key2[1])) {
23441
23315
  const providerSetupId = key2[1];
23442
23316
  return {
23443
23317
  kind: "providerSetup",
@@ -23445,7 +23319,7 @@ ${context2.authorReply.trim()}
23445
23319
  providerSetupId
23446
23320
  };
23447
23321
  }
23448
- if (key2.length === 2 && key2[0] === "providerSetupCancellation" && isNonEmptyString$1(key2[1])) {
23322
+ if (key2.length === 2 && key2[0] === "providerSetupCancellation" && isNonEmptyString$2(key2[1])) {
23449
23323
  const providerSetupId = key2[1];
23450
23324
  return {
23451
23325
  kind: "providerSetupCancellation",
@@ -23453,7 +23327,7 @@ ${context2.authorReply.trim()}
23453
23327
  providerSetupId
23454
23328
  };
23455
23329
  }
23456
- if (key2.length === 2 && key2[0] === "agentConfigIndex" && isNonEmptyString$1(key2[1])) {
23330
+ if (key2.length === 2 && key2[0] === "agentConfigIndex" && isNonEmptyString$2(key2[1])) {
23457
23331
  const agentConfigId = key2[1];
23458
23332
  return {
23459
23333
  kind: "agentConfigIndex",
@@ -23461,7 +23335,7 @@ ${context2.authorReply.trim()}
23461
23335
  agentConfigId
23462
23336
  };
23463
23337
  }
23464
- if (key2.length === 2 && key2[0] === "acpCapability" && isNonEmptyString$1(key2[1])) {
23338
+ if (key2.length === 2 && key2[0] === "acpCapability" && isNonEmptyString$2(key2[1])) {
23465
23339
  const configId = key2[1];
23466
23340
  return {
23467
23341
  kind: "acpCapability",
@@ -23469,7 +23343,7 @@ ${context2.authorReply.trim()}
23469
23343
  configId
23470
23344
  };
23471
23345
  }
23472
- if (key2.length === 3 && key2[0] === "rateLimit" && isCliType(key2[1]) && isNonEmptyString$1(key2[2])) {
23346
+ if (key2.length === 3 && key2[0] === "rateLimit" && isCliType(key2[1]) && isNonEmptyString$2(key2[2])) {
23473
23347
  return {
23474
23348
  kind: "rateLimit",
23475
23349
  key: machineFlockKeys.rateLimit(key2[1], key2[2]),
@@ -23477,7 +23351,7 @@ ${context2.authorReply.trim()}
23477
23351
  limitId: key2[2]
23478
23352
  };
23479
23353
  }
23480
- if (key2.length === 2 && key2[0] === "sessionLaunchConfig" && isNonEmptyString$1(key2[1])) {
23354
+ if (key2.length === 2 && key2[0] === "sessionLaunchConfig" && isNonEmptyString$2(key2[1])) {
23481
23355
  const sessionId = key2[1];
23482
23356
  return {
23483
23357
  kind: "sessionLaunchConfig",
@@ -23815,7 +23689,7 @@ ${context2.authorReply.trim()}
23815
23689
  value
23816
23690
  } : void 0;
23817
23691
  case "rateLimit":
23818
- return isRecord$7(value) ? {
23692
+ return isRecord$8(value) ? {
23819
23693
  key: parsedKey.key,
23820
23694
  value
23821
23695
  } : void 0;
@@ -23834,16 +23708,16 @@ ${context2.authorReply.trim()}
23834
23708
  if (!left2 || !right2) return false;
23835
23709
  return serializeMachineFlockKey(left2.key) === serializeMachineFlockKey(right2.key) && JSON.stringify(left2.value) === JSON.stringify(right2.value);
23836
23710
  }
23837
- const isRecord$7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
23838
- const isNonEmptyString$1 = (value) => typeof value === "string" && value.length > 0;
23711
+ const isRecord$8 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
23712
+ const isNonEmptyString$2 = (value) => typeof value === "string" && value.length > 0;
23839
23713
  const nonEmptyString = (value) => {
23840
23714
  const trimmed2 = value?.trim();
23841
23715
  return trimmed2 ? trimmed2 : void 0;
23842
23716
  };
23843
23717
  const isMissing = (value) => value === void 0 || value === null;
23844
- const isStringRecord$1 = (value) => isRecord$7(value) && Object.values(value).every((entry) => typeof entry === "string");
23718
+ const isStringRecord$1 = (value) => isRecord$8(value) && Object.values(value).every((entry) => typeof entry === "string");
23845
23719
  const normalizeWorktreeScriptConfig = (value) => {
23846
- if (!isRecord$7(value) || !isRecord$7(value.scripts)) {
23720
+ if (!isRecord$8(value) || !isRecord$8(value.scripts)) {
23847
23721
  return void 0;
23848
23722
  }
23849
23723
  for (const key2 of Object.keys(value.scripts)) {
@@ -23876,7 +23750,7 @@ ${context2.authorReply.trim()}
23876
23750
  return config2;
23877
23751
  };
23878
23752
  const normalizeSessionLaunchConfig = (value) => {
23879
- if (!isRecord$7(value)) {
23753
+ if (!isRecord$8(value)) {
23880
23754
  return void 0;
23881
23755
  }
23882
23756
  const config2 = {};
@@ -23921,7 +23795,7 @@ ${context2.authorReply.trim()}
23921
23795
  const isCliType = (value) => typeof value === "string" && isBuiltinAgentType(value);
23922
23796
  const isAgentConfigCliType$1 = (value) => value === "builtin" || value === "registry" || value === "custom";
23923
23797
  const normalizeMachineArchiveSessionCommand = (value) => {
23924
- if (!isRecord$7(value) || value.v !== 1 || typeof value.requestedAt !== "number") {
23798
+ if (!isRecord$8(value) || value.v !== 1 || typeof value.requestedAt !== "number") {
23925
23799
  return void 0;
23926
23800
  }
23927
23801
  const command2 = {
@@ -23937,7 +23811,7 @@ ${context2.authorReply.trim()}
23937
23811
  return command2;
23938
23812
  };
23939
23813
  const normalizeMachineDeleteSessionCommand = (value) => {
23940
- if (!isRecord$7(value) || value.v !== 1 || typeof value.requestedAt !== "number") {
23814
+ if (!isRecord$8(value) || value.v !== 1 || typeof value.requestedAt !== "number") {
23941
23815
  return void 0;
23942
23816
  }
23943
23817
  const command2 = {
@@ -23975,7 +23849,7 @@ ${context2.authorReply.trim()}
23975
23849
  return command2;
23976
23850
  };
23977
23851
  const normalizeMachineDeleteLocalProjectCommand = (value) => {
23978
- if (!isRecord$7(value) || value.v !== 1 || typeof value.requestedAt !== "number") {
23852
+ if (!isRecord$8(value) || value.v !== 1 || typeof value.requestedAt !== "number") {
23979
23853
  return void 0;
23980
23854
  }
23981
23855
  const command2 = {
@@ -23991,7 +23865,7 @@ ${context2.authorReply.trim()}
23991
23865
  return command2;
23992
23866
  };
23993
23867
  const normalizeLocalProjectMeta = (value) => {
23994
- if (!isRecord$7(value) || !isNonEmptyString$1(value.id) || !isNonEmptyString$1(value.name) || !isNonEmptyString$1(value.rootPath) || typeof value.createdAtMs !== "number") {
23868
+ if (!isRecord$8(value) || !isNonEmptyString$2(value.id) || !isNonEmptyString$2(value.name) || !isNonEmptyString$2(value.rootPath) || typeof value.createdAtMs !== "number") {
23995
23869
  return void 0;
23996
23870
  }
23997
23871
  const project = {
@@ -24012,7 +23886,7 @@ ${context2.authorReply.trim()}
24012
23886
  return project;
24013
23887
  };
24014
23888
  const normalizeAgentConfigMeta$1 = (value) => {
24015
- if (!isRecord$7(value) || !isNonEmptyString$1(value.id) || !isNonEmptyString$1(value.machineId) || !isNonEmptyString$1(value.name) || !isMissing(value.description) && typeof value.description !== "string" || !isAgentConfigCliType$1(value.cliType) || !isNonEmptyString$1(value.agentType) || !isStringRecord$1(value.env)) {
23889
+ if (!isRecord$8(value) || !isNonEmptyString$2(value.id) || !isNonEmptyString$2(value.machineId) || !isNonEmptyString$2(value.name) || !isMissing(value.description) && typeof value.description !== "string" || !isAgentConfigCliType$1(value.cliType) || !isNonEmptyString$2(value.agentType) || !isStringRecord$1(value.env)) {
24016
23890
  return void 0;
24017
23891
  }
24018
23892
  const config2 = {
@@ -24039,7 +23913,7 @@ ${context2.authorReply.trim()}
24039
23913
  config2.prompt = value.prompt;
24040
23914
  }
24041
23915
  if (!isMissing(value.titleGeneration)) {
24042
- if (!isRecord$7(value.titleGeneration)) return void 0;
23916
+ if (!isRecord$8(value.titleGeneration)) return void 0;
24043
23917
  config2.titleGeneration = value.titleGeneration;
24044
23918
  }
24045
23919
  if (!isMissing(value.brandId)) {
@@ -24051,7 +23925,7 @@ ${context2.authorReply.trim()}
24051
23925
  const isProviderSetupStatus = (value) => value === "queued" || value === "preparing-runtime" || value === "verifying" || value === "awaiting-auth" || value === "failed";
24052
23926
  const isProviderSetupFailureCode = (value) => value === "runtime-unavailable" || value === "runtime-install-failed" || value === "verification-failed";
24053
23927
  const normalizeProviderSetupTask = (value) => {
24054
- if (!isRecord$7(value) || value.v !== 1 || !isNonEmptyString$1(value.id) || !isNonEmptyString$1(value.machineId) || !isProviderSetupStatus(value.status) || typeof value.attempt !== "number" || !Number.isInteger(value.attempt) || value.attempt < 1 || typeof value.createdAt !== "number" || !Number.isFinite(value.createdAt) || typeof value.updatedAt !== "number" || !Number.isFinite(value.updatedAt)) {
23928
+ if (!isRecord$8(value) || value.v !== 1 || !isNonEmptyString$2(value.id) || !isNonEmptyString$2(value.machineId) || !isProviderSetupStatus(value.status) || typeof value.attempt !== "number" || !Number.isInteger(value.attempt) || value.attempt < 1 || typeof value.createdAt !== "number" || !Number.isFinite(value.createdAt) || typeof value.updatedAt !== "number" || !Number.isFinite(value.updatedAt)) {
24055
23929
  return void 0;
24056
23930
  }
24057
23931
  const config2 = normalizeAgentConfigMeta$1(value.config);
@@ -24076,7 +23950,7 @@ ${context2.authorReply.trim()}
24076
23950
  };
24077
23951
  };
24078
23952
  const normalizeProviderSetupCancellation = (value) => {
24079
- if (!isRecord$7(value) || value.v !== 1 || !isNonEmptyString$1(value.id) || !isNonEmptyString$1(value.machineId) || typeof value.cancelledAt !== "number" || !Number.isFinite(value.cancelledAt)) {
23953
+ if (!isRecord$8(value) || value.v !== 1 || !isNonEmptyString$2(value.id) || !isNonEmptyString$2(value.machineId) || typeof value.cancelledAt !== "number" || !Number.isFinite(value.cancelledAt)) {
24080
23954
  return void 0;
24081
23955
  }
24082
23956
  return {
@@ -24087,7 +23961,7 @@ ${context2.authorReply.trim()}
24087
23961
  };
24088
23962
  };
24089
23963
  const normalizeAgentConfigListSummary = (value) => {
24090
- if (!isRecord$7(value) || !isNonEmptyString$1(value.id) || !isNonEmptyString$1(value.machineId) || !isNonEmptyString$1(value.name) || !isMissing(value.description) && typeof value.description !== "string" || !isAgentConfigCliType$1(value.cliType) || !isNonEmptyString$1(value.agentType) || !isMissing(value.brandId) && typeof value.brandId !== "string") {
23964
+ if (!isRecord$8(value) || !isNonEmptyString$2(value.id) || !isNonEmptyString$2(value.machineId) || !isNonEmptyString$2(value.name) || !isMissing(value.description) && typeof value.description !== "string" || !isAgentConfigCliType$1(value.cliType) || !isNonEmptyString$2(value.agentType) || !isMissing(value.brandId) && typeof value.brandId !== "string") {
24091
23965
  return void 0;
24092
23966
  }
24093
23967
  const summary2 = {
@@ -24105,7 +23979,95 @@ ${context2.authorReply.trim()}
24105
23979
  }
24106
23980
  return summary2;
24107
23981
  };
24108
- const isAcpCapabilityCacheEntry = (value) => isRecord$7(value) && isAgentConfigCliType$1(value.cliType) && isNonEmptyString$1(value.agentType) && Array.isArray(value.modes) && Array.isArray(value.models) && typeof value.fetchedAt === "number";
23982
+ const isAcpCapabilityCacheEntry = (value) => isRecord$8(value) && isAgentConfigCliType$1(value.cliType) && isNonEmptyString$2(value.agentType) && Array.isArray(value.modes) && Array.isArray(value.models) && typeof value.fetchedAt === "number";
23983
+ const AGENT_ROLE_VERSION = 1;
23984
+ const isRecord$7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
23985
+ const isNonEmptyString$1 = (value) => typeof value === "string" && value.trim().length > 0;
23986
+ const isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
23987
+ const isAgentRoleVisibility = (value) => value === "private" || value === "workspace";
23988
+ const AGENT_ROLE_MENTION_SLUG_MAX_LENGTH = 40;
23989
+ const AGENT_ROLE_EMOJI_MAX_LENGTH = 8;
23990
+ const getAgentRoleMentionSlug = (role) => normalizeAgentRoleMentionSlug(role.name);
23991
+ const normalizeAgentRoleMentionSlug = (value) => {
23992
+ const collapsed = value.trim().replace(/^@+/u, "").replace(new RegExp("\\p{Cc}", "gu"), "").replace(/\s+/gu, "-").replace(/-{2,}/gu, "-").replace(/^-+|-+$/gu, "");
23993
+ return Array.from(collapsed).slice(0, AGENT_ROLE_MENTION_SLUG_MAX_LENGTH).join("");
23994
+ };
23995
+ const normalizeAgentRoleEmoji = (value) => {
23996
+ if (typeof value !== "string") return void 0;
23997
+ const stripped = value.replace(new RegExp("\\p{Cc}", "gu"), "").replace(/\s+/gu, "");
23998
+ const capped = Array.from(stripped).slice(0, AGENT_ROLE_EMOJI_MAX_LENGTH).join("");
23999
+ return capped || void 0;
24000
+ };
24001
+ const EXTRA_SENSITIVE_ROLE_OPTION_KEY_PATTERN = /(?:\bkey\b|cookie|session[_-]?id|private)/i;
24002
+ const isSensitiveAgentRoleConfigOptionKey = (key2) => isSensitiveAcpConfigOptionId(key2) || EXTRA_SENSITIVE_ROLE_OPTION_KEY_PATTERN.test(key2);
24003
+ const normalizeAgentRoleConfigOptionValues = (value) => {
24004
+ if (!isRecord$7(value)) return void 0;
24005
+ const normalized = {};
24006
+ for (const [key2, entry] of Object.entries(value)) {
24007
+ const trimmedKey = key2.trim();
24008
+ if (!trimmedKey || isSensitiveAgentRoleConfigOptionKey(trimmedKey)) continue;
24009
+ if (typeof entry === "boolean") {
24010
+ normalized[trimmedKey] = entry;
24011
+ continue;
24012
+ }
24013
+ if (typeof entry === "string") {
24014
+ normalized[trimmedKey] = entry;
24015
+ }
24016
+ }
24017
+ return Object.keys(normalized).length > 0 ? normalized : void 0;
24018
+ };
24019
+ const normalizeAgentRoleRunConfig = (value) => {
24020
+ if (!isRecord$7(value)) return {};
24021
+ const modeId = typeof value.modeId === "string" ? value.modeId.trim() : "";
24022
+ const modelId = typeof value.modelId === "string" ? value.modelId.trim() : "";
24023
+ const configOptionValues = normalizeAgentRoleConfigOptionValues(value.configOptionValues);
24024
+ return {
24025
+ ...modeId ? {
24026
+ modeId
24027
+ } : {},
24028
+ ...modelId ? {
24029
+ modelId
24030
+ } : {},
24031
+ ...configOptionValues ? {
24032
+ configOptionValues
24033
+ } : {}
24034
+ };
24035
+ };
24036
+ const isAgentRole = (value) => {
24037
+ if (!isRecord$7(value) || value.v !== AGENT_ROLE_VERSION || !isNonEmptyString$1(value.id) || !isNonEmptyString$1(value.ownerUserId) || !isAgentRoleVisibility(value.visibility) || !isNonEmptyString$1(value.name) || !isNonEmptyString$1(value.machineId) || !isNonEmptyString$1(value.agentConfigId) || !isFiniteNumber(value.revision) || !isFiniteNumber(value.createdAt) || !isFiniteNumber(value.updatedAt)) {
24038
+ return false;
24039
+ }
24040
+ if (value.emoji !== void 0 && typeof value.emoji !== "string") return false;
24041
+ if (value.promptPrefix !== void 0 && typeof value.promptPrefix !== "string") return false;
24042
+ if (value.runConfig !== void 0 && !isRecord$7(value.runConfig)) return false;
24043
+ return getAgentRoleMentionSlug({
24044
+ name: value.name.trim()
24045
+ }).length > 0;
24046
+ };
24047
+ const normalizeAgentRole = (value) => {
24048
+ if (!isAgentRole(value)) return void 0;
24049
+ const emoji = normalizeAgentRoleEmoji(value.emoji);
24050
+ const promptPrefix = value.promptPrefix?.trim();
24051
+ return {
24052
+ v: AGENT_ROLE_VERSION,
24053
+ id: value.id.trim(),
24054
+ ownerUserId: value.ownerUserId.trim(),
24055
+ visibility: value.visibility,
24056
+ name: value.name.trim(),
24057
+ ...emoji ? {
24058
+ emoji
24059
+ } : {},
24060
+ machineId: value.machineId.trim(),
24061
+ agentConfigId: value.agentConfigId.trim(),
24062
+ runConfig: normalizeAgentRoleRunConfig(value.runConfig),
24063
+ ...promptPrefix ? {
24064
+ promptPrefix
24065
+ } : {},
24066
+ revision: Math.max(1, Math.trunc(value.revision)),
24067
+ createdAt: value.createdAt,
24068
+ updatedAt: value.updatedAt
24069
+ };
24070
+ };
24109
24071
  const WORKSPACE_FLOCK_DOC_STREAM_SEGMENT = "wf";
24110
24072
  const WORKSPACE_FLOCK_DOC_NAME = "workspace";
24111
24073
  const getWorkspaceFlockDocId = (workspaceId) => `${workspaceId}:${WORKSPACE_FLOCK_DOC_STREAM_SEGMENT}:${WORKSPACE_FLOCK_DOC_NAME}`;
@@ -24174,6 +24136,7 @@ ${context2.authorReply.trim()}
24174
24136
  };
24175
24137
  };
24176
24138
  const isMcpServerRow = (row) => row.key[0] === "mcpServer";
24139
+ const isAgentRoleRow = (row) => row.key[0] === "agentRole";
24177
24140
  const readWorkspaceFlockRowsFromFlock = (flock) => {
24178
24141
  const rows = {};
24179
24142
  for (const family of WORKSPACE_FLOCK_ROW_FAMILIES) {
@@ -24200,6 +24163,7 @@ ${context2.authorReply.trim()}
24200
24163
  return catalog;
24201
24164
  };
24202
24165
  const listWorkspaceMcpServers = (rows) => Object.values(rows).filter(isMcpServerRow).map((row) => row.value).sort((left2, right2) => left2.name.localeCompare(right2.name) || left2.id.localeCompare(right2.id));
24166
+ const listWorkspaceAgentRoles = (rows) => Object.values(rows).filter(isAgentRoleRow).map((row) => row.value).sort((left2, right2) => left2.name.localeCompare(right2.name) || left2.id.localeCompare(right2.id));
24203
24167
  const workspaceFlockRowsEqual = (left2, right2) => {
24204
24168
  if (left2 === right2) return true;
24205
24169
  if (!left2 || !right2) return false;
@@ -220325,7 +220289,7 @@ ${page}${helpTipBottom}${choiceDescription}${ansiEscapes.cursorHide}`;
220325
220289
  data = createReviewBundleSnapshot(bundle);
220326
220290
  }
220327
220291
  const { injectReviewSnapshot } = await import("./chunks/index-VoI6Ds2-.js");
220328
- const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-DE7MFi1P.js").then(async (m) => {
220292
+ const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-Bcj5lkU7.js").then(async (m) => {
220329
220293
  await m.__tla;
220330
220294
  return m;
220331
220295
  });
@@ -238723,7 +238687,7 @@ ${result.stdout ?? ""}`;
238723
238687
  const SessionCreateCommandInputShape = {
238724
238688
  deadlineSeconds: number$4().int().min(LODY_OPERATION_MIN_DEADLINE_SECONDS).max(LODY_OPERATION_MAX_DEADLINE_SECONDS).optional(),
238725
238689
  prompt: string$1().trim().min(1).describe("Initial user prompt for the new session."),
238726
- agentRoleId: string$1().trim().min(1).optional().describe("Agent Role id authorized by an agent_role mention in the driving user turn. When set, machine, agent config, and run config come from that frozen mention."),
238690
+ agentRoleId: string$1().trim().min(1).optional().describe("Agent Role id from the workspace catalog. When set, machine, agent config, and run config come from the current Role row."),
238727
238691
  machineId: string$1().trim().min(1).optional().describe("Target machine id."),
238728
238692
  agentConfigId: string$1().trim().min(1).optional().describe("Target agent config id."),
238729
238693
  ...SessionRunConfigInputShape
@@ -238841,7 +238805,7 @@ ${result.stdout ?? ""}`;
238841
238805
  });
238842
238806
  const SessionCreateBatchItemShape = {
238843
238807
  prompt: string$1().trim().min(1).optional(),
238844
- agentRoleId: string$1().trim().min(1).optional().describe("Agent Role id authorized by the driving user turn."),
238808
+ agentRoleId: string$1().trim().min(1).optional().describe("Agent Role id from the workspace catalog."),
238845
238809
  machineId: string$1().trim().min(1).optional(),
238846
238810
  agentConfigId: string$1().trim().min(1).optional(),
238847
238811
  ...SessionRunConfigInputShape,
@@ -239233,14 +239197,19 @@ ${result.stdout ?? ""}`;
239233
239197
 
239234
239198
  ${prompt2}` : prompt2;
239235
239199
  };
239236
- const readAgentRoleInvocationSnapshot = (inputConfig, agentRoleId) => {
239237
- const snapshot = inputConfig?.agentRoleInvocations?.find((candidate) => candidate.roleId === agentRoleId);
239238
- if (!snapshot) {
239239
- throw new LodyOperationStoreError("AGENT_ROLE_NOT_AUTHORIZED", `Agent Role ${agentRoleId} was not mentioned in the driving user turn.`, false);
239240
- }
239241
- return snapshot;
239200
+ const loadWorkspaceAgentRoleCatalog = async (manager, workspaceId) => {
239201
+ const docId = getWorkspaceFlockDocId(workspaceId);
239202
+ await manager.syncFlockDocOrThrow(docId, {
239203
+ timeoutMs: 1e4,
239204
+ reason: "mcp-agent-role-read"
239205
+ });
239206
+ const handle = await manager.repo.openFlockDoc(docId);
239207
+ return new Map(listWorkspaceAgentRoles(readWorkspaceFlockRowsFromFlock(handle.flock)).map((role) => [
239208
+ role.id,
239209
+ role
239210
+ ]));
239242
239211
  };
239243
- const resolveMcpSessionCreate = (input2, invoking, requester) => {
239212
+ const resolveMcpSessionCreate = (input2, invoking, requester, role) => {
239244
239213
  if (!input2.agentRoleId) {
239245
239214
  return {
239246
239215
  input: input2,
@@ -239251,10 +239220,12 @@ ${prompt2}` : prompt2;
239251
239220
  }
239252
239221
  };
239253
239222
  }
239254
- const role = readAgentRoleInvocationSnapshot(invoking?.frozenInputConfig, input2.agentRoleId);
239223
+ if (!role || role.id !== input2.agentRoleId) {
239224
+ throw new LodyOperationStoreError("AGENT_ROLE_NOT_FOUND", `Agent Role ${input2.agentRoleId} does not exist in the workspace catalog.`, false);
239225
+ }
239255
239226
  const project = requester.project;
239256
239227
  if (project?.kind !== "github" && role.machineId !== requester.machineId) {
239257
- throw new LodyOperationStoreError("AGENT_ROLE_MACHINE_MISMATCH", project?.kind === "local" ? `Agent Role ${role.roleName} must run on the Local Project's Machine.` : `Agent Role ${role.roleName} must run on the current Machine in a chat Session.`, false);
239228
+ throw new LodyOperationStoreError("AGENT_ROLE_MACHINE_MISMATCH", project?.kind === "local" ? `Agent Role ${role.name} must run on the Local Project's Machine.` : `Agent Role ${role.name} must run on the current Machine in a chat Session.`, false);
239258
239229
  }
239259
239230
  let useCurrentSessionAsParent = input2.useCurrentSessionAsParent;
239260
239231
  let workContext = input2.workContext;
@@ -239300,8 +239271,8 @@ ${prompt2}` : prompt2;
239300
239271
  agentConfigId: resolved.input.agentConfigId
239301
239272
  } : {},
239302
239273
  ...resolved.role ? {
239303
- agentRoleId: resolved.role.roleId,
239304
- agentRoleRevision: resolved.role.roleRevision,
239274
+ agentRoleId: resolved.role.id,
239275
+ agentRoleRevision: resolved.role.revision,
239305
239276
  agentRoleRunConfig: resolved.role.runConfig
239306
239277
  } : buildMcpRunConfigCanonicalCommand(resolved.input),
239307
239278
  ...resolved.input.useCurrentSessionAsParent !== void 0 ? {
@@ -239316,8 +239287,8 @@ ${prompt2}` : prompt2;
239316
239287
  });
239317
239288
  const bindAgentRoleCreateOptions = (options, role) => {
239318
239289
  if (!role) return;
239319
- options.agentRoleId = role.roleId;
239320
- options.agentRoleRevision = role.roleRevision;
239290
+ options.agentRoleId = role.id;
239291
+ options.agentRoleRevision = role.revision;
239321
239292
  };
239322
239293
  const buildMcpCreateOptions = (input2, ctx) => {
239323
239294
  const options = {
@@ -240220,7 +240191,8 @@ ${prompt2}` : prompt2;
240220
240191
  throw new LodyOperationStoreError("SESSION_NOT_FOUND", `Requester Session not found: ${ctx.sessionId}`, false);
240221
240192
  }
240222
240193
  const invoking = await resolveInvokingTurnContext(manager, currentSession);
240223
- const resolved = resolveMcpSessionCreate(args2, invoking, currentSession);
240194
+ const roleCatalog = args2.agentRoleId ? await loadWorkspaceAgentRoleCatalog(manager, workspace.id) : void 0;
240195
+ const resolved = resolveMcpSessionCreate(args2, invoking, currentSession, args2.agentRoleId ? roleCatalog?.get(args2.agentRoleId) : void 0);
240224
240196
  const canonicalCommand = buildResolvedMcpCreateCanonicalCommand(resolved, args2.deadlineSeconds);
240225
240197
  const retry2 = await withOperationStore((store) => store.findMatchingRetry(ctx.sessionId, args2.operationId, "session_create", canonicalCommand));
240226
240198
  if (retry2) return await withOperationStore((store) => store.snapshot(retry2));
@@ -240456,6 +240428,7 @@ ${prompt2}` : prompt2;
240456
240428
  ...item
240457
240429
  }));
240458
240430
  const invoking = await resolveInvokingTurnContext(manager, requester);
240431
+ const roleCatalog = expanded.some((item) => Boolean(item.agentRoleId)) ? await loadWorkspaceAgentRoleCatalog(manager, workspace.id) : void 0;
240459
240432
  const resolvedItems = expanded.map((item) => {
240460
240433
  if (!item.prompt) return {
240461
240434
  resolved: void 0,
@@ -240483,7 +240456,7 @@ ${prompt2}` : prompt2;
240483
240456
  } : {}
240484
240457
  };
240485
240458
  return {
240486
- resolved: resolveMcpSessionCreate(single2, invoking, requester),
240459
+ resolved: resolveMcpSessionCreate(single2, invoking, requester, item.agentRoleId ? roleCatalog?.get(item.agentRoleId) : void 0),
240487
240460
  error: void 0
240488
240461
  };
240489
240462
  } catch (error2) {
@@ -241181,7 +241154,7 @@ ${lines2.join("\n")}` : ""}${suffix}`);
241181
241154
  });
241182
241155
  server.registerTool(SESSION_CREATE_TOOL_NAME, {
241183
241156
  title: "Create a Lody session",
241184
- description: "Start durable asynchronous work that creates a Lody session. Supply operationId; the result arrives automatically as a continuation, so do not poll operation_get. To recover an already accepted create without resending its prompt, send only operationId with resume=true. When the driving user turn contains an Agent Role mention, pass its agentRoleId and do not pass machineId, agentConfigId, modelId, reasoningEffort, fastMode, or planMode; the frozen mention supplies them. useCurrentSessionAsParent=true and workContext are mutually exclusive schema branches. Machine/config ids and runConfig values for non-Role creates come from lody_session_create_options. The wait field is temporary legacy compatibility only.",
241157
+ description: "Start durable asynchronous work that creates a Lody session. Supply operationId; the result arrives automatically as a continuation, so do not poll operation_get. To recover an already accepted create without resending its prompt, send only operationId with resume=true. To use an Agent Role, pass its agentRoleId and do not pass machineId, agentConfigId, modelId, reasoningEffort, fastMode, or planMode; the current workspace catalog row supplies them. useCurrentSessionAsParent=true and workContext are mutually exclusive schema branches. Machine/config ids and runConfig values for non-Role creates come from lody_session_create_options. The wait field is temporary legacy compatibility only.",
241185
241158
  inputSchema: SessionCreateToolInputSchema
241186
241159
  }, async (input2) => {
241187
241160
  try {
@@ -241203,7 +241176,8 @@ ${lines2.join("\n")}` : ""}${suffix}`);
241203
241176
  throw new Error(`Session not found: ${ctx.sessionId}`);
241204
241177
  }
241205
241178
  const invoking = args2.agentRoleId ? await resolveInvokingTurnContext(manager, currentSession) : void 0;
241206
- const resolved = resolveMcpSessionCreate(args2, invoking, currentSession);
241179
+ const roleCatalog = args2.agentRoleId ? await loadWorkspaceAgentRoleCatalog(manager, workspace.id) : void 0;
241180
+ const resolved = resolveMcpSessionCreate(args2, invoking, currentSession, args2.agentRoleId ? roleCatalog?.get(args2.agentRoleId) : void 0);
241207
241181
  const options = buildMcpCreateOptions(resolved.input, ctx);
241208
241182
  bindMcpCreateContext(options, auth, currentSession);
241209
241183
  bindAgentRoleCreateOptions(options, resolved.role);
@@ -241287,7 +241261,7 @@ ${lines2.join("\n")}` : ""}${suffix}`);
241287
241261
  });
241288
241262
  server.registerTool(SESSION_CREATE_MANY_TOOL_NAME, {
241289
241263
  title: "Create multiple Lody sessions",
241290
- description: "Start one durable batch Operation for 1-20 Session creates. defaults and items shallow-merge; nested objects replace wholesale. Each item may use an agentRoleId authorized by the driving user turn; Role items cannot also override machine, agent config, or run config. Non-Role items accept modelId, reasoningEffort, fastMode, and planMode. Ordered item failures are isolated. Completion arrives automatically as one continuation, so do not poll operation_get in a loop.",
241264
+ description: "Start one durable batch Operation for 1-20 Session creates. defaults and items shallow-merge; nested objects replace wholesale. Each item may use an agentRoleId from the workspace catalog; Role items cannot also override machine, agent config, or run config. Non-Role items accept modelId, reasoningEffort, fastMode, and planMode. Ordered item failures are isolated. Completion arrives automatically as one continuation, so do not poll operation_get in a loop.",
241291
241265
  inputSchema: SessionCreateManyToolInputSchema
241292
241266
  }, async (input2) => {
241293
241267
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lody",
3
- "version": "0.86.0",
3
+ "version": "0.86.2",
4
4
  "description": "Lody Agent CLI tool for managing remote command execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",