poe-code 3.0.15 → 3.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -190,38 +190,38 @@ import { createTwoFilesPatch } from "diff";
190
190
  import chalk from "chalk";
191
191
  function createDryRunFileSystem(base, recorder) {
192
192
  const proxy = {
193
- async readFile(path14, encoding) {
193
+ async readFile(path12, encoding) {
194
194
  if (encoding) {
195
- return base.readFile(path14, encoding);
195
+ return base.readFile(path12, encoding);
196
196
  }
197
- return base.readFile(path14);
197
+ return base.readFile(path12);
198
198
  },
199
- async writeFile(path14, data, options) {
200
- const previousContent = await tryReadText(base, path14);
199
+ async writeFile(path12, data, options) {
200
+ const previousContent = await tryReadText(base, path12);
201
201
  const nextContent = formatData(data, options?.encoding);
202
202
  recorder.record({
203
203
  type: "writeFile",
204
- path: path14,
204
+ path: path12,
205
205
  nextContent,
206
206
  previousContent
207
207
  });
208
208
  },
209
- async mkdir(path14, options) {
210
- recorder.record({ type: "mkdir", path: path14, options });
209
+ async mkdir(path12, options) {
210
+ recorder.record({ type: "mkdir", path: path12, options });
211
211
  },
212
- async stat(path14) {
213
- return base.stat(path14);
212
+ async stat(path12) {
213
+ return base.stat(path12);
214
214
  },
215
- async unlink(path14) {
216
- recorder.record({ type: "unlink", path: path14 });
215
+ async unlink(path12) {
216
+ recorder.record({ type: "unlink", path: path12 });
217
217
  },
218
- async readdir(path14) {
219
- return base.readdir(path14);
218
+ async readdir(path12) {
219
+ return base.readdir(path12);
220
220
  }
221
221
  };
222
222
  if (typeof base.rm === "function") {
223
- proxy.rm = async (path14, options) => {
224
- recorder.record({ type: "rm", path: path14, options });
223
+ proxy.rm = async (path12, options) => {
224
+ recorder.record({ type: "rm", path: path12, options });
225
225
  };
226
226
  }
227
227
  if (typeof base.copyFile === "function") {
@@ -311,8 +311,8 @@ function describeWriteChange(previous, next) {
311
311
  }
312
312
  return "update";
313
313
  }
314
- function renderWriteCommand(path14, change) {
315
- const command = `cat > ${path14}`;
314
+ function renderWriteCommand(path12, change) {
315
+ const command = `cat > ${path12}`;
316
316
  if (change === "create") {
317
317
  return renderOperationCommand(command, chalk.green, "# create");
318
318
  }
@@ -474,9 +474,9 @@ function redactTomlLine(line) {
474
474
  }
475
475
  return line;
476
476
  }
477
- async function tryReadText(base, path14) {
477
+ async function tryReadText(base, path12) {
478
478
  try {
479
- return await base.readFile(path14, "utf8");
479
+ return await base.readFile(path12, "utf8");
480
480
  } catch (error2) {
481
481
  if (isNotFound2(error2)) {
482
482
  return null;
@@ -796,8 +796,36 @@ var require_picocolors = __commonJS({
796
796
  }
797
797
  });
798
798
 
799
+ // src/templates/python/env.hbs
800
+ var require_env = __commonJS({
801
+ "src/templates/python/env.hbs"(exports, module) {
802
+ module.exports = "POE_API_KEY={{apiKey}}\nPOE_BASE_URL=https://api.poe.com/v1\nMODEL={{model}}\n";
803
+ }
804
+ });
805
+
806
+ // src/templates/python/main.py.hbs
807
+ var require_main_py = __commonJS({
808
+ "src/templates/python/main.py.hbs"(exports, module) {
809
+ module.exports = 'import os\nfrom openai import OpenAI\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\nclient = OpenAI(\n api_key=os.getenv("POE_API_KEY"),\n base_url=os.getenv("POE_BASE_URL")\n)\n\nresponse = client.chat.completions.create(\n model=os.getenv("MODEL", "{{model}}"),\n messages=[{"role": "user", "content": "Tell me a joke"}]\n)\n\nprint(response.choices[0].message.content)\n';
810
+ }
811
+ });
812
+
813
+ // src/templates/python/requirements.txt.hbs
814
+ var require_requirements_txt = __commonJS({
815
+ "src/templates/python/requirements.txt.hbs"(exports, module) {
816
+ module.exports = "openai>=1.0.0\npython-dotenv>=1.0.0\n";
817
+ }
818
+ });
819
+
820
+ // src/templates/codex/config.toml.hbs
821
+ var require_config_toml = __commonJS({
822
+ "src/templates/codex/config.toml.hbs"(exports, module) {
823
+ module.exports = 'model_provider = "poe"\nmodel = "{{{model}}}"\nmodel_reasoning_effort = "{{reasoningEffort}}"\n\n[model_providers.poe]\nname = "poe"\nbase_url = "{{{baseUrl}}}"\nwire_api = "responses"\nexperimental_bearer_token = "{{apiKey}}"\n';
824
+ }
825
+ });
826
+
799
827
  // src/cli/isolated-env.ts
800
- import path6 from "node:path";
828
+ import path5 from "node:path";
801
829
  async function resolveIsolatedEnvDetails(env, isolated, providerName, fs3) {
802
830
  if (!providerName) {
803
831
  throw new Error("resolveIsolatedEnvDetails requires providerName.");
@@ -819,7 +847,7 @@ function resolveIsolatedTargetDirectory(input) {
819
847
  const expanded = expandHomeShortcut(input.env, input.targetDirectory);
820
848
  const baseDir = resolveIsolatedBaseDir(input.env, input.providerName);
821
849
  const homeDir = input.env.homeDir;
822
- const homeDirWithSep = `${homeDir}${path6.sep}`;
850
+ const homeDirWithSep = `${homeDir}${path5.sep}`;
823
851
  if (expanded !== homeDir && !expanded.startsWith(homeDirWithSep)) {
824
852
  throw new Error(
825
853
  `Isolated config targets must live under the user's home directory (received "${input.targetDirectory}").`
@@ -834,7 +862,7 @@ function resolveIsolatedTargetDirectory(input) {
834
862
  if (!expanded.startsWith(homeDirWithSep)) {
835
863
  return expanded;
836
864
  }
837
- const mapped = path6.join(baseDir, expanded.slice(homeDirWithSep.length));
865
+ const mapped = path5.join(baseDir, expanded.slice(homeDirWithSep.length));
838
866
  return stripAgentHome(mapped, baseDir, input.isolated.agentBinary);
839
867
  }
840
868
  function resolveIsolatedBaseDir(env, providerName) {
@@ -883,9 +911,9 @@ async function resolveIsolatedEnvValue(env, baseDir, value, fs3) {
883
911
  function resolveIsolatedEnvPath(env, baseDir, value) {
884
912
  switch (value.kind) {
885
913
  case "isolatedDir":
886
- return value.relativePath ? path6.join(baseDir, value.relativePath) : baseDir;
914
+ return value.relativePath ? path5.join(baseDir, value.relativePath) : baseDir;
887
915
  case "isolatedFile":
888
- return path6.join(baseDir, value.relativePath);
916
+ return path5.join(baseDir, value.relativePath);
889
917
  }
890
918
  }
891
919
  function isEnvVarReference(value) {
@@ -927,10 +955,10 @@ async function applyIsolatedEnvRepairs(input) {
927
955
  if (repair.kind !== "chmod") {
928
956
  continue;
929
957
  }
930
- if (path6.isAbsolute(repair.relativePath)) {
958
+ if (path5.isAbsolute(repair.relativePath)) {
931
959
  continue;
932
960
  }
933
- const repairPath = path6.join(baseDir, repair.relativePath);
961
+ const repairPath = path5.join(baseDir, repair.relativePath);
934
962
  try {
935
963
  await input.fs.chmod(repairPath, repair.mode);
936
964
  } catch (error2) {
@@ -943,13 +971,13 @@ async function applyIsolatedEnvRepairs(input) {
943
971
  }
944
972
  function stripAgentHome(mapped, baseDir, agentBinary) {
945
973
  const agentDir = `.${agentBinary}`;
946
- const prefix = path6.join(baseDir, agentDir);
974
+ const prefix = path5.join(baseDir, agentDir);
947
975
  if (mapped === prefix) {
948
976
  return baseDir;
949
977
  }
950
- const withSep = `${prefix}${path6.sep}`;
978
+ const withSep = `${prefix}${path5.sep}`;
951
979
  if (mapped.startsWith(withSep)) {
952
- return path6.join(baseDir, mapped.slice(withSep.length));
980
+ return path5.join(baseDir, mapped.slice(withSep.length));
953
981
  }
954
982
  return mapped;
955
983
  }
@@ -960,11 +988,11 @@ function expandHomeShortcut(env, input) {
960
988
  if (input === "~") {
961
989
  return env.homeDir;
962
990
  }
963
- if (input.startsWith("~/") || input.startsWith(`~${path6.sep}`)) {
964
- return path6.join(env.homeDir, input.slice(2));
991
+ if (input.startsWith("~/") || input.startsWith(`~${path5.sep}`)) {
992
+ return path5.join(env.homeDir, input.slice(2));
965
993
  }
966
- if (input.startsWith("~./") || input.startsWith(`~.${path6.sep}`)) {
967
- return path6.join(env.homeDir, `.${input.slice(3)}`);
994
+ if (input.startsWith("~./") || input.startsWith(`~.${path5.sep}`)) {
995
+ return path5.join(env.homeDir, `.${input.slice(3)}`);
968
996
  }
969
997
  return input;
970
998
  }
@@ -4439,8 +4467,8 @@ var require_utils = __commonJS({
4439
4467
  }
4440
4468
  return ind;
4441
4469
  }
4442
- function removeDotSegments(path14) {
4443
- let input = path14;
4470
+ function removeDotSegments(path12) {
4471
+ let input = path12;
4444
4472
  const output = [];
4445
4473
  let nextSlash = -1;
4446
4474
  let len = 0;
@@ -4639,8 +4667,8 @@ var require_schemes = __commonJS({
4639
4667
  wsComponent.secure = void 0;
4640
4668
  }
4641
4669
  if (wsComponent.resourceName) {
4642
- const [path14, query] = wsComponent.resourceName.split("?");
4643
- wsComponent.path = path14 && path14 !== "/" ? path14 : void 0;
4670
+ const [path12, query] = wsComponent.resourceName.split("?");
4671
+ wsComponent.path = path12 && path12 !== "/" ? path12 : void 0;
4644
4672
  wsComponent.query = query;
4645
4673
  wsComponent.resourceName = void 0;
4646
4674
  }
@@ -13692,6 +13720,13 @@ var require_dist = __commonJS({
13692
13720
  }
13693
13721
  });
13694
13722
 
13723
+ // packages/agent-skill-config/src/templates/poe-generate.md
13724
+ var require_poe_generate = __commonJS({
13725
+ "packages/agent-skill-config/src/templates/poe-generate.md"(exports, module) {
13726
+ module.exports = '---\nname: poe-generate\ndescription: \'Poe code generation skill\'\n---\n\n# poe-code generate\n\nUse `poe-code generate` to create text, images, audio, or video via the Poe API.\n\n## Text generation\n\n```bash\npoe-code generate "Write a short function that parses a JSON string safely."\n```\n\nSpecify the model/bot:\n\n```bash\n# CLI option\npoe-code generate --model "gpt-4.1" "Summarize this codebase change."\n\n# Some agent runtimes call the model selector `--bot`\npoe-code generate --bot "gpt-4.1" "Summarize this codebase change."\n```\n\n## Media generation\n\nThe CLI supports media generation as subcommands:\n\n```bash\npoe-code generate image "A 3D render of a rubber duck wearing sunglasses" --model "gpt-image-1" -o duck.png\npoe-code generate video "A cinematic timelapse of a city at night" --model "veo" -o city.mp4\npoe-code generate audio "A calm 10 second lo-fi beat" --model "audio-model" -o beat.wav\n```\n\nSome agent runtimes expose the same media types as flags. If available, these are equivalent:\n\n```bash\npoe-code generate --image "A 3D render of a rubber duck wearing sunglasses" --bot "gpt-image-1" -o duck.png\npoe-code generate --video "A cinematic timelapse of a city at night" --bot "veo" -o city.mp4\npoe-code generate --audio "A calm 10 second lo-fi beat" --bot "audio-model" -o beat.wav\n```\n\n## Tips\n\n- Use `--param key=value` to pass provider/model parameters (repeatable).\n- Use `--output <path>` (or `-o`) for media outputs.\n';
13727
+ }
13728
+ });
13729
+
13695
13730
  // src/cli/program.ts
13696
13731
  import { Command } from "commander";
13697
13732
 
@@ -13803,7 +13838,7 @@ function stripV1Suffix(value) {
13803
13838
  return value;
13804
13839
  }
13805
13840
 
13806
- // packages/agent-defs/dist/agents/claude-code.js
13841
+ // packages/agent-defs/src/agents/claude-code.ts
13807
13842
  var claudeCodeAgent = {
13808
13843
  id: "claude-code",
13809
13844
  name: "claude-code",
@@ -13820,7 +13855,7 @@ var claudeCodeAgent = {
13820
13855
  }
13821
13856
  };
13822
13857
 
13823
- // packages/agent-defs/dist/agents/claude-desktop.js
13858
+ // packages/agent-defs/src/agents/claude-desktop.ts
13824
13859
  var claudeDesktopAgent = {
13825
13860
  id: "claude-desktop",
13826
13861
  name: "claude-desktop",
@@ -13835,7 +13870,7 @@ var claudeDesktopAgent = {
13835
13870
  }
13836
13871
  };
13837
13872
 
13838
- // packages/agent-defs/dist/agents/codex.js
13873
+ // packages/agent-defs/src/agents/codex.ts
13839
13874
  var codexAgent = {
13840
13875
  id: "codex",
13841
13876
  name: "codex",
@@ -13851,7 +13886,7 @@ var codexAgent = {
13851
13886
  }
13852
13887
  };
13853
13888
 
13854
- // packages/agent-defs/dist/agents/opencode.js
13889
+ // packages/agent-defs/src/agents/opencode.ts
13855
13890
  var openCodeAgent = {
13856
13891
  id: "opencode",
13857
13892
  name: "opencode",
@@ -13867,7 +13902,7 @@ var openCodeAgent = {
13867
13902
  }
13868
13903
  };
13869
13904
 
13870
- // packages/agent-defs/dist/agents/kimi.js
13905
+ // packages/agent-defs/src/agents/kimi.ts
13871
13906
  var kimiAgent = {
13872
13907
  id: "kimi",
13873
13908
  name: "kimi",
@@ -13884,7 +13919,7 @@ var kimiAgent = {
13884
13919
  }
13885
13920
  };
13886
13921
 
13887
- // packages/agent-defs/dist/registry.js
13922
+ // packages/agent-defs/src/registry.ts
13888
13923
  var allAgents = [
13889
13924
  claudeCodeAgent,
13890
13925
  claudeDesktopAgent,
@@ -14151,7 +14186,7 @@ function createOptionResolvers(init) {
14151
14186
  };
14152
14187
  }
14153
14188
 
14154
- // packages/design-system/dist/tokens/colors.js
14189
+ // packages/design-system/src/tokens/colors.ts
14155
14190
  import chalk2 from "chalk";
14156
14191
  var dark = {
14157
14192
  header: (text3) => chalk2.magentaBright.bold(text3),
@@ -14184,7 +14219,7 @@ var light = {
14184
14219
  info: (text3) => chalk2.hex("#a200ff")(text3)
14185
14220
  };
14186
14221
 
14187
- // packages/design-system/dist/tokens/typography.js
14222
+ // packages/design-system/src/tokens/typography.ts
14188
14223
  import chalk3 from "chalk";
14189
14224
  var typography = {
14190
14225
  bold: (text3) => chalk3.bold(text3),
@@ -14194,10 +14229,10 @@ var typography = {
14194
14229
  strikethrough: (text3) => chalk3.strikethrough(text3)
14195
14230
  };
14196
14231
 
14197
- // packages/design-system/dist/components/text.js
14232
+ // packages/design-system/src/components/text.ts
14198
14233
  import chalk4 from "chalk";
14199
14234
 
14200
- // packages/design-system/dist/internal/theme-detect.js
14235
+ // packages/design-system/src/internal/theme-detect.ts
14201
14236
  function detectThemeFromEnv(env) {
14202
14237
  const apple = env.APPLE_INTERFACE_STYLE;
14203
14238
  if (typeof apple === "string") {
@@ -14244,7 +14279,7 @@ function getTheme(env) {
14244
14279
  return cachedTheme;
14245
14280
  }
14246
14281
 
14247
- // packages/design-system/dist/components/text.js
14282
+ // packages/design-system/src/components/text.ts
14248
14283
  var text = {
14249
14284
  intro(content) {
14250
14285
  const theme = getTheme();
@@ -14285,7 +14320,7 @@ var text = {
14285
14320
  }
14286
14321
  };
14287
14322
 
14288
- // packages/design-system/dist/components/symbols.js
14323
+ // packages/design-system/src/components/symbols.ts
14289
14324
  import chalk5 from "chalk";
14290
14325
  var symbols = {
14291
14326
  get info() {
@@ -14939,7 +14974,7 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
14939
14974
  } };
14940
14975
  };
14941
14976
 
14942
- // packages/design-system/dist/components/logger.js
14977
+ // packages/design-system/src/components/logger.ts
14943
14978
  import chalk6 from "chalk";
14944
14979
  function createLogger(emitter) {
14945
14980
  const emit = (level, message) => {
@@ -15001,7 +15036,7 @@ function createLogger(emitter) {
15001
15036
  }
15002
15037
  var logger = createLogger();
15003
15038
 
15004
- // packages/design-system/dist/acp/index.js
15039
+ // packages/design-system/src/acp/index.ts
15005
15040
  var acp_exports = {};
15006
15041
  __export(acp_exports, {
15007
15042
  renderAgentMessage: () => renderAgentMessage,
@@ -15012,13 +15047,11 @@ __export(acp_exports, {
15012
15047
  renderUsage: () => renderUsage
15013
15048
  });
15014
15049
 
15015
- // packages/design-system/dist/acp/components.js
15050
+ // packages/design-system/src/acp/components.ts
15016
15051
  import chalk7 from "chalk";
15017
15052
  function truncate(text3, maxLength) {
15018
- if (text3.length <= maxLength)
15019
- return text3;
15020
- if (maxLength <= 3)
15021
- return text3.slice(0, maxLength);
15053
+ if (text3.length <= maxLength) return text3;
15054
+ if (maxLength <= 3) return text3.slice(0, maxLength);
15022
15055
  return `${text3.slice(0, maxLength - 3)}...`;
15023
15056
  }
15024
15057
  var KIND_COLORS = {
@@ -15063,13 +15096,17 @@ function renderUsage(tokens) {
15063
15096
  }).format(tokens.costUsd);
15064
15097
  cost = ` (${formatted})`;
15065
15098
  }
15066
- writeLine(chalk7.green(`\u2713 tokens: ${tokens.input} in${cached2} \u2192 ${tokens.output} out${cost}`));
15099
+ writeLine(
15100
+ chalk7.green(
15101
+ `\u2713 tokens: ${tokens.input} in${cached2} \u2192 ${tokens.output} out${cost}`
15102
+ )
15103
+ );
15067
15104
  }
15068
15105
  function renderError(message) {
15069
15106
  writeLine(chalk7.red(`\u2717 ${message}`));
15070
15107
  }
15071
15108
 
15072
- // packages/design-system/dist/prompts/index.js
15109
+ // packages/design-system/src/prompts/index.ts
15073
15110
  function intro(title) {
15074
15111
  Ie(text.intro(title));
15075
15112
  }
@@ -15092,10 +15129,10 @@ function spinner() {
15092
15129
  return Y2();
15093
15130
  }
15094
15131
 
15095
- // packages/design-system/dist/static/spinner.js
15132
+ // packages/design-system/src/static/spinner.ts
15096
15133
  import chalk8 from "chalk";
15097
15134
 
15098
- // packages/design-system/dist/static/menu.js
15135
+ // packages/design-system/src/static/menu.ts
15099
15136
  import chalk9 from "chalk";
15100
15137
 
15101
15138
  // src/cli/logger.ts
@@ -15582,7 +15619,7 @@ function createBinaryExistsCheck(binaryName, id, description) {
15582
15619
  };
15583
15620
  }
15584
15621
 
15585
- // packages/config-mutations/dist/mutations/config-mutation.js
15622
+ // packages/config-mutations/src/mutations/config-mutation.ts
15586
15623
  function merge(options) {
15587
15624
  return {
15588
15625
  kind: "configMerge",
@@ -15618,7 +15655,7 @@ var configMutation = {
15618
15655
  transform
15619
15656
  };
15620
15657
 
15621
- // packages/config-mutations/dist/mutations/file-mutation.js
15658
+ // packages/config-mutations/src/mutations/file-mutation.ts
15622
15659
  function ensureDirectory(options) {
15623
15660
  return {
15624
15661
  kind: "ensureDirectory",
@@ -15666,7 +15703,7 @@ var fileMutation = {
15666
15703
  backup
15667
15704
  };
15668
15705
 
15669
- // packages/config-mutations/dist/mutations/template-mutation.js
15706
+ // packages/config-mutations/src/mutations/template-mutation.ts
15670
15707
  function write(options) {
15671
15708
  return {
15672
15709
  kind: "templateWrite",
@@ -15700,10 +15737,10 @@ var templateMutation = {
15700
15737
  mergeJson
15701
15738
  };
15702
15739
 
15703
- // packages/config-mutations/dist/execution/apply-mutation.js
15740
+ // packages/config-mutations/src/execution/apply-mutation.ts
15704
15741
  import Mustache from "mustache";
15705
15742
 
15706
- // packages/config-mutations/dist/formats/json.js
15743
+ // packages/config-mutations/src/formats/json.ts
15707
15744
  import * as jsonc from "jsonc-parser";
15708
15745
  function isConfigObject(value) {
15709
15746
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -15761,7 +15798,10 @@ function prune2(obj, shape) {
15761
15798
  continue;
15762
15799
  }
15763
15800
  if (isConfigObject(pattern) && isConfigObject(current)) {
15764
- const { changed: childChanged, result: childResult } = prune2(current, pattern);
15801
+ const { changed: childChanged, result: childResult } = prune2(
15802
+ current,
15803
+ pattern
15804
+ );
15765
15805
  if (childChanged) {
15766
15806
  changed = true;
15767
15807
  }
@@ -15784,7 +15824,7 @@ var jsonFormat = {
15784
15824
  prune: prune2
15785
15825
  };
15786
15826
 
15787
- // packages/config-mutations/dist/formats/toml.js
15827
+ // packages/config-mutations/src/formats/toml.ts
15788
15828
  import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
15789
15829
  function isConfigObject2(value) {
15790
15830
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -15833,7 +15873,10 @@ function prune3(obj, shape) {
15833
15873
  continue;
15834
15874
  }
15835
15875
  if (isConfigObject2(pattern) && isConfigObject2(current)) {
15836
- const { changed: childChanged, result: childResult } = prune3(current, pattern);
15876
+ const { changed: childChanged, result: childResult } = prune3(
15877
+ current,
15878
+ pattern
15879
+ );
15837
15880
  if (childChanged) {
15838
15881
  changed = true;
15839
15882
  }
@@ -15856,7 +15899,7 @@ var tomlFormat = {
15856
15899
  prune: prune3
15857
15900
  };
15858
15901
 
15859
- // packages/config-mutations/dist/formats/index.js
15902
+ // packages/config-mutations/src/formats/index.ts
15860
15903
  var formatRegistry = {
15861
15904
  json: jsonFormat,
15862
15905
  toml: tomlFormat
@@ -15872,23 +15915,25 @@ function getConfigFormat(pathOrFormat) {
15872
15915
  const ext = getExtension(pathOrFormat);
15873
15916
  const formatName = extensionMap[ext];
15874
15917
  if (!formatName) {
15875
- throw new Error(`Unsupported config format. Cannot detect format from "${pathOrFormat}". Supported extensions: ${Object.keys(extensionMap).join(", ")}. Supported format names: ${Object.keys(formatRegistry).join(", ")}.`);
15918
+ throw new Error(
15919
+ `Unsupported config format. Cannot detect format from "${pathOrFormat}". Supported extensions: ${Object.keys(extensionMap).join(", ")}. Supported format names: ${Object.keys(formatRegistry).join(", ")}.`
15920
+ );
15876
15921
  }
15877
15922
  return formatRegistry[formatName];
15878
15923
  }
15879
- function detectFormat(path14) {
15880
- const ext = getExtension(path14);
15924
+ function detectFormat(path12) {
15925
+ const ext = getExtension(path12);
15881
15926
  return extensionMap[ext];
15882
15927
  }
15883
- function getExtension(path14) {
15884
- const lastDot = path14.lastIndexOf(".");
15928
+ function getExtension(path12) {
15929
+ const lastDot = path12.lastIndexOf(".");
15885
15930
  if (lastDot === -1) {
15886
15931
  return "";
15887
15932
  }
15888
- return path14.slice(lastDot).toLowerCase();
15933
+ return path12.slice(lastDot).toLowerCase();
15889
15934
  }
15890
15935
 
15891
- // packages/config-mutations/dist/execution/path-utils.js
15936
+ // packages/config-mutations/src/execution/path-utils.ts
15892
15937
  import path4 from "node:path";
15893
15938
  function expandHome(targetPath, homeDir) {
15894
15939
  if (!targetPath?.startsWith("~")) {
@@ -15913,7 +15958,9 @@ function validateHomePath(targetPath) {
15913
15958
  throw new Error("Target path must be a non-empty string.");
15914
15959
  }
15915
15960
  if (!targetPath.startsWith("~")) {
15916
- throw new Error(`All target paths must be home-relative (start with ~). Received: "${targetPath}"`);
15961
+ throw new Error(
15962
+ `All target paths must be home-relative (start with ~). Received: "${targetPath}"`
15963
+ );
15917
15964
  }
15918
15965
  }
15919
15966
  function resolvePath(rawPath, homeDir, pathMapper) {
@@ -15930,7 +15977,7 @@ function resolvePath(rawPath, homeDir, pathMapper) {
15930
15977
  return filename.length === 0 ? mappedDirectory : path4.join(mappedDirectory, filename);
15931
15978
  }
15932
15979
 
15933
- // packages/config-mutations/dist/execution/apply-mutation.js
15980
+ // packages/config-mutations/src/execution/apply-mutation.ts
15934
15981
  function resolveValue(resolver, options) {
15935
15982
  if (typeof resolver === "function") {
15936
15983
  return resolver(options);
@@ -16020,7 +16067,11 @@ function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
16020
16067
  const pruned = pruneKeysByPrefix(current, prefix);
16021
16068
  result[key] = { ...pruned, ...value };
16022
16069
  } else {
16023
- result[key] = mergeWithPruneByPrefix(current, value, prefixMap);
16070
+ result[key] = mergeWithPruneByPrefix(
16071
+ current,
16072
+ value,
16073
+ prefixMap
16074
+ );
16024
16075
  }
16025
16076
  continue;
16026
16077
  }
@@ -16238,7 +16289,9 @@ async function applyConfigMerge(mutation, context, options) {
16238
16289
  };
16239
16290
  const formatName = mutation.format ?? detectFormat(rawPath);
16240
16291
  if (!formatName) {
16241
- throw new Error(`Cannot detect config format for "${rawPath}". Provide explicit format option.`);
16292
+ throw new Error(
16293
+ `Cannot detect config format for "${rawPath}". Provide explicit format option.`
16294
+ );
16242
16295
  }
16243
16296
  const format = getConfigFormat(formatName);
16244
16297
  const rawContent = await readFileIfExists(context.fs, targetPath);
@@ -16289,7 +16342,9 @@ async function applyConfigPrune(mutation, context, options) {
16289
16342
  }
16290
16343
  const formatName = mutation.format ?? detectFormat(rawPath);
16291
16344
  if (!formatName) {
16292
- throw new Error(`Cannot detect config format for "${rawPath}". Provide explicit format option.`);
16345
+ throw new Error(
16346
+ `Cannot detect config format for "${rawPath}". Provide explicit format option.`
16347
+ );
16293
16348
  }
16294
16349
  const format = getConfigFormat(formatName);
16295
16350
  let current;
@@ -16343,7 +16398,9 @@ async function applyConfigTransform(mutation, context, options) {
16343
16398
  };
16344
16399
  const formatName = mutation.format ?? detectFormat(rawPath);
16345
16400
  if (!formatName) {
16346
- throw new Error(`Cannot detect config format for "${rawPath}". Provide explicit format option.`);
16401
+ throw new Error(
16402
+ `Cannot detect config format for "${rawPath}". Provide explicit format option.`
16403
+ );
16347
16404
  }
16348
16405
  const format = getConfigFormat(formatName);
16349
16406
  const rawContent = await readFileIfExists(context.fs, targetPath);
@@ -16393,7 +16450,9 @@ async function applyConfigTransform(mutation, context, options) {
16393
16450
  }
16394
16451
  async function applyTemplateWrite(mutation, context, options) {
16395
16452
  if (!context.templates) {
16396
- throw new Error("Template mutations require a templates loader. Provide templates function to runMutations context.");
16453
+ throw new Error(
16454
+ "Template mutations require a templates loader. Provide templates function to runMutations context."
16455
+ );
16397
16456
  }
16398
16457
  const rawPath = resolveValue(mutation.target, options);
16399
16458
  const targetPath = resolvePath(rawPath, context.homeDir, context.pathMapper);
@@ -16420,7 +16479,9 @@ async function applyTemplateWrite(mutation, context, options) {
16420
16479
  }
16421
16480
  async function applyTemplateMerge(mutation, context, options, formatName) {
16422
16481
  if (!context.templates) {
16423
- throw new Error("Template mutations require a templates loader. Provide templates function to runMutations context.");
16482
+ throw new Error(
16483
+ "Template mutations require a templates loader. Provide templates function to runMutations context."
16484
+ );
16424
16485
  }
16425
16486
  const rawPath = resolveValue(mutation.target, options);
16426
16487
  const targetPath = resolvePath(rawPath, context.homeDir, context.pathMapper);
@@ -16437,7 +16498,9 @@ async function applyTemplateMerge(mutation, context, options, formatName) {
16437
16498
  try {
16438
16499
  templateDoc = format.parse(rendered);
16439
16500
  } catch (error2) {
16440
- throw new Error(`Failed to parse rendered template "${mutation.templateId}" as ${formatName.toUpperCase()}: ${error2}`);
16501
+ throw new Error(
16502
+ `Failed to parse rendered template "${mutation.templateId}" as ${formatName.toUpperCase()}: ${error2}`
16503
+ );
16441
16504
  }
16442
16505
  const rawContent = await readFileIfExists(context.fs, targetPath);
16443
16506
  let current;
@@ -16465,13 +16528,17 @@ async function applyTemplateMerge(mutation, context, options, formatName) {
16465
16528
  };
16466
16529
  }
16467
16530
 
16468
- // packages/config-mutations/dist/execution/run-mutations.js
16531
+ // packages/config-mutations/src/execution/run-mutations.ts
16469
16532
  async function runMutations(mutations, context, options) {
16470
16533
  const effects = [];
16471
16534
  let anyChanged = false;
16472
16535
  const resolverOptions = options ?? {};
16473
16536
  for (const mutation of mutations) {
16474
- const { outcome } = await executeMutation(mutation, context, resolverOptions);
16537
+ const { outcome } = await executeMutation(
16538
+ mutation,
16539
+ context,
16540
+ resolverOptions
16541
+ );
16475
16542
  effects.push(outcome);
16476
16543
  if (outcome.changed) {
16477
16544
  anyChanged = true;
@@ -16494,16 +16561,19 @@ async function executeMutation(mutation, context, options) {
16494
16561
  context.observers?.onComplete?.(details, outcome);
16495
16562
  return { outcome, details };
16496
16563
  } catch (error2) {
16497
- context.observers?.onError?.({
16498
- kind: mutation.kind,
16499
- label: mutation.label ?? mutation.kind,
16500
- targetPath: void 0
16501
- }, error2);
16564
+ context.observers?.onError?.(
16565
+ {
16566
+ kind: mutation.kind,
16567
+ label: mutation.label ?? mutation.kind,
16568
+ targetPath: void 0
16569
+ },
16570
+ error2
16571
+ );
16502
16572
  throw error2;
16503
16573
  }
16504
16574
  }
16505
16575
 
16506
- // packages/config-mutations/dist/types.js
16576
+ // packages/config-mutations/src/types.ts
16507
16577
  function isConfigObject4(value) {
16508
16578
  return typeof value === "object" && value !== null && !Array.isArray(value);
16509
16579
  }
@@ -16588,18 +16658,37 @@ async function runInstallStep(step, context) {
16588
16658
  }
16589
16659
 
16590
16660
  // src/utils/templates.ts
16591
- import { fileURLToPath } from "node:url";
16592
- import path5 from "node:path";
16593
- import { readFile } from "node:fs/promises";
16594
16661
  import Mustache2 from "mustache";
16595
- var templateRoot = fileURLToPath(new URL("../templates", import.meta.url));
16596
16662
  var customLoader = null;
16663
+ var templatesCache = null;
16664
+ async function getTemplates() {
16665
+ if (templatesCache) {
16666
+ return templatesCache;
16667
+ }
16668
+ const [pythonEnvTemplate, pythonMainTemplate, pythonRequirementsTemplate, codexConfigTemplate] = await Promise.all([
16669
+ Promise.resolve().then(() => __toESM(require_env(), 1)).then((m2) => m2.default),
16670
+ Promise.resolve().then(() => __toESM(require_main_py(), 1)).then((m2) => m2.default),
16671
+ Promise.resolve().then(() => __toESM(require_requirements_txt(), 1)).then((m2) => m2.default),
16672
+ Promise.resolve().then(() => __toESM(require_config_toml(), 1)).then((m2) => m2.default)
16673
+ ]);
16674
+ templatesCache = {
16675
+ "python/env.hbs": pythonEnvTemplate,
16676
+ "python/main.py.hbs": pythonMainTemplate,
16677
+ "python/requirements.txt.hbs": pythonRequirementsTemplate,
16678
+ "codex/config.toml.hbs": codexConfigTemplate
16679
+ };
16680
+ return templatesCache;
16681
+ }
16597
16682
  async function loadTemplate(relativePath) {
16598
16683
  if (customLoader) {
16599
16684
  return customLoader(relativePath);
16600
16685
  }
16601
- const templatePath = path5.join(templateRoot, relativePath);
16602
- return readFile(templatePath, "utf8");
16686
+ const templates = await getTemplates();
16687
+ const template = templates[relativePath];
16688
+ if (!template) {
16689
+ throw new Error(`Template not found: ${relativePath}`);
16690
+ }
16691
+ return template;
16603
16692
  }
16604
16693
 
16605
16694
  // src/providers/create-provider.ts
@@ -17579,9 +17668,9 @@ async function resolveServiceArgument(program, container, provided, selectionCon
17579
17668
  }
17580
17669
 
17581
17670
  // src/cli/commands/spawn.ts
17582
- import path9 from "node:path";
17671
+ import path8 from "node:path";
17583
17672
 
17584
- // packages/agent-spawn/dist/configs/claude-code.js
17673
+ // packages/agent-spawn/src/configs/claude-code.ts
17585
17674
  var claudeCodeSpawnConfig = {
17586
17675
  kind: "cli",
17587
17676
  agentId: "claude-code",
@@ -17604,7 +17693,7 @@ var claudeCodeSpawnConfig = {
17604
17693
  }
17605
17694
  };
17606
17695
 
17607
- // packages/agent-spawn/dist/configs/codex.js
17696
+ // packages/agent-spawn/src/configs/codex.ts
17608
17697
  var codexSpawnConfig = {
17609
17698
  kind: "cli",
17610
17699
  agentId: "codex",
@@ -17619,7 +17708,7 @@ var codexSpawnConfig = {
17619
17708
  }
17620
17709
  };
17621
17710
 
17622
- // packages/agent-spawn/dist/configs/opencode.js
17711
+ // packages/agent-spawn/src/configs/opencode.ts
17623
17712
  var openCodeSpawnConfig = {
17624
17713
  kind: "cli",
17625
17714
  agentId: "opencode",
@@ -17632,7 +17721,7 @@ var openCodeSpawnConfig = {
17632
17721
  defaultArgs: ["--format", "json"]
17633
17722
  };
17634
17723
 
17635
- // packages/agent-spawn/dist/configs/kimi.js
17724
+ // packages/agent-spawn/src/configs/kimi.ts
17636
17725
  var kimiSpawnConfig = {
17637
17726
  kind: "cli",
17638
17727
  agentId: "kimi",
@@ -17648,7 +17737,7 @@ var kimiSpawnConfig = {
17648
17737
  }
17649
17738
  };
17650
17739
 
17651
- // packages/agent-spawn/dist/configs/index.js
17740
+ // packages/agent-spawn/src/configs/index.ts
17652
17741
  var allSpawnConfigs = [
17653
17742
  claudeCodeSpawnConfig,
17654
17743
  codexSpawnConfig,
@@ -17667,7 +17756,7 @@ function getSpawnConfig(input) {
17667
17756
  return lookup2.get(resolvedId);
17668
17757
  }
17669
17758
 
17670
- // packages/agent-spawn/dist/spawn.js
17759
+ // packages/agent-spawn/src/spawn.ts
17671
17760
  import { spawn as spawnChildProcess } from "node:child_process";
17672
17761
  async function spawn2(agentId, options, _context) {
17673
17762
  const resolvedAgentId = resolveAgentId(agentId);
@@ -17725,7 +17814,7 @@ async function spawn2(agentId, options, _context) {
17725
17814
  });
17726
17815
  }
17727
17816
 
17728
- // packages/agent-spawn/dist/acp/renderer.js
17817
+ // packages/agent-spawn/src/acp/renderer.ts
17729
17818
  function writeLine2(line) {
17730
17819
  process.stdout.write(`${line}
17731
17820
  `);
@@ -17738,7 +17827,10 @@ function renderAcpEvent(event) {
17738
17827
  acp_exports.renderAgentMessage(event.text);
17739
17828
  return;
17740
17829
  case "tool_start":
17741
- acp_exports.renderToolStart(event.kind, event.title);
17830
+ acp_exports.renderToolStart(
17831
+ event.kind,
17832
+ event.title
17833
+ );
17742
17834
  return;
17743
17835
  case "tool_complete":
17744
17836
  acp_exports.renderToolComplete(event.kind);
@@ -17755,11 +17847,13 @@ function renderAcpEvent(event) {
17755
17847
  });
17756
17848
  return;
17757
17849
  case "error":
17758
- acp_exports.renderError((() => {
17759
- const { message, stack } = event;
17760
- return typeof stack === "string" && stack.length > 0 ? `${message}
17850
+ acp_exports.renderError(
17851
+ (() => {
17852
+ const { message, stack } = event;
17853
+ return typeof stack === "string" && stack.length > 0 ? `${message}
17761
17854
  ${stack}` : message;
17762
- })());
17855
+ })()
17856
+ );
17763
17857
  return;
17764
17858
  default:
17765
17859
  writeLine2(text.muted(event.event));
@@ -17785,29 +17879,26 @@ async function renderAcpStream(events) {
17785
17879
  flushBuffer();
17786
17880
  }
17787
17881
 
17788
- // packages/agent-spawn/dist/acp/spawn.js
17882
+ // packages/agent-spawn/src/acp/spawn.ts
17789
17883
  import { spawn as spawnChildProcess2 } from "node:child_process";
17790
17884
 
17791
- // packages/agent-spawn/dist/adapters/utils.js
17885
+ // packages/agent-spawn/src/adapters/utils.ts
17792
17886
  function truncate2(text3, maxLength) {
17793
- if (text3.length <= maxLength)
17794
- return text3;
17795
- if (maxLength <= 3)
17796
- return text3.slice(0, maxLength);
17887
+ if (text3.length <= maxLength) return text3;
17888
+ if (maxLength <= 3) return text3.slice(0, maxLength);
17797
17889
  return `${text3.slice(0, maxLength - 3)}...`;
17798
17890
  }
17799
17891
  function isNonEmptyString(value) {
17800
17892
  return typeof value === "string" && value.length > 0;
17801
17893
  }
17802
17894
  function extractThreadId(value) {
17803
- if (!value || typeof value !== "object")
17804
- return;
17895
+ if (!value || typeof value !== "object") return;
17805
17896
  const obj = value;
17806
17897
  const maybeThreadId = isNonEmptyString(obj.thread_id) && obj.thread_id || isNonEmptyString(obj.threadId) && obj.threadId || isNonEmptyString(obj.threadID) && obj.threadID || isNonEmptyString(obj.session_id) && obj.session_id || isNonEmptyString(obj.sessionId) && obj.sessionId || isNonEmptyString(obj.sessionID) && obj.sessionID;
17807
17898
  return maybeThreadId || void 0;
17808
17899
  }
17809
17900
 
17810
- // packages/agent-spawn/dist/adapters/claude.js
17901
+ // packages/agent-spawn/src/adapters/claude.ts
17811
17902
  var TOOL_KIND_MAP = {
17812
17903
  Read: "read",
17813
17904
  Write: "edit",
@@ -17823,8 +17914,7 @@ async function* adaptClaude(lines) {
17823
17914
  let emittedSessionStart = false;
17824
17915
  for await (const rawLine of lines) {
17825
17916
  const line = rawLine.trim();
17826
- if (!line)
17827
- continue;
17917
+ if (!line) continue;
17828
17918
  const firstChar = line[0];
17829
17919
  if (firstChar !== "{" && firstChar !== "[") {
17830
17920
  continue;
@@ -17842,8 +17932,7 @@ async function* adaptClaude(lines) {
17842
17932
  continue;
17843
17933
  }
17844
17934
  const eventType = event.type;
17845
- if (!isNonEmptyString(eventType))
17846
- continue;
17935
+ if (!isNonEmptyString(eventType)) continue;
17847
17936
  if (!emittedSessionStart) {
17848
17937
  const threadId = extractThreadId(event);
17849
17938
  emittedSessionStart = true;
@@ -17857,21 +17946,16 @@ async function* adaptClaude(lines) {
17857
17946
  yield { event: "usage", inputTokens, outputTokens, costUsd };
17858
17947
  continue;
17859
17948
  }
17860
- if (eventType !== "assistant" && eventType !== "user")
17861
- continue;
17949
+ if (eventType !== "assistant" && eventType !== "user") continue;
17862
17950
  const message = event.message ?? null;
17863
- if (!message || typeof message !== "object")
17864
- continue;
17951
+ if (!message || typeof message !== "object") continue;
17865
17952
  const content = message.content ?? null;
17866
- if (!Array.isArray(content))
17867
- continue;
17953
+ if (!Array.isArray(content)) continue;
17868
17954
  for (const block of content) {
17869
17955
  const item = block;
17870
- if (!item || typeof item !== "object")
17871
- continue;
17956
+ if (!item || typeof item !== "object") continue;
17872
17957
  const blockType = item.type;
17873
- if (!isNonEmptyString(blockType))
17874
- continue;
17958
+ if (!isNonEmptyString(blockType)) continue;
17875
17959
  if (eventType === "assistant") {
17876
17960
  if (blockType === "text" && isNonEmptyString(item.text)) {
17877
17961
  yield {
@@ -17894,41 +17978,38 @@ async function* adaptClaude(lines) {
17894
17978
  continue;
17895
17979
  }
17896
17980
  if (eventType === "user") {
17897
- if (!isNonEmptyString(item.tool_use_id))
17898
- continue;
17899
- if (blockType !== "tool_result")
17900
- continue;
17981
+ if (!isNonEmptyString(item.tool_use_id)) continue;
17982
+ if (blockType !== "tool_result") continue;
17901
17983
  const kind = toolKindsById.get(item.tool_use_id);
17902
17984
  toolKindsById.delete(item.tool_use_id);
17903
- let path14 = "";
17985
+ let path12 = "";
17904
17986
  if (typeof item.content === "string") {
17905
- path14 = item.content;
17987
+ path12 = item.content;
17906
17988
  } else {
17907
17989
  try {
17908
- path14 = JSON.stringify(item.content);
17990
+ path12 = JSON.stringify(item.content);
17909
17991
  } catch {
17910
- path14 = String(item.content);
17992
+ path12 = String(item.content);
17911
17993
  }
17912
17994
  }
17913
17995
  yield {
17914
17996
  event: "tool_complete",
17915
17997
  id: item.tool_use_id,
17916
17998
  kind,
17917
- path: path14
17999
+ path: path12
17918
18000
  };
17919
18001
  }
17920
18002
  }
17921
18003
  }
17922
18004
  }
17923
18005
 
17924
- // packages/agent-spawn/dist/adapters/codex.js
18006
+ // packages/agent-spawn/src/adapters/codex.ts
17925
18007
  async function* adaptCodex(lines) {
17926
18008
  const toolTitleById = /* @__PURE__ */ new Map();
17927
18009
  const toolKindById = /* @__PURE__ */ new Map();
17928
18010
  for await (const rawLine of lines) {
17929
18011
  const line = rawLine.trim();
17930
- if (!line)
17931
- continue;
18012
+ if (!line) continue;
17932
18013
  let event;
17933
18014
  try {
17934
18015
  event = JSON.parse(line);
@@ -17942,8 +18023,7 @@ async function* adaptCodex(lines) {
17942
18023
  continue;
17943
18024
  }
17944
18025
  const eventType = event.type;
17945
- if (!isNonEmptyString(eventType))
17946
- continue;
18026
+ if (!isNonEmptyString(eventType)) continue;
17947
18027
  if (eventType === "thread.started") {
17948
18028
  const maybeThreadId = extractThreadId(event);
17949
18029
  yield { event: "session_start", threadId: maybeThreadId };
@@ -17965,14 +18045,11 @@ async function* adaptCodex(lines) {
17965
18045
  continue;
17966
18046
  }
17967
18047
  const item = event.item ?? null;
17968
- if (!item || typeof item !== "object")
17969
- continue;
18048
+ if (!item || typeof item !== "object") continue;
17970
18049
  const itemType = item.type;
17971
- if (!isNonEmptyString(itemType))
17972
- continue;
18050
+ if (!isNonEmptyString(itemType)) continue;
17973
18051
  if (eventType === "item.started") {
17974
- if (!isNonEmptyString(item.id))
17975
- continue;
18052
+ if (!isNonEmptyString(item.id)) continue;
17976
18053
  let kind;
17977
18054
  let title;
17978
18055
  if (itemType === "command_execution") {
@@ -17999,40 +18076,36 @@ async function* adaptCodex(lines) {
17999
18076
  }
18000
18077
  if (eventType === "item.completed") {
18001
18078
  if (itemType === "agent_message") {
18002
- if (!isNonEmptyString(item.text))
18003
- continue;
18079
+ if (!isNonEmptyString(item.text)) continue;
18004
18080
  yield { event: "agent_message", text: item.text };
18005
18081
  continue;
18006
18082
  }
18007
18083
  if (itemType === "reasoning") {
18008
18084
  const text3 = isNonEmptyString(item.text) ? item.text : isNonEmptyString(item.content) ? item.content : isNonEmptyString(item.summary) ? item.summary : void 0;
18009
- if (!text3)
18010
- continue;
18085
+ if (!text3) continue;
18011
18086
  yield { event: "reasoning", text: text3 };
18012
18087
  continue;
18013
18088
  }
18014
- if (!isNonEmptyString(item.id))
18015
- continue;
18089
+ if (!isNonEmptyString(item.id)) continue;
18016
18090
  if (itemType === "command_execution" || itemType === "file_edit" || itemType === "mcp_tool_call") {
18017
18091
  const kindFromStart = toolKindById.get(item.id);
18018
18092
  const kind = kindFromStart ?? (itemType === "command_execution" ? "exec" : itemType === "file_edit" ? "edit" : "other");
18019
18093
  const titleFromEvent = isNonEmptyString(item.path) ? item.path : itemType === "mcp_tool_call" ? `${isNonEmptyString(item.server) ? item.server : "unknown"}.${isNonEmptyString(item.tool) ? item.tool : "unknown"}` : void 0;
18020
- const path14 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
18094
+ const path12 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
18021
18095
  toolTitleById.delete(item.id);
18022
18096
  toolKindById.delete(item.id);
18023
- yield { event: "tool_complete", id: item.id, kind, path: path14 };
18097
+ yield { event: "tool_complete", id: item.id, kind, path: path12 };
18024
18098
  }
18025
18099
  }
18026
18100
  }
18027
18101
  }
18028
18102
 
18029
- // packages/agent-spawn/dist/adapters/kimi.js
18103
+ // packages/agent-spawn/src/adapters/kimi.ts
18030
18104
  async function* adaptKimi(lines) {
18031
18105
  let emittedSessionStart = false;
18032
18106
  for await (const rawLine of lines) {
18033
18107
  const line = rawLine.trim();
18034
- if (!line)
18035
- continue;
18108
+ if (!line) continue;
18036
18109
  let event;
18037
18110
  try {
18038
18111
  event = JSON.parse(line);
@@ -18045,8 +18118,7 @@ async function* adaptKimi(lines) {
18045
18118
  };
18046
18119
  continue;
18047
18120
  }
18048
- if (!event || typeof event !== "object")
18049
- continue;
18121
+ if (!event || typeof event !== "object") continue;
18050
18122
  if (!emittedSessionStart) {
18051
18123
  const threadId = extractThreadId(event);
18052
18124
  if (threadId) {
@@ -18055,21 +18127,18 @@ async function* adaptKimi(lines) {
18055
18127
  }
18056
18128
  }
18057
18129
  const role = event.role;
18058
- if (!isNonEmptyString(role) || role !== "assistant")
18059
- continue;
18130
+ if (!isNonEmptyString(role) || role !== "assistant") continue;
18060
18131
  const content = event.content;
18061
- if (!isNonEmptyString(content))
18062
- continue;
18132
+ if (!isNonEmptyString(content)) continue;
18063
18133
  yield { event: "agent_message", text: content };
18064
18134
  }
18065
18135
  }
18066
18136
 
18067
- // packages/agent-spawn/dist/adapters/native.js
18137
+ // packages/agent-spawn/src/adapters/native.ts
18068
18138
  async function* adaptNative(lines) {
18069
18139
  for await (const rawLine of lines) {
18070
18140
  const line = rawLine.trim();
18071
- if (!line)
18072
- continue;
18141
+ if (!line) continue;
18073
18142
  let event;
18074
18143
  try {
18075
18144
  event = JSON.parse(line);
@@ -18094,26 +18163,22 @@ async function* adaptNative(lines) {
18094
18163
  }
18095
18164
  }
18096
18165
 
18097
- // packages/agent-spawn/dist/adapters/opencode.js
18166
+ // packages/agent-spawn/src/adapters/opencode.ts
18098
18167
  function guessToolKind(toolName) {
18099
18168
  const normalized = toolName.toLowerCase();
18100
- if (normalized === "bash" || normalized === "shell" || normalized === "sh")
18101
- return "exec";
18102
- if (normalized.includes("read"))
18103
- return "read";
18169
+ if (normalized === "bash" || normalized === "shell" || normalized === "sh") return "exec";
18170
+ if (normalized.includes("read")) return "read";
18104
18171
  if (normalized.includes("write") || normalized.includes("edit") || normalized.includes("patch")) {
18105
18172
  return "edit";
18106
18173
  }
18107
18174
  if (normalized.includes("search") || normalized.includes("grep") || normalized.includes("glob") || normalized.includes("find")) {
18108
18175
  return "search";
18109
18176
  }
18110
- if (normalized.includes("think") || normalized.includes("task"))
18111
- return "think";
18177
+ if (normalized.includes("think") || normalized.includes("task")) return "think";
18112
18178
  return "other";
18113
18179
  }
18114
18180
  function safeStringify(value) {
18115
- if (typeof value === "string")
18116
- return value;
18181
+ if (typeof value === "string") return value;
18117
18182
  try {
18118
18183
  return JSON.stringify(value);
18119
18184
  } catch {
@@ -18125,8 +18190,7 @@ async function* adaptOpenCode(lines) {
18125
18190
  const toolKindById = /* @__PURE__ */ new Map();
18126
18191
  for await (const rawLine of lines) {
18127
18192
  const line = rawLine.trim();
18128
- if (!line)
18129
- continue;
18193
+ if (!line) continue;
18130
18194
  let event;
18131
18195
  try {
18132
18196
  event = JSON.parse(line);
@@ -18139,34 +18203,27 @@ async function* adaptOpenCode(lines) {
18139
18203
  };
18140
18204
  continue;
18141
18205
  }
18142
- if (!event || typeof event !== "object")
18143
- continue;
18206
+ if (!event || typeof event !== "object") continue;
18144
18207
  const sessionID = extractThreadId(event);
18145
18208
  if (!emittedSessionStart && isNonEmptyString(sessionID)) {
18146
18209
  emittedSessionStart = true;
18147
18210
  yield { event: "session_start", threadId: sessionID };
18148
18211
  }
18149
18212
  const eventType = event.type;
18150
- if (!isNonEmptyString(eventType))
18151
- continue;
18213
+ if (!isNonEmptyString(eventType)) continue;
18152
18214
  if (eventType === "text") {
18153
18215
  const part = event.part ?? null;
18154
- if (!part || typeof part !== "object")
18155
- continue;
18156
- if (!isNonEmptyString(part.text))
18157
- continue;
18216
+ if (!part || typeof part !== "object") continue;
18217
+ if (!isNonEmptyString(part.text)) continue;
18158
18218
  yield { event: "agent_message", text: part.text };
18159
18219
  continue;
18160
18220
  }
18161
18221
  if (eventType === "tool_use") {
18162
18222
  const part = event.part ?? null;
18163
- if (!part || typeof part !== "object")
18164
- continue;
18165
- if (!isNonEmptyString(part.callID) || !isNonEmptyString(part.tool))
18166
- continue;
18223
+ if (!part || typeof part !== "object") continue;
18224
+ if (!isNonEmptyString(part.callID) || !isNonEmptyString(part.tool)) continue;
18167
18225
  const state = part.state ?? null;
18168
- if (!state || typeof state !== "object")
18169
- continue;
18226
+ if (!state || typeof state !== "object") continue;
18170
18227
  const kind = guessToolKind(part.tool);
18171
18228
  const status = state.status;
18172
18229
  const terminal = status === "completed" || status === "failed";
@@ -18202,24 +18259,21 @@ async function* adaptOpenCode(lines) {
18202
18259
  }
18203
18260
  if (eventType === "step_finish") {
18204
18261
  const part = event.part ?? null;
18205
- if (!part || typeof part !== "object")
18206
- continue;
18262
+ if (!part || typeof part !== "object") continue;
18207
18263
  const tokens = part.tokens ?? null;
18208
- if (!tokens || typeof tokens !== "object")
18209
- continue;
18264
+ if (!tokens || typeof tokens !== "object") continue;
18210
18265
  const inputTokens = typeof tokens.input === "number" ? tokens.input : 0;
18211
18266
  const outputTokens = typeof tokens.output === "number" ? tokens.output : 0;
18212
18267
  const cache = tokens.cache ?? null;
18213
18268
  const cachedTokens = cache && typeof cache === "object" && typeof cache.read === "number" ? cache.read : void 0;
18214
- if (inputTokens === 0 && outputTokens === 0 && cachedTokens === void 0)
18215
- continue;
18269
+ if (inputTokens === 0 && outputTokens === 0 && cachedTokens === void 0) continue;
18216
18270
  yield { event: "usage", inputTokens, outputTokens, cachedTokens };
18217
18271
  continue;
18218
18272
  }
18219
18273
  }
18220
18274
  }
18221
18275
 
18222
- // packages/agent-spawn/dist/adapters/index.js
18276
+ // packages/agent-spawn/src/adapters/index.ts
18223
18277
  var adapters = {
18224
18278
  codex: adaptCodex,
18225
18279
  claude: adaptClaude,
@@ -18235,12 +18289,10 @@ function getAdapter(type) {
18235
18289
  return adapter;
18236
18290
  }
18237
18291
 
18238
- // packages/agent-spawn/dist/acp/line-reader.js
18292
+ // packages/agent-spawn/src/acp/line-reader.ts
18239
18293
  function chunkToString(chunk) {
18240
- if (typeof chunk === "string")
18241
- return chunk;
18242
- if (chunk instanceof Uint8Array)
18243
- return Buffer.from(chunk).toString("utf8");
18294
+ if (typeof chunk === "string") return chunk;
18295
+ if (chunk instanceof Uint8Array) return Buffer.from(chunk).toString("utf8");
18244
18296
  return String(chunk);
18245
18297
  }
18246
18298
  async function* readLines(stream) {
@@ -18249,8 +18301,7 @@ async function* readLines(stream) {
18249
18301
  buffer += chunkToString(chunk);
18250
18302
  while (true) {
18251
18303
  const newlineIndex = buffer.indexOf("\n");
18252
- if (newlineIndex === -1)
18253
- break;
18304
+ if (newlineIndex === -1) break;
18254
18305
  yield buffer.slice(0, newlineIndex);
18255
18306
  buffer = buffer.slice(newlineIndex + 1);
18256
18307
  }
@@ -18260,7 +18311,7 @@ async function* readLines(stream) {
18260
18311
  }
18261
18312
  }
18262
18313
 
18263
- // packages/agent-spawn/dist/configs/resolve-config.js
18314
+ // packages/agent-spawn/src/configs/resolve-config.ts
18264
18315
  function resolveConfig(agentId) {
18265
18316
  const resolvedAgentId = resolveAgentId(agentId);
18266
18317
  if (!resolvedAgentId) {
@@ -18275,13 +18326,12 @@ function resolveConfig(agentId) {
18275
18326
  return { agentId: resolvedAgentId, binaryName, spawnConfig };
18276
18327
  }
18277
18328
 
18278
- // packages/agent-spawn/dist/acp/spawn.js
18329
+ // packages/agent-spawn/src/acp/spawn.ts
18279
18330
  function isAcpEvent(value) {
18280
18331
  return !!value && typeof value === "object" && "event" in value;
18281
18332
  }
18282
18333
  function captureUsage(event) {
18283
- if (event.event !== "usage")
18284
- return;
18334
+ if (event.event !== "usage") return;
18285
18335
  const usage = event;
18286
18336
  const inputTokens = typeof usage.inputTokens === "number" ? usage.inputTokens : 0;
18287
18337
  const outputTokens = typeof usage.outputTokens === "number" ? usage.outputTokens : 0;
@@ -18331,8 +18381,7 @@ function spawnStreaming(options) {
18331
18381
  const adapter = getAdapter(spawnConfig.adapter);
18332
18382
  const events = (async function* () {
18333
18383
  for await (const output of adapter(readLines(child.stdout))) {
18334
- if (!isAcpEvent(output))
18335
- continue;
18384
+ if (!isAcpEvent(output)) continue;
18336
18385
  if (output.event === "session_start") {
18337
18386
  const maybeThreadId = output.threadId;
18338
18387
  if (typeof maybeThreadId === "string" && maybeThreadId.length > 0) {
@@ -18364,7 +18413,7 @@ init_shared();
18364
18413
 
18365
18414
  // src/sdk/spawn-core.ts
18366
18415
  init_shared();
18367
- import path7 from "node:path";
18416
+ import path6 from "node:path";
18368
18417
  import chalk11 from "chalk";
18369
18418
  async function spawnCore(container, service, options, flags = { dryRun: false, verbose: false }) {
18370
18419
  const cwdOverride = resolveSpawnWorkingDirectory(
@@ -18461,16 +18510,16 @@ function resolveSpawnWorkingDirectory(baseDir, candidate) {
18461
18510
  if (!candidate || candidate.trim().length === 0) {
18462
18511
  return void 0;
18463
18512
  }
18464
- if (path7.isAbsolute(candidate)) {
18513
+ if (path6.isAbsolute(candidate)) {
18465
18514
  return candidate;
18466
18515
  }
18467
- return path7.resolve(baseDir, candidate);
18516
+ return path6.resolve(baseDir, candidate);
18468
18517
  }
18469
18518
 
18470
18519
  // src/sdk/credentials.ts
18471
18520
  import * as fs from "node:fs/promises";
18472
18521
  import * as os from "node:os";
18473
- import * as path8 from "node:path";
18522
+ import * as path7 from "node:path";
18474
18523
  var CREDENTIALS_RELATIVE_PATH = ".poe-code/credentials.json";
18475
18524
  async function getPoeApiKey() {
18476
18525
  const envKey = process.env.POE_API_KEY;
@@ -18478,7 +18527,7 @@ async function getPoeApiKey() {
18478
18527
  return envKey.trim();
18479
18528
  }
18480
18529
  const homeDir = os.homedir();
18481
- const credentialsPath = path8.join(homeDir, CREDENTIALS_RELATIVE_PATH);
18530
+ const credentialsPath = path7.join(homeDir, CREDENTIALS_RELATIVE_PATH);
18482
18531
  try {
18483
18532
  const content = await fs.readFile(credentialsPath, "utf8");
18484
18533
  const parsed = JSON.parse(content);
@@ -18519,21 +18568,21 @@ function createSdkContainer(options) {
18519
18568
  });
18520
18569
  loggerFactory.setErrorLogger(errorLogger);
18521
18570
  const asyncFs = {
18522
- readFile: ((path14, encoding) => {
18571
+ readFile: ((path12, encoding) => {
18523
18572
  if (encoding) {
18524
- return fs2.readFile(path14, encoding);
18573
+ return fs2.readFile(path12, encoding);
18525
18574
  }
18526
- return fs2.readFile(path14);
18575
+ return fs2.readFile(path12);
18527
18576
  }),
18528
- writeFile: (path14, data, opts) => fs2.writeFile(path14, data, opts),
18529
- mkdir: (path14, opts) => fs2.mkdir(path14, opts).then(() => {
18577
+ writeFile: (path12, data, opts) => fs2.writeFile(path12, data, opts),
18578
+ mkdir: (path12, opts) => fs2.mkdir(path12, opts).then(() => {
18530
18579
  }),
18531
- stat: (path14) => fs2.stat(path14),
18532
- rm: (path14, opts) => fs2.rm(path14, opts),
18533
- unlink: (path14) => fs2.unlink(path14),
18534
- readdir: (path14) => fs2.readdir(path14),
18580
+ stat: (path12) => fs2.stat(path12),
18581
+ rm: (path12, opts) => fs2.rm(path12, opts),
18582
+ unlink: (path12) => fs2.unlink(path12),
18583
+ readdir: (path12) => fs2.readdir(path12),
18535
18584
  copyFile: (src, dest) => fs2.copyFile(src, dest),
18536
- chmod: (path14, mode) => fs2.chmod(path14, mode)
18585
+ chmod: (path12, mode) => fs2.chmod(path12, mode)
18537
18586
  };
18538
18587
  const contextFactory = createCommandContextFactory({ fs: asyncFs });
18539
18588
  const noopPrompts = async () => {
@@ -18875,10 +18924,10 @@ function resolveSpawnWorkingDirectory2(baseDir, candidate) {
18875
18924
  if (!candidate || candidate.trim().length === 0) {
18876
18925
  return void 0;
18877
18926
  }
18878
- if (path9.isAbsolute(candidate)) {
18927
+ if (path8.isAbsolute(candidate)) {
18879
18928
  return candidate;
18880
18929
  }
18881
- return path9.resolve(baseDir, candidate);
18930
+ return path8.resolve(baseDir, candidate);
18882
18931
  }
18883
18932
 
18884
18933
  // src/cli/commands/wrap.ts
@@ -19411,7 +19460,7 @@ async function executeTest(program, container, service, options = {}) {
19411
19460
  }
19412
19461
 
19413
19462
  // src/cli/commands/generate.ts
19414
- import path10 from "node:path";
19463
+ import path9 from "node:path";
19415
19464
  init_constants();
19416
19465
  init_shared();
19417
19466
 
@@ -19931,11 +19980,11 @@ function getDefaultMimeType(type) {
19931
19980
  return defaults[type];
19932
19981
  }
19933
19982
  function resolveOutputPath(filename, cwd) {
19934
- if (path10.isAbsolute(filename)) {
19983
+ if (path9.isAbsolute(filename)) {
19935
19984
  return { path: filename, label: filename };
19936
19985
  }
19937
19986
  return {
19938
- path: path10.join(cwd, filename),
19987
+ path: path9.join(cwd, filename),
19939
19988
  label: `./${filename}`
19940
19989
  };
19941
19990
  }
@@ -19943,10 +19992,10 @@ function resolveOutputPath(filename, cwd) {
19943
19992
  // src/cli/commands/mcp.ts
19944
19993
  init_credentials();
19945
19994
 
19946
- // packages/tiny-mcp-server/dist/server.js
19995
+ // packages/tiny-mcp-server/src/server.ts
19947
19996
  import * as readline from "readline";
19948
19997
 
19949
- // packages/tiny-mcp-server/dist/types.js
19998
+ // packages/tiny-mcp-server/src/types.ts
19950
19999
  var JSON_RPC_ERROR_CODES = {
19951
20000
  PARSE_ERROR: -32700,
19952
20001
  INVALID_REQUEST: -32600,
@@ -19955,7 +20004,7 @@ var JSON_RPC_ERROR_CODES = {
19955
20004
  INTERNAL_ERROR: -32603
19956
20005
  };
19957
20006
 
19958
- // packages/tiny-mcp-server/dist/jsonrpc.js
20007
+ // packages/tiny-mcp-server/src/jsonrpc.ts
19959
20008
  function parseMessage(line) {
19960
20009
  let parsed;
19961
20010
  try {
@@ -20052,7 +20101,7 @@ function formatErrorResponse(id, error2) {
20052
20101
  return JSON.stringify(response);
20053
20102
  }
20054
20103
 
20055
- // packages/tiny-file-type/dist/file-type.js
20104
+ // packages/tiny-file-type/src/file-type.ts
20056
20105
  function fileTypeFromBuffer(data) {
20057
20106
  if (data.length < 12) {
20058
20107
  return void 0;
@@ -20090,7 +20139,7 @@ function fileTypeFromBuffer(data) {
20090
20139
  return void 0;
20091
20140
  }
20092
20141
 
20093
- // packages/tiny-mcp-server/dist/content/image.js
20142
+ // packages/tiny-mcp-server/src/content/image.ts
20094
20143
  var SUPPORTED_IMAGE_MIMES = /* @__PURE__ */ new Set([
20095
20144
  "image/png",
20096
20145
  "image/jpeg",
@@ -20098,8 +20147,6 @@ var SUPPORTED_IMAGE_MIMES = /* @__PURE__ */ new Set([
20098
20147
  "image/webp"
20099
20148
  ]);
20100
20149
  var Image = class _Image {
20101
- base64Data;
20102
- mimeType;
20103
20150
  constructor(base64Data, mimeType) {
20104
20151
  this.base64Data = base64Data;
20105
20152
  this.mimeType = mimeType;
@@ -20152,7 +20199,7 @@ var Image = class _Image {
20152
20199
  }
20153
20200
  };
20154
20201
 
20155
- // packages/tiny-mcp-server/dist/content/audio.js
20202
+ // packages/tiny-mcp-server/src/content/audio.ts
20156
20203
  var SUPPORTED_AUDIO_MIMES = /* @__PURE__ */ new Set([
20157
20204
  "audio/mpeg",
20158
20205
  "audio/wav",
@@ -20167,8 +20214,6 @@ var AUDIO_FORMAT_MAP = {
20167
20214
  mpeg: "audio/mpeg"
20168
20215
  };
20169
20216
  var Audio = class _Audio {
20170
- base64Data;
20171
- mimeType;
20172
20217
  constructor(base64Data, mimeType) {
20173
20218
  this.base64Data = base64Data;
20174
20219
  this.mimeType = mimeType;
@@ -20225,15 +20270,11 @@ var Audio = class _Audio {
20225
20270
  }
20226
20271
  };
20227
20272
 
20228
- // packages/tiny-mcp-server/dist/content/file.js
20273
+ // packages/tiny-mcp-server/src/content/file.ts
20229
20274
  function isTextMimeType(mimeType) {
20230
20275
  return mimeType.startsWith("text/") || mimeType === "application/json" || mimeType === "application/xml" || mimeType === "application/javascript" || mimeType === "application/typescript";
20231
20276
  }
20232
20277
  var File2 = class _File {
20233
- data;
20234
- mimeType;
20235
- isText;
20236
- name;
20237
20278
  constructor(data, mimeType, isText, name) {
20238
20279
  this.data = data;
20239
20280
  this.mimeType = mimeType;
@@ -20311,7 +20352,7 @@ var File2 = class _File {
20311
20352
  }
20312
20353
  };
20313
20354
 
20314
- // packages/tiny-mcp-server/dist/content/convert.js
20355
+ // packages/tiny-mcp-server/src/content/convert.ts
20315
20356
  function convertSingleValue(value) {
20316
20357
  if (typeof value === "string") {
20317
20358
  return { type: "text", text: value };
@@ -20334,7 +20375,7 @@ function toContentBlocks(result) {
20334
20375
  return [convertSingleValue(result)];
20335
20376
  }
20336
20377
 
20337
- // packages/tiny-mcp-server/dist/server.js
20378
+ // packages/tiny-mcp-server/src/server.ts
20338
20379
  var PROTOCOL_VERSION = "2025-11-25";
20339
20380
  function createServer(options) {
20340
20381
  const tools = /* @__PURE__ */ new Map();
@@ -20535,7 +20576,7 @@ function createServer(options) {
20535
20576
  return server;
20536
20577
  }
20537
20578
 
20538
- // packages/tiny-mcp-server/dist/schema.js
20579
+ // packages/tiny-mcp-server/src/schema.ts
20539
20580
  function defineSchema(definition) {
20540
20581
  const properties = {};
20541
20582
  const required2 = [];
@@ -20914,8 +20955,8 @@ function getErrorMap() {
20914
20955
 
20915
20956
  // node_modules/zod/v3/helpers/parseUtil.js
20916
20957
  var makeIssue = (params) => {
20917
- const { data, path: path14, errorMaps, issueData } = params;
20918
- const fullPath = [...path14, ...issueData.path || []];
20958
+ const { data, path: path12, errorMaps, issueData } = params;
20959
+ const fullPath = [...path12, ...issueData.path || []];
20919
20960
  const fullIssue = {
20920
20961
  ...issueData,
20921
20962
  path: fullPath
@@ -21030,11 +21071,11 @@ var errorUtil;
21030
21071
 
21031
21072
  // node_modules/zod/v3/types.js
21032
21073
  var ParseInputLazyPath = class {
21033
- constructor(parent, value, path14, key) {
21074
+ constructor(parent, value, path12, key) {
21034
21075
  this._cachedPath = [];
21035
21076
  this.parent = parent;
21036
21077
  this.data = value;
21037
- this._path = path14;
21078
+ this._path = path12;
21038
21079
  this._key = key;
21039
21080
  }
21040
21081
  get path() {
@@ -24678,10 +24719,10 @@ function mergeDefs(...defs) {
24678
24719
  function cloneDef(schema) {
24679
24720
  return mergeDefs(schema._zod.def);
24680
24721
  }
24681
- function getElementAtPath(obj, path14) {
24682
- if (!path14)
24722
+ function getElementAtPath(obj, path12) {
24723
+ if (!path12)
24683
24724
  return obj;
24684
- return path14.reduce((acc, key) => acc?.[key], obj);
24725
+ return path12.reduce((acc, key) => acc?.[key], obj);
24685
24726
  }
24686
24727
  function promiseAllObject(promisesObj) {
24687
24728
  const keys = Object.keys(promisesObj);
@@ -25064,11 +25105,11 @@ function aborted(x2, startIndex = 0) {
25064
25105
  }
25065
25106
  return false;
25066
25107
  }
25067
- function prefixIssues(path14, issues) {
25108
+ function prefixIssues(path12, issues) {
25068
25109
  return issues.map((iss) => {
25069
25110
  var _a2;
25070
25111
  (_a2 = iss).path ?? (_a2.path = []);
25071
- iss.path.unshift(path14);
25112
+ iss.path.unshift(path12);
25072
25113
  return iss;
25073
25114
  });
25074
25115
  }
@@ -33019,7 +33060,7 @@ function parseMcpOutputFormatPreferences(value) {
33019
33060
  return preferences;
33020
33061
  }
33021
33062
 
33022
- // packages/agent-mcp-config/dist/configs.js
33063
+ // packages/agent-mcp-config/src/configs.ts
33023
33064
  var agentMcpConfigs = {
33024
33065
  "claude-code": {
33025
33066
  configFile: "~/.claude.json",
@@ -33087,10 +33128,10 @@ function resolveConfigPath(config2, platform) {
33087
33128
  return config2.configFile;
33088
33129
  }
33089
33130
 
33090
- // packages/agent-mcp-config/dist/apply.js
33091
- import path11 from "node:path";
33131
+ // packages/agent-mcp-config/src/apply.ts
33132
+ import path10 from "node:path";
33092
33133
 
33093
- // packages/agent-mcp-config/dist/shapes.js
33134
+ // packages/agent-mcp-config/src/shapes.ts
33094
33135
  function transformStdioServer(config2, enabled) {
33095
33136
  if (!enabled) {
33096
33137
  return void 0;
@@ -33149,9 +33190,9 @@ function getShapeTransformer(shape) {
33149
33190
  return shapeTransformers[shape];
33150
33191
  }
33151
33192
 
33152
- // packages/agent-mcp-config/dist/apply.js
33193
+ // packages/agent-mcp-config/src/apply.ts
33153
33194
  function getConfigDirectory(configPath) {
33154
- return path11.dirname(configPath);
33195
+ return path10.dirname(configPath);
33155
33196
  }
33156
33197
  var UnsupportedAgentError = class extends Error {
33157
33198
  constructor(agentId) {
@@ -33172,36 +33213,39 @@ async function configure(agentId, server, options) {
33172
33213
  return;
33173
33214
  }
33174
33215
  const configDir = getConfigDirectory(configPath);
33175
- await runMutations([
33176
- fileMutation.ensureDirectory({
33177
- path: configDir,
33178
- label: `Ensure directory ${configDir}`
33179
- }),
33180
- // Use transform to replace the server entry entirely (not deep-merge)
33181
- // This ensures old fields like 'args' are removed when switching to array 'command'
33182
- configMutation.transform({
33183
- target: configPath,
33184
- format: config2.format,
33185
- transform: (document) => {
33186
- const serversKey = config2.configKey;
33187
- const servers = document[serversKey] ?? {};
33188
- const newServers = {
33189
- ...servers,
33190
- [server.name]: shaped
33191
- };
33192
- return {
33193
- changed: true,
33194
- content: { ...document, [serversKey]: newServers }
33195
- };
33196
- },
33197
- label: `Add ${server.name} to ${configPath}`
33198
- })
33199
- ], {
33200
- fs: options.fs,
33201
- homeDir: options.homeDir,
33202
- dryRun: options.dryRun,
33203
- observers: options.observers
33204
- });
33216
+ await runMutations(
33217
+ [
33218
+ fileMutation.ensureDirectory({
33219
+ path: configDir,
33220
+ label: `Ensure directory ${configDir}`
33221
+ }),
33222
+ // Use transform to replace the server entry entirely (not deep-merge)
33223
+ // This ensures old fields like 'args' are removed when switching to array 'command'
33224
+ configMutation.transform({
33225
+ target: configPath,
33226
+ format: config2.format,
33227
+ transform: (document) => {
33228
+ const serversKey = config2.configKey;
33229
+ const servers = document[serversKey] ?? {};
33230
+ const newServers = {
33231
+ ...servers,
33232
+ [server.name]: shaped
33233
+ };
33234
+ return {
33235
+ changed: true,
33236
+ content: { ...document, [serversKey]: newServers }
33237
+ };
33238
+ },
33239
+ label: `Add ${server.name} to ${configPath}`
33240
+ })
33241
+ ],
33242
+ {
33243
+ fs: options.fs,
33244
+ homeDir: options.homeDir,
33245
+ dryRun: options.dryRun,
33246
+ observers: options.observers
33247
+ }
33248
+ );
33205
33249
  }
33206
33250
  async function unconfigure(agentId, serverName, options) {
33207
33251
  if (!isSupported(agentId)) {
@@ -33209,28 +33253,31 @@ async function unconfigure(agentId, serverName, options) {
33209
33253
  }
33210
33254
  const config2 = getAgentConfig(agentId);
33211
33255
  const configPath = resolveConfigPath(config2, options.platform);
33212
- await runMutations([
33213
- configMutation.prune({
33214
- target: configPath,
33215
- format: config2.format,
33216
- shape: {
33217
- [config2.configKey]: {
33218
- [serverName]: {}
33219
- }
33220
- },
33221
- label: `Remove ${serverName} from ${configPath}`
33222
- })
33223
- ], {
33224
- fs: options.fs,
33225
- homeDir: options.homeDir,
33226
- dryRun: options.dryRun,
33227
- observers: options.observers
33228
- });
33256
+ await runMutations(
33257
+ [
33258
+ configMutation.prune({
33259
+ target: configPath,
33260
+ format: config2.format,
33261
+ shape: {
33262
+ [config2.configKey]: {
33263
+ [serverName]: {}
33264
+ }
33265
+ },
33266
+ label: `Remove ${serverName} from ${configPath}`
33267
+ })
33268
+ ],
33269
+ {
33270
+ fs: options.fs,
33271
+ homeDir: options.homeDir,
33272
+ dryRun: options.dryRun,
33273
+ observers: options.observers
33274
+ }
33275
+ );
33229
33276
  }
33230
33277
 
33231
33278
  // src/utils/execution-context.ts
33232
33279
  import { dirname } from "node:path";
33233
- import { fileURLToPath as fileURLToPath2 } from "node:url";
33280
+ import { fileURLToPath } from "node:url";
33234
33281
  function detectExecutionContext(input) {
33235
33282
  const { argv, env, moduleUrl } = input;
33236
33283
  if (isDevelopmentMode(argv, env)) {
@@ -33287,7 +33334,7 @@ function detectNpxVersion(env) {
33287
33334
  return "default";
33288
33335
  }
33289
33336
  function createDevelopmentContext(moduleUrl) {
33290
- const modulePath = fileURLToPath2(moduleUrl);
33337
+ const modulePath = fileURLToPath(moduleUrl);
33291
33338
  const srcIndex = modulePath.lastIndexOf("/src/");
33292
33339
  const projectRoot = srcIndex !== -1 ? modulePath.substring(0, srcIndex) : dirname(dirname(modulePath));
33293
33340
  return {
@@ -33471,9 +33518,9 @@ async function runMcpServer(container, options) {
33471
33518
  await runMcpServerWithTransport(outputFormatPreferences);
33472
33519
  }
33473
33520
 
33474
- // packages/agent-skill-config/dist/configs.js
33521
+ // packages/agent-skill-config/src/configs.ts
33475
33522
  import os3 from "node:os";
33476
- import path12 from "node:path";
33523
+ import path11 from "node:path";
33477
33524
  var agentSkillConfigs = {
33478
33525
  "claude-code": {
33479
33526
  globalSkillDir: "~/.claude/skills",
@@ -33501,28 +33548,33 @@ function resolveAgentSupport2(input, registry2 = agentSkillConfigs) {
33501
33548
  return { status: "supported", input, id: resolvedId, config: config2 };
33502
33549
  }
33503
33550
 
33504
- // packages/agent-skill-config/dist/templates.js
33505
- import path13 from "node:path";
33506
- import { readFile as readFile4 } from "node:fs/promises";
33507
- import { fileURLToPath as fileURLToPath3 } from "node:url";
33508
- var templatesRoot = fileURLToPath3(new URL("./templates", import.meta.url));
33509
- function resolveTemplatePath(templateId) {
33510
- const resolved = path13.resolve(templatesRoot, templateId);
33511
- const relative = path13.relative(templatesRoot, resolved);
33512
- if (relative.startsWith("..") || path13.isAbsolute(relative)) {
33513
- throw new Error(`Invalid template id: ${templateId}`);
33551
+ // packages/agent-skill-config/src/templates.ts
33552
+ var templatesCache2 = null;
33553
+ async function getTemplates2() {
33554
+ if (templatesCache2) {
33555
+ return templatesCache2;
33514
33556
  }
33515
- return resolved;
33557
+ const poeGenerateTemplate = await Promise.resolve().then(() => __toESM(require_poe_generate(), 1)).then(
33558
+ (m2) => m2.default
33559
+ );
33560
+ templatesCache2 = {
33561
+ "poe-generate.md": poeGenerateTemplate
33562
+ };
33563
+ return templatesCache2;
33516
33564
  }
33517
33565
  async function loadTemplate2(templateId) {
33518
- const templatePath = resolveTemplatePath(templateId);
33519
- return readFile4(templatePath, "utf8");
33566
+ const templates = await getTemplates2();
33567
+ const template = templates[templateId];
33568
+ if (!template) {
33569
+ throw new Error(`Template not found: ${templateId}`);
33570
+ }
33571
+ return template;
33520
33572
  }
33521
33573
  function createTemplateLoader() {
33522
33574
  return loadTemplate2;
33523
33575
  }
33524
33576
 
33525
- // packages/agent-skill-config/dist/apply.js
33577
+ // packages/agent-skill-config/src/apply.ts
33526
33578
  var UnsupportedAgentError2 = class extends Error {
33527
33579
  constructor(agentId) {
33528
33580
  super(`Unsupported agent: ${agentId}`);
@@ -33546,23 +33598,28 @@ async function configure2(agentId, options) {
33546
33598
  const config2 = support.config;
33547
33599
  const skillDir = scope === "global" ? config2.globalSkillDir : toHomeRelative(config2.localSkillDir);
33548
33600
  const homeDir = scope === "global" ? options.homeDir : options.cwd;
33549
- await runMutations([
33550
- fileMutation.ensureDirectory({
33551
- path: skillDir,
33552
- label: `Ensure directory ${skillDir}`
33553
- }),
33554
- ...bundledSkillTemplateIds.map((templateId) => templateMutation.write({
33555
- target: `${skillDir}/${templateId}`,
33556
- templateId,
33557
- label: `Write bundled skill ${templateId} to ${skillDir}`
33558
- }))
33559
- ], {
33560
- fs: options.fs,
33561
- homeDir,
33562
- dryRun: options.dryRun,
33563
- observers: options.observers,
33564
- templates: createTemplateLoader()
33565
- });
33601
+ await runMutations(
33602
+ [
33603
+ fileMutation.ensureDirectory({
33604
+ path: skillDir,
33605
+ label: `Ensure directory ${skillDir}`
33606
+ }),
33607
+ ...bundledSkillTemplateIds.map(
33608
+ (templateId) => templateMutation.write({
33609
+ target: `${skillDir}/${templateId}`,
33610
+ templateId,
33611
+ label: `Write bundled skill ${templateId} to ${skillDir}`
33612
+ })
33613
+ )
33614
+ ],
33615
+ {
33616
+ fs: options.fs,
33617
+ homeDir,
33618
+ dryRun: options.dryRun,
33619
+ observers: options.observers,
33620
+ templates: createTemplateLoader()
33621
+ }
33622
+ );
33566
33623
  }
33567
33624
  async function unconfigure2(agentId, options) {
33568
33625
  const support = resolveAgentSupport2(agentId);
@@ -33573,18 +33630,21 @@ async function unconfigure2(agentId, options) {
33573
33630
  const config2 = support.config;
33574
33631
  const skillDir = scope === "global" ? config2.globalSkillDir : toHomeRelative(config2.localSkillDir);
33575
33632
  const homeDir = scope === "global" ? options.homeDir : options.cwd;
33576
- await runMutations([
33577
- fileMutation.removeDirectory({
33578
- path: skillDir,
33579
- force: options.force,
33580
- label: `Remove skills directory ${skillDir}`
33581
- })
33582
- ], {
33583
- fs: options.fs,
33584
- homeDir,
33585
- dryRun: options.dryRun,
33586
- observers: options.observers
33587
- });
33633
+ await runMutations(
33634
+ [
33635
+ fileMutation.removeDirectory({
33636
+ path: skillDir,
33637
+ force: options.force,
33638
+ label: `Remove skills directory ${skillDir}`
33639
+ })
33640
+ ],
33641
+ {
33642
+ fs: options.fs,
33643
+ homeDir,
33644
+ dryRun: options.dryRun,
33645
+ observers: options.observers
33646
+ }
33647
+ );
33588
33648
  }
33589
33649
 
33590
33650
  // src/cli/commands/skill.ts
@@ -33871,7 +33931,7 @@ var package_default = {
33871
33931
  "packages/*"
33872
33932
  ],
33873
33933
  scripts: {
33874
- build: "turbo run build && tsc -p tsconfig.build.json && node scripts/copy-templates.mjs && node scripts/generate-bin-wrappers.mjs && node scripts/bundle.mjs",
33934
+ build: "turbo run build && tsc -p tsconfig.build.json && node scripts/generate-bin-wrappers.mjs && node scripts/bundle.mjs",
33875
33935
  predev: "turbo run build --filter=@poe-code/agent-mcp-config --filter=@poe-code/tiny-mcp-server --output-logs=none --log-prefix=none --verbosity=0 > /dev/null 2>&1",
33876
33936
  dev: "tsx src/index.ts",
33877
33937
  start: "node dist/index.js",