heyio 4.0.4 → 4.0.6

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.
@@ -27989,7 +27989,7 @@ var require_view = __commonJS({
27989
27989
  var dirname9 = path.dirname;
27990
27990
  var basename6 = path.basename;
27991
27991
  var extname4 = path.extname;
27992
- var join14 = path.join;
27992
+ var join15 = path.join;
27993
27993
  var resolve5 = path.resolve;
27994
27994
  module2.exports = View;
27995
27995
  function View(name, options2) {
@@ -28051,12 +28051,12 @@ var require_view = __commonJS({
28051
28051
  };
28052
28052
  View.prototype.resolve = function resolve6(dir, file2) {
28053
28053
  var ext = this.ext;
28054
- var path2 = join14(dir, file2);
28054
+ var path2 = join15(dir, file2);
28055
28055
  var stat4 = tryStat(path2);
28056
28056
  if (stat4 && stat4.isFile()) {
28057
28057
  return path2;
28058
28058
  }
28059
- path2 = join14(dir, basename6(file2, ext), "index" + ext);
28059
+ path2 = join15(dir, basename6(file2, ext), "index" + ext);
28060
28060
  stat4 = tryStat(path2);
28061
28061
  if (stat4 && stat4.isFile()) {
28062
28062
  return path2;
@@ -31761,7 +31761,7 @@ var require_send = __commonJS({
31761
31761
  var Stream = __require("stream");
31762
31762
  var util = __require("util");
31763
31763
  var extname4 = path.extname;
31764
- var join14 = path.join;
31764
+ var join15 = path.join;
31765
31765
  var normalize = path.normalize;
31766
31766
  var resolve5 = path.resolve;
31767
31767
  var sep = path.sep;
@@ -31933,7 +31933,7 @@ var require_send = __commonJS({
31933
31933
  return res;
31934
31934
  }
31935
31935
  parts = path2.split(sep);
31936
- path2 = normalize(join14(root, path2));
31936
+ path2 = normalize(join15(root, path2));
31937
31937
  } else {
31938
31938
  if (UP_PATH_REGEXP.test(path2)) {
31939
31939
  debug('malicious path "%s"', path2);
@@ -32066,7 +32066,7 @@ var require_send = __commonJS({
32066
32066
  if (err) return self.onStatError(err);
32067
32067
  return self.error(404);
32068
32068
  }
32069
- var p = join14(path2, self._index[i]);
32069
+ var p = join15(path2, self._index[i]);
32070
32070
  debug('stat "%s"', p);
32071
32071
  fs.stat(p, function(err2, stat4) {
32072
32072
  if (err2) return next(err2);
@@ -42076,7 +42076,7 @@ var require_thread_stream = __commonJS({
42076
42076
  var { version: version2 } = require_package();
42077
42077
  var { EventEmitter: EventEmitter2 } = __require("events");
42078
42078
  var { Worker } = __require("worker_threads");
42079
- var { join: join14 } = __require("path");
42079
+ var { join: join15 } = __require("path");
42080
42080
  var { pathToFileURL: pathToFileURL2 } = __require("url");
42081
42081
  var { wait } = require_wait();
42082
42082
  var {
@@ -42119,7 +42119,7 @@ var require_thread_stream = __commonJS({
42119
42119
  function createWorker(stream, opts) {
42120
42120
  const { filename, workerData } = opts;
42121
42121
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
42122
- const toExecute = bundlerOverrides["thread-stream-worker"] || join14(__dirname, "lib", "worker.js");
42122
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join15(__dirname, "lib", "worker.js");
42123
42123
  const worker = new Worker(toExecute, {
42124
42124
  ...opts.workerOpts,
42125
42125
  trackUnmanagedFds: false,
@@ -42522,7 +42522,7 @@ var require_transport = __commonJS({
42522
42522
  "use strict";
42523
42523
  var { createRequire } = __require("module");
42524
42524
  var getCallers = require_caller();
42525
- var { join: join14, isAbsolute: isAbsolute2, sep } = __require("node:path");
42525
+ var { join: join15, isAbsolute: isAbsolute2, sep } = __require("node:path");
42526
42526
  var sleep = require_atomic_sleep();
42527
42527
  var onExit = require_on_exit_leak_free();
42528
42528
  var ThreadStream = require_thread_stream();
@@ -42585,7 +42585,7 @@ var require_transport = __commonJS({
42585
42585
  throw new Error("only one of target or targets can be specified");
42586
42586
  }
42587
42587
  if (targets) {
42588
- target = bundlerOverrides["pino-worker"] || join14(__dirname, "worker.js");
42588
+ target = bundlerOverrides["pino-worker"] || join15(__dirname, "worker.js");
42589
42589
  options2.targets = targets.filter((dest) => dest.target).map((dest) => {
42590
42590
  return {
42591
42591
  ...dest,
@@ -42603,7 +42603,7 @@ var require_transport = __commonJS({
42603
42603
  });
42604
42604
  });
42605
42605
  } else if (pipeline) {
42606
- target = bundlerOverrides["pino-worker"] || join14(__dirname, "worker.js");
42606
+ target = bundlerOverrides["pino-worker"] || join15(__dirname, "worker.js");
42607
42607
  options2.pipelines = [pipeline.map((dest) => {
42608
42608
  return {
42609
42609
  ...dest,
@@ -42625,7 +42625,7 @@ var require_transport = __commonJS({
42625
42625
  return origin;
42626
42626
  }
42627
42627
  if (origin === "pino/file") {
42628
- return join14(__dirname, "..", "file.js");
42628
+ return join15(__dirname, "..", "file.js");
42629
42629
  }
42630
42630
  let fixTarget2;
42631
42631
  for (const filePath of callers) {
@@ -43614,7 +43614,7 @@ var require_safe_stable_stringify = __commonJS({
43614
43614
  return circularValue;
43615
43615
  }
43616
43616
  let res = "";
43617
- let join14 = ",";
43617
+ let join15 = ",";
43618
43618
  const originalIndentation = indentation;
43619
43619
  if (Array.isArray(value)) {
43620
43620
  if (value.length === 0) {
@@ -43628,7 +43628,7 @@ var require_safe_stable_stringify = __commonJS({
43628
43628
  indentation += spacer;
43629
43629
  res += `
43630
43630
  ${indentation}`;
43631
- join14 = `,
43631
+ join15 = `,
43632
43632
  ${indentation}`;
43633
43633
  }
43634
43634
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -43636,13 +43636,13 @@ ${indentation}`;
43636
43636
  for (; i < maximumValuesToStringify - 1; i++) {
43637
43637
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
43638
43638
  res += tmp2 !== void 0 ? tmp2 : "null";
43639
- res += join14;
43639
+ res += join15;
43640
43640
  }
43641
43641
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
43642
43642
  res += tmp !== void 0 ? tmp : "null";
43643
43643
  if (value.length - 1 > maximumBreadth) {
43644
43644
  const removedKeys = value.length - maximumBreadth - 1;
43645
- res += `${join14}"... ${getItemCount(removedKeys)} not stringified"`;
43645
+ res += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
43646
43646
  }
43647
43647
  if (spacer !== "") {
43648
43648
  res += `
@@ -43663,7 +43663,7 @@ ${originalIndentation}`;
43663
43663
  let separator = "";
43664
43664
  if (spacer !== "") {
43665
43665
  indentation += spacer;
43666
- join14 = `,
43666
+ join15 = `,
43667
43667
  ${indentation}`;
43668
43668
  whitespace = " ";
43669
43669
  }
@@ -43677,13 +43677,13 @@ ${indentation}`;
43677
43677
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
43678
43678
  if (tmp !== void 0) {
43679
43679
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
43680
- separator = join14;
43680
+ separator = join15;
43681
43681
  }
43682
43682
  }
43683
43683
  if (keyLength > maximumBreadth) {
43684
43684
  const removedKeys = keyLength - maximumBreadth;
43685
43685
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
43686
- separator = join14;
43686
+ separator = join15;
43687
43687
  }
43688
43688
  if (spacer !== "" && separator.length > 1) {
43689
43689
  res = `
@@ -43724,7 +43724,7 @@ ${originalIndentation}`;
43724
43724
  }
43725
43725
  const originalIndentation = indentation;
43726
43726
  let res = "";
43727
- let join14 = ",";
43727
+ let join15 = ",";
43728
43728
  if (Array.isArray(value)) {
43729
43729
  if (value.length === 0) {
43730
43730
  return "[]";
@@ -43737,7 +43737,7 @@ ${originalIndentation}`;
43737
43737
  indentation += spacer;
43738
43738
  res += `
43739
43739
  ${indentation}`;
43740
- join14 = `,
43740
+ join15 = `,
43741
43741
  ${indentation}`;
43742
43742
  }
43743
43743
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -43745,13 +43745,13 @@ ${indentation}`;
43745
43745
  for (; i < maximumValuesToStringify - 1; i++) {
43746
43746
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
43747
43747
  res += tmp2 !== void 0 ? tmp2 : "null";
43748
- res += join14;
43748
+ res += join15;
43749
43749
  }
43750
43750
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
43751
43751
  res += tmp !== void 0 ? tmp : "null";
43752
43752
  if (value.length - 1 > maximumBreadth) {
43753
43753
  const removedKeys = value.length - maximumBreadth - 1;
43754
- res += `${join14}"... ${getItemCount(removedKeys)} not stringified"`;
43754
+ res += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
43755
43755
  }
43756
43756
  if (spacer !== "") {
43757
43757
  res += `
@@ -43764,7 +43764,7 @@ ${originalIndentation}`;
43764
43764
  let whitespace = "";
43765
43765
  if (spacer !== "") {
43766
43766
  indentation += spacer;
43767
- join14 = `,
43767
+ join15 = `,
43768
43768
  ${indentation}`;
43769
43769
  whitespace = " ";
43770
43770
  }
@@ -43773,7 +43773,7 @@ ${indentation}`;
43773
43773
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
43774
43774
  if (tmp !== void 0) {
43775
43775
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
43776
- separator = join14;
43776
+ separator = join15;
43777
43777
  }
43778
43778
  }
43779
43779
  if (spacer !== "" && separator.length > 1) {
@@ -43831,20 +43831,20 @@ ${originalIndentation}`;
43831
43831
  indentation += spacer;
43832
43832
  let res2 = `
43833
43833
  ${indentation}`;
43834
- const join15 = `,
43834
+ const join16 = `,
43835
43835
  ${indentation}`;
43836
43836
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
43837
43837
  let i = 0;
43838
43838
  for (; i < maximumValuesToStringify - 1; i++) {
43839
43839
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
43840
43840
  res2 += tmp2 !== void 0 ? tmp2 : "null";
43841
- res2 += join15;
43841
+ res2 += join16;
43842
43842
  }
43843
43843
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
43844
43844
  res2 += tmp !== void 0 ? tmp : "null";
43845
43845
  if (value.length - 1 > maximumBreadth) {
43846
43846
  const removedKeys = value.length - maximumBreadth - 1;
43847
- res2 += `${join15}"... ${getItemCount(removedKeys)} not stringified"`;
43847
+ res2 += `${join16}"... ${getItemCount(removedKeys)} not stringified"`;
43848
43848
  }
43849
43849
  res2 += `
43850
43850
  ${originalIndentation}`;
@@ -43860,16 +43860,16 @@ ${originalIndentation}`;
43860
43860
  return '"[Object]"';
43861
43861
  }
43862
43862
  indentation += spacer;
43863
- const join14 = `,
43863
+ const join15 = `,
43864
43864
  ${indentation}`;
43865
43865
  let res = "";
43866
43866
  let separator = "";
43867
43867
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
43868
43868
  if (isTypedArrayWithEntries(value)) {
43869
- res += stringifyTypedArray(value, join14, maximumBreadth);
43869
+ res += stringifyTypedArray(value, join15, maximumBreadth);
43870
43870
  keys = keys.slice(value.length);
43871
43871
  maximumPropertiesToStringify -= value.length;
43872
- separator = join14;
43872
+ separator = join15;
43873
43873
  }
43874
43874
  if (deterministic) {
43875
43875
  keys = sort(keys, comparator);
@@ -43880,13 +43880,13 @@ ${indentation}`;
43880
43880
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
43881
43881
  if (tmp !== void 0) {
43882
43882
  res += `${separator}${strEscape(key2)}: ${tmp}`;
43883
- separator = join14;
43883
+ separator = join15;
43884
43884
  }
43885
43885
  }
43886
43886
  if (keyLength > maximumBreadth) {
43887
43887
  const removedKeys = keyLength - maximumBreadth;
43888
43888
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
43889
- separator = join14;
43889
+ separator = join15;
43890
43890
  }
43891
43891
  if (separator !== "") {
43892
43892
  res = `
@@ -60175,7 +60175,7 @@ var require_mod2 = __commonJS({
60175
60175
 
60176
60176
  // packages/shared/dist/constants.js
60177
60177
  var APP_NAME = "io";
60178
- var APP_VERSION = "4.0.4";
60178
+ var APP_VERSION = "4.0.6";
60179
60179
  var API_PORT = 7777;
60180
60180
  var API_HOST = "0.0.0.0";
60181
60181
  var DEFAULT_MODEL = "gpt-4o";
@@ -63037,7 +63037,7 @@ async function createNotificationItemIfMissing(eventBus2, payload, type, title,
63037
63037
  // packages/daemon/src/api/server.ts
63038
63038
  import { existsSync as existsSync2 } from "node:fs";
63039
63039
  import { createServer } from "node:http";
63040
- import { dirname as dirname4, resolve as resolve2 } from "node:path";
63040
+ import { dirname as dirname4, join as join4, resolve as resolve2 } from "node:path";
63041
63041
  import { fileURLToPath } from "node:url";
63042
63042
  var import_express10 = __toESM(require_express2(), 1);
63043
63043
 
@@ -78059,11 +78059,16 @@ router6.get("/api/skills", async (_req, res) => {
78059
78059
  router6.post("/api/skills/install", async (req, res) => {
78060
78060
  try {
78061
78061
  const body = req.body;
78062
- if (!body?.url && !(body?.source && body?.slug)) {
78062
+ if (!body?.url && !(body?.source && (body?.slug || body?.skillId || body?.name))) {
78063
78063
  res.status(400).json({ error: "Provide url or source+slug to install a skill" });
78064
78064
  return;
78065
78065
  }
78066
- const result = await installSkill(body);
78066
+ const normalized = {
78067
+ url: body.url,
78068
+ source: body.source,
78069
+ slug: body.slug || body.skillId || body.name
78070
+ };
78071
+ const result = await installSkill(normalized);
78067
78072
  res.status(result.created ? 201 : 200).json(result.skill);
78068
78073
  } catch (error51) {
78069
78074
  const statusCode = error51 instanceof Error && /Invalid skill|fetch/i.test(error51.message) ? 400 : 500;
@@ -78118,13 +78123,20 @@ async function installSkill(request) {
78118
78123
  const directory = join2(SKILLS_DIR, directoryName);
78119
78124
  const existing = installedSkills.find((skill2) => skill2.id === id);
78120
78125
  let entryFile = existing?.entryFile ?? null;
78121
- if (request.url) {
78122
- const response = await fetch(request.url);
78126
+ let resolvedUrl = request.url;
78127
+ if (source === "skillssh" && resolvedUrl) {
78128
+ const fetchResult = await fetch(resolvedUrl);
78129
+ if (!fetchResult.ok) {
78130
+ resolvedUrl = await resolveSkillsShUrl(request) ?? resolvedUrl;
78131
+ }
78132
+ }
78133
+ if (resolvedUrl) {
78134
+ const response = await fetch(resolvedUrl);
78123
78135
  if (!response.ok) {
78124
- throw new Error(`Failed to fetch skill from ${request.url}`);
78136
+ throw new Error(`Failed to fetch skill from ${resolvedUrl} (${response.status})`);
78125
78137
  }
78126
78138
  const body = await response.text();
78127
- entryFile = chooseEntryFileName(request.url, response.headers.get("content-type"));
78139
+ entryFile = chooseEntryFileName(resolvedUrl, response.headers.get("content-type"));
78128
78140
  await mkdir3(directory, { recursive: true });
78129
78141
  await writeFile2(join2(directory, entryFile), body, "utf8");
78130
78142
  } else {
@@ -78211,6 +78223,42 @@ function chooseEntryFileName(url2, contentType) {
78211
78223
  function isMissingFileError2(error51) {
78212
78224
  return !!error51 && typeof error51 === "object" && "code" in error51 && error51.code === "ENOENT";
78213
78225
  }
78226
+ async function resolveSkillsShUrl(request) {
78227
+ const slug = request.slug?.trim();
78228
+ if (!slug) return null;
78229
+ try {
78230
+ const searchResponse = await fetch(
78231
+ `https://skills.sh/api/search?q=${encodeURIComponent(slug)}&limit=10`,
78232
+ { signal: AbortSignal.timeout(1e4) }
78233
+ );
78234
+ if (!searchResponse.ok) return null;
78235
+ const data = await searchResponse.json();
78236
+ const match = data.skills?.find(
78237
+ (s) => s.skillId === slug || s.name === slug || s.id.endsWith(`/${slug}`)
78238
+ );
78239
+ if (!match?.source) return null;
78240
+ const headers = {
78241
+ Accept: "application/vnd.github.v3+json",
78242
+ "User-Agent": "io-daemon"
78243
+ };
78244
+ if (process.env.GITHUB_TOKEN) {
78245
+ headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
78246
+ }
78247
+ const treeResponse = await fetch(
78248
+ `https://api.github.com/repos/${match.source}/git/trees/main?recursive=1`,
78249
+ { headers, signal: AbortSignal.timeout(15e3) }
78250
+ );
78251
+ if (!treeResponse.ok) return null;
78252
+ const treeData = await treeResponse.json();
78253
+ const skillFile = treeData.tree?.find(
78254
+ (entry) => entry.type === "blob" && entry.path.endsWith(`/${match.skillId}/SKILL.md`)
78255
+ );
78256
+ if (!skillFile) return null;
78257
+ return `https://raw.githubusercontent.com/${match.source}/main/${skillFile.path}`;
78258
+ } catch {
78259
+ return null;
78260
+ }
78261
+ }
78214
78262
  async function discoverSkillsSh(query) {
78215
78263
  if (!query) return [];
78216
78264
  const endpoint = `https://skills.sh/api/search?q=${encodeURIComponent(query)}&limit=50`;
@@ -79130,6 +79178,9 @@ function createApiServer(config2) {
79130
79178
  });
79131
79179
  if (existsSync2(webDirectory)) {
79132
79180
  app.use(import_express10.default.static(webDirectory));
79181
+ app.use((_req, res) => {
79182
+ res.sendFile(join4(webDirectory, "index.html"));
79183
+ });
79133
79184
  }
79134
79185
  app.use((error51, _req, res, next) => {
79135
79186
  if (res.headersSent) {
@@ -79176,8 +79227,8 @@ function createApiServer(config2) {
79176
79227
 
79177
79228
  // packages/daemon/src/data-dir.ts
79178
79229
  import { mkdirSync } from "node:fs";
79179
- import { join as join4 } from "node:path";
79180
- var WIKI_PAGES_DIR = join4(WIKI_DIR, "pages");
79230
+ import { join as join5 } from "node:path";
79231
+ var WIKI_PAGES_DIR = join5(WIKI_DIR, "pages");
79181
79232
  function ensureDataDirectories() {
79182
79233
  for (const directory of [DATA_DIR, WIKI_DIR, WIKI_PAGES_DIR, SKILLS_DIR, LOGS_DIR]) {
79183
79234
  mkdirSync(directory, { recursive: true });
@@ -79185,10 +79236,10 @@ function ensureDataDirectories() {
79185
79236
  }
79186
79237
 
79187
79238
  // packages/daemon/src/logging/logger.ts
79188
- import { join as join5 } from "node:path";
79239
+ import { join as join6 } from "node:path";
79189
79240
  var import_pino = __toESM(require_pino(), 1);
79190
79241
  var import_pino_pretty = __toESM(require_pino_pretty(), 1);
79191
- var LOG_FILE_PATH = join5(LOGS_DIR, "io.log");
79242
+ var LOG_FILE_PATH = join6(LOGS_DIR, "io.log");
79192
79243
  var rootLogger = null;
79193
79244
  function shouldPrettyPrint(logLevel) {
79194
79245
  return process.env.NODE_ENV !== "production" || process.env.LOG_LEVEL === "debug" || logLevel === "debug" || logLevel === "trace";
@@ -79771,10 +79822,10 @@ import {
79771
79822
  // packages/daemon/src/copilot/client.ts
79772
79823
  import { execFileSync as execFileSync2 } from "node:child_process";
79773
79824
  import { mkdirSync as mkdirSync2 } from "node:fs";
79774
- import { join as join6 } from "node:path";
79825
+ import { join as join7 } from "node:path";
79775
79826
  import { CopilotClient } from "@github/copilot-sdk";
79776
79827
  var COPILOT_AUTH_ERROR_HINT = "Set GITHUB_TOKEN or authenticate with the GitHub CLI (`gh auth login`) so `gh auth token` returns a valid token.";
79777
- var COPILOT_BASE_DIRECTORY = join6(DATA_DIR, "copilot-sdk");
79828
+ var COPILOT_BASE_DIRECTORY = join7(DATA_DIR, "copilot-sdk");
79778
79829
  var copilotClientSingleton = null;
79779
79830
  var copilotClientInitPromise = null;
79780
79831
  function readTokenFromEnvironment() {
@@ -80001,7 +80052,7 @@ async function sendMessage(session, message2, onChunk) {
80001
80052
  // packages/daemon/src/skills/loader.ts
80002
80053
  var import_gray_matter2 = __toESM(require_gray_matter(), 1);
80003
80054
  import { readFile as readFile4, readdir as readdir2 } from "node:fs/promises";
80004
- import { basename as basename3, dirname as dirname5, join as join7 } from "node:path";
80055
+ import { basename as basename3, dirname as dirname5, join as join8 } from "node:path";
80005
80056
  async function scanSkills() {
80006
80057
  const skillFilePaths = await collectSkillFiles(SKILLS_DIR);
80007
80058
  const skills = await Promise.all(skillFilePaths.map((filePath) => readSkillFromFile(filePath)));
@@ -80012,7 +80063,7 @@ async function collectSkillFiles(directory) {
80012
80063
  const entries = await readdir2(directory, { withFileTypes: true });
80013
80064
  const skillFiles = [];
80014
80065
  for (const entry of entries) {
80015
- const entryPath = join7(directory, entry.name);
80066
+ const entryPath = join8(directory, entry.name);
80016
80067
  if (entry.isDirectory()) {
80017
80068
  skillFiles.push(...await collectSkillFiles(entryPath));
80018
80069
  continue;
@@ -80049,7 +80100,7 @@ function isMissingFileError4(error51) {
80049
80100
  // packages/daemon/src/skills/manager.ts
80050
80101
  var import_gray_matter3 = __toESM(require_gray_matter(), 1);
80051
80102
  import { mkdir as mkdir5, readFile as readFile5, rm as rm3, writeFile as writeFile4 } from "node:fs/promises";
80052
- import { basename as basename4, dirname as dirname6, join as join8 } from "node:path";
80103
+ import { basename as basename4, dirname as dirname6, join as join9 } from "node:path";
80053
80104
  async function installSkill2(url2) {
80054
80105
  const response = await fetch(url2);
80055
80106
  if (!response.ok) {
@@ -80059,8 +80110,8 @@ async function installSkill2(url2) {
80059
80110
  }
80060
80111
  const skillMarkdown = await response.text();
80061
80112
  const skillId = getSkillIdFromUrl(url2);
80062
- const skillDirectory = join8(SKILLS_DIR, skillId);
80063
- const skillPath = join8(skillDirectory, "SKILL.md");
80113
+ const skillDirectory = join9(SKILLS_DIR, skillId);
80114
+ const skillPath = join9(skillDirectory, "SKILL.md");
80064
80115
  const parsed = (0, import_gray_matter3.default)(skillMarkdown);
80065
80116
  const installedSkill = {
80066
80117
  id: skillId,
@@ -80074,7 +80125,7 @@ async function installSkill2(url2) {
80074
80125
  return installedSkill;
80075
80126
  }
80076
80127
  async function removeSkill2(id) {
80077
- await rm3(join8(SKILLS_DIR, id), { recursive: true, force: true });
80128
+ await rm3(join9(SKILLS_DIR, id), { recursive: true, force: true });
80078
80129
  const lockFile = await readSkillsLock();
80079
80130
  lockFile.skills = lockFile.skills.filter((skill) => skill.id !== id);
80080
80131
  await writeSkillsLock2(lockFile);
@@ -80563,7 +80614,7 @@ var executeSkillsToolCall = async (toolName, rawArgs) => {
80563
80614
  // packages/daemon/src/execution/runner.ts
80564
80615
  import { exec as exec7 } from "node:child_process";
80565
80616
  import { access as access2 } from "node:fs/promises";
80566
- import { basename as basename5, join as join13 } from "node:path";
80617
+ import { basename as basename5, join as join14 } from "node:path";
80567
80618
  import { promisify as promisify7 } from "node:util";
80568
80619
 
80569
80620
  // packages/daemon/src/squad/manager.ts
@@ -80595,7 +80646,7 @@ async function isSquadAvailable(squadId) {
80595
80646
  // packages/daemon/src/execution/agent.ts
80596
80647
  import { exec as exec2 } from "node:child_process";
80597
80648
  import { mkdir as mkdir7, readFile as readFile7, readdir as readdir4, stat as stat3, writeFile as writeFile6 } from "node:fs/promises";
80598
- import { dirname as dirname8, extname as extname3, isAbsolute, join as join9, relative as relative3, resolve as resolve4 } from "node:path";
80649
+ import { dirname as dirname8, extname as extname3, isAbsolute, join as join10, relative as relative3, resolve as resolve4 } from "node:path";
80599
80650
  import { promisify as promisify2 } from "node:util";
80600
80651
  import {
80601
80652
  CopilotClient as CopilotClient2,
@@ -80691,7 +80742,7 @@ async function collectFiles(directory, recursive, output) {
80691
80742
  if (output.length >= MAX_LIST_RESULTS) {
80692
80743
  return;
80693
80744
  }
80694
- const fullPath = join9(directory, entry.name);
80745
+ const fullPath = join10(directory, entry.name);
80695
80746
  output.push(fullPath);
80696
80747
  if (recursive && entry.isDirectory()) {
80697
80748
  await collectFiles(fullPath, recursive, output);
@@ -80947,7 +80998,7 @@ Work only inside the current worktree. Summarize the concrete changes you made,
80947
80998
  // packages/daemon/src/execution/planning.ts
80948
80999
  import { exec as exec3 } from "node:child_process";
80949
81000
  import { access, readFile as readFile8 } from "node:fs/promises";
80950
- import { join as join10 } from "node:path";
81001
+ import { join as join11 } from "node:path";
80951
81002
  import { promisify as promisify3 } from "node:util";
80952
81003
  import { CopilotClient as CopilotClient3, approveAll as approveAll3 } from "@github/copilot-sdk";
80953
81004
 
@@ -81046,7 +81097,7 @@ async function fileExists(path) {
81046
81097
  }
81047
81098
  async function buildRepoContext(repoPath) {
81048
81099
  for (const candidate of README_CANDIDATES) {
81049
- const readmePath = join10(repoPath, candidate);
81100
+ const readmePath = join11(repoPath, candidate);
81050
81101
  if (await fileExists(readmePath)) {
81051
81102
  const content = await readFile8(readmePath, "utf8");
81052
81103
  return content.slice(0, MAX_REPO_CONTEXT_LENGTH);
@@ -81169,13 +81220,13 @@ ${repoContext}`
81169
81220
  // packages/daemon/src/execution/pr.ts
81170
81221
  import { exec as exec5 } from "node:child_process";
81171
81222
  import { rm as rm5, writeFile as writeFile7 } from "node:fs/promises";
81172
- import { join as join12 } from "node:path";
81223
+ import { join as join13 } from "node:path";
81173
81224
  import { promisify as promisify5 } from "node:util";
81174
81225
 
81175
81226
  // packages/daemon/src/execution/worktree.ts
81176
81227
  import { exec as exec4 } from "node:child_process";
81177
81228
  import { mkdir as mkdir8, rm as rm4 } from "node:fs/promises";
81178
- import { join as join11 } from "node:path";
81229
+ import { join as join12 } from "node:path";
81179
81230
  import { promisify as promisify4 } from "node:util";
81180
81231
  var execAsync4 = promisify4(exec4);
81181
81232
  var DEFAULT_REMOTE = "origin";
@@ -81195,7 +81246,7 @@ async function branchExists(repoPath, branchName) {
81195
81246
  return output.length > 0;
81196
81247
  }
81197
81248
  function getWorktreePath(repoPath, branchName) {
81198
- return join11(repoPath, ".worktrees", sanitizeBranchName(branchName));
81249
+ return join12(repoPath, ".worktrees", sanitizeBranchName(branchName));
81199
81250
  }
81200
81251
  async function listWorktrees(repoPath) {
81201
81252
  const output = await runGit("git worktree list --porcelain", repoPath);
@@ -81245,7 +81296,7 @@ async function listWorktrees(repoPath) {
81245
81296
  }
81246
81297
  async function createWorktree(repoPath, branchName, baseBranch) {
81247
81298
  const worktreePath = getWorktreePath(repoPath, branchName);
81248
- await mkdir8(join11(repoPath, ".worktrees"), { recursive: true });
81299
+ await mkdir8(join12(repoPath, ".worktrees"), { recursive: true });
81249
81300
  const existing = (await listWorktrees(repoPath)).find(
81250
81301
  (worktree) => worktree.path === worktreePath
81251
81302
  );
@@ -81267,7 +81318,7 @@ async function createWorktree(repoPath, branchName, baseBranch) {
81267
81318
  }
81268
81319
  }
81269
81320
  async function cleanupWorktree(worktreePath) {
81270
- const parentRepoPath = join11(worktreePath, "..", "..");
81321
+ const parentRepoPath = join12(worktreePath, "..", "..");
81271
81322
  try {
81272
81323
  await runGit(`git worktree remove ${JSON.stringify(worktreePath)}`, parentRepoPath);
81273
81324
  } catch (error51) {
@@ -81309,7 +81360,7 @@ function extractUrl(output) {
81309
81360
  }
81310
81361
  function buildBodyFilePath(repoPath, branchName) {
81311
81362
  const safeBranchName = branchName.replace(/[^a-zA-Z0-9._-]+/g, "-");
81312
- return join12(repoPath, `.io-pr-body-${safeBranchName}.md`);
81363
+ return join13(repoPath, `.io-pr-body-${safeBranchName}.md`);
81313
81364
  }
81314
81365
  function buildPrBody(objective, plan, taskSummaries, qaOutcome) {
81315
81366
  const tasks = taskSummaries.map((summary) => `- ${summary}`).join("\n") || "- No task summaries recorded.";
@@ -81627,12 +81678,12 @@ async function runGit2(command, cwd) {
81627
81678
  async function resolveRepoPath(repoUrl, repoName) {
81628
81679
  const candidates = [
81629
81680
  process.cwd(),
81630
- join13(process.cwd(), repoName),
81631
- join13(process.cwd(), "repos", repoName),
81632
- join13(process.cwd(), "..", repoName)
81681
+ join14(process.cwd(), repoName),
81682
+ join14(process.cwd(), "repos", repoName),
81683
+ join14(process.cwd(), "..", repoName)
81633
81684
  ];
81634
81685
  for (const candidate of candidates) {
81635
- if (!await pathExists(join13(candidate, ".git"))) {
81686
+ if (!await pathExists(join14(candidate, ".git"))) {
81636
81687
  continue;
81637
81688
  }
81638
81689
  const remoteUrl = await runGit2("git remote get-url origin", candidate).catch(() => "");
@@ -82587,12 +82638,25 @@ var Orchestrator = class {
82587
82638
  }
82588
82639
  async refreshSession(model, systemPrompt) {
82589
82640
  await this.disconnectSession();
82590
- this.activeSession = await createSession({
82591
- model,
82592
- systemPrompt,
82593
- tools: createBoundOrchestratorTools(this.config)
82594
- });
82595
- this.activeModel = model;
82641
+ try {
82642
+ this.activeSession = await createSession({
82643
+ model,
82644
+ systemPrompt,
82645
+ tools: createBoundOrchestratorTools(this.config)
82646
+ });
82647
+ this.activeModel = model;
82648
+ } catch (error51) {
82649
+ if (model !== DEFAULT_MODEL) {
82650
+ this.activeSession = await createSession({
82651
+ model: DEFAULT_MODEL,
82652
+ systemPrompt,
82653
+ tools: createBoundOrchestratorTools(this.config)
82654
+ });
82655
+ this.activeModel = DEFAULT_MODEL;
82656
+ } else {
82657
+ throw error51;
82658
+ }
82659
+ }
82596
82660
  }
82597
82661
  async disconnectSession() {
82598
82662
  if (!this.activeSession) {