@oh-my-pi/pi-coding-agent 3.24.0 → 3.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +4 -4
  3. package/src/core/custom-commands/bundled/wt/index.ts +3 -0
  4. package/src/core/sdk.ts +7 -0
  5. package/src/core/tools/complete.ts +129 -0
  6. package/src/core/tools/index.test.ts +9 -1
  7. package/src/core/tools/index.ts +18 -5
  8. package/src/core/tools/jtd-to-json-schema.ts +252 -0
  9. package/src/core/tools/output.ts +125 -14
  10. package/src/core/tools/read.ts +4 -4
  11. package/src/core/tools/task/artifacts.ts +6 -9
  12. package/src/core/tools/task/executor.ts +189 -24
  13. package/src/core/tools/task/index.ts +23 -18
  14. package/src/core/tools/task/name-generator.ts +1577 -0
  15. package/src/core/tools/task/render.ts +137 -8
  16. package/src/core/tools/task/types.ts +26 -5
  17. package/src/core/tools/task/worker-protocol.ts +1 -0
  18. package/src/core/tools/task/worker.ts +136 -14
  19. package/src/core/tools/web-fetch-handlers/academic.test.ts +239 -0
  20. package/src/core/tools/web-fetch-handlers/artifacthub.ts +210 -0
  21. package/src/core/tools/web-fetch-handlers/arxiv.ts +84 -0
  22. package/src/core/tools/web-fetch-handlers/aur.ts +171 -0
  23. package/src/core/tools/web-fetch-handlers/biorxiv.ts +136 -0
  24. package/src/core/tools/web-fetch-handlers/bluesky.ts +277 -0
  25. package/src/core/tools/web-fetch-handlers/brew.ts +173 -0
  26. package/src/core/tools/web-fetch-handlers/business.test.ts +82 -0
  27. package/src/core/tools/web-fetch-handlers/cheatsh.ts +73 -0
  28. package/src/core/tools/web-fetch-handlers/chocolatey.ts +153 -0
  29. package/src/core/tools/web-fetch-handlers/coingecko.ts +179 -0
  30. package/src/core/tools/web-fetch-handlers/crates-io.ts +123 -0
  31. package/src/core/tools/web-fetch-handlers/dev-platforms.test.ts +254 -0
  32. package/src/core/tools/web-fetch-handlers/devto.ts +173 -0
  33. package/src/core/tools/web-fetch-handlers/discogs.ts +303 -0
  34. package/src/core/tools/web-fetch-handlers/dockerhub.ts +156 -0
  35. package/src/core/tools/web-fetch-handlers/documentation.test.ts +85 -0
  36. package/src/core/tools/web-fetch-handlers/finance-media.test.ts +144 -0
  37. package/src/core/tools/web-fetch-handlers/git-hosting.test.ts +272 -0
  38. package/src/core/tools/web-fetch-handlers/github-gist.ts +64 -0
  39. package/src/core/tools/web-fetch-handlers/github.ts +424 -0
  40. package/src/core/tools/web-fetch-handlers/gitlab.ts +444 -0
  41. package/src/core/tools/web-fetch-handlers/go-pkg.ts +271 -0
  42. package/src/core/tools/web-fetch-handlers/hackage.ts +89 -0
  43. package/src/core/tools/web-fetch-handlers/hackernews.ts +208 -0
  44. package/src/core/tools/web-fetch-handlers/hex.ts +121 -0
  45. package/src/core/tools/web-fetch-handlers/huggingface.ts +385 -0
  46. package/src/core/tools/web-fetch-handlers/iacr.ts +82 -0
  47. package/src/core/tools/web-fetch-handlers/index.ts +69 -0
  48. package/src/core/tools/web-fetch-handlers/lobsters.ts +186 -0
  49. package/src/core/tools/web-fetch-handlers/mastodon.ts +302 -0
  50. package/src/core/tools/web-fetch-handlers/maven.ts +147 -0
  51. package/src/core/tools/web-fetch-handlers/mdn.ts +174 -0
  52. package/src/core/tools/web-fetch-handlers/media.test.ts +138 -0
  53. package/src/core/tools/web-fetch-handlers/metacpan.ts +247 -0
  54. package/src/core/tools/web-fetch-handlers/npm.ts +107 -0
  55. package/src/core/tools/web-fetch-handlers/nuget.ts +201 -0
  56. package/src/core/tools/web-fetch-handlers/nvd.ts +238 -0
  57. package/src/core/tools/web-fetch-handlers/opencorporates.ts +273 -0
  58. package/src/core/tools/web-fetch-handlers/openlibrary.ts +313 -0
  59. package/src/core/tools/web-fetch-handlers/osv.ts +184 -0
  60. package/src/core/tools/web-fetch-handlers/package-managers-2.test.ts +199 -0
  61. package/src/core/tools/web-fetch-handlers/package-managers.test.ts +171 -0
  62. package/src/core/tools/web-fetch-handlers/package-registries.test.ts +259 -0
  63. package/src/core/tools/web-fetch-handlers/packagist.ts +170 -0
  64. package/src/core/tools/web-fetch-handlers/pub-dev.ts +185 -0
  65. package/src/core/tools/web-fetch-handlers/pubmed.ts +174 -0
  66. package/src/core/tools/web-fetch-handlers/pypi.ts +125 -0
  67. package/src/core/tools/web-fetch-handlers/readthedocs.ts +122 -0
  68. package/src/core/tools/web-fetch-handlers/reddit.ts +100 -0
  69. package/src/core/tools/web-fetch-handlers/repology.ts +257 -0
  70. package/src/core/tools/web-fetch-handlers/research.test.ts +107 -0
  71. package/src/core/tools/web-fetch-handlers/rfc.ts +205 -0
  72. package/src/core/tools/web-fetch-handlers/rubygems.ts +112 -0
  73. package/src/core/tools/web-fetch-handlers/sec-edgar.ts +269 -0
  74. package/src/core/tools/web-fetch-handlers/security.test.ts +103 -0
  75. package/src/core/tools/web-fetch-handlers/semantic-scholar.ts +190 -0
  76. package/src/core/tools/web-fetch-handlers/social-extended.test.ts +192 -0
  77. package/src/core/tools/web-fetch-handlers/social.test.ts +259 -0
  78. package/src/core/tools/web-fetch-handlers/spotify.ts +218 -0
  79. package/src/core/tools/web-fetch-handlers/stackexchange.test.ts +120 -0
  80. package/src/core/tools/web-fetch-handlers/stackoverflow.ts +123 -0
  81. package/src/core/tools/web-fetch-handlers/standards.test.ts +122 -0
  82. package/src/core/tools/web-fetch-handlers/terraform.ts +296 -0
  83. package/src/core/tools/web-fetch-handlers/tldr.ts +47 -0
  84. package/src/core/tools/web-fetch-handlers/twitter.ts +84 -0
  85. package/src/core/tools/web-fetch-handlers/types.ts +163 -0
  86. package/src/core/tools/web-fetch-handlers/utils.ts +91 -0
  87. package/src/core/tools/web-fetch-handlers/vimeo.ts +152 -0
  88. package/src/core/tools/web-fetch-handlers/wikidata.ts +349 -0
  89. package/src/core/tools/web-fetch-handlers/wikipedia.test.ts +73 -0
  90. package/src/core/tools/web-fetch-handlers/wikipedia.ts +91 -0
  91. package/src/core/tools/web-fetch-handlers/youtube.test.ts +198 -0
  92. package/src/core/tools/web-fetch-handlers/youtube.ts +319 -0
  93. package/src/core/tools/web-fetch.ts +152 -1324
  94. package/src/prompts/task.md +14 -50
  95. package/src/prompts/tools/output.md +2 -1
  96. package/src/prompts/tools/task.md +3 -1
  97. package/src/utils/tools-manager.ts +110 -8
