@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.
- package/CHANGELOG.md +34 -0
- package/package.json +4 -4
- package/src/core/custom-commands/bundled/wt/index.ts +3 -0
- package/src/core/sdk.ts +7 -0
- package/src/core/tools/complete.ts +129 -0
- package/src/core/tools/index.test.ts +9 -1
- package/src/core/tools/index.ts +18 -5
- package/src/core/tools/jtd-to-json-schema.ts +252 -0
- package/src/core/tools/output.ts +125 -14
- package/src/core/tools/read.ts +4 -4
- package/src/core/tools/task/artifacts.ts +6 -9
- package/src/core/tools/task/executor.ts +189 -24
- package/src/core/tools/task/index.ts +23 -18
- package/src/core/tools/task/name-generator.ts +1577 -0
- package/src/core/tools/task/render.ts +137 -8
- package/src/core/tools/task/types.ts +26 -5
- package/src/core/tools/task/worker-protocol.ts +1 -0
- package/src/core/tools/task/worker.ts +136 -14
- package/src/core/tools/web-fetch-handlers/academic.test.ts +239 -0
- package/src/core/tools/web-fetch-handlers/artifacthub.ts +210 -0
- package/src/core/tools/web-fetch-handlers/arxiv.ts +84 -0
- package/src/core/tools/web-fetch-handlers/aur.ts +171 -0
- package/src/core/tools/web-fetch-handlers/biorxiv.ts +136 -0
- package/src/core/tools/web-fetch-handlers/bluesky.ts +277 -0
- package/src/core/tools/web-fetch-handlers/brew.ts +173 -0
- package/src/core/tools/web-fetch-handlers/business.test.ts +82 -0
- package/src/core/tools/web-fetch-handlers/cheatsh.ts +73 -0
- package/src/core/tools/web-fetch-handlers/chocolatey.ts +153 -0
- package/src/core/tools/web-fetch-handlers/coingecko.ts +179 -0
- package/src/core/tools/web-fetch-handlers/crates-io.ts +123 -0
- package/src/core/tools/web-fetch-handlers/dev-platforms.test.ts +254 -0
- package/src/core/tools/web-fetch-handlers/devto.ts +173 -0
- package/src/core/tools/web-fetch-handlers/discogs.ts +303 -0
- package/src/core/tools/web-fetch-handlers/dockerhub.ts +156 -0
- package/src/core/tools/web-fetch-handlers/documentation.test.ts +85 -0
- package/src/core/tools/web-fetch-handlers/finance-media.test.ts +144 -0
- package/src/core/tools/web-fetch-handlers/git-hosting.test.ts +272 -0
- package/src/core/tools/web-fetch-handlers/github-gist.ts +64 -0
- package/src/core/tools/web-fetch-handlers/github.ts +424 -0
- package/src/core/tools/web-fetch-handlers/gitlab.ts +444 -0
- package/src/core/tools/web-fetch-handlers/go-pkg.ts +271 -0
- package/src/core/tools/web-fetch-handlers/hackage.ts +89 -0
- package/src/core/tools/web-fetch-handlers/hackernews.ts +208 -0
- package/src/core/tools/web-fetch-handlers/hex.ts +121 -0
- package/src/core/tools/web-fetch-handlers/huggingface.ts +385 -0
- package/src/core/tools/web-fetch-handlers/iacr.ts +82 -0
- package/src/core/tools/web-fetch-handlers/index.ts +69 -0
- package/src/core/tools/web-fetch-handlers/lobsters.ts +186 -0
- package/src/core/tools/web-fetch-handlers/mastodon.ts +302 -0
- package/src/core/tools/web-fetch-handlers/maven.ts +147 -0
- package/src/core/tools/web-fetch-handlers/mdn.ts +174 -0
- package/src/core/tools/web-fetch-handlers/media.test.ts +138 -0
- package/src/core/tools/web-fetch-handlers/metacpan.ts +247 -0
- package/src/core/tools/web-fetch-handlers/npm.ts +107 -0
- package/src/core/tools/web-fetch-handlers/nuget.ts +201 -0
- package/src/core/tools/web-fetch-handlers/nvd.ts +238 -0
- package/src/core/tools/web-fetch-handlers/opencorporates.ts +273 -0
- package/src/core/tools/web-fetch-handlers/openlibrary.ts +313 -0
- package/src/core/tools/web-fetch-handlers/osv.ts +184 -0
- package/src/core/tools/web-fetch-handlers/package-managers-2.test.ts +199 -0
- package/src/core/tools/web-fetch-handlers/package-managers.test.ts +171 -0
- package/src/core/tools/web-fetch-handlers/package-registries.test.ts +259 -0
- package/src/core/tools/web-fetch-handlers/packagist.ts +170 -0
- package/src/core/tools/web-fetch-handlers/pub-dev.ts +185 -0
- package/src/core/tools/web-fetch-handlers/pubmed.ts +174 -0
- package/src/core/tools/web-fetch-handlers/pypi.ts +125 -0
- package/src/core/tools/web-fetch-handlers/readthedocs.ts +122 -0
- package/src/core/tools/web-fetch-handlers/reddit.ts +100 -0
- package/src/core/tools/web-fetch-handlers/repology.ts +257 -0
- package/src/core/tools/web-fetch-handlers/research.test.ts +107 -0
- package/src/core/tools/web-fetch-handlers/rfc.ts +205 -0
- package/src/core/tools/web-fetch-handlers/rubygems.ts +112 -0
- package/src/core/tools/web-fetch-handlers/sec-edgar.ts +269 -0
- package/src/core/tools/web-fetch-handlers/security.test.ts +103 -0
- package/src/core/tools/web-fetch-handlers/semantic-scholar.ts +190 -0
- package/src/core/tools/web-fetch-handlers/social-extended.test.ts +192 -0
- package/src/core/tools/web-fetch-handlers/social.test.ts +259 -0
- package/src/core/tools/web-fetch-handlers/spotify.ts +218 -0
- package/src/core/tools/web-fetch-handlers/stackexchange.test.ts +120 -0
- package/src/core/tools/web-fetch-handlers/stackoverflow.ts +123 -0
- package/src/core/tools/web-fetch-handlers/standards.test.ts +122 -0
- package/src/core/tools/web-fetch-handlers/terraform.ts +296 -0
- package/src/core/tools/web-fetch-handlers/tldr.ts +47 -0
- package/src/core/tools/web-fetch-handlers/twitter.ts +84 -0
- package/src/core/tools/web-fetch-handlers/types.ts +163 -0
- package/src/core/tools/web-fetch-handlers/utils.ts +91 -0
- package/src/core/tools/web-fetch-handlers/vimeo.ts +152 -0
- package/src/core/tools/web-fetch-handlers/wikidata.ts +349 -0
- package/src/core/tools/web-fetch-handlers/wikipedia.test.ts +73 -0
- package/src/core/tools/web-fetch-handlers/wikipedia.ts +91 -0
- package/src/core/tools/web-fetch-handlers/youtube.test.ts +198 -0
- package/src/core/tools/web-fetch-handlers/youtube.ts +319 -0
- package/src/core/tools/web-fetch.ts +152 -1324
- package/src/prompts/task.md +14 -50
- package/src/prompts/tools/output.md +2 -1
- package/src/prompts/tools/task.md +3 -1
- 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 <
|
|
264
|
-
const
|
|
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
|
-
|
|
279
|
+
taskId: t.taskId,
|
|
280
|
+
agent: t.agent,
|
|
268
281
|
agentSource: agentCfg?.source ?? "user",
|
|
269
282
|
status: "pending",
|
|
270
|
-
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:
|
|
277
|
-
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} ${
|
|
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) =>
|
|
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(
|