@chosengeneration/light-code 0.161.0 → 0.162.0

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.
Files changed (3) hide show
  1. package/dist/cli.cjs +657 -119
  2. package/dist/server.cjs +655 -117
  3. package/package.json +1 -1
package/dist/server.cjs CHANGED
@@ -38956,14 +38956,14 @@ function convertBaseSchema(schema8, ctx) {
38956
38956
  shape[key2] = requiredSet.has(key2) ? propZodSchema : propZodSchema.optional();
38957
38957
  }
38958
38958
  if (schema8.propertyNames) {
38959
- const keySchema = convertSchema(schema8.propertyNames, ctx);
38959
+ const keySchema2 = convertSchema(schema8.propertyNames, ctx);
38960
38960
  const valueSchema = schema8.additionalProperties && typeof schema8.additionalProperties === "object" ? convertSchema(schema8.additionalProperties, ctx) : z.any();
38961
38961
  if (Object.keys(shape).length === 0) {
38962
- zodSchema = z.record(keySchema, valueSchema);
38962
+ zodSchema = z.record(keySchema2, valueSchema);
38963
38963
  break;
38964
38964
  }
38965
38965
  const objectSchema2 = z.object(shape).passthrough();
38966
- const recordSchema = z.looseRecord(keySchema, valueSchema);
38966
+ const recordSchema = z.looseRecord(keySchema2, valueSchema);
38967
38967
  zodSchema = z.intersection(objectSchema2, recordSchema);
38968
38968
  break;
38969
38969
  }
