@ordewell/core 0.10.1 → 0.10.3
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/{IFileSystem-Bj6fy1cG.d.mts → IFileSystem-B8Nkgg4e.d.mts} +1 -1
- package/dist/{IFileSystem-BCJBHFwB.d.ts → IFileSystem-DCd-rkeH.d.ts} +1 -1
- package/dist/{IRunner-hWAJC4hg.d.mts → IRunner-CXdYyIZo.d.mts} +213 -202
- package/dist/{IRunner-C7_SSpzG.d.ts → IRunner-QBdYcatb.d.ts} +213 -202
- package/dist/{ModeResolver-m1d8Cb-j.d.mts → ModeResolver-BOU90Nn-.d.ts} +1 -1
- package/dist/{ModeResolver-u5ZhRC8x.d.ts → ModeResolver-geqjKkLY.d.mts} +1 -1
- package/dist/{Task-CxwnCJLi.d.mts → Task-CRVIqSfy.d.mts} +58 -11
- package/dist/{Task-CxwnCJLi.d.ts → Task-CRVIqSfy.d.ts} +58 -11
- package/dist/{chunk-DNFT4SQG.mjs → chunk-645FALZX.mjs} +5 -5
- package/dist/chunk-645FALZX.mjs.map +1 -0
- package/dist/{chunk-DJAPDO6E.mjs → chunk-A57ITQE7.mjs} +41 -21
- package/dist/chunk-A57ITQE7.mjs.map +1 -0
- package/dist/{chunk-CH5IGWFS.mjs → chunk-FH6M5QZG.mjs} +168 -122
- package/dist/chunk-FH6M5QZG.mjs.map +1 -0
- package/dist/{chunk-2IIRSBEQ.mjs → chunk-SM6BV6XS.mjs} +20 -4
- package/dist/chunk-SM6BV6XS.mjs.map +1 -0
- package/dist/index.d.mts +454 -63
- package/dist/index.d.ts +454 -63
- package/dist/index.js +19575 -18631
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17991 -17137
- package/dist/index.mjs.map +1 -1
- package/dist/parsing.d.mts +2 -2
- package/dist/parsing.d.ts +2 -2
- package/dist/parsing.js +15 -14
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +3 -3
- package/dist/{plan-utils-CKXdD1AD.d.mts → plan-utils-KU1Rse82.d.mts} +1322 -1146
- package/dist/{plan-utils-B6yJdpgi.d.ts → plan-utils-oC8bO4pN.d.ts} +1322 -1146
- package/dist/plan-utils.d.mts +4 -4
- package/dist/plan-utils.d.ts +4 -4
- package/dist/plan-utils.js +60 -0
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +11 -3
- package/dist/testing.d.mts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +3 -1
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +4 -2
- package/dist/testing.mjs.map +1 -1
- package/package.json +5 -1
- package/dist/chunk-2IIRSBEQ.mjs.map +0 -1
- package/dist/chunk-CH5IGWFS.mjs.map +0 -1
- package/dist/chunk-DJAPDO6E.mjs.map +0 -1
- package/dist/chunk-DNFT4SQG.mjs.map +0 -1
package/dist/parsing.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { R as RunnerModeInfo } from './ModeResolver-
|
|
1
|
+
import { a2 as RunnerId, af as Task } from './Task-CRVIqSfy.mjs';
|
|
2
|
+
import { R as RunnerModeInfo } from './ModeResolver-geqjKkLY.mjs';
|
|
3
3
|
|
|
4
4
|
declare function parsePlanJson(raw: string, runners: RunnerId[], runnerModes?: Record<RunnerId, RunnerModeInfo[]>, autonomousDefault?: boolean): Task[];
|
|
5
5
|
|
package/dist/parsing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { R as RunnerModeInfo } from './ModeResolver-
|
|
1
|
+
import { a2 as RunnerId, af as Task } from './Task-CRVIqSfy.js';
|
|
2
|
+
import { R as RunnerModeInfo } from './ModeResolver-BOU90Nn-.js';
|
|
3
3
|
|
|
4
4
|
declare function parsePlanJson(raw: string, runners: RunnerId[], runnerModes?: Record<RunnerId, RunnerModeInfo[]>, autonomousDefault?: boolean): Task[];
|
|
5
5
|
|
package/dist/parsing.js
CHANGED
|
@@ -57,7 +57,7 @@ function createTask(overrides = {}) {
|
|
|
57
57
|
outputSummary: overrides.outputSummary,
|
|
58
58
|
...overrides.attemptUsage ? { attemptUsage: structuredClone(overrides.attemptUsage) } : {},
|
|
59
59
|
assignedModel: overrides.assignedModel,
|
|
60
|
-
assignedRunner: overrides.assignedRunner ??
|
|
60
|
+
assignedRunner: overrides.assignedRunner ?? DEFAULT_RUNNERS[0],
|
|
61
61
|
taskMode: overrides.taskMode ?? "build",
|
|
62
62
|
autonomy: overrides.autonomy,
|
|
63
63
|
sliceType: overrides.sliceType,
|
|
@@ -83,6 +83,7 @@ function inheritedSkills(chosen, inherited) {
|
|
|
83
83
|
function opsFlag(value, type = "ai") {
|
|
84
84
|
return value === true && type === "ai" ? true : void 0;
|
|
85
85
|
}
|
|
86
|
+
var DEFAULT_RUNNERS = ["claude-code"];
|
|
86
87
|
function flattenTasksWithParents(tasks) {
|
|
87
88
|
const rows = [];
|
|
88
89
|
const walk = (t, parent, parentLabel) => {
|
|
@@ -273,7 +274,7 @@ function plannedMode(runner, runnerModes, { readOnly, current }, autonomousDefau
|
|
|
273
274
|
const reason2 = unavailableModeReason(modes, taggedReadOnlyMode(modes));
|
|
274
275
|
return {
|
|
275
276
|
ok: false,
|
|
276
|
-
error: `Runner "${runner}" has no read-only mode${reason2 ? " available on this host" : ""}
|
|
277
|
+
error: `Runner "${runner}" has no read-only mode${reason2 ? " available on this host" : ""}: assign a read-only task to ${able.length > 0 ? `one of: ${able.join(", ")}` : "no runner: none of the enabled runners has one"}, or drop "readOnly"${reason2 ? `. ${reason2}` : ""}`
|
|
277
278
|
};
|
|
278
279
|
}
|
|
279
280
|
const keep = current !== void 0 && modes.some((m) => m.id === current) && !(readOnly === false && current === taggedReadOnlyMode(modes));
|
|
@@ -319,7 +320,7 @@ function checkModelAndModeValidity(runner, assignedModel, taskMode, catalog) {
|
|
|
319
320
|
if (taskMode !== void 0) {
|
|
320
321
|
const modes = catalog.runnerModes[runner];
|
|
321
322
|
if (modes && modes.length > 0 && !modes.some((m) => m.id === taskMode)) {
|
|
322
|
-
return { ok: false, error: `Runner "${runner}" has no task mode "${taskMode}"
|
|
323
|
+
return { ok: false, error: `Runner "${runner}" has no task mode "${taskMode}": valid modes: ${modes.map((m) => m.id).join(", ")}` };
|
|
323
324
|
}
|
|
324
325
|
const unavailable = unavailableModeReason(modes, taskMode);
|
|
325
326
|
if (unavailable) return { ok: false, error: `Mode "${taskMode}" of runner "${runner}" is unavailable on this host: ${unavailable}` };
|
|
@@ -328,9 +329,9 @@ function checkModelAndModeValidity(runner, assignedModel, taskMode, catalog) {
|
|
|
328
329
|
}
|
|
329
330
|
|
|
330
331
|
// src/services/PlannedTask.ts
|
|
331
|
-
var MODE_NOT_THE_PLANNERS = `"taskMode" is the user's to choose
|
|
332
|
-
var MANUAL_NOT_READ_ONLY = '"readOnly" is for AI tasks
|
|
333
|
-
var OPS_NOT_READ_ONLY = `"readOnly" is not for an ops task
|
|
332
|
+
var MODE_NOT_THE_PLANNERS = `"taskMode" is the user's to choose: set "readOnly": true on a task that must not change files, and leave it out otherwise`;
|
|
333
|
+
var MANUAL_NOT_READ_ONLY = '"readOnly" is for AI tasks: a manual task runs in no mode';
|
|
334
|
+
var OPS_NOT_READ_ONLY = `"readOnly" is not for an ops task: it runs commands, in the session's mode, and a read-only mode refuses them`;
|
|
334
335
|
function isRecord(value) {
|
|
335
336
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
336
337
|
}
|
|
@@ -338,8 +339,8 @@ function text(value) {
|
|
|
338
339
|
return typeof value === "string" || typeof value === "number" ? String(value) : void 0;
|
|
339
340
|
}
|
|
340
341
|
function opsPlacementRefusal(type, isSubtask) {
|
|
341
|
-
if (type !== "ai") return "is a manual task
|
|
342
|
-
if (isSubtask) return "is a subtask, which runs with its parent
|
|
342
|
+
if (type !== "ai") return "is a manual task: only an AI task can be an ops task";
|
|
343
|
+
if (isSubtask) return "is a subtask, which runs with its parent: only a top-level task can be an ops task";
|
|
343
344
|
return null;
|
|
344
345
|
}
|
|
345
346
|
function taskWhere(title, parentTitle) {
|
|
@@ -360,7 +361,7 @@ function modelOf(raw, from) {
|
|
|
360
361
|
}
|
|
361
362
|
function plannedTask(spec, catalog, at = {}) {
|
|
362
363
|
const raw = isRecord(spec) ? spec : {};
|
|
363
|
-
const { parent, from, freshIds } = at;
|
|
364
|
+
const { parent, from, freshIds, newId = import_uuid2.v4 } = at;
|
|
364
365
|
const base = from?.fields ?? {};
|
|
365
366
|
const errors = [];
|
|
366
367
|
const ignored = [];
|
|
@@ -368,11 +369,11 @@ function plannedTask(spec, catalog, at = {}) {
|
|
|
368
369
|
const title = text(raw.title) ?? "";
|
|
369
370
|
const where = taskWhere(title, parent?.title);
|
|
370
371
|
const plannerId = text(raw.id);
|
|
371
|
-
const id = freshIds || !plannerId ? (
|
|
372
|
+
const id = freshIds || !plannerId ? newId() : plannerId;
|
|
372
373
|
if (freshIds && plannerId) renamed.set(plannerId, id);
|
|
373
374
|
const type = raw.type === "user" || raw.type === "ai" ? raw.type : base.type ?? "ai";
|
|
374
375
|
const ai = type === "ai";
|
|
375
|
-
const assignedRunner = text(raw.assignedRunner) ?? base.assignedRunner ?? catalog.runners[0] ??
|
|
376
|
+
const assignedRunner = text(raw.assignedRunner) ?? base.assignedRunner ?? catalog.runners[0] ?? DEFAULT_RUNNERS[0];
|
|
376
377
|
const description = text(raw.description) ?? base.description ?? title;
|
|
377
378
|
if (raw.ops === true && !ai) errors.push({ taskId: id, field: "ops", message: `${where} ${opsPlacementRefusal(type, !!parent)}` });
|
|
378
379
|
if (raw.taskMode !== void 0) ignored.push({ taskId: id, field: "taskMode", message: `${where}: ${MODE_NOT_THE_PLANNERS}` });
|
|
@@ -399,7 +400,7 @@ function plannedTask(spec, catalog, at = {}) {
|
|
|
399
400
|
const subtasks = [];
|
|
400
401
|
if (Array.isArray(raw.subtasks)) {
|
|
401
402
|
for (const s of raw.subtasks) {
|
|
402
|
-
const child = plannedTask(s, catalog, { parent: { title, sliceType, autonomy, readOnly }, freshIds });
|
|
403
|
+
const child = plannedTask(s, catalog, { parent: { title, sliceType, autonomy, readOnly }, freshIds, newId });
|
|
403
404
|
subtasks.push(child.task);
|
|
404
405
|
errors.push(...child.errors);
|
|
405
406
|
ignored.push(...child.ignored);
|
|
@@ -498,7 +499,7 @@ function parsePlanJson(raw, runners, runnerModes, autonomousDefault = true) {
|
|
|
498
499
|
}
|
|
499
500
|
if (matches.length === 0 && sawUnbalanced) {
|
|
500
501
|
throw new PlanParseError(
|
|
501
|
-
"Plan response appears truncated
|
|
502
|
+
"Plan response appears truncated: the model likely hit its output length limit before finishing the JSON.",
|
|
502
503
|
raw,
|
|
503
504
|
{ truncated: true }
|
|
504
505
|
);
|
|
@@ -538,7 +539,7 @@ function validatePlanTasks(obj, runners, runnerModes, autonomousDefault = true)
|
|
|
538
539
|
const ignored = planned.flatMap((p) => p.ignored);
|
|
539
540
|
const warnings = [
|
|
540
541
|
...ignored.some((i) => i.field === "taskMode") ? [`"taskMode" is not yours to set and was ignored: each task runs in its runner's mode for the user's autonomy level, or its read-only mode when you set "readOnly": true.`] : [],
|
|
541
|
-
...ignored.filter((i) => i.field === "readOnly").map((i) => `${i.message}
|
|
542
|
+
...ignored.filter((i) => i.field === "readOnly").map((i) => `${i.message}: it was ignored.`)
|
|
542
543
|
];
|
|
543
544
|
return warnings.length > 0 ? { ok: true, tasks, warnings } : { ok: true, tasks };
|
|
544
545
|
}
|