@@ -21,6 +21,7 @@ import { formatDuration } from "../render-utils";
21
21
  import { cleanupTempDir, createTempArtifactsDir, getArtifactsDir } from "./artifacts";
22
22
  import { discoverAgents, getAgent } from "./discovery";
23
23
  import { runSubprocess } from "./executor";
24
+ import { generateTaskName } from "./name-generator";
24
25
  import { mapWithConcurrencyLimit } from "./parallel";
25
26
  import { renderCall, renderResult } from "./render";
26
27
  import {
@@ -135,6 +136,7 @@ export async function createTaskTool(
135
136
  const startTime = Date.now();
136
137
  const { agents, projectAgentsDir } = await discoverAgents(session.cwd);
137
138
  const context = params.context;
139
+ const outputSchema = params.output_schema;
138
140
 
139
141
  // Handle empty or missing tasks
140
142
  if (!params.tasks || params.tasks.length === 0) {
@@ -259,34 +261,37 @@ export async function createTaskTool(
259
261
  }
260
262
  }
261
263
 
264
+ // Build full prompts with context prepended and generate task IDs
265
+ const tasksWithContext = tasks.map((t) => ({
266
+ agent: t.agent,
267
+ task: context ? `${context}\n\n${t.task}` : t.task,
268
+ model: t.model,
269
+ description: t.description,
270
+ taskId: generateTaskName(),
271
+ }));
272
+
262
273
  // Initialize progress for all tasks
263
- for (let i = 0; i < tasks.length; i++) {
264
- const agentCfg = getAgent(agents, tasks[i].agent);
274
+ for (let i = 0; i < tasksWithContext.length; i++) {
275
+ const t = tasksWithContext[i];
276
+ const agentCfg = getAgent(agents, t.agent);
265
277
  progressMap.set(i, {
266
278
  index: i,
267
- agent: tasks[i].agent,
279
+ taskId: t.taskId,
280
+ agent: t.agent,
268
281
  agentSource: agentCfg?.source ?? "user",
269
282
  status: "pending",
270
- task: tasks[i].task,
283
+ task: t.task,
271
284
  recentTools: [],
272
285
  recentOutput: [],
273
286
  toolCount: 0,
274
287
  tokens: 0,
275
288
  durationMs: 0,
276
- modelOverride: tasks[i].model,
277
- description: tasks[i].description,
289
+ modelOverride: t.model,
290
+ description: t.description,
278
291
  });
279
292
  }
280
293
  emitProgress();
281
294
 
282
- // Build full prompts with context prepended
283
- const tasksWithContext = tasks.map((t) => ({
284
- agent: t.agent,
285
- task: context ? `${context}\n\n${t.task}` : t.task,
286
- model: t.model,
287
- description: t.description,
288
- }));
289
-
290
295
  // Execute in parallel with concurrency limit
291
296
  const results = await mapWithConcurrencyLimit(tasksWithContext, MAX_CONCURRENCY, async (task, index) => {
292
297
  const agent = getAgent(agents, task.agent)!;
@@ -296,8 +301,10 @@ export async function createTaskTool(
296
301
  task: task.task,
297
302
  description: task.description,
298
303
  index,
304
+ taskId: task.taskId,
299
305
  context: undefined, // Already prepended above
300
306
  modelOverride: task.model,
307
+ outputSchema,
301
308
  sessionFile,
302
309
  persistArtifacts: !!artifactsDir,
303
310
  artifactsDir: effectiveArtifactsDir,
@@ -336,19 +343,17 @@ export async function createTaskTool(
336
343
  const status = r.exitCode === 0 ? "completed" : `failed (exit ${r.exitCode})`;
337
344
  const output = r.output.trim() || r.stderr.trim() || "(no output)";
338
345
  const preview = output.split("\n").slice(0, 5).join("\n");
339
- // Include output metadata and ID
340
- const outputId = `${r.agent}_${r.index}`;
341
346
  const meta = r.outputMeta
342
347
  ? ` [${r.outputMeta.lineCount} lines, ${formatBytes(r.outputMeta.charCount)}]`
343
348
  : "";
344
- return `[${r.agent}] ${status}${meta} ${outputId}\n${preview}`;
349
+ return `[${r.agent}] ${status}${meta} ${r.taskId}\n${preview}`;
345
350
  });
346
351
 
347
352
  const skippedNote =
348
353
  skippedSelfRecursion > 0
349
354
  ? ` (${skippedSelfRecursion} ${blockedAgent} task${skippedSelfRecursion > 1 ? "s" : ""} skipped - self-recursion blocked)`
350
355
  : "";
351
- const outputIds = results.map((r) => `${r.agent}_${r.index}`);
356
+ const outputIds = results.map((r) => r.taskId);
352
357
  const outputHint =
353
358
  outputIds.length > 0 ? `\n\nUse output tool for full logs: output ids ${outputIds.join(", ")}` : "";
354
359
  const summary = `${successCount}/${results.length} succeeded${skippedNote} [${formatDuration(