@@ -38973,8 +38973,8 @@ function convertBaseSchema(schema8, ctx) {
38973
38973
  const looseRecords = [];
38974
38974
  for (const pattern of patternKeys) {
38975
38975
  const patternValue = convertSchema(patternProps[pattern], ctx);
38976
- const keySchema = z.string().regex(new RegExp(pattern));
38977
- looseRecords.push(z.looseRecord(keySchema, patternValue));
38976
+ const keySchema2 = z.string().regex(new RegExp(pattern));
38977
+ looseRecords.push(z.looseRecord(keySchema2, patternValue));
38978
38978
  }
38979
38979
  const schemasToIntersect = [];
38980
38980
  if (Object.keys(shape).length > 0) {
@@ -44864,8 +44864,8 @@ function idFor(text2) {
44864
44864
  function normalise(text2) {
44865
44865
  return text2.trim().toLowerCase().replace(/\s+/g, " ").replace(/[.;,:]+$/, "");
44866
44866
  }
44867
- function parseCheckpoints(plan2) {
44868
- const lines2 = (plan2 ?? "").split(/\r?\n/);
44867
+ function parseCheckpoints(plan3) {
44868
+ const lines2 = (plan3 ?? "").split(/\r?\n/);
44869
44869
  const items = [];
44870
44870
  lines2.forEach((line, index) => {
44871
44871
  const match = LIST_ITEM.exec(line);
@@ -44914,8 +44914,8 @@ function rolesMentionedIn(text2) {
44914
44914
  const haystack = text2.toLowerCase();
44915
44915
  return AGENT_ROLES.filter((role) => new RegExp(`\\b${role}\\b`).test(haystack));
44916
44916
  }
44917
- function checkpointViews(plan2, progress) {
44918
- return parseCheckpoints(plan2).map((checkpoint) => {
44917
+ function checkpointViews(plan3, progress) {
44918
+ return parseCheckpoints(plan3).map((checkpoint) => {
44919
44919
  const recorded = progress?.[checkpoint.id];
44920
44920
  return {
44921
44921
  ...checkpoint,
@@ -44924,18 +44924,18 @@ function checkpointViews(plan2, progress) {
44924
44924
  };
44925
44925
  });
44926
44926
  }
44927
- function pruneProgress(plan2, progress) {
44927
+ function pruneProgress(plan3, progress) {
44928
44928
  if (progress === void 0)
44929
44929
  return {};
44930
- const live = new Set(parseCheckpoints(plan2).map((checkpoint) => checkpoint.id));
44930
+ const live = new Set(parseCheckpoints(plan3).map((checkpoint) => checkpoint.id));
44931
44931
  const kept = {};
44932
44932
  for (const [id, entry] of Object.entries(progress))
44933
44933
  if (live.has(id))
44934
44934
  kept[id] = entry;
44935
44935
  return kept;
44936
44936
  }
44937
- function markCheckpoint(plan2, progress, index, status2) {
44938
- const checkpoint = parseCheckpoints(plan2).find((candidate) => candidate.index === index);
44937
+ function markCheckpoint(plan3, progress, index, status2) {
44938
+ const checkpoint = parseCheckpoints(plan3).find((candidate) => candidate.index === index);
44939
44939
  if (checkpoint === void 0)
44940
44940
  return void 0;
44941
44941
  const existing = progress[checkpoint.id];
@@ -44966,8 +44966,8 @@ function progressSummary(views) {
44966
44966
 
44967
44967
  // ../../packages/core/dist/agent/plan.js
44968
44968
  var PLAN_LIMIT = 4e3;
44969
- function buildPlanGuidance(plan2) {
44970
- const trimmed = plan2?.trim() ?? "";
44969
+ function buildPlanGuidance(plan3) {
44970
+ const trimmed = plan3?.trim() ?? "";
44971
44971
  if (trimmed.length === 0)
44972
44972
  return "";
44973
44973
  const checkpoints = parseCheckpoints(trimmed);
@@ -45126,9 +45126,9 @@ function buildSystemPrompt(workspaceRoot, options = {}) {
45126
45126
  }
45127
45127
  if (codebaseInstructions.length > 0)
45128
45128
  lines2.push("", codebaseInstructions);
45129
- const plan2 = buildPlanGuidance(options.plan);
45130
- if (plan2.length > 0)
45131
- lines2.push("", plan2);
45129
+ const plan3 = buildPlanGuidance(options.plan);
45130
+ if (plan3.length > 0)
45131
+ lines2.push("", plan3);
45132
45132
  return lines2.join("\n");
45133
45133
  }
45134
45134
 
@@ -46422,6 +46422,8 @@ var ALWAYS_ASK_TOOLS = /* @__PURE__ */ new Set([
46422
46422
  // Production schedules: an event (force-start, kill, hold, ice, status) or a changed definition.
46423
46423
  "autosys_send_event",
46424
46424
  "autosys_apply_jil",
46425
+ // Where every AutoSys request goes from now on - often learned from a wiki page; the prompt shows each one tried live.
46426
+ "autosys_set_addresses",
46425
46427
  "bitbucket_write_pull_request",
46426
46428
  // Merges into a shared branch (and may tag it) under the user's name; only after a reviewer approved.
46427
46429
  "bitbucket_merge_pull_request",
@@ -52524,6 +52526,8 @@ var NEVER_AVAILABLE_TO_SCHEDULES = [
52524
52526
  // A production scheduler changed with nobody watching.
52525
52527
  "autosys_send_event",
52526
52528
  "autosys_apply_jil",
52529
+ // Repointing every later AutoSys request, with nobody to see where.
52530
+ "autosys_set_addresses",
52527
52531
  // A merge into a shared branch, and a release tag, with nobody watching.
52528
52532
  "bitbucket_merge_pull_request",
52529
52533
  // A chat window opened with nobody there to press Send, or to notice it.
@@ -60598,6 +60602,13 @@ var SHARE_SECTIONS = [
60598
60602
  strip: ["jenkins.username", "autosys.username"],
60599
60603
  stripNote: "Your Jenkins and AutoSys user names are left out; each person uses their own."
60600
60604
  },
60605
+ {
60606
+ id: "autosysAddresses",
60607
+ label: "AutoSys addresses",
60608
+ description: "The addresses this office's AutoSys server answers at, as found by the assistant or set by hand. Alone, an import changes only these - not the importer's site, sign-in or other DevOps settings.",
60609
+ keys: [],
60610
+ nested: ["autosys.paths"]
60611
+ },
60601
60612
  {
60602
60613
  id: "datasets",
60603
60614
  label: "Custom data",
@@ -60694,6 +60705,8 @@ function detailFor(section, config2) {
60694
60705
  const sites = [config2.confluence?.baseUrl, config2.jira?.baseUrl, config2.bitbucket?.baseUrl].filter((site) => site !== void 0);
60695
60706
  return sites.length > 0 ? sites.join(", ") : "not set up";
60696
60707
  }
60708
+ case "autosysAddresses":
60709
+ return count(Object.keys(config2.autosys?.paths ?? {}).length, "address", "addresses");
60697
60710
  case "datasets":
60698
60711
  return count((config2.datasets ?? []).length, "dataset");
60699
60712
  case "commands":
@@ -60767,12 +60780,54 @@ function secretRefsFor(section, config2) {
60767
60780
  }
60768
60781
  return refs;
60769
60782
  }
60783
+ function getPath2(source, path63) {
60784
+ let value = source;
60785
+ for (const part of path63.split(".")) {
60786
+ if (typeof value !== "object" || value === null)
60787
+ return void 0;
60788
+ value = value[part];
60789
+ }
60790
+ return value;
60791
+ }
60792
+ function hasValue(value) {
60793
+ if (value === void 0 || value === null)
60794
+ return false;
60795
+ if (typeof value === "object")
60796
+ return Object.keys(value).length > 0;
60797
+ return true;
60798
+ }
60799
+ function setPath(target, path63, value) {
60800
+ const [head, ...rest] = path63.split(".");
60801
+ if (head === void 0)
60802
+ return;
60803
+ if (rest.length === 0) {
60804
+ if (value === void 0)
60805
+ delete target[head];
60806
+ else
60807
+ target[head] = value;
60808
+ return;
60809
+ }
60810
+ const inner = target[head];
60811
+ if ((inner === void 0 || inner === null) && value === void 0)
60812
+ return;
60813
+ const copy = typeof inner === "object" && inner !== null ? { ...inner } : {};
60814
+ setPath(copy, rest.join("."), value);
60815
+ target[head] = copy;
60816
+ }
60817
+ var NESTED_PATHS = SHARE_SECTIONS.flatMap((section) => section.nested ?? []);
60818
+ function withoutNested(config2) {
60819
+ const copy = { ...config2 };
60820
+ for (const path63 of NESTED_PATHS)
60821
+ setPath(copy, path63, void 0);
60822
+ return copy;
60823
+ }
60770
60824
  function describeSections(config2) {
60825
+ const owned = withoutNested(config2);
60771
60826
  return SHARE_SECTIONS.map((section) => ({
60772
60827
  id: section.id,
60773
60828
  label: section.label,
60774
60829
  description: section.description,
60775
- present: section.keys.some((key2) => has(config2, key2)),
60830
+ present: section.keys.some((key2) => has(owned, key2)) || (section.nested ?? []).some((path63) => hasValue(getPath2(config2, path63))),
60776
60831
  detail: detailFor(section, config2),
60777
60832
  secretRefs: secretRefsFor(section, config2),
60778
60833
  ...section.machineSpecific === true ? { machineSpecific: true } : {},
@@ -60793,6 +60848,11 @@ function buildExport(config2, selected) {
60793
60848
  if (has(config2, key2))
60794
60849
  exported[key2] = config2[key2];
60795
60850
  }
60851
+ for (const path63 of section.nested ?? []) {
60852
+ const value = getPath2(config2, path63);
60853
+ if (hasValue(value))
60854
+ setPath(exported, path63, value);
60855
+ }
60796
60856
  for (const path63 of section.strip ?? [])
60797
60857
  stripPath(exported, path63);
60798
60858
  }
@@ -60831,6 +60891,14 @@ function applyImport(existing, imported, selected) {
60831
60891
  carryPath(existing, merged, path63);
60832
60892
  }
60833
60893
  }
60894
+ for (const section of SHARE_SECTIONS) {
60895
+ if (!chosen.has(section.id))
60896
+ continue;
60897
+ for (const path63 of section.nested ?? []) {
60898
+ const value = getPath2(imported, path63);
60899
+ setPath(merged, path63, hasValue(value) ? value : void 0);
60900
+ }
60901
+ }
60834
60902
  return merged;
60835
60903
  }
60836
60904
  function carryPath(from, to, path63) {
@@ -66071,10 +66139,10 @@ async function planMigration(options) {
66071
66139
  skip.sort();
66072
66140
  return { copy, skip };
66073
66141
  }
66074
- async function runMigration(plan2) {
66142
+ async function runMigration(plan3) {
66075
66143
  const copied = [];
66076
66144
  const failed2 = [];
66077
- for (const item of plan2.copy) {
66145
+ for (const item of plan3.copy) {
66078
66146
  try {
66079
66147
  await import_promises22.default.mkdir(import_node_path38.default.dirname(item.destination), { recursive: true });
66080
66148
  await import_promises22.default.cp(item.source, item.destination, {
@@ -66087,7 +66155,7 @@ async function runMigration(plan2) {
66087
66155
  failed2.push({ name: item.name, problem: error51 instanceof Error ? error51.message : String(error51) });
66088
66156
  }
66089
66157
  }
66090
- return { copied, skipped: plan2.skip, failed: failed2 };
66158
+ return { copied, skipped: plan3.skip, failed: failed2 };
66091
66159
  }
66092
66160
  function describeMigration(result, kind) {
66093
66161
  const noun = kind === "skills" ? "skill" : "tool";
@@ -66481,13 +66549,13 @@ async function transferPaths(context, params3) {
66481
66549
  }
66482
66550
  return { ok: true, items, outside };
66483
66551
  }
66484
- function describePlan(params3, plan2, outside) {
66552
+ function describePlan(params3, plan3, outside) {
66485
66553
  const verb = params3.action === "move" ? "Move" : "Copy";
66486
- const files = plan2.reduce((n, p) => n + p.files, 0);
66487
- const bytes = plan2.reduce((n, p) => n + p.bytes, 0);
66488
- const replacing = plan2.reduce((n, p) => n + p.replaceCount, 0);
66489
- const lines2 = [`${verb} ${String(plan2.length)} item${plan2.length === 1 ? "" : "s"}: ${files.toLocaleString("en")} file${files === 1 ? "" : "s"}, ${formatBytes(bytes)}`, ""];
66490
- for (const p of plan2) {
66554
+ const files = plan3.reduce((n, p) => n + p.files, 0);
66555
+ const bytes = plan3.reduce((n, p) => n + p.bytes, 0);
66556
+ const replacing = plan3.reduce((n, p) => n + p.replaceCount, 0);
66557
+ const lines2 = [`${verb} ${String(plan3.length)} item${plan3.length === 1 ? "" : "s"}: ${files.toLocaleString("en")} file${files === 1 ? "" : "s"}, ${formatBytes(bytes)}`, ""];
66558
+ for (const p of plan3) {
66491
66559
  lines2.push(` ${p.from} (${p.folder ? `folder, ${p.files.toLocaleString("en")} files` : "file"}, ${formatBytes(p.bytes)})`);
66492
66560
  lines2.push(` \u2192 ${p.to}${params3.action === "move" && p.rename ? " [rename: same drive, instant]" : ""}`);
66493
66561
  if (p.replaceCount > 0) {
@@ -66966,21 +67034,21 @@ ${errors.map((e) => `- ${e}`).join("\n")}` : ""),
66966
67034
  return { kind: "text", text: paths.message };
66967
67035
  if (params3.action === "list")
66968
67036
  return { kind: "text", text: `List the contents of ${String(paths.request.archive)}` };
66969
- const plan2 = await runHelper(exe, { ...paths.request, plan: true });
66970
- if (plan2.ok !== true)
66971
- return { kind: "text", text: `Could not plan this: ${plan2.error ?? "unknown error"}` };
67037
+ const plan3 = await runHelper(exe, { ...paths.request, plan: true });
67038
+ if (plan3.ok !== true)
67039
+ return { kind: "text", text: `Could not plan this: ${plan3.error ?? "unknown error"}` };
66972
67040
  const lines2 = params3.action === "create" ? [
66973
- `Create ${String(paths.request.archive)}${plan2.exists === true ? params3.overwrite === true ? " (REPLACES the existing file)" : " (already exists, so nothing will be changed)" : ""}`,
67041
+ `Create ${String(paths.request.archive)}${plan3.exists === true ? params3.overwrite === true ? " (REPLACES the existing file)" : " (already exists, so nothing will be changed)" : ""}`,
66974
67042
  ` from ${paths.request.sources.join(", ")}`,
66975
- ` ${Number(plan2.files).toLocaleString("en")} file(s), ${formatBytes(Number(plan2.bytes))} before compression`,
66976
- ...(plan2.sample ?? []).map((n) => ` ${n}`)
67043
+ ` ${Number(plan3.files).toLocaleString("en")} file(s), ${formatBytes(Number(plan3.bytes))} before compression`,
67044
+ ...(plan3.sample ?? []).map((n) => ` ${n}`)
66977
67045
  ] : [
66978
67046
  `Extract ${String(paths.request.archive)}`,
66979
67047
  ` into ${String(paths.request.to)}`,
66980
- ` ${Number(plan2.files).toLocaleString("en")} file(s), ${formatBytes(Number(plan2.bytes))}`,
66981
- ...Number(plan2.replaceCount) > 0 ? [
66982
- ` ${params3.overwrite === true ? "REPLACES" : "already exists, so nothing will be changed"}: ${String(plan2.replaceCount)} file(s)`,
66983
- ...(plan2.replaces ?? []).map((n) => ` ${n}`)
67048
+ ` ${Number(plan3.files).toLocaleString("en")} file(s), ${formatBytes(Number(plan3.bytes))}`,
67049
+ ...Number(plan3.replaceCount) > 0 ? [
67050
+ ` ${params3.overwrite === true ? "REPLACES" : "already exists, so nothing will be changed"}: ${String(plan3.replaceCount)} file(s)`,
67051
+ ...(plan3.replaces ?? []).map((n) => ` ${n}`)
66984
67052
  ] : []
66985
67053
  ];
66986
67054
  if (paths.outside)
@@ -73646,7 +73714,7 @@ function createJenkinsWriteJobTool(options) {
73646
73714
  });
73647
73715
  const shown2 = /* @__PURE__ */ new Map();
73648
73716
  const keyOf = (params3) => JSON.stringify(params3);
73649
- const plan2 = async (client, params3) => {
73717
+ const plan3 = async (client, params3) => {
73650
73718
  const target = params3.job.trim();
73651
73719
  jobPath(target, client.base);
73652
73720
  const changes = {
@@ -73685,7 +73753,7 @@ function createJenkinsWriteJobTool(options) {
73685
73753
  async preview(params3) {
73686
73754
  try {
73687
73755
  const client = await options.client();
73688
- const result = await plan2(client, params3);
73756
+ const result = await plan3(client, params3);
73689
73757
  shown2.set(keyOf(params3), { before: result.before, after: result.after });
73690
73758
  const parameters = jobParameters(result.after);
73691
73759
  return {
@@ -73706,7 +73774,7 @@ function createJenkinsWriteJobTool(options) {
73706
73774
  try {
73707
73775
  const client = await options.client();
73708
73776
  const approved = shown2.get(keyOf(params3));
73709
- const now = await plan2(client, params3);
73777
+ const now = await plan3(client, params3);
73710
73778
  if (approved !== void 0 && approved.before !== now.before) {
73711
73779
  return {
73712
73780
  content: `${params3.action === "update" ? params3.job : params3.from ?? params3.job} changed on Jenkins after this was shown, so nothing was saved. Ask again to see the change against the current configuration.`,
@@ -73959,11 +74027,65 @@ function isAutosysName(name, pattern = false) {
73959
74027
  function fill(template, values) {
73960
74028
  return template.replace(/\{(filter:)?(\w+)\}/g, (_, filter, key2) => {
73961
74029
  if (filter !== void 0) {
73962
- return encodeURIComponent(`${key2}==${values["pattern"] ?? values[key2] ?? ""}`);
74030
+ return encodeURIComponent(`${key2}==${values["pattern"] ?? values[key2] ?? values["job"] ?? ""}`);
73963
74031
  }
73964
74032
  return encodeURIComponent(values[key2] ?? "");
73965
74033
  });
73966
74034
  }
74035
+ var AUTOSYS_PATH_KEYS = Object.keys(DEFAULT_AUTOSYS_PATHS);
74036
+ var AUTOSYS_SENDING_KEYS = ["event", "jil"];
74037
+ var PLACEHOLDERS = /* @__PURE__ */ new Set(["pattern", "job", "runNum", "type", "machine", "calendar", "boxName", "jobName"]);
74038
+ var SUBJECT = {
74039
+ jobs: ["pattern"],
74040
+ runInfo: ["pattern"],
74041
+ boxMembers: ["pattern", "boxName"],
74042
+ machines: ["pattern"],
74043
+ globalVariables: ["pattern"],
74044
+ job: ["job"],
74045
+ jobRunInfo: ["job"],
74046
+ log: ["job"],
74047
+ runHistory: ["job"],
74048
+ eventHistory: ["job", "jobName"],
74049
+ machine: ["machine"],
74050
+ calendar: ["calendar"],
74051
+ extendedCalendar: ["calendar"]
74052
+ };
74053
+ function autosysPathProblem(key2, template) {
74054
+ if (!AUTOSYS_PATH_KEYS.includes(key2))
74055
+ return `"${String(key2)}" is not an AutoSys address name.`;
74056
+ if (template.length === 0 || template.length > 500)
74057
+ return "An address must be 1 to 500 characters.";
74058
+ if (!template.startsWith("/") || template.startsWith("//"))
74059
+ return 'An address must start with a single "/" - it is added to the site address, never a site of its own.';
74060
+ if (/[\s\\#]/.test(template) || template.includes("://"))
74061
+ return 'An address may not contain spaces, backslashes, "#" or "://".';
74062
+ const pathPart = template.split("?")[0] ?? "";
74063
+ let decoded;
74064
+ try {
74065
+ decoded = decodeURIComponent(pathPart);
74066
+ } catch {
74067
+ return "The address has a broken %-escape.";
74068
+ }
74069
+ if (decoded.split("/").some((segment) => segment === ".." || segment === "."))
74070
+ return 'An address may not contain "." or ".." segments.';
74071
+ const named2 = [...template.matchAll(/\{(filter:)?(\w+)\}/g)];
74072
+ const stripped = template.replace(/\{(filter:)?(\w+)\}/g, "");
74073
+ if (stripped.includes("{") || stripped.includes("}"))
74074
+ return "Placeholders are written {job}, {pattern} or {filter:name}; this address has a stray brace.";
74075
+ for (const [, filter, name] of named2) {
74076
+ if (filter === void 0 && !PLACEHOLDERS.has(name ?? ""))
74077
+ return `{${name ?? ""}} is not a placeholder - use one of ${[...PLACEHOLDERS].map((p) => `{${p}}`).join(", ")}, or {filter:<field>}.`;
74078
+ }
74079
+ const subject = SUBJECT[key2];
74080
+ if (subject !== void 0 && !named2.some(([, filter, name]) => filter !== void 0 || subject.includes(name ?? ""))) {
74081
+ return `The ${key2} address must say which one it is about: include ${subject.map((p) => `{${p}}`).join(" or ")} (or a {filter:<field>}).`;
74082
+ }
74083
+ return void 0;
74084
+ }
74085
+ function jobNameOf(record2) {
74086
+ return field(record2, "name", "jobName", "job_name", "job");
74087
+ }
74088
+ var MAX_ONE_BY_ONE = 200;
73967
74089
  function asList(value) {
73968
74090
  if (Array.isArray(value))
73969
74091
  return value;
@@ -74032,19 +74154,69 @@ var AUTOSYS_EVENTS = [
74032
74154
  "CHANGE_PRIORITY",
74033
74155
  "COMMENT"
74034
74156
  ];
74035
- var AutosysClient = class {
74157
+ var AutosysClient = class _AutosysClient {
74158
+ http;
74159
+ connection;
74036
74160
  rest;
74037
74161
  paths;
74162
+ overrides;
74038
74163
  constructor(http, connection, paths) {
74164
+ this.http = http;
74165
+ this.connection = connection;
74039
74166
  this.rest = new AtlassianRest(http, "autosys", connection);
74040
- this.paths = { ...DEFAULT_AUTOSYS_PATHS, ...paths ?? {} };
74167
+ this.overrides = { ...paths ?? {} };
74168
+ for (const [key2, template] of Object.entries(this.overrides)) {
74169
+ const problem = autosysPathProblem(key2, template);
74170
+ if (problem !== void 0)
74171
+ throw new AtlassianError(`The AutoSys address config:autosys (paths.${key2}) "${template}" cannot be used: ${problem}`);
74172
+ }
74173
+ this.paths = { ...DEFAULT_AUTOSYS_PATHS, ...this.overrides };
74041
74174
  }
74042
74175
  get base() {
74043
74176
  return this.rest.base;
74044
74177
  }
74178
+ /** The address templates in use, defaults included. */
74179
+ get addresses() {
74180
+ return { ...this.paths };
74181
+ }
74182
+ /** The same connection with some addresses replaced - to try candidates before anything is saved. */
74183
+ withPaths(paths) {
74184
+ return new _AutosysClient(this.http, this.connection, { ...this.overrides, ...paths });
74185
+ }
74186
+ /**
74187
+ * Tries one read address once and says what came back. Never for an address that is sent to
74188
+ * (`AUTOSYS_SENDING_KEYS`): a test POST of an event would be a real event.
74189
+ */
74190
+ async check(key2, values, signal) {
74191
+ const template = this.paths[key2];
74192
+ const requested2 = fill(template, values);
74193
+ if (AUTOSYS_SENDING_KEYS.includes(key2)) {
74194
+ return { key: key2, template, requested: requested2, ok: false, message: "not tried - this address is sent to, and trying it would change production" };
74195
+ }
74196
+ try {
74197
+ if (key2 === "log") {
74198
+ const text2 = await this.rest.text(`trying the ${key2} address`, requested2, signal);
74199
+ return { key: key2, template, requested: requested2, ok: true, status: 200, records: text2.length > 0 ? 1 : 0 };
74200
+ }
74201
+ const list2 = asList(await this.rest.json(`trying the ${key2} address`, requested2, { method: "GET" }, signal));
74202
+ const first = list2[0];
74203
+ return { key: key2, template, requested: requested2, ok: true, status: 200, records: list2.length, fields: first === void 0 ? [] : Object.keys(first).slice(0, 15) };
74204
+ } catch (error51) {
74205
+ const status2 = error51 instanceof AtlassianError ? error51.status : void 0;
74206
+ return {
74207
+ key: key2,
74208
+ template,
74209
+ requested: requested2,
74210
+ ok: false,
74211
+ status: status2,
74212
+ message: error51 instanceof Error ? error51.message : String(error51),
74213
+ signIn: status2 === 401 || status2 === 403
74214
+ };
74215
+ }
74216
+ }
74045
74217
  /** Signs in and lists nothing: proves the credential and the path without fetching every job. */
74046
74218
  async probe(username, signal) {
74047
- await this.rest.json("signing in", fill(this.paths.runInfo, { pattern: "LIGHTCODE_PROBE_NO_SUCH_JOB*" }), { method: "GET" }, signal);
74219
+ await this.runInfo("LIGHTCODE_PROBE_NO_SUCH_JOB*", signal);
74048
74220
  return username;
74049
74221
  }
74050
74222
  async findJobs(pattern, signal) {
@@ -74064,11 +74236,57 @@ var AutosysClient = class {
74064
74236
  async boxMembers(box, signal) {
74065
74237
  return asList(await this.rest.json(`listing the jobs in box ${box}`, fill(this.paths.boxMembers, { pattern: box, boxName: box }), { method: "GET" }, signal));
74066
74238
  }
74239
+ /**
74240
+ * Status of one job or every job a pattern matches.
74241
+ *
74242
+ * A pattern goes to the pattern address (`runInfo`). Reported from real use: a server with no such
74243
+ * address answered `JOB*UK` with a 404 while one job's status worked. So when the pattern address
74244
+ * answers 404, the jobs are listed with the definitions address (`jobs`) and each one's status is
74245
+ * read on its own - slower, and it works with what the server has. One job reads `jobRunInfo`, and
74246
+ * where that is missing too, a definition that carries a status.
74247
+ */
74067
74248
  async runInfo(pattern, signal) {
74068
74249
  if (!isAutosysName(pattern, true))
74069
74250
  throw new AtlassianError(`"${pattern}" is not a job name or pattern.`);
74070
- const path63 = pattern.includes("*") ? fill(this.paths.runInfo, { pattern }) : fill(this.paths.jobRunInfo, { job: pattern });
74071
- return asList(await this.rest.json(`reading the status of ${pattern}`, path63, { method: "GET" }, signal)).map(toRun);
74251
+ if (!pattern.includes("*"))
74252
+ return this.oneRun(pattern, signal);
74253
+ try {
74254
+ return asList(await this.rest.json(`reading the status of ${pattern}`, fill(this.paths.runInfo, { pattern }), { method: "GET" }, signal)).map(toRun);
74255
+ } catch (error51) {
74256
+ if (!(error51 instanceof AtlassianError && error51.status === 404))
74257
+ throw error51;
74258
+ let jobs;
74259
+ try {
74260
+ jobs = await this.findJobs(pattern, signal);
74261
+ } catch (listing2) {
74262
+ if (listing2 instanceof AtlassianError && listing2.status === 404) {
74263
+ throw new AtlassianError(`Neither the status address (${this.base}${fill(this.paths.runInfo, { pattern })}) nor the job list address (${this.base}${fill(this.paths.jobs, { pattern })}) answered for ${pattern} - both 404. Some servers answer 404 when nothing matches; otherwise this server uses other addresses. autosys_check_addresses tries them, and the office wiki's description of the AutoSys REST service usually names them.`, 404);
74264
+ }
74265
+ throw listing2;
74266
+ }
74267
+ const names = [...new Set(jobs.map(jobNameOf).filter((name) => name !== void 0 && isAutosysName(name)))];
74268
+ const runs = await inBatches2(names.slice(0, MAX_ONE_BY_ONE), async (name) => {
74269
+ try {
74270
+ return await this.oneRun(name, signal);
74271
+ } catch {
74272
+ return [{ name, status: "UNREADABLE" }];
74273
+ }
74274
+ });
74275
+ return runs.flat();
74276
+ }
74277
+ }
74278
+ async oneRun(name, signal) {
74279
+ try {
74280
+ return asList(await this.rest.json(`reading the status of ${name}`, fill(this.paths.jobRunInfo, { job: name }), { method: "GET" }, signal)).map(toRun);
74281
+ } catch (error51) {
74282
+ if (!(error51 instanceof AtlassianError && error51.status === 404))
74283
+ throw error51;
74284
+ const definitions = await this.optional(`reading job ${name}`, fill(this.paths.job, { job: name }), signal);
74285
+ const withStatus = (definitions ?? []).filter((record2) => field(record2, "status", "jobStatus") !== void 0);
74286
+ if (withStatus.length === 0)
74287
+ throw error51;
74288
+ return withStatus.map(toRun);
74289
+ }
74072
74290
  }
74073
74291
  /** A job's log, or undefined when this server has no log endpoint (404). */
74074
74292
  async log(name, runNum, type, signal) {
@@ -75069,6 +75287,270 @@ function createAutosysTools(options) {
75069
75287
  ];
75070
75288
  }
75071
75289
 
75290
+ // ../../packages/core/dist/atlassian/autosysAddresses.js
75291
+ var COMMON_PREFIXES = ["", "/v1", "/AEWS", "/AEWS/v1", "/api/v1", "/wla/v1"];
75292
+ var PATTERN_QUERIES = {
75293
+ jobs: ["/job?name={pattern}", "/job?jobName={pattern}"],
75294
+ runInfo: ["/job-run-info?name={pattern}", "/job-run-info?jobName={pattern}", "/job-status?filter={filter:name}"],
75295
+ jobRunInfo: ["/job-status/{job}", "/job/{job}/status"]
75296
+ };
75297
+ var DEFAULT_CHECKED = ["jobs", "job", "runInfo", "jobRunInfo", "runHistory", "eventHistory"];
75298
+ var keySchema = external_exports.enum(AUTOSYS_PATH_KEYS);
75299
+ var checkSchema2 = external_exports.object({
75300
+ job: external_exports.string().optional().describe("A job that exists - addresses are tried with it. Default the configured test job. Ask the user for one when there is none."),
75301
+ pattern: external_exports.string().optional().describe("A pattern for the pattern addresses (* wildcards). Default the job followed by *."),
75302
+ machine: external_exports.string().optional().describe("A machine name, to also try the machine addresses."),
75303
+ calendar: external_exports.string().optional().describe("A calendar name, to also try the calendar addresses."),
75304
+ keys: external_exports.array(keySchema).optional().describe("Which addresses to try. Default jobs, job, runInfo, jobRunInfo, runHistory, eventHistory."),
75305
+ addresses: external_exports.record(external_exports.string(), external_exports.string()).optional().describe('Candidate templates to try before the saved ones - e.g. from the office wiki: {"runInfo": "/v1/job-run-info?filter={filter:name}"}.'),
75306
+ common: external_exports.boolean().optional().describe("Also try the usual layouts (/v1, /AEWS, /AEWS/v1, /api/v1, other query forms). Default true when nothing saved works.")
75307
+ });
75308
+ function describeCheck(check2) {
75309
+ if (check2.ok) {
75310
+ const what = check2.records === void 0 ? "" : `, ${String(check2.records)} record(s)`;
75311
+ const fields = check2.fields !== void 0 && check2.fields.length > 0 ? ` - fields: ${check2.fields.join(", ")}` : "";
75312
+ return `answers${what}${fields}`;
75313
+ }
75314
+ return `${check2.status !== void 0 ? String(check2.status) : "failed"}: ${(check2.message ?? "").slice(0, 300)}`;
75315
+ }
75316
+ function candidatesFor(key2, current, given, common) {
75317
+ const list2 = [...given !== void 0 ? [given] : [], current];
75318
+ if (common) {
75319
+ const shapes = [DEFAULT_AUTOSYS_PATHS[key2], ...PATTERN_QUERIES[key2] ?? []];
75320
+ for (const prefix of COMMON_PREFIXES)
75321
+ for (const shape of shapes)
75322
+ list2.push(`${prefix}${shape}`);
75323
+ }
75324
+ return [...new Set(list2)];
75325
+ }
75326
+ function createAutosysCheckAddressesTool(options) {
75327
+ return {
75328
+ name: "autosys_check_addresses",
75329
+ group: "read",
75330
+ description: "Find the addresses this AutoSys server answers at. Use when an AutoSys tool or Test connection gets a 404, or a pattern (JOB*UK) fails while one job works: the office REST service often lives under its own prefix (/v1, /AEWS). Tries the saved addresses, any candidates in `addresses`, and with `common` the usual layouts, with a job that exists, and shows each answer's field names. Changes nothing. If the office wiki documents the AutoSys REST API, read it first (confluence_search / confluence_read_page) and pass what it says as `addresses`; then save what works with autosys_set_addresses.",
75331
+ parametersSchema: checkSchema2,
75332
+ async execute(params3) {
75333
+ try {
75334
+ const job = (params3.job ?? options.testJob)?.trim();
75335
+ if (job !== void 0 && !isAutosysName(job))
75336
+ return { content: `"${job}" is not a job name.`, isError: true };
75337
+ const pattern = (params3.pattern ?? (job !== void 0 ? `${job}*` : options.defaultPattern))?.trim();
75338
+ if (pattern !== void 0 && !isAutosysName(pattern, true))
75339
+ return { content: `"${pattern}" is not a job pattern.`, isError: true };
75340
+ if (job === void 0) {
75341
+ return {
75342
+ content: 'Name a job that exists (`job`) - an address can only be judged by asking it about something real, and some servers answer 404 when nothing matches. Ask the user for one, or set "Job to check in Test connection".',
75343
+ isError: true
75344
+ };
75345
+ }
75346
+ const given = {};
75347
+ const refused = [];
75348
+ for (const [key2, template] of Object.entries(params3.addresses ?? {})) {
75349
+ const problem = autosysPathProblem(key2, template);
75350
+ if (problem !== void 0)
75351
+ refused.push(`- ${key2} "${template}": ${problem}`);
75352
+ else
75353
+ given[key2] = template;
75354
+ }
75355
+ const keys = [
75356
+ .../* @__PURE__ */ new Set([
75357
+ ...params3.keys ?? DEFAULT_CHECKED,
75358
+ ...Object.keys(given),
75359
+ ...params3.machine !== void 0 ? ["machines", "machine"] : [],
75360
+ ...params3.calendar !== void 0 ? ["calendar"] : []
75361
+ ])
75362
+ ].filter((key2) => !AUTOSYS_SENDING_KEYS.includes(key2));
75363
+ const values = {
75364
+ job,
75365
+ jobName: job,
75366
+ pattern: pattern ?? `${job}*`,
75367
+ boxName: pattern ?? job,
75368
+ runNum: "",
75369
+ type: "stderr",
75370
+ ...params3.machine !== void 0 ? { machine: params3.machine } : {},
75371
+ ...params3.calendar !== void 0 ? { calendar: params3.calendar } : {}
75372
+ };
75373
+ const client = await options.client();
75374
+ const current = client.addresses;
75375
+ const halt = {};
75376
+ const run3 = async (common, only) => Promise.all(only.map(async (key2) => {
75377
+ const outcome = { key: key2, tried: [] };
75378
+ let fallback;
75379
+ for (const template of candidatesFor(key2, current[key2], given[key2], common)) {
75380
+ if (halt.by !== void 0)
75381
+ break;
75382
+ if (outcome.tried.some((check3) => check3.template === template))
75383
+ continue;
75384
+ const check2 = await client.withPaths({ [key2]: template }).check(key2, values);
75385
+ outcome.tried.push(check2);
75386
+ if (check2.signIn === true) {
75387
+ halt.by = check2;
75388
+ break;
75389
+ }
75390
+ if (check2.ok && (check2.records ?? 0) > 0) {
75391
+ outcome.chosen = check2;
75392
+ break;
75393
+ }
75394
+ if (check2.ok && fallback === void 0)
75395
+ fallback = check2;
75396
+ }
75397
+ outcome.chosen ??= fallback;
75398
+ return outcome;
75399
+ }));
75400
+ let outcomes = await run3(params3.common === true, keys);
75401
+ const missing = outcomes.filter((outcome) => outcome.chosen === void 0).map((outcome) => outcome.key);
75402
+ if (halt.by === void 0 && params3.common === void 0 && missing.length > 0) {
75403
+ const again = await run3(true, missing);
75404
+ outcomes = outcomes.map((outcome) => again.find((other) => other.key === outcome.key) ?? outcome);
75405
+ }
75406
+ if (halt.by !== void 0) {
75407
+ return {
75408
+ content: `Stopped: the server refused the sign-in (${describeCheck(halt.by)}). That is the credential, not the address - check it in Settings \u2192 DevOps \u2192 AutoSys before trying addresses; nothing more was sent.`,
75409
+ isError: true
75410
+ };
75411
+ }
75412
+ const lines2 = [`Tried on ${client.base} with job ${job} and pattern ${values["pattern"] ?? ""}:`, ""];
75413
+ const proposal = {};
75414
+ for (const outcome of outcomes) {
75415
+ const chosen = outcome.chosen;
75416
+ if (chosen !== void 0) {
75417
+ lines2.push(`\u2713 ${outcome.key}: ${chosen.template} - ${describeCheck(chosen)}`);
75418
+ if (chosen.template !== current[outcome.key])
75419
+ proposal[outcome.key] = chosen.template;
75420
+ if (chosen.records === 0)
75421
+ lines2.push(` (answered but empty - right address with the wrong filter form, or ${job} has none)`);
75422
+ } else {
75423
+ lines2.push(`\u2717 ${outcome.key}: nothing answered (${String(outcome.tried.length)} tried)`);
75424
+ for (const check2 of outcome.tried.slice(0, 3))
75425
+ lines2.push(` - ${check2.template} - ${describeCheck(check2)}`);
75426
+ }
75427
+ }
75428
+ if (refused.length > 0)
75429
+ lines2.push("", "Not tried - these candidates are not usable addresses:", ...refused);
75430
+ lines2.push("", Object.keys(proposal).length > 0 ? `To keep the working ones, call autosys_set_addresses with addresses ${JSON.stringify(proposal)}.` : "Every address that answered is already the saved one.");
75431
+ if (outcomes.some((outcome) => outcome.chosen === void 0)) {
75432
+ lines2.push("For the ones that did not answer, the office wiki is the place to look: search it for the AutoSys REST / AEWS API, and try what it names here with `addresses`. A 404 whose words say no job matched means the address is right.");
75433
+ }
75434
+ return { content: lines2.join("\n") };
75435
+ } catch (error51) {
75436
+ return { content: error51 instanceof Error ? error51.message : String(error51), isError: true };
75437
+ }
75438
+ }
75439
+ };
75440
+ }
75441
+ var setSchema = external_exports.object({
75442
+ addresses: external_exports.record(external_exports.string(), external_exports.string().nullable()).describe("Address templates to save, by name (jobs, job, runInfo, jobRunInfo, log, ...). null puts one back to the default."),
75443
+ source: external_exports.string().max(300).optional().describe("Where these came from - the wiki page title or link - shown to the user when approving."),
75444
+ job: external_exports.string().optional().describe("A job that exists, to try each changed address with in the approval. Default the configured test job."),
75445
+ pattern: external_exports.string().optional().describe("A pattern for trying the pattern addresses. Default the job followed by *.")
75446
+ });
75447
+ function render(paths) {
75448
+ const ordered = Object.fromEntries(AUTOSYS_PATH_KEYS.filter((key2) => paths[key2] !== void 0).map((key2) => [key2, paths[key2]]));
75449
+ return `${JSON.stringify(ordered, null, 2)}
75450
+ `;
75451
+ }
75452
+ function plan2(current, addresses2) {
75453
+ const next = { ...current };
75454
+ const changed = [];
75455
+ const problems = [];
75456
+ for (const [raw, template] of Object.entries(addresses2)) {
75457
+ const key2 = raw;
75458
+ if (!AUTOSYS_PATH_KEYS.includes(key2)) {
75459
+ problems.push(`"${raw}" is not an AutoSys address name - one of ${AUTOSYS_PATH_KEYS.join(", ")}.`);
75460
+ continue;
75461
+ }
75462
+ if (template === null || template.trim() === DEFAULT_AUTOSYS_PATHS[key2]) {
75463
+ if (next[key2] !== void 0) {
75464
+ delete next[key2];
75465
+ changed.push(key2);
75466
+ }
75467
+ continue;
75468
+ }
75469
+ const problem = autosysPathProblem(key2, template.trim());
75470
+ if (problem !== void 0) {
75471
+ problems.push(`${key2} "${template}": ${problem}`);
75472
+ continue;
75473
+ }
75474
+ if (next[key2] !== template.trim()) {
75475
+ next[key2] = template.trim();
75476
+ changed.push(key2);
75477
+ }
75478
+ }
75479
+ return { next, changed, problems };
75480
+ }
75481
+ var SHARE_HINT = 'To give the team the same addresses: Settings \u2192 Export, tick only "AutoSys addresses" (or light_code_export_config with sections ["autosysAddresses"]); colleagues import it with that section ticked, and nothing else of theirs changes.';
75482
+ function createAutosysSetAddressesTool(options) {
75483
+ return {
75484
+ name: "autosys_set_addresses",
75485
+ group: "edit",
75486
+ description: 'Save the addresses this AutoSys server answers at, so every AutoSys tool and Test connection uses them - after autosys_check_addresses found them working, or from the office wiki. Paths on the configured site only, e.g. "/v1/job-run-info?filter={filter:name}"; placeholders {job}, {pattern}, {filter:<field>}, {runNum}, {type}, {machine}, {calendar}. null resets one. The user approves, seeing each changed address tried live.',
75487
+ parametersSchema: setSchema,
75488
+ async preview(params3) {
75489
+ const current = await options.currentPaths();
75490
+ const { next, changed, problems } = plan2(current, params3.addresses);
75491
+ const notes = [];
75492
+ if (params3.source !== void 0)
75493
+ notes.push(`Learned from: ${params3.source}`);
75494
+ if (problems.length > 0)
75495
+ notes.push(`Will be refused: ${problems.join(" ")}`);
75496
+ const job = (params3.job ?? options.testJob)?.trim();
75497
+ const tryable = changed.filter((key2) => next[key2] !== void 0 && !AUTOSYS_SENDING_KEYS.includes(key2));
75498
+ if (problems.length === 0 && tryable.length > 0) {
75499
+ if (job === void 0 || !isAutosysName(job)) {
75500
+ notes.push("Not tried live: no job to try them with.");
75501
+ } else {
75502
+ const pattern = params3.pattern !== void 0 && isAutosysName(params3.pattern, true) ? params3.pattern : `${job}*`;
75503
+ try {
75504
+ const client = (await options.client()).withPaths(next);
75505
+ const values = { job, jobName: job, pattern, boxName: pattern, runNum: "", type: "stderr" };
75506
+ const checks = await Promise.all(tryable.map((key2) => client.check(key2, values)));
75507
+ notes.push(`Tried now with ${job}: ${checks.map((check2) => `${check2.ok ? "\u2713" : "\u2717"} ${check2.key} ${describeCheck(check2)}`).join("; ")}`);
75508
+ } catch (error51) {
75509
+ notes.push(`Could not try them: ${error51 instanceof Error ? error51.message : String(error51)}`);
75510
+ }
75511
+ }
75512
+ }
75513
+ const sent = changed.filter((key2) => AUTOSYS_SENDING_KEYS.includes(key2) && next[key2] !== void 0);
75514
+ if (sent.length > 0)
75515
+ notes.push(`Not tried: ${sent.join(", ")} - those are sent to, and trying would change production.`);
75516
+ return {
75517
+ kind: "diff",
75518
+ path: "AutoSys addresses (settings).json",
75519
+ before: render(current),
75520
+ after: render(next),
75521
+ ...notes.length > 0 ? { note: notes.join("\n") } : {}
75522
+ };
75523
+ },
75524
+ async execute(params3) {
75525
+ try {
75526
+ const { next, changed, problems } = plan2(await options.currentPaths(), params3.addresses);
75527
+ if (problems.length > 0)
75528
+ return { content: `Nothing saved: ${problems.join(" ")}`, isError: true };
75529
+ if (changed.length === 0)
75530
+ return { content: "Those are already the saved addresses; nothing changed." };
75531
+ await options.savePaths(next);
75532
+ return {
75533
+ content: [
75534
+ `Saved ${changed.join(", ")}. Every AutoSys tool uses them from the next call.`,
75535
+ ...changed.map((key2) => `- ${key2}: ${next[key2] ?? `default (${DEFAULT_AUTOSYS_PATHS[key2]})`}`),
75536
+ "",
75537
+ SHARE_HINT
75538
+ ].join("\n")
75539
+ };
75540
+ } catch (error51) {
75541
+ return { content: error51 instanceof Error ? error51.message : String(error51), isError: true };
75542
+ }
75543
+ }
75544
+ };
75545
+ }
75546
+ function createAutosysAddressTools(options) {
75547
+ const { savePaths } = options;
75548
+ return [
75549
+ createAutosysCheckAddressesTool(options),
75550
+ ...savePaths !== void 0 ? [createAutosysSetAddressesTool({ ...options, savePaths })] : []
75551
+ ];
75552
+ }
75553
+
75072
75554
  // ../../packages/core/dist/atlassian/readOnly.js
75073
75555
  function readOnlyNote(label) {
75074
75556
  return ` Access to ${label} here is read-only: nothing in ${label} can be changed from this chat. If asked to change something, say so and give the exact change for someone with access to make; do not try another way.`;
@@ -80181,17 +80663,17 @@ ${preview.text}` } : {}
80181
80663
  const to = await managedFolderFor(kind);
80182
80664
  if (to === void 0 || to.length === 0)
80183
80665
  throw new Error(noFolderMessage(kind));
80184
- const plan2 = await planMigration({ from: source, to, kind });
80185
- if (plan2.copy.length === 0) {
80186
- ui.showInfo(plan2.skip.length > 0 ? `Nothing to copy - all ${String(plan2.skip.length)} are already here.` : `Nothing in ${source} to copy.`);
80666
+ const plan3 = await planMigration({ from: source, to, kind });
80667
+ if (plan3.copy.length === 0) {
80668
+ ui.showInfo(plan3.skip.length > 0 ? `Nothing to copy - all ${String(plan3.skip.length)} are already here.` : `Nothing in ${source} to copy.`);
80187
80669
  return;
80188
80670
  }
80189
- const shown2 = plan2.copy.slice(0, 12).map((item) => item.name).join(", ");
80190
- const more = plan2.copy.length > 12 ? `, and ${String(plan2.copy.length - 12)} more` : "";
80191
- const confirmed = await ui.showActionMessage(`Copy into ${to}: ${shown2}${more}.` + (plan2.skip.length > 0 ? ` ${String(plan2.skip.length)} already here and left alone.` : "") + (kind === "tools" ? " They will arrive unapproved, to be read before they can run." : ""), "Copy", "info");
80671
+ const shown2 = plan3.copy.slice(0, 12).map((item) => item.name).join(", ");
80672
+ const more = plan3.copy.length > 12 ? `, and ${String(plan3.copy.length - 12)} more` : "";
80673
+ const confirmed = await ui.showActionMessage(`Copy into ${to}: ${shown2}${more}.` + (plan3.skip.length > 0 ? ` ${String(plan3.skip.length)} already here and left alone.` : "") + (kind === "tools" ? " They will arrive unapproved, to be read before they can run." : ""), "Copy", "info");
80192
80674
  if (!confirmed)
80193
80675
  return;
80194
- const result = await runMigration(plan2);
80676
+ const result = await runMigration(plan3);
80195
80677
  if (kind === "skills")
80196
80678
  await refreshSkills();
80197
80679
  else {
@@ -81624,10 +82106,20 @@ ${preview.text}` } : {}
81624
82106
  }
81625
82107
  }
81626
82108
  if (cachedAutosys?.enabled === true && cachedAutosys.baseUrl !== void 0) {
81627
- for (const tool of toolsForAccess(createAutosysTools({
81628
- client: autosysClient,
81629
- ...cachedAutosys.defaultPattern !== void 0 ? { defaultPattern: cachedAutosys.defaultPattern } : {}
81630
- }), cachedAutosys.readOnly === true, "AutoSys")) {
82109
+ const autosysDefaults = {
82110
+ ...cachedAutosys.defaultPattern !== void 0 ? { defaultPattern: cachedAutosys.defaultPattern } : {},
82111
+ ...cachedAutosys.testJob !== void 0 ? { testJob: cachedAutosys.testJob } : {}
82112
+ };
82113
+ for (const tool of toolsForAccess([
82114
+ ...createAutosysTools({ client: autosysClient, ...autosysDefaults }),
82115
+ // Finding and keeping the addresses this server answers at; saving is `edit`, so read-only leaves it out.
82116
+ ...createAutosysAddressTools({
82117
+ client: autosysClient,
82118
+ ...autosysDefaults,
82119
+ currentPaths: async () => Object.fromEntries(Object.entries((await configManager.load()).config.autosys?.paths ?? {}).filter(([, value]) => value !== void 0)),
82120
+ savePaths: saveAutosysPaths
82121
+ })
82122
+ ], cachedAutosys.readOnly === true, "AutoSys")) {
81631
82123
  combined.register(tool);
81632
82124
  }
81633
82125
  }
@@ -84551,6 +85043,14 @@ ${redact(shown2, cachedSecretValues)}` }
84551
85043
  const paths = Object.fromEntries(Object.entries(config2.autosys?.paths ?? {}).filter(([, value]) => value !== void 0));
84552
85044
  return new AutosysClient(http, await atlassianConnection("autosys", http), paths);
84553
85045
  }
85046
+ async function saveAutosysPaths(paths) {
85047
+ const { config: config2 } = await configManager.load();
85048
+ const { paths: _old, ...rest } = config2.autosys ?? {};
85049
+ void _old;
85050
+ await configManager.save("user", { autosys: { ...rest, ...Object.keys(paths).length > 0 ? { paths } : {} } });
85051
+ await loadSettings();
85052
+ await postAtlassian();
85053
+ }
84554
85054
  async function postAtlassian() {
84555
85055
  const { config: config2 } = await configManager.load();
84556
85056
  const products = {};
@@ -84704,14 +85204,21 @@ ${redact(shown2, cachedSecretValues)}` }
84704
85204
  const who = config2.autosys?.auth?.type === "apigee" ? `the gateway client ${config2.autosys.auth.clientId ?? ""}` : config2.autosys?.username ?? "";
84705
85205
  const testJob = config2.autosys?.testJob?.trim();
84706
85206
  if (testJob !== void 0 && testJob.length > 0) {
84707
- await client.job(testJob);
85207
+ try {
85208
+ await client.job(testJob);
85209
+ } catch (error51) {
85210
+ if (error51 instanceof AtlassianError && error51.status === 404) {
85211
+ throw new AtlassianError(`${error51.message} The sign-in was not refused; ${client.base}${client.addresses.job.replace("{job}", testJob)} is not where this server keeps job definitions. Ask the assistant to "find the AutoSys addresses" - it tries the usual layouts with ${testJob}, and what your wiki says about the AutoSys REST service, and saves the ones that answer once you approve.`, 404);
85212
+ }
85213
+ throw error51;
85214
+ }
84708
85215
  return `${who} - read the definition of ${testJob}`;
84709
85216
  }
84710
85217
  try {
84711
85218
  return await client.probe(who);
84712
85219
  } catch (error51) {
84713
85220
  if (error51 instanceof AtlassianError && error51.status === 404) {
84714
- throw new AtlassianError(`${error51.message} This server does not offer job status at ${client.base}/job-run-info. Enter a job you can read in "Job to check in Test connection" - the test then reads ${client.base}/job/<that job> instead - and set the status address in config:autosys (paths.runInfo, paths.jobRunInfo) to what this server uses.`, 404);
85221
+ throw new AtlassianError(`${error51.message} Enter a job you can read in "Job to check in Test connection" - the test then reads that one job - and ask the assistant to "find the AutoSys addresses": it tries the usual layouts (and what your wiki says about the AutoSys REST service) with that job, and saves the ones that answer once you approve.`, 404);
84715
85222
  }
84716
85223
  throw error51;
84717
85224
  }
@@ -84909,19 +85416,19 @@ ${redact(shown2, cachedSecretValues)}` }
84909
85416
  let teamRepoPushSoon;
84910
85417
  async function postTeamRepo(saveError) {
84911
85418
  const { config: config2 } = await configManager.load();
84912
- const plan2 = teamRepoPlan(config2);
85419
+ const plan3 = teamRepoPlan(config2);
84913
85420
  const bitbucketReady = config2.bitbucket?.enabled === true && config2.bitbucket.baseUrl !== void 0 && config2.bitbucket.tokenRef !== void 0;
84914
85421
  post({
84915
85422
  type: "teamRepo",
84916
85423
  settings: teamRepoSettings(config2),
84917
85424
  available: bitbucketReady,
84918
- ..."reason" in plan2 ? { reason: plan2.reason } : {},
85425
+ ..."reason" in plan3 ? { reason: plan3.reason } : {},
84919
85426
  ...teamRepoStatus !== void 0 ? { status: teamRepoStatus } : {},
84920
85427
  syncing: teamRepoSyncing,
84921
85428
  ...saveError !== void 0 ? { saveError } : {},
84922
85429
  bucketFolders: bucketFolderLabels(config2),
84923
85430
  // Where new skills and tools land while it is on - outside the project, unless a folder was chosen.
84924
- ..."dirs" in plan2 ? { savedIn: { ...skillsDir !== void 0 ? { skills: skillsDir } : {}, ...(pythonFolders(config2).toolsDir ?? localToolsDir(config2)) !== void 0 ? { tools: pythonFolders(config2).toolsDir ?? localToolsDir(config2) } : {} } } : {},
85431
+ ..."dirs" in plan3 ? { savedIn: { ...skillsDir !== void 0 ? { skills: skillsDir } : {}, ...(pythonFolders(config2).toolsDir ?? localToolsDir(config2)) !== void 0 ? { tools: pythonFolders(config2).toolsDir ?? localToolsDir(config2) } : {} } } : {},
84925
85432
  ...teamRepoRetire !== void 0 ? { retire: teamRepoRetire } : {}
84926
85433
  });
84927
85434
  }
@@ -84939,10 +85446,10 @@ ${redact(shown2, cachedSecretValues)}` }
84939
85446
  };
84940
85447
  }
84941
85448
  async function planDeleteEverywhere(kind, name) {
84942
- const plan2 = { kind, name, local: [], buckets: [], repo: [], notes: [] };
85449
+ const plan3 = { kind, name, local: [], buckets: [], repo: [], notes: [] };
84943
85450
  const valid = kind === "skill" ? isValidSkillName(name) : isValidToolName(name);
84944
85451
  if (!valid)
84945
- return { ...plan2, error: `"${name}" is not a valid ${kind} name.` };
85452
+ return { ...plan3, error: `"${name}" is not a valid ${kind} name.` };
84946
85453
  const config2 = await loadSettings();
84947
85454
  const team = teamRepoPlan(config2);
84948
85455
  const teamCopy = "dirs" in team ? kind === "skill" ? team.dirs.skills : team.dirs.tools : void 0;
@@ -84957,27 +85464,27 @@ ${redact(shown2, cachedSecretValues)}` }
84957
85464
  if (kind === "skill") {
84958
85465
  for (const dir of unique([skillsDir, localSkillsDir, personalSkillsDir, ...mirroredSkillsDirs])) {
84959
85466
  if (await has2(import_node_path52.default.join(dir, skillFileName(name))))
84960
- plan2.local.push(import_node_path52.default.join(dir, skillFileName(name)));
85467
+ plan3.local.push(import_node_path52.default.join(dir, skillFileName(name)));
84961
85468
  if (await has2(import_node_path52.default.join(dir, name, "SKILL.md")))
84962
- plan2.local.push(import_node_path52.default.join(dir, name));
85469
+ plan3.local.push(import_node_path52.default.join(dir, name));
84963
85470
  }
84964
85471
  for (const extra of config2.skills?.paths ?? []) {
84965
85472
  const dir = resolveSkillDir(extra);
84966
85473
  if (dir !== void 0 && (await has2(import_node_path52.default.join(dir, skillFileName(name))) || await has2(import_node_path52.default.join(dir, name, "SKILL.md")))) {
84967
- plan2.notes.push(`Also in ${dir}, a folder you added in Settings -> Skills - not removed; delete it there.`);
85474
+ plan3.notes.push(`Also in ${dir}, a folder you added in Settings -> Skills - not removed; delete it there.`);
84968
85475
  }
84969
85476
  }
84970
85477
  } else {
84971
85478
  for (const dir of unique([pythonFolders(config2).toolsDir, localToolsDir(config2), personalToolsDir, ...mirroredToolsDirs])) {
84972
85479
  if (await has2(import_node_path52.default.join(dir, toolFileName(name))))
84973
- plan2.local.push(import_node_path52.default.join(dir, toolFileName(name)));
85480
+ plan3.local.push(import_node_path52.default.join(dir, toolFileName(name)));
84974
85481
  }
84975
85482
  }
84976
85483
  const mirrors = (kind === "skill" ? cachedSkillMirrors : cachedToolMirrors).filter((mirror) => mirror.enabled === true);
84977
85484
  for (const mirror of mirrors) {
84978
85485
  const target = targetById(cachedS3, mirror.connectionId);
84979
85486
  if (target === void 0) {
84980
- plan2.notes.push(`The bucket connection "${mirror.connectionId}" is unusable - its copy, if any, cannot be checked.`);
85487
+ plan3.notes.push(`The bucket connection "${mirror.connectionId}" is unusable - its copy, if any, cannot be checked.`);
84981
85488
  continue;
84982
85489
  }
84983
85490
  try {
@@ -84986,21 +85493,21 @@ ${redact(shown2, cachedSecretValues)}` }
84986
85493
  if (keys.length === 0)
84987
85494
  continue;
84988
85495
  if (target.readOnly === true) {
84989
- plan2.notes.push(`In ${target.label}, which is configured read-only - not removed there.`);
85496
+ plan3.notes.push(`In ${target.label}, which is configured read-only - not removed there.`);
84990
85497
  continue;
84991
85498
  }
84992
- plan2.buckets.push({ connectionId: mirror.connectionId, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, label: target.label, keys });
85499
+ plan3.buckets.push({ connectionId: mirror.connectionId, ...mirror.prefix !== void 0 ? { prefix: mirror.prefix } : {}, label: target.label, keys });
84993
85500
  } catch (error51) {
84994
- plan2.notes.push(`${target.label} could not be listed: ${error51 instanceof Error ? error51.message : String(error51)}`);
85501
+ plan3.notes.push(`${target.label} could not be listed: ${error51 instanceof Error ? error51.message : String(error51)}`);
84995
85502
  }
84996
85503
  }
84997
85504
  if ("dirs" in team) {
84998
- plan2.repo = await repoFilesOf({ folder: team.settings.folder, stateFile: team.stateFile, mirror: team.dirs, kind: kind === "skill" ? "skills" : "tools", name });
84999
- plan2.repoLabel = `${team.settings.project}/${team.settings.repo} (${team.settings.branch})`;
85505
+ plan3.repo = await repoFilesOf({ folder: team.settings.folder, stateFile: team.stateFile, mirror: team.dirs, kind: kind === "skill" ? "skills" : "tools", name });
85506
+ plan3.repoLabel = `${team.settings.project}/${team.settings.repo} (${team.settings.branch})`;
85000
85507
  }
85001
- if (plan2.local.length === 0 && plan2.buckets.length === 0 && plan2.repo.length === 0)
85002
- plan2.error = `No ${kind} called "${name}" was found to delete.`;
85003
- return plan2;
85508
+ if (plan3.local.length === 0 && plan3.buckets.length === 0 && plan3.repo.length === 0)
85509
+ plan3.error = `No ${kind} called "${name}" was found to delete.`;
85510
+ return plan3;
85004
85511
  }
85005
85512
  async function handlePreviewDeleteEverywhere(kind, name) {
85006
85513
  post({ type: "deleteEverywherePlan", plan: await planDeleteEverywhere(kind, name) });
@@ -85104,14 +85611,14 @@ ${redact(shown2, cachedSecretValues)}` }
85104
85611
  let teamRepoRetire;
85105
85612
  async function handleRetireS3Buckets(confirm) {
85106
85613
  const config2 = await loadSettings();
85107
- const plan2 = teamRepoPlan(config2);
85614
+ const plan3 = teamRepoPlan(config2);
85108
85615
  const folders = bucketFolderLabels(config2);
85109
85616
  const refuse = async (problems) => {
85110
85617
  teamRepoRetire = { ready: false, folders, covered: { skills: 0, tools: 0 }, problems };
85111
85618
  await postTeamRepo();
85112
85619
  };
85113
- if ("reason" in plan2)
85114
- return refuse([`The team repository is not set up: ${plan2.reason}`]);
85620
+ if ("reason" in plan3)
85621
+ return refuse([`The team repository is not set up: ${plan3.reason}`]);
85115
85622
  if (folders.length === 0)
85116
85623
  return refuse(["No S3 bucket folders are switched on for skills or tools."]);
85117
85624
  teamRepoRetire = { ready: false, folders, covered: { skills: 0, tools: 0 }, problems: [], checking: true };
@@ -85125,10 +85632,10 @@ ${redact(shown2, cachedSecretValues)}` }
85125
85632
  return refuse(status2.conflicts.map((conflict) => `${conflict.path} - ${conflict.reason}`));
85126
85633
  }
85127
85634
  const bucketDirs = {
85128
- skills: mirroredSkillsDirs.filter((dir) => !samePath(dir, plan2.dirs.skills)),
85129
- tools: mirroredToolsDirs.filter((dir) => !samePath(dir, plan2.dirs.tools))
85635
+ skills: mirroredSkillsDirs.filter((dir) => !samePath(dir, plan3.dirs.skills)),
85636
+ tools: mirroredToolsDirs.filter((dir) => !samePath(dir, plan3.dirs.tools))
85130
85637
  };
85131
- const coverage = await checkCoverage({ folder: plan2.settings.folder, stateFile: plan2.stateFile, mirror: plan2.dirs, dirs: bucketDirs });
85638
+ const coverage = await checkCoverage({ folder: plan3.settings.folder, stateFile: plan3.stateFile, mirror: plan3.dirs, dirs: bucketDirs });
85132
85639
  if (coverage.problems.length > 0) {
85133
85640
  teamRepoRetire = { ready: false, folders, covered: coverage.covered, problems: coverage.problems };
85134
85641
  await postTeamRepo();
@@ -85153,12 +85660,12 @@ ${redact(shown2, cachedSecretValues)}` }
85153
85660
  s3.tools = toolMirrors;
85154
85661
  await configManager.save("user", { s3 });
85155
85662
  const stillHere = await checkCoverage({
85156
- folder: plan2.settings.folder,
85157
- stateFile: plan2.stateFile,
85158
- mirror: plan2.dirs,
85663
+ folder: plan3.settings.folder,
85664
+ stateFile: plan3.stateFile,
85665
+ mirror: plan3.dirs,
85159
85666
  dirs: { skills: [localSkillsDir].filter((dir) => dir !== void 0), tools: [localToolsDir(config2)].filter((dir) => dir !== void 0) }
85160
85667
  });
85161
- await releaseFromRecord(plan2.stateFile, coverage.repoPaths.filter((repoPath) => !stillHere.repoPaths.includes(repoPath)));
85668
+ await releaseFromRecord(plan3.stateFile, coverage.repoPaths.filter((repoPath) => !stillHere.repoPaths.includes(repoPath)));
85162
85669
  await loadSettings();
85163
85670
  await configurePythonFromSettings();
85164
85671
  await refreshSkills();
@@ -85214,8 +85721,8 @@ ${redact(shown2, cachedSecretValues)}` }
85214
85721
  if (teamRepoSyncing)
85215
85722
  return;
85216
85723
  const config2 = await loadSettings();
85217
- const plan2 = teamRepoPlan(config2);
85218
- if ("reason" in plan2) {
85724
+ const plan3 = teamRepoPlan(config2);
85725
+ if ("reason" in plan3) {
85219
85726
  noteProblem("teamrepo", void 0);
85220
85727
  await postTeamRepo();
85221
85728
  return;
@@ -85223,26 +85730,26 @@ ${redact(shown2, cachedSecretValues)}` }
85223
85730
  teamRepoSyncing = true;
85224
85731
  await postTeamRepo();
85225
85732
  try {
85226
- const api = await teamRepoFiles(plan2.settings);
85733
+ const api = await teamRepoFiles(plan3.settings);
85227
85734
  const report = await syncTeamRepo({
85228
85735
  api,
85229
- branch: plan2.settings.branch,
85230
- folder: plan2.settings.folder,
85736
+ branch: plan3.settings.branch,
85737
+ folder: plan3.settings.folder,
85231
85738
  // Every folder skills and tools load from here, in the order they win a name: the save folder,
85232
85739
  // the project's own folder, and S3 bucket folders - never the team copy itself.
85233
85740
  local: {
85234
- skills: [skillsDir, localSkillsDir, ...mirroredSkillsDirs].filter((dir) => !samePath(dir, plan2.dirs.skills)),
85235
- tools: [pythonFolders(config2).toolsDir, localToolsDir(config2), ...mirroredToolsDirs].filter((dir) => !samePath(dir, plan2.dirs.tools))
85741
+ skills: [skillsDir, localSkillsDir, ...mirroredSkillsDirs].filter((dir) => !samePath(dir, plan3.dirs.skills)),
85742
+ tools: [pythonFolders(config2).toolsDir, localToolsDir(config2), ...mirroredToolsDirs].filter((dir) => !samePath(dir, plan3.dirs.tools))
85236
85743
  },
85237
- mirror: plan2.dirs,
85238
- stateFile: plan2.stateFile,
85744
+ mirror: plan3.dirs,
85745
+ stateFile: plan3.stateFile,
85239
85746
  author: cachedAttribution.author ?? "someone",
85240
85747
  // Folders Light Code syncs itself: an unchanged copy there of something deleted for the team goes.
85241
85748
  removable: [
85242
- ...mirroredSkillsDirs.filter((dir) => !samePath(dir, plan2.dirs.skills)),
85243
- ...mirroredToolsDirs.filter((dir) => !samePath(dir, plan2.dirs.tools)),
85244
- plan2.own.skills,
85245
- plan2.own.tools
85749
+ ...mirroredSkillsDirs.filter((dir) => !samePath(dir, plan3.dirs.skills)),
85750
+ ...mirroredToolsDirs.filter((dir) => !samePath(dir, plan3.dirs.tools)),
85751
+ plan3.own.skills,
85752
+ plan3.own.tools
85246
85753
  ]
85247
85754
  });
85248
85755
  lastTeamRepoSync = Date.now();
@@ -85258,7 +85765,7 @@ ${redact(shown2, cachedSecretValues)}` }
85258
85765
  deletedHere: report.deletedHere
85259
85766
  };
85260
85767
  logger.info(`team repository sync (${reason}): ${String(report.pushed.length)} pushed, ${String(report.pulled.length)} pulled, ${String(report.conflicts.length)} conflict(s)`);
85261
- const where = `${plan2.settings.project}/${plan2.settings.repo} (${plan2.settings.branch})`;
85768
+ const where = `${plan3.settings.project}/${plan3.settings.repo} (${plan3.settings.branch})`;
85262
85769
  noteProblem("teamrepo", report.conflicts.length > 0 || report.deletedHere.length > 0 ? {
85263
85770
  severity: report.conflicts.length > 0 ? "warning" : "info",
85264
85771
  id: "teamrepo",
@@ -85283,7 +85790,7 @@ ${redact(shown2, cachedSecretValues)}` }
85283
85790
  severity: "error",
85284
85791
  id: "teamrepo",
85285
85792
  title: "The team repository could not be synced",
85286
- detail: `${plan2.settings.project}/${plan2.settings.repo} (${plan2.settings.branch}): ${detail}`,
85793
+ detail: `${plan3.settings.project}/${plan3.settings.repo} (${plan3.settings.branch}): ${detail}`,
85287
85794
  items: []
85288
85795
  });
85289
85796
  } finally {
@@ -86517,9 +87024,9 @@ ${last}` : ""}`);
86517
87024
  skills: { legacy: skillsIndexName(config2, false), current: skillsIndexName(config2) }
86518
87025
  });
86519
87026
  const plans = [];
86520
- for (const plan2 of candidates) {
86521
- if (await hasDocuments(writer, plan2.from))
86522
- plans.push(plan2);
87027
+ for (const plan3 of candidates) {
87028
+ if (await hasDocuments(writer, plan3.from))
87029
+ plans.push(plan3);
86523
87030
  }
86524
87031
  const store = search.store.label ?? search.id;
86525
87032
  if (!apply || plans.length === 0) {
@@ -86539,18 +87046,18 @@ ${last}` : ""}`);
86539
87046
  }
86540
87047
  const project = projectName(config2, workspaceRoot);
86541
87048
  const done = [];
86542
- for (const plan2 of plans) {
87049
+ for (const plan3 of plans) {
86543
87050
  const copied = await copyIndex({
86544
87051
  writer,
86545
- from: plan2.from,
86546
- to: plan2.to,
87052
+ from: plan3.from,
87053
+ to: plan3.to,
86547
87054
  dimensions: embedder.dimensions,
86548
87055
  project,
86549
- aliases: plan2.kind === "codebase" ? codebaseAliases(config2) : plan2.kind === "skills" ? skillAliases(config2) : [],
86550
- onProgress: (count3) => post({ type: "indexRenames", running: true, plans, store, current: plan2.to, copied: count3 })
87056
+ aliases: plan3.kind === "codebase" ? codebaseAliases(config2) : plan3.kind === "skills" ? skillAliases(config2) : [],
87057
+ onProgress: (count3) => post({ type: "indexRenames", running: true, plans, store, current: plan3.to, copied: count3 })
86551
87058
  });
86552
- await copyBookkeeping(import_node_path52.default.join(manifestsRoot, "index-manifests"), plan2.from, plan2.to, search.id);
86553
- done.push({ ...plan2, copied });
87059
+ await copyBookkeeping(import_node_path52.default.join(manifestsRoot, "index-manifests"), plan3.from, plan3.to, search.id);
87060
+ done.push({ ...plan3, copied });
86554
87061
  }
86555
87062
  post({ type: "indexRenames", running: false, plans: [], store, done });
86556
87063
  } catch (error51) {
@@ -88005,6 +88512,10 @@ ${last}` : ""}`);
88005
88512
  continue;
88006
88513
  for (const key2 of section.keys)
88007
88514
  patch[key2] = key2 === "profiles" && merged.profiles !== void 0 ? reconciled : merged[key2];
88515
+ for (const path63 of section.nested ?? []) {
88516
+ const head = path63.split(".")[0];
88517
+ patch[head] = merged[head];
88518
+ }
88008
88519
  }
88009
88520
  await configManager.save("user", patch);
88010
88521
  if (chosen.includes("project")) {
@@ -91924,7 +92435,15 @@ an access token as a Bearer token, leave the user id empty and paste that token
91924
92435
  "manual run",
91925
92436
  "run history",
91926
92437
  "runs today",
91927
- "last n hours"
92438
+ "last n hours",
92439
+ "aews",
92440
+ "404",
92441
+ "wrong address",
92442
+ "addresses",
92443
+ "urls",
92444
+ "endpoints",
92445
+ "wiki",
92446
+ "share addresses"
91928
92447
  ],
91929
92448
  body: `
91930
92449
  **Settings \u2192 DevOps \u2192 AutoSys**: the web services address, as far as the web services' own prefix (for
@@ -91980,6 +92499,25 @@ elsewhere can be pointed at with config:autosys (paths) \u2014 one template each
91980
92499
  runInfo, jobRunInfo, boxMembers, event, jil, log, machines, machine, globalVariables, calendar,
91981
92500
  extendedCalendar, runHistory and eventHistory. A tool whose address this server does not answer says which of these to set.
91982
92501
 
92502
+ **Your office's server answers at other addresses?** (Test connection 404, one job works but \`JOB*UK\`
92503
+ does not.) Fill in **Job to check in Test connection** with a job that exists, and ask the assistant to
92504
+ **"find the AutoSys addresses"**. \`autosys_check_addresses\` tries the saved addresses and the usual
92505
+ layouts (\`/v1\`, \`/AEWS\`, \`/AEWS/v1\`, \`/api/v1\`, other query forms) with that job and says what each
92506
+ answered, with the field names. **If your wiki documents the AutoSys REST service**, ask it to read that
92507
+ page first (Confluence configured: it searches and reads it; otherwise drop the page into the chat) - it tries
92508
+ what the page names, since a wiki page can be out of date and the server cannot. \`autosys_set_addresses\`
92509
+ then saves the ones that answered: it asks **every time**, the prompt shows the addresses before and after
92510
+ with each changed one tried live, and it is never available to a schedule or with read-only access.
92511
+ Addresses must be paths on your site (\`/v1/job/{job}\`) - never another host - and the ones that send
92512
+ (events, JIL) are never tried. Placeholders: {job}, {pattern}, {filter:name} (\`name==PAY_*\`), {runNum},
92513
+ {type}, {machine}, {calendar}. Even without any of this, a **pattern** works on a server with no pattern
92514
+ status address: the jobs are listed and each one's status read in turn.
92515
+
92516
+ **Share them with the team**: Settings \u2192 Export, tick only **AutoSys addresses**; colleagues import the
92517
+ file with that section ticked. It carries config:autosys (paths) alone, so their own site, sign-in and
92518
+ other DevOps settings are not touched. The assistant can write the same file (\`light_code_export_config\`
92519
+ with the section \`autosysAddresses\`), for example next to an onboarding page.
92520
+
91983
92521
  **Reading** \u2014 ordinary read tools, which you may set to always allow:
91984
92522
  - \`autosys_find_jobs\` \u2014 jobs matching a name pattern, with type, box, machine and owner, narrowed by
91985
92523
  what their definitions say: the **machine** they run on, **owner**, **box**, **type**, a **calendar**
@@ -94118,7 +94656,7 @@ function scoreTopic(topic, query) {
94118
94656
  return score;
94119
94657
  }
94120
94658
  var CONFIDENT = 4;
94121
- function render(topic) {
94659
+ function render2(topic) {
94122
94660
  return `## ${topic.title}
94123
94661
  (topic id: ${topic.id})
94124
94662
  ${topic.body.replace(/config:/g, "")}`;
@@ -94144,7 +94682,7 @@ function createLightCodeHelpTool() {
94144
94682
  const wanted = params3.topic.trim().toLowerCase();
94145
94683
  const found2 = HELP_TOPICS.find((topic) => topic.id === wanted);
94146
94684
  if (found2 !== void 0)
94147
- return { content: render(found2) };
94685
+ return { content: render2(found2) };
94148
94686
  params3 = { ...params3, query: params3.query ?? wanted };
94149
94687
  }
94150
94688
  const query = params3.query?.trim() ?? "";
@@ -94165,7 +94703,7 @@ function createLightCodeHelpTool() {
94165
94703
  }
94166
94704
  const best = ranked[0];
94167
94705
  const alsoRelevant = ranked.slice(1, 3);
94168
- const parts = [render(best.topic)];
94706
+ const parts = [render2(best.topic)];
94169
94707
  if (alsoRelevant.length > 0) {
94170
94708
  parts.push("", "---", "Also possibly relevant \u2014 call this tool again with one of these ids:", ...alsoRelevant.map((entry) => `- \`${entry.topic.id}\` \u2014 ${entry.topic.title}`));
94171
94709
  }