@oh-my-pi/pi-coding-agent 15.1.2 → 15.1.4
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 +60 -0
- package/dist/types/async/job-manager.d.ts +3 -2
- package/dist/types/cli/auth-broker-cli.d.ts +25 -0
- package/dist/types/cli/auth-gateway-cli.d.ts +18 -0
- package/dist/types/cli/grievances-cli.d.ts +12 -0
- package/dist/types/commands/auth-broker.d.ts +54 -0
- package/dist/types/commands/auth-gateway.d.ts +32 -0
- package/dist/types/commands/grievances.d.ts +1 -1
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +9 -1
- package/dist/types/commit/agentic/tools/schemas.d.ts +9 -1
- package/dist/types/commit/agentic/tools/split-commit.d.ts +9 -1
- package/dist/types/config/model-registry.d.ts +3 -0
- package/dist/types/config/models-config-schema.d.ts +1 -0
- package/dist/types/config/settings-schema.d.ts +46 -0
- package/dist/types/discovery/agents.d.ts +12 -1
- package/dist/types/edit/renderer.d.ts +3 -0
- package/dist/types/eval/index.d.ts +0 -2
- package/dist/types/goals/tools/goal-tool.d.ts +10 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/internal-urls/index.d.ts +1 -1
- package/dist/types/internal-urls/{pi-protocol.d.ts → omp-protocol.d.ts} +3 -3
- package/dist/types/internal-urls/types.d.ts +1 -1
- package/dist/types/main.d.ts +11 -2
- package/dist/types/modes/acp/acp-agent.d.ts +2 -1
- package/dist/types/modes/acp/acp-event-mapper.d.ts +13 -1
- package/dist/types/modes/acp/acp-mode.d.ts +3 -1
- package/dist/types/modes/emoji-autocomplete.d.ts +16 -0
- package/dist/types/modes/interactive-mode.d.ts +1 -1
- package/dist/types/modes/prompt-action-autocomplete.d.ts +4 -0
- package/dist/types/plan-mode/approved-plan.d.ts +10 -4
- package/dist/types/sdk.d.ts +10 -3
- package/dist/types/session/agent-session.d.ts +7 -3
- package/dist/types/session/auth-broker-config.d.ts +13 -0
- package/dist/types/session/auth-storage.d.ts +1 -1
- package/dist/types/session/client-bridge.d.ts +3 -0
- package/dist/types/tools/eval.d.ts +41 -7
- package/dist/types/tools/irc.d.ts +8 -2
- package/dist/types/tools/report-tool-issue.d.ts +118 -1
- package/dist/types/tools/resolve.d.ts +8 -2
- package/examples/custom-tools/README.md +3 -12
- package/examples/extensions/README.md +2 -15
- package/examples/extensions/api-demo.ts +1 -7
- package/package.json +7 -7
- package/src/async/job-manager.ts +111 -13
- package/src/autoresearch/tools/init-experiment.ts +11 -33
- package/src/autoresearch/tools/log-experiment.ts +10 -24
- package/src/autoresearch/tools/run-experiment.ts +1 -1
- package/src/autoresearch/tools/update-notes.ts +2 -9
- package/src/cli/auth-broker-cli.ts +746 -0
- package/src/cli/auth-gateway-cli.ts +342 -0
- package/src/cli/grievances-cli.ts +109 -16
- package/src/cli/update-cli.ts +1 -5
- package/src/cli.ts +4 -2
- package/src/commands/auth-broker.ts +96 -0
- package/src/commands/auth-gateway.ts +61 -0
- package/src/commands/grievances.ts +13 -8
- package/src/commands/launch.ts +1 -1
- package/src/commit/agentic/agent.ts +2 -0
- package/src/commit/agentic/tools/analyze-file.ts +2 -2
- package/src/commit/agentic/tools/git-file-diff.ts +2 -2
- package/src/commit/agentic/tools/git-hunk.ts +3 -3
- package/src/commit/agentic/tools/git-overview.ts +2 -2
- package/src/commit/agentic/tools/propose-changelog.ts +1 -3
- package/src/commit/agentic/tools/recent-commits.ts +1 -1
- package/src/commit/agentic/tools/schemas.ts +1 -9
- package/src/config/model-equivalence.ts +279 -174
- package/src/config/model-registry.ts +37 -6
- package/src/config/model-resolver.ts +13 -8
- package/src/config/models-config-schema.ts +8 -0
- package/src/config/settings-schema.ts +52 -0
- package/src/cursor.ts +1 -1
- package/src/debug/log-formatting.ts +1 -1
- package/src/debug/log-viewer.ts +1 -1
- package/src/debug/profiler.ts +4 -0
- package/src/debug/raw-sse-buffer.ts +100 -59
- package/src/debug/raw-sse.ts +1 -1
- package/src/discovery/agents.ts +15 -4
- package/src/edit/modes/apply-patch.ts +1 -5
- package/src/edit/modes/patch.ts +5 -5
- package/src/edit/modes/replace.ts +5 -5
- package/src/edit/renderer.ts +2 -1
- package/src/edit/streaming.ts +1 -1
- package/src/eval/index.ts +0 -2
- package/src/eval/js/shared/runtime.ts +107 -2
- package/src/eval/py/kernel.ts +1 -1
- package/src/exa/researcher.ts +4 -4
- package/src/exa/search.ts +10 -22
- package/src/exa/websets.ts +33 -33
- package/src/extensibility/typebox.ts +44 -17
- package/src/goals/tools/goal-tool.ts +3 -3
- package/src/index.ts +0 -3
- package/src/internal-urls/docs-index.generated.ts +21 -18
- package/src/internal-urls/index.ts +1 -1
- package/src/internal-urls/{pi-protocol.ts → omp-protocol.ts} +10 -10
- package/src/internal-urls/router.ts +3 -3
- package/src/internal-urls/types.ts +1 -1
- package/src/lsp/types.ts +8 -11
- package/src/main.ts +216 -146
- package/src/mcp/tool-bridge.ts +3 -3
- package/src/modes/acp/acp-agent.ts +203 -57
- package/src/modes/acp/acp-client-bridge.ts +2 -1
- package/src/modes/acp/acp-event-mapper.ts +208 -32
- package/src/modes/acp/acp-mode.ts +11 -3
- package/src/modes/components/bash-execution.ts +1 -1
- package/src/modes/components/diff.ts +1 -2
- package/src/modes/components/eval-execution.ts +1 -1
- package/src/modes/components/oauth-selector.ts +38 -2
- package/src/modes/components/tool-execution.ts +1 -2
- package/src/modes/components/tree-selector.ts +26 -7
- package/src/modes/controllers/command-controller.ts +95 -34
- package/src/modes/controllers/input-controller.ts +4 -3
- package/src/modes/data/emojis.json +1 -0
- package/src/modes/emoji-autocomplete.ts +285 -0
- package/src/modes/interactive-mode.ts +92 -19
- package/src/modes/print-mode.ts +3 -3
- package/src/modes/prompt-action-autocomplete.ts +14 -0
- package/src/plan-mode/approved-plan.ts +30 -9
- package/src/prompts/system/system-prompt.md +1 -1
- package/src/prompts/system/ttsr-tool-reminder.md +5 -0
- package/src/prompts/tools/ask.md +4 -3
- package/src/prompts/tools/eval.md +25 -26
- package/src/prompts/tools/read.md +1 -1
- package/src/prompts/tools/resolve.md +1 -1
- package/src/prompts/tools/search.md +1 -1
- package/src/prompts/tools/web-search.md +1 -1
- package/src/sdk.ts +81 -8
- package/src/session/agent-session.ts +362 -131
- package/src/session/agent-storage.ts +7 -2
- package/src/session/auth-broker-config.ts +102 -0
- package/src/session/auth-storage.ts +7 -1
- package/src/session/client-bridge.ts +3 -0
- package/src/session/streaming-output.ts +1 -1
- package/src/task/types.ts +10 -35
- package/src/tools/bash-interactive.ts +4 -1
- package/src/tools/bash-pty-selection.ts +2 -2
- package/src/tools/browser.ts +12 -20
- package/src/tools/eval.ts +77 -100
- package/src/tools/gh.ts +21 -45
- package/src/tools/hindsight-recall.ts +1 -1
- package/src/tools/hindsight-reflect.ts +2 -2
- package/src/tools/hindsight-retain.ts +3 -7
- package/src/tools/index.ts +8 -1
- package/src/tools/inspect-image.ts +4 -1
- package/src/tools/irc.ts +4 -12
- package/src/tools/job.ts +3 -11
- package/src/tools/report-tool-issue.ts +462 -17
- package/src/tools/resolve.ts +2 -7
- package/src/tools/todo-write.ts +8 -15
- package/src/utils/title-generator.ts +3 -0
- package/src/web/search/index.ts +6 -6
- package/dist/types/eval/parse.d.ts +0 -28
- package/dist/types/eval/sniff.d.ts +0 -11
- package/src/eval/eval.lark +0 -36
- package/src/eval/parse.ts +0 -407
- package/src/eval/sniff.ts +0 -28
package/src/async/job-manager.ts
CHANGED
|
@@ -37,6 +37,8 @@ interface AsyncJobDelivery {
|
|
|
37
37
|
attempt: number;
|
|
38
38
|
nextAttemptAt: number;
|
|
39
39
|
lastError?: string;
|
|
40
|
+
ownerId?: string;
|
|
41
|
+
promise?: Promise<void>;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export interface AsyncJobDeliveryState {
|
|
@@ -82,6 +84,7 @@ export class AsyncJobManager {
|
|
|
82
84
|
|
|
83
85
|
readonly #jobs = new Map<string, AsyncJob>();
|
|
84
86
|
readonly #deliveries: AsyncJobDelivery[] = [];
|
|
87
|
+
readonly #inFlightDeliveries: AsyncJobDelivery[] = [];
|
|
85
88
|
readonly #suppressedDeliveries = new Set<string>();
|
|
86
89
|
readonly #watchedJobs = new Set<string>();
|
|
87
90
|
readonly #evictionTimers = new Map<string, NodeJS.Timeout>();
|
|
@@ -219,22 +222,24 @@ export class AsyncJobManager {
|
|
|
219
222
|
return this.#filterJobs(this.#jobs.values(), filter);
|
|
220
223
|
}
|
|
221
224
|
|
|
222
|
-
getDeliveryState(): AsyncJobDeliveryState {
|
|
223
|
-
const
|
|
225
|
+
getDeliveryState(filter?: AsyncJobFilter): AsyncJobDeliveryState {
|
|
226
|
+
const deliveries = this.#filterDeliveries(filter);
|
|
227
|
+
const inFlightDeliveries = this.#filterInFlightDeliveries(filter);
|
|
228
|
+
const nextRetryAt = deliveries.reduce<number | undefined>((next, delivery) => {
|
|
224
229
|
if (next === undefined) return delivery.nextAttemptAt;
|
|
225
230
|
return Math.min(next, delivery.nextAttemptAt);
|
|
226
231
|
}, undefined);
|
|
227
232
|
|
|
228
233
|
return {
|
|
229
|
-
queued:
|
|
230
|
-
delivering: this.#deliveryLoop !== undefined,
|
|
234
|
+
queued: deliveries.length + inFlightDeliveries.length,
|
|
235
|
+
delivering: inFlightDeliveries.length > 0 || (this.#deliveryLoop !== undefined && deliveries.length > 0),
|
|
231
236
|
nextRetryAt,
|
|
232
|
-
pendingJobIds:
|
|
237
|
+
pendingJobIds: deliveries.concat(inFlightDeliveries).map(delivery => delivery.jobId),
|
|
233
238
|
};
|
|
234
239
|
}
|
|
235
240
|
|
|
236
|
-
hasPendingDeliveries(): boolean {
|
|
237
|
-
return this
|
|
241
|
+
hasPendingDeliveries(filter?: AsyncJobFilter): boolean {
|
|
242
|
+
return this.getDeliveryState(filter).queued > 0;
|
|
238
243
|
}
|
|
239
244
|
|
|
240
245
|
watchJobs(jobIds: string[]): number {
|
|
@@ -290,12 +295,25 @@ export class AsyncJobManager {
|
|
|
290
295
|
await Promise.all(Array.from(this.#jobs.values()).map(job => job.promise));
|
|
291
296
|
}
|
|
292
297
|
|
|
293
|
-
async drainDeliveries(options?: { timeoutMs?: number }): Promise<boolean> {
|
|
298
|
+
async drainDeliveries(options?: { timeoutMs?: number; filter?: AsyncJobFilter }): Promise<boolean> {
|
|
294
299
|
const timeoutMs = options?.timeoutMs;
|
|
300
|
+
const filter = options?.filter;
|
|
295
301
|
const hasDeadline = timeoutMs !== undefined;
|
|
296
302
|
const deadline = hasDeadline ? Date.now() + Math.max(timeoutMs, 0) : Number.POSITIVE_INFINITY;
|
|
297
303
|
|
|
298
|
-
while (this.hasPendingDeliveries()) {
|
|
304
|
+
while (this.hasPendingDeliveries(filter)) {
|
|
305
|
+
if (filter?.ownerId) {
|
|
306
|
+
const delivered = await this.#deliverNextFiltered(filter, deadline);
|
|
307
|
+
if (delivered) continue;
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
const inFlightDeliveries = this.#filterInFlightDeliveries();
|
|
311
|
+
if (inFlightDeliveries.length > 0 && this.#filterDeliveries().length === 0) {
|
|
312
|
+
const delivered = await this.#waitForDeliveryPromise(inFlightDeliveries[0]?.promise, deadline);
|
|
313
|
+
if (delivered) continue;
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
|
|
299
317
|
this.#ensureDeliveryLoop();
|
|
300
318
|
const loop = this.#deliveryLoop;
|
|
301
319
|
if (!loop) {
|
|
@@ -313,7 +331,7 @@ export class AsyncJobManager {
|
|
|
313
331
|
}
|
|
314
332
|
|
|
315
333
|
await Promise.race([loop, Bun.sleep(remainingMs)]);
|
|
316
|
-
if (Date.now() >= deadline && this.hasPendingDeliveries()) {
|
|
334
|
+
if (Date.now() >= deadline && this.hasPendingDeliveries(filter)) {
|
|
317
335
|
return false;
|
|
318
336
|
}
|
|
319
337
|
}
|
|
@@ -330,6 +348,7 @@ export class AsyncJobManager {
|
|
|
330
348
|
this.#clearEvictionTimers();
|
|
331
349
|
this.#jobs.clear();
|
|
332
350
|
this.#deliveries.length = 0;
|
|
351
|
+
this.#inFlightDeliveries.length = 0;
|
|
333
352
|
this.#suppressedDeliveries.clear();
|
|
334
353
|
this.#watchedJobs.clear();
|
|
335
354
|
return drained;
|
|
@@ -388,6 +407,55 @@ export class AsyncJobManager {
|
|
|
388
407
|
this.#evictionTimers.clear();
|
|
389
408
|
}
|
|
390
409
|
|
|
410
|
+
#filterDeliveries(filter?: AsyncJobFilter): AsyncJobDelivery[] {
|
|
411
|
+
const ownerId = filter?.ownerId;
|
|
412
|
+
if (!ownerId) return this.#deliveries.filter(delivery => !this.isDeliverySuppressed(delivery.jobId));
|
|
413
|
+
return this.#deliveries.filter(
|
|
414
|
+
delivery => delivery.ownerId === ownerId && !this.isDeliverySuppressed(delivery.jobId),
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
#filterInFlightDeliveries(filter?: AsyncJobFilter): AsyncJobDelivery[] {
|
|
419
|
+
const ownerId = filter?.ownerId;
|
|
420
|
+
if (!ownerId) return this.#inFlightDeliveries.filter(delivery => !this.isDeliverySuppressed(delivery.jobId));
|
|
421
|
+
return this.#inFlightDeliveries.filter(
|
|
422
|
+
delivery => delivery.ownerId === ownerId && !this.isDeliverySuppressed(delivery.jobId),
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
async #deliverNextFiltered(filter: AsyncJobFilter, deadline: number): Promise<boolean> {
|
|
427
|
+
while (true) {
|
|
428
|
+
let selected: AsyncJobDelivery | undefined;
|
|
429
|
+
for (const delivery of this.#deliveries) {
|
|
430
|
+
if (delivery.ownerId !== filter.ownerId) continue;
|
|
431
|
+
if (this.isDeliverySuppressed(delivery.jobId)) continue;
|
|
432
|
+
if (!selected || delivery.nextAttemptAt < selected.nextAttemptAt) {
|
|
433
|
+
selected = delivery;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (!selected) {
|
|
438
|
+
const inFlight = this.#filterInFlightDeliveries(filter);
|
|
439
|
+
if (inFlight.length === 0) return true;
|
|
440
|
+
return this.#waitForDeliveryPromise(inFlight[0]?.promise, deadline);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const now = Date.now();
|
|
444
|
+
if (selected.nextAttemptAt > now) {
|
|
445
|
+
if (selected.nextAttemptAt > deadline) return false;
|
|
446
|
+
await Bun.sleep(selected.nextAttemptAt - now);
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const index = this.#deliveries.indexOf(selected);
|
|
451
|
+
if (index === -1) continue;
|
|
452
|
+
this.#deliveries.splice(index, 1);
|
|
453
|
+
if (this.isDeliverySuppressed(selected.jobId)) continue;
|
|
454
|
+
|
|
455
|
+
return this.#waitForDeliveryPromise(this.#deliverDelivery(selected), deadline);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
391
459
|
isDeliverySuppressed(jobId: string): boolean {
|
|
392
460
|
return this.#suppressedDeliveries.has(jobId) || this.#watchedJobs.has(jobId);
|
|
393
461
|
}
|
|
@@ -402,6 +470,7 @@ export class AsyncJobManager {
|
|
|
402
470
|
text,
|
|
403
471
|
attempt: 0,
|
|
404
472
|
nextAttemptAt: Date.now(),
|
|
473
|
+
ownerId: this.#jobs.get(jobId)?.ownerId,
|
|
405
474
|
});
|
|
406
475
|
this.#ensureDeliveryLoop();
|
|
407
476
|
}
|
|
@@ -437,20 +506,25 @@ export class AsyncJobManager {
|
|
|
437
506
|
if (this.#deliveries[0] !== delivery) {
|
|
438
507
|
continue;
|
|
439
508
|
}
|
|
440
|
-
// Check again after sleep
|
|
441
509
|
if (this.isDeliverySuppressed(delivery.jobId)) {
|
|
442
510
|
this.#deliveries.shift();
|
|
443
511
|
continue;
|
|
444
512
|
}
|
|
445
513
|
|
|
514
|
+
this.#deliveries.shift();
|
|
515
|
+
await this.#deliverDelivery(delivery);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
#deliverDelivery(delivery: AsyncJobDelivery): Promise<void> {
|
|
520
|
+
const promise = (async () => {
|
|
521
|
+
this.#inFlightDeliveries.push(delivery);
|
|
446
522
|
try {
|
|
447
523
|
await this.#onJobComplete(delivery.jobId, delivery.text, this.#jobs.get(delivery.jobId));
|
|
448
|
-
this.#deliveries.shift();
|
|
449
524
|
} catch (error) {
|
|
450
525
|
delivery.attempt += 1;
|
|
451
526
|
delivery.lastError = error instanceof Error ? error.message : String(error);
|
|
452
527
|
delivery.nextAttemptAt = Date.now() + this.#getRetryDelay(delivery.attempt);
|
|
453
|
-
this.#deliveries.shift();
|
|
454
528
|
if (!this.isDeliverySuppressed(delivery.jobId)) {
|
|
455
529
|
this.#deliveries.push(delivery);
|
|
456
530
|
}
|
|
@@ -460,8 +534,32 @@ export class AsyncJobManager {
|
|
|
460
534
|
nextRetryAt: delivery.nextAttemptAt,
|
|
461
535
|
error: delivery.lastError,
|
|
462
536
|
});
|
|
537
|
+
} finally {
|
|
538
|
+
const index = this.#inFlightDeliveries.indexOf(delivery);
|
|
539
|
+
if (index !== -1) this.#inFlightDeliveries.splice(index, 1);
|
|
540
|
+
if (this.#deliveries.length > 0) this.#ensureDeliveryLoop();
|
|
463
541
|
}
|
|
542
|
+
})();
|
|
543
|
+
delivery.promise = promise;
|
|
544
|
+
return promise;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
async #waitForDeliveryPromise(promise: Promise<void> | undefined, deadline: number): Promise<boolean> {
|
|
548
|
+
if (!promise) return true;
|
|
549
|
+
if (deadline === Number.POSITIVE_INFINITY) {
|
|
550
|
+
await promise;
|
|
551
|
+
return true;
|
|
464
552
|
}
|
|
553
|
+
const remainingMs = deadline - Date.now();
|
|
554
|
+
if (remainingMs <= 0) return false;
|
|
555
|
+
let timedOut = false;
|
|
556
|
+
await Promise.race([
|
|
557
|
+
promise,
|
|
558
|
+
Bun.sleep(remainingMs).then(() => {
|
|
559
|
+
timedOut = true;
|
|
560
|
+
}),
|
|
561
|
+
]);
|
|
562
|
+
return !timedOut;
|
|
465
563
|
}
|
|
466
564
|
|
|
467
565
|
#getRetryDelay(attempt: number): number {
|
|
@@ -17,42 +17,20 @@ export const DEFAULT_HARNESS_COMMAND = `bash ${HARNESS_FILENAME}`;
|
|
|
17
17
|
const HARNESS_COMMIT_TITLE = "autoresearch: harness setup";
|
|
18
18
|
|
|
19
19
|
const initExperimentSchema = z.object({
|
|
20
|
-
name: z.string().describe("
|
|
21
|
-
goal: z.string().describe("
|
|
22
|
-
primary_metric: z
|
|
23
|
-
|
|
24
|
-
.describe(
|
|
25
|
-
"Primary metric name shown in the dashboard. Match the `METRIC <name>=<value>` lines printed by the benchmark.",
|
|
26
|
-
),
|
|
27
|
-
metric_unit: z.string().describe("Unit for the primary metric (e.g. ms, µs, mb). Empty when unitless.").optional(),
|
|
20
|
+
name: z.string().describe("experiment name"),
|
|
21
|
+
goal: z.string().describe("session goal").optional(),
|
|
22
|
+
primary_metric: z.string().describe("primary metric name"),
|
|
23
|
+
metric_unit: z.string().describe("metric unit (e.g. ms, µs, mb)").optional(),
|
|
28
24
|
direction: z
|
|
29
25
|
.enum(["lower", "higher"] as const)
|
|
30
|
-
.describe("
|
|
31
|
-
.optional(),
|
|
32
|
-
secondary_metrics: z
|
|
33
|
-
.array(z.string())
|
|
34
|
-
.describe("Names of secondary metrics tracked alongside the primary metric.")
|
|
35
|
-
.optional(),
|
|
36
|
-
scope_paths: z
|
|
37
|
-
.array(z.string())
|
|
38
|
-
.describe(
|
|
39
|
-
"Files or directories the agent expects to modify. Used post-hoc to flag scope deviations on log_experiment; never used to block edits.",
|
|
40
|
-
)
|
|
41
|
-
.optional(),
|
|
42
|
-
off_limits: z
|
|
43
|
-
.array(z.string())
|
|
44
|
-
.describe(
|
|
45
|
-
"Paths the agent SHOULD NOT modify. Used post-hoc to flag scope deviations on log_experiment; never used to block edits.",
|
|
46
|
-
)
|
|
47
|
-
.optional(),
|
|
48
|
-
constraints: z.array(z.string()).describe("Free-form constraints (e.g. 'no api break').").optional(),
|
|
49
|
-
max_iterations: z.number().describe("Soft cap on iterations per segment. Optional.").optional(),
|
|
50
|
-
new_segment: z
|
|
51
|
-
.boolean()
|
|
52
|
-
.describe(
|
|
53
|
-
"When true, bump to a new segment even when an active session exists. New baselines and best-metric reset.",
|
|
54
|
-
)
|
|
26
|
+
.describe("better direction (default lower)")
|
|
55
27
|
.optional(),
|
|
28
|
+
secondary_metrics: z.array(z.string()).describe("secondary metric names").optional(),
|
|
29
|
+
scope_paths: z.array(z.string()).describe("expected-to-modify paths").optional(),
|
|
30
|
+
off_limits: z.array(z.string()).describe("off-limits paths").optional(),
|
|
31
|
+
constraints: z.array(z.string()).describe("free-form constraints").optional(),
|
|
32
|
+
max_iterations: z.number().describe("soft iteration cap per segment").optional(),
|
|
33
|
+
new_segment: z.boolean().describe("bump to a new segment in existing session").optional(),
|
|
56
34
|
});
|
|
57
35
|
|
|
58
36
|
interface InitExperimentDetails {
|
|
@@ -37,35 +37,21 @@ import type {
|
|
|
37
37
|
const EXPERIMENT_TOOL_NAMES = ["init_experiment", "run_experiment", "log_experiment", "update_notes"];
|
|
38
38
|
|
|
39
39
|
const logExperimentSchema = z.object({
|
|
40
|
-
metric: z
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.object({})
|
|
48
|
-
.passthrough()
|
|
49
|
-
.describe("Free-form structured metadata captured for this run (hypothesis, learnings, etc.).")
|
|
50
|
-
.optional(),
|
|
51
|
-
commit: z
|
|
52
|
-
.string()
|
|
53
|
-
.describe("Override the commit hash recorded for this run. Defaults to the current HEAD.")
|
|
54
|
-
.optional(),
|
|
55
|
-
justification: z
|
|
56
|
-
.string()
|
|
57
|
-
.describe(
|
|
58
|
-
"Required when the run modifies paths outside scope or inside off-limits and you still want it kept. Free-form explanation.",
|
|
59
|
-
)
|
|
60
|
-
.optional(),
|
|
40
|
+
metric: z.number().describe("primary metric value"),
|
|
41
|
+
status: z.enum(["keep", "discard", "crash", "checks_failed"] as const).describe("run outcome"),
|
|
42
|
+
description: z.string().describe("short run description"),
|
|
43
|
+
metrics: z.record(z.string(), z.number()).describe("secondary metrics").optional(),
|
|
44
|
+
asi: z.object({}).passthrough().describe("free-form structured metadata").optional(),
|
|
45
|
+
commit: z.string().describe("override recorded commit hash").optional(),
|
|
46
|
+
justification: z.string().describe("required when keeping a scope-deviating run").optional(),
|
|
61
47
|
flag_runs: z
|
|
62
48
|
.array(
|
|
63
49
|
z.object({
|
|
64
|
-
run_id: z.number().describe("
|
|
65
|
-
reason: z.string().describe("
|
|
50
|
+
run_id: z.number().describe("run id to flag"),
|
|
51
|
+
reason: z.string().describe("why this run is suspect"),
|
|
66
52
|
}),
|
|
67
53
|
)
|
|
68
|
-
.describe("
|
|
54
|
+
.describe("flag earlier runs as suspect")
|
|
69
55
|
.optional(),
|
|
70
56
|
});
|
|
71
57
|
|
|
@@ -27,7 +27,7 @@ import type { AutoresearchToolFactoryOptions, RunDetails, RunExperimentProgressD
|
|
|
27
27
|
import { DEFAULT_HARNESS_COMMAND } from "./init-experiment";
|
|
28
28
|
|
|
29
29
|
const runExperimentSchema = z.object({
|
|
30
|
-
timeout_seconds: z.number().describe("
|
|
30
|
+
timeout_seconds: z.number().describe("timeout in seconds (default 600)").optional(),
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
interface ProcessExecutionResult {
|
|
@@ -9,15 +9,8 @@ import { openAutoresearchStorageIfExists } from "../storage";
|
|
|
9
9
|
import type { AutoresearchToolFactoryOptions } from "../types";
|
|
10
10
|
|
|
11
11
|
const updateNotesSchema = z.object({
|
|
12
|
-
body: z
|
|
13
|
-
|
|
14
|
-
.describe("Replacement markdown body for the active autoresearch session's notes (your durable playbook)."),
|
|
15
|
-
append_idea: z
|
|
16
|
-
.string()
|
|
17
|
-
.describe(
|
|
18
|
-
"When set, append this string as a new bullet under an Ideas section instead of replacing the body. `body` is ignored.",
|
|
19
|
-
)
|
|
20
|
-
.optional(),
|
|
12
|
+
body: z.string().describe("replacement notes body"),
|
|
13
|
+
append_idea: z.string().describe("append as bullet under Ideas instead of replacing body").optional(),
|
|
21
14
|
});
|
|
22
15
|
|
|
23
16
|
interface UpdateNotesDetails {
|