@sabaiway/agent-workflow-kit 23.12.0 → 24.0.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 +58 -0
- package/README.md +4 -4
- package/SKILL.md +1 -1
- package/bridges/codex-cli-bridge/SKILL.md +7 -2
- package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +11 -6
- package/bridges/codex-cli-bridge/bin/codex-exec.sh +72 -33
- package/bridges/codex-cli-bridge/bin/codex-exec.test.mjs +111 -3
- package/bridges/codex-cli-bridge/bin/codex-fixtures-harness.test.mjs +16 -1
- package/bridges/codex-cli-bridge/bin/codex-model-posture.test.mjs +5 -3
- package/bridges/codex-cli-bridge/bin/codex-review.sh +1 -1
- package/bridges/codex-cli-bridge/capability.json +2 -2
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/advisor-writers.md +2 -0
- package/references/agents/author.md +21 -0
- package/references/agents/executor.md +12 -6
- package/references/contracts.md +4 -4
- package/references/hooks/gate-approve.mjs +7 -8
- package/references/hooks/stage-write-guard.mjs +314 -0
- package/references/modes/agents.md +6 -4
- package/references/modes/bootstrap.md +1 -1
- package/references/modes/flow-writer.md +10 -2
- package/references/modes/hook.md +4 -1
- package/references/modes/now.md +1 -1
- package/references/modes/procedures.md +49 -10
- package/references/modes/recipes.md +7 -7
- package/references/modes/recommendations.md +4 -3
- package/references/modes/robustness-brief.md +9 -8
- package/references/modes/set-recipe.md +1 -1
- package/references/modes/state-block-guard.md +4 -3
- package/references/modes/status.md +1 -1
- package/references/modes/upgrade.md +1 -1
- package/references/modes/worktrees.md +28 -5
- package/references/rules/story-sessions.md +2 -2
- package/references/scripts/archives/archive-caps.mjs +1 -1
- package/references/scripts/archives/archive-changelog.mjs +8 -8
- package/references/scripts/archives/archive-decisions.mjs +7 -7
- package/references/scripts/archives/archive-issues.mjs +5 -5
- package/references/scripts/archives/rotation-conservation.mjs +2 -1
- package/references/scripts/docs-size/check-docs-size.mjs +15 -15
- package/references/scripts/family.json +2 -0
- package/references/scripts/gates/kit-command-gates.mjs +7 -8
- package/references/scripts/gates/migrate-gates.mjs +10 -10
- package/references/scripts/git-hooks/install-git-hooks.mjs +13 -13
- package/references/scripts/run.mjs +1 -2
- package/references/scripts/shared/index.mjs +2 -0
- package/references/scripts/shared/locations.mjs +103 -0
- package/references/scripts/spec-schema/spec-schema.mjs +2 -1
- package/references/templates/orchestration.json +1 -1
- package/tools/ack-store.mjs +2 -1
- package/tools/apply-danger-check.mjs +20 -6
- package/tools/atomic-write.mjs +3 -2
- package/tools/attribution.mjs +2 -1
- package/tools/autonomy-config.mjs +2 -1
- package/tools/bridge-wiring.mjs +13 -11
- package/tools/carriers.mjs +54 -14
- package/tools/cheap-agents-read.mjs +28 -7
- package/tools/cheap-agents.mjs +15 -10
- package/tools/checker-gates-read.mjs +6 -5
- package/tools/commands.mjs +2 -2
- package/tools/coverage-declared/config.mjs +2 -1
- package/tools/coverage-producer.mjs +10 -9
- package/tools/delegation.mjs +7 -6
- package/tools/detect-backends.mjs +1 -1
- package/tools/dispatch-baseline.mjs +2 -1
- package/tools/distribution-files/scripts.mjs +4 -4
- package/tools/ensure-configs.mjs +2 -2
- package/tools/ensure-ops.mjs +24 -24
- package/tools/ensure-specs.mjs +7 -7
- package/tools/epic-shape-cli.mjs +2 -2
- package/tools/epic-shape-ledger.mjs +5 -5
- package/tools/epic-shape.mjs +5 -3
- package/tools/epic-store.mjs +2 -1
- package/tools/family-members.mjs +7 -5
- package/tools/family-registry.mjs +36 -30
- package/tools/feedback-record-cli.mjs +4 -5
- package/tools/flow-writer.mjs +26 -15
- package/tools/gate-hook.mjs +33 -28
- package/tools/gates-declaration.mjs +2 -1
- package/tools/gates-init.mjs +6 -5
- package/tools/git-hooks.mjs +64 -41
- package/tools/grounding.mjs +3 -2
- package/tools/hide-footprint.mjs +2 -1
- package/tools/hook-writer/index.mjs +147 -0
- package/tools/init-preflight.mjs +5 -4
- package/tools/init-project.mjs +12 -11
- package/tools/inject-methodology.mjs +3 -2
- package/tools/jev-guide.mjs +2 -2
- package/tools/known-footprint.mjs +27 -25
- package/tools/mcp-registration.mjs +6 -5
- package/tools/migration-blocks.mjs +2 -1
- package/tools/migration-notes.mjs +2 -2
- package/tools/node-evidence.mjs +4 -4
- package/tools/now-facts.mjs +5 -5
- package/tools/now-status.mjs +1 -5
- package/tools/orchestration-config.mjs +2 -1
- package/tools/orchestration-readme.mjs +7 -2
- package/tools/plan-approval/cli.mjs +45 -0
- package/tools/plan-approval/entries.mjs +109 -0
- package/tools/plan-approval/index.mjs +2 -0
- package/tools/plan-approval/record.mjs +198 -0
- package/tools/plan-files.mjs +6 -4
- package/tools/plan-shape-cli.mjs +10 -64
- package/tools/plan-shape-facts.mjs +240 -83
- package/tools/plan-shape.mjs +173 -160
- package/tools/plan-structure/cli.mjs +79 -0
- package/tools/plan-structure/index.mjs +67 -0
- package/tools/procedures.mjs +21 -17
- package/tools/profile-gaps.mjs +4 -6
- package/tools/project-rules/rules-priors.mjs +2 -0
- package/tools/project-rules/themes.mjs +6 -4
- package/tools/recipes.mjs +44 -29
- package/tools/recommendations.mjs +84 -33
- package/tools/reference-profile.mjs +2 -2
- package/tools/renderers.mjs +14 -8
- package/tools/repo-lex.mjs +84 -0
- package/tools/robustness-brief.mjs +14 -11
- package/tools/satellite-locator.mjs +3 -2
- package/tools/script-priors.mjs +3 -2
- package/tools/session-close-check.mjs +71 -15
- package/tools/set-flow.mjs +2 -2
- package/tools/set-recipe.mjs +17 -9
- package/tools/source-size/help.mjs +4 -4
- package/tools/source-size/layout.mjs +2 -1
- package/tools/source-size/piles.mjs +2 -2
- package/tools/source-size-config.mjs +3 -3
- package/tools/source-size-refusal.mjs +4 -3
- package/tools/source-size-report.mjs +41 -13
- package/tools/spec-check-cli.mjs +159 -21
- package/tools/spec-check-ops.mjs +74 -5
- package/tools/spec-check.mjs +54 -45
- package/tools/spec-coverage-cli.mjs +3 -2
- package/tools/stage-render/cli.mjs +231 -0
- package/tools/stage-render/index.mjs +340 -0
- package/tools/stage-render/stages.json +115 -0
- package/tools/stage-write-guard/cli.mjs +64 -0
- package/tools/stage-write-guard/index.mjs +56 -0
- package/tools/state-block-hook.mjs +38 -163
- package/tools/task-brief.mjs +8 -13
- package/tools/task-thread.mjs +3 -1
- package/tools/tier-guide-facts.mjs +23 -9
- package/tools/tier-preview.mjs +15 -19
- package/tools/transition/index.mjs +10 -9
- package/tools/uninstall.mjs +26 -12
- package/tools/vehicle-settings.mjs +2 -1
- package/tools/velocity-profile.mjs +5 -6
- package/tools/view-model.mjs +7 -4
- package/tools/worktree-prompt.mjs +7 -3
- package/tools/worktrees.mjs +235 -159
- package/tools/write-lanes.mjs +20 -14
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
|
+
import { SPEC_SCHEMA } from '../../references/scripts/spec-schema/index.mjs';
|
|
3
|
+
import { PLANS_REL } from '../plan-files.mjs';
|
|
4
|
+
import { parseRobustTag } from '../robustness-literals.mjs';
|
|
5
|
+
import { getRevisionHomePath, SPEC_OPS_GRAMMAR } from '../spec-check-ops.mjs';
|
|
6
|
+
|
|
7
|
+
export const AMENDMENT_LINE = 'amendments:';
|
|
8
|
+
|
|
9
|
+
const AMENDMENT_LINE_CODE = 'amendment-line';
|
|
10
|
+
const AMENDMENT_PATH_CODE = 'amendment-path';
|
|
11
|
+
const ROBUST_CLASS_CODE = 'robust-class';
|
|
12
|
+
const AMENDMENT_LINE_MESSAGE = `use one ${AMENDMENT_LINE} line between approved rows and amendment entries`;
|
|
13
|
+
const AMENDMENT_PATH_MESSAGE = 'must name a literal path outside the spec store and revision homes';
|
|
14
|
+
const ROBUST_TAG_LABEL = 'robust tag:';
|
|
15
|
+
const ASCII_UPPERCASE = /[A-Z]/g;
|
|
16
|
+
const PLANS_PREFIX = `${PLANS_REL}${posix.sep}`;
|
|
17
|
+
const STORE_ROOT = SPEC_SCHEMA.storePrefix.slice(0, -posix.sep.length);
|
|
18
|
+
const REVISION_HOME_SUFFIX = getRevisionHomePath(SPEC_OPS_GRAMMAR.suffix);
|
|
19
|
+
|
|
20
|
+
const refusesAmendmentPath = (path, isSweep) => {
|
|
21
|
+
if (isSweep(path)) return true;
|
|
22
|
+
const foldedPath = path.replace(ASCII_UPPERCASE, (letter) => letter.toLowerCase());
|
|
23
|
+
if (foldedPath === STORE_ROOT || foldedPath.startsWith(SPEC_SCHEMA.storePrefix)) return true;
|
|
24
|
+
if (!foldedPath.startsWith(PLANS_PREFIX)) return false;
|
|
25
|
+
const [home] = foldedPath.slice(PLANS_PREFIX.length).split(posix.sep);
|
|
26
|
+
return home.length > REVISION_HOME_SUFFIX.length && home.endsWith(REVISION_HOME_SUFFIX);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const relateAmendments = ({ parsed, makeFinding, isSweep }) => {
|
|
30
|
+
const separators = parsed.entries.filter(({ raw }) => raw === AMENDMENT_LINE);
|
|
31
|
+
const [separator, extraSeparator] = separators;
|
|
32
|
+
const unsplit = { approved: parsed.rows, entries: [], amendmentLines: [], findings: [] };
|
|
33
|
+
if (!separator) return unsplit;
|
|
34
|
+
|
|
35
|
+
const approved = parsed.rows.filter(({ line }) => line < separator.line);
|
|
36
|
+
const entries = parsed.rows.filter(({ line }) => line > separator.line);
|
|
37
|
+
if (extraSeparator || !approved.length || !entries.length) {
|
|
38
|
+
return {
|
|
39
|
+
...unsplit,
|
|
40
|
+
findings: separators.map(({ line }) => makeFinding(line, AMENDMENT_LINE_CODE, AMENDMENT_LINE_MESSAGE, null)),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const amendmentLines = parsed.entries.filter(({ line }) => line >= separator.line)
|
|
45
|
+
.map(({ line }) => line);
|
|
46
|
+
const refusedEntries = entries.filter(({ path }) => path && refusesAmendmentPath(path, isSweep));
|
|
47
|
+
const findings = refusedEntries.map(({ line, id }) =>
|
|
48
|
+
makeFinding(line, AMENDMENT_PATH_CODE, `${id} ${AMENDMENT_PATH_MESSAGE}`, id));
|
|
49
|
+
return { approved, entries, amendmentLines, findings };
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const describeRobustRefusal = (refusal) => `tag grammar refused ${refusal}`;
|
|
53
|
+
const describeUnknownRobustClass = (classId) => `class ${classId} is not in the shipped list`;
|
|
54
|
+
|
|
55
|
+
export const checkRobustTags = ({ rows, facts, makeFinding }) => {
|
|
56
|
+
const taggedRows = rows.map((row) => ({ row, tag: parseRobustTag(row.responsibility) }))
|
|
57
|
+
.filter(({ tag }) => tag.refusal || tag.classes?.length);
|
|
58
|
+
if (!taggedRows.length) return [];
|
|
59
|
+
|
|
60
|
+
const robustClasses = new Set(facts.robustClasses ?? []);
|
|
61
|
+
return taggedRows.flatMap(({ row, tag }) => {
|
|
62
|
+
const unknownClass = tag.classes?.find((classId) => !robustClasses.has(classId));
|
|
63
|
+
if (!tag.refusal && unknownClass === undefined) return [];
|
|
64
|
+
const reason = tag.refusal ? describeRobustRefusal(tag.refusal) : describeUnknownRobustClass(unknownClass);
|
|
65
|
+
return [makeFinding(row.line, ROBUST_CLASS_CODE, `${row.id} ${ROBUST_TAG_LABEL} ${reason}`, row.id)];
|
|
66
|
+
});
|
|
67
|
+
};
|
package/tools/procedures.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// It composes the AD-018 orchestration recipes into NAMED activities: it reads the canonical procedure
|
|
5
5
|
// steps LIVE from the installed agent-workflow-engine (references/procedures.md — AD-016 live read, no
|
|
6
6
|
// bundled mirror), reads the per-project, hand-edited config (docs/ai/orchestration.json), composes the
|
|
7
|
-
// readiness every caller composes (detected backends + the executor
|
|
7
|
+
// readiness every caller composes (detected backends + the executor and author vehicles), and prints the activity's
|
|
8
8
|
// steps VERBATIM + the resolved effective recipe per slot, plus the project's DECLARED source-size
|
|
9
9
|
// practice when it declares one (D-17 U1).
|
|
10
10
|
//
|
|
@@ -21,6 +21,7 @@ import { readFileSync, lstatSync } from 'node:fs';
|
|
|
21
21
|
import { homedir } from 'node:os';
|
|
22
22
|
import { join, dirname } from 'node:path';
|
|
23
23
|
import { fileURLToPath } from 'node:url';
|
|
24
|
+
import { QUEUE } from '../references/scripts/shared/index.mjs';
|
|
24
25
|
import { detectBackends, wrapperCmdFor, wrapperContractFor } from './detect-backends.mjs';
|
|
25
26
|
import { surveyVehicle as surveyReviewVehicle } from './cheap-agents-read.mjs';
|
|
26
27
|
import { isReadyMember, skippedLine } from './review-roster-resolve.mjs';
|
|
@@ -30,7 +31,7 @@ import { loadRegistry, allowedLabel } from './bridge-settings-read.mjs';
|
|
|
30
31
|
import { isDirectRun } from './direct-run.mjs';
|
|
31
32
|
import { ACTIVITIES, SLOT_RECIPES, isSwitchSlot, resolveActivityRecipe, planRecipe, composeReadiness } from './recipes.mjs';
|
|
32
33
|
// The dispatch-form wording, from the pure (fs-free) leaf that owns it: composed here, never re-worded.
|
|
33
|
-
import { dispatchForm, parallelLine } from './carriers.mjs';
|
|
34
|
+
import { AUTHOR_ROLE, slotRole, dispatchForm, parallelLine } from './carriers.mjs';
|
|
34
35
|
import { resolveEngineDir, readEngineFragment, PROCEDURES_FRAGMENT_REL } from './engine-source.mjs';
|
|
35
36
|
// The plan-in-flight detector (AD-038) — imported from the plan-files.mjs LEAF (read-only fs by
|
|
36
37
|
// construction); the WRITER-capable grounding.mjs is only NAMED in rendered text, never imported.
|
|
@@ -170,7 +171,8 @@ const resolveAllSlots = ({ activity, config, detection, overrides, surveyLens })
|
|
|
170
171
|
// planRecipe's drift-guarded dispatch for WHICH backends, then resolve each (backend, role) to its
|
|
171
172
|
// manifest wrapper cmd via the bridge registry — no wrapper name is hand-composed here. A vehicle
|
|
172
173
|
// step is NOT a bridge: it carries its own state and is never looked up in a manifest.
|
|
173
|
-
const
|
|
174
|
+
const role = slotRole(activity, slot);
|
|
175
|
+
const { dispatch } = resolved.roster ? { dispatch: [] } : planRecipe(resolved.recipe, detection, role);
|
|
174
176
|
const vehicles = dispatch.filter((d) => d.vehicle != null).map((d) => ({ backend: d.backend, state: d.vehicle }));
|
|
175
177
|
const bridged = dispatch.filter((d) => d.vehicle == null);
|
|
176
178
|
const backends = bridged.map((d) => wrapperCmdFor(d.backend, d.role)).filter(Boolean);
|
|
@@ -352,10 +354,10 @@ const renderToolPath = (abs) => (isSeedablePathToken(abs) ? abs : shellQuoteArg(
|
|
|
352
354
|
const readersSweepAdvice = (activity, registered, toolPath = REPO_SEARCH_TOOL) => {
|
|
353
355
|
if (activity !== 'plan-authoring') return [];
|
|
354
356
|
return [
|
|
355
|
-
'Readers sweep (before the first review) — for every changed config key, registry entry, exported constant, receipt field or canon sentence:',
|
|
357
|
+
'Readers sweep (before the first review) — for every changed config key, registry entry, exported constant, receipt field or canon sentence, search by name and by value:',
|
|
356
358
|
...(registered ? [' use: repo_search {"pattern": "<the literal>"} — the kit\'s read-only MCP tool (registration complete; if it is not loaded in this session, the command below)'] : []),
|
|
357
359
|
` run: node ${renderToolPath(toolPath)} --pattern <the literal> (a pattern carrying a shell-significant byte goes through --pattern-file <f> instead)`,
|
|
358
|
-
' classify every reader as a ledger row, a stated non-goal, or unchanged with its proof',
|
|
360
|
+
' classify every reader the search instrument lists as a ledger row, a stated non-goal, or unchanged with its proof',
|
|
359
361
|
];
|
|
360
362
|
};
|
|
361
363
|
|
|
@@ -426,7 +428,7 @@ export const FOLD_SCOPE_TOOL = join(dirname(fileURLToPath(import.meta.url)), 'fo
|
|
|
426
428
|
const foldScopeAdvice = (activity, config, plans) => {
|
|
427
429
|
if (activity !== 'plan-execution') return [];
|
|
428
430
|
const declared = config?.flow?.debtQueue ?? null;
|
|
429
|
-
const queue = declared ??
|
|
431
|
+
const queue = declared ?? QUEUE;
|
|
430
432
|
const plan = plans.length === 1 ? `${PLANS_REL}/${plans[0]}` : '<plan-file>';
|
|
431
433
|
return [
|
|
432
434
|
'Finding scope (procedures.md plan-execution step 5) — the rule is the section above; this is the checker it names:',
|
|
@@ -479,7 +481,7 @@ const costLanesAdvice = () => [
|
|
|
479
481
|
' • Sandbox lanes (under an OS sandbox): the L0 surfaces are sandbox-safe — gates/ledger/state/fold checks, git reads, plain no-network tests; the bridge wrappers are genuinely unsandboxed (network); npm-cache-touching commands are COMMAND-SHAPE dependent — first try the sandbox-safe shape (cache under $TMPDIR, offline/notifier off). Move ONLY the failing command out of the sandbox, never its class; BATCH consecutive unsandboxed calls. Pre-dispatch host-diff: before the FIRST dispatch of each bridge, diff the hosts of the services its manifest names against the live sandbox allow-list — a missing host is surfaced to the maintainer BEFORE dispatching, never fired into a known prompt. Nested-sandbox honesty: a backend CLI shipping its OWN OS sandbox cannot run nested inside a harness sandbox — route it outside (excludedCommands / a per-run consented bypass) on the OBSERVED failure, never a preemptive blanket.',
|
|
480
482
|
' • Prompt economy (autonomy-preserving dispatch): read-only fan-out (research/sweeps/extraction) runs ONLY on restricted-tool vehicles — a full-tool subagent for read-only work is a forbidden lane downgrade (invisible prompt-flood + blast radius), and a subagent is never told to shell out for facts obtainable read-only; the orchestrator\'s own shell form is ONE plain pipeline per call (a ;/&& chain or env-prefixed invocation never matches a prefix allow rule); a fan-out LAUNCHER that gates per call yields to the agent-spawn lane. Capability-gated: on a host with restricted-tool subagent vehicles use them; without restricted-tool vehicles (a host offering only full-tool agents included), read-only research stays in the orchestrator\'s own context — never a vehicle mandate a host cannot satisfy.',
|
|
481
483
|
' • Writer economy (autonomy-preserving dispatch): a stage\'s repeated WRITER commands batch into ONE invocation — combine a stage\'s writers via one batched write or one launcher per stage; never one writer call at a time (each write is its own prompt).',
|
|
482
|
-
' • The prompt-economy clause narrows TOOLS for read-only work
|
|
484
|
+
' • The prompt-economy clause narrows TOOLS for read-only work and authoring — judgment, code, synthesis stay at the frontier lane; a task that needs to run commands keeps a full-tool subagent; an authoring slice rides the no-shell author vehicle. Honest limit: no deterministic gate classifies a dispatch — enforcement is the canon at the point of use + the placed vehicles + the retro loop.',
|
|
483
485
|
];
|
|
484
486
|
|
|
485
487
|
// ── the flow armed-halves block (P8 — design §5 read side) ─────────────────────────
|
|
@@ -532,9 +534,7 @@ const flowHalvesAdvice = (flow, probe) => {
|
|
|
532
534
|
};
|
|
533
535
|
|
|
534
536
|
// ── the declared source-size practice (D-17 U1) ────────────────────────────────────
|
|
535
|
-
//
|
|
536
|
-
// their reason ride EVERY named-activity render, so the plan's Module ledger is cut to them while the
|
|
537
|
-
// plan is being written. Composed from the project's live declaration, never from constants here.
|
|
537
|
+
// The caps and their reason come from the live declaration for every named activity.
|
|
538
538
|
// Each config state speaks as itself: ABSENT renders NOTHING (a project that declares no practice must
|
|
539
539
|
// not be handed invented limits); AUTHORED renders the declared caps plus the honest "no file size is
|
|
540
540
|
// recorded yet" line; MINTED renders the recorded count too.
|
|
@@ -542,7 +542,7 @@ const flowHalvesAdvice = (flow, probe) => {
|
|
|
542
542
|
// still completes: the exit code for a broken source-size config belongs to the practice's own checker,
|
|
543
543
|
// while THIS tool's exit contract is about its own config and the engine.
|
|
544
544
|
|
|
545
|
-
export const DECLARED_PRACTICE_HEADER = `Declared source-size practice (${SOURCE_SIZE_CONFIG_REL})
|
|
545
|
+
export const DECLARED_PRACTICE_HEADER = `Declared source-size practice (${SOURCE_SIZE_CONFIG_REL}):`;
|
|
546
546
|
|
|
547
547
|
const declaredPracticeAdvice = (cwd, readFile, lstat) => {
|
|
548
548
|
let declaration;
|
|
@@ -567,7 +567,7 @@ const declaredPracticeAdvice = (cwd, readFile, lstat) => {
|
|
|
567
567
|
: ' layout: not recorded — `source-size-check.mjs --write-baseline --layout --reason "<text>"` starts it.',
|
|
568
568
|
...(config.schema === 1 ? [' schema 1: the check stops on it — `source-size-check.mjs --write-baseline` moves it off schema 1.'] : []),
|
|
569
569
|
declaration.state === 'minted'
|
|
570
|
-
? ` recorded: ${facts.recordedFiles} file(s) carry a recorded size
|
|
570
|
+
? ` recorded: ${facts.recordedFiles} file(s) carry a recorded size, each an exception with its reason — growth the regeneration would raise stops and takes a reason, asking again whether the code rules were kept, and a record above the tree warns until the regeneration lowers it.`
|
|
571
571
|
: unmintedRecord,
|
|
572
572
|
` why: ${SOURCE_SIZE_WHY}`,
|
|
573
573
|
];
|
|
@@ -611,7 +611,7 @@ const contractLines = ({ cmd, contract, settings }) => {
|
|
|
611
611
|
|
|
612
612
|
// The fold lane under a delegated execute slot (this activity's, or task.execute under plan-execution):
|
|
613
613
|
// one line resuming the run's session, its id read from the run's exec receipt — no ledger is read.
|
|
614
|
-
const FOLD_LANE_LINE = `Fold lane (execute = delegated) — a fold of code a bridge wrote resumes that run's session: ${wrapperCmdFor('codex-cli-bridge', 'execute')} --resume <session id> --nonce <n> <prompt file>, the session id read from the sessionId of the run's exec receipt, with a new prompt and a fresh nonce; the orchestrator may make the fold itself.`;
|
|
614
|
+
const FOLD_LANE_LINE = `Fold lane (execute = delegated) — a fold of code a bridge wrote resumes that run's session: ${wrapperCmdFor('codex-cli-bridge', 'execute')} --resume <session id> --nonce <n> <prompt file>, the session id read from the sessionId of the run's exec receipt, with a new prompt carrying the aw-plan-approval block and a fresh nonce; the orchestrator may make the fold itself.`;
|
|
615
615
|
const foldLaneAdvice = ({ activity, slots, config, detection }) => {
|
|
616
616
|
const own = slots.find((slot) => slot.slot === 'execute')?.recipe;
|
|
617
617
|
const task = activity === 'plan-execution' ? resolveActivityRecipe({ config: config ?? {}, readiness: detection, activity: 'task', slot: 'execute' }).recipe : null;
|
|
@@ -623,7 +623,7 @@ const formatHuman = ({ activity, section, slots, warnings, plans, autonomy, flow
|
|
|
623
623
|
const lines = [
|
|
624
624
|
section,
|
|
625
625
|
'',
|
|
626
|
-
`resolved recipes for "${activity}" (read-only — the orchestrator runs the recipe via the bridge skills or the
|
|
626
|
+
`resolved recipes for "${activity}" (read-only — the orchestrator runs the recipe via the bridge skills, the executor vehicle for carry or the author vehicle for author, and owns any commit; every other carrier never commits):`,
|
|
627
627
|
];
|
|
628
628
|
const carrier = effectiveCarrier(slots);
|
|
629
629
|
for (const s of slots) {
|
|
@@ -671,6 +671,9 @@ const buildJson = ({ activity, section, slots, configSource, warnings, plans, au
|
|
|
671
671
|
slots.map((s) => [s.slot, {
|
|
672
672
|
recipe: s.recipe, source: s.source, degradedFrom: s.degradedFrom, reason: s.reason, backends: s.backends, contracts: s.contracts,
|
|
673
673
|
...(s.roster ? { roster: s.roster } : {}),
|
|
674
|
+
...(slotRole(activity, s.slot) === AUTHOR_ROLE && s.vehicles.length
|
|
675
|
+
? { dispatchForm: s.vehicles.flatMap((v) => dispatchForm({ activity, slot: s.slot, state: v.state })) }
|
|
676
|
+
: {}),
|
|
674
677
|
}]),
|
|
675
678
|
),
|
|
676
679
|
reviewLoop: reviewLoopAdvice(slots, activity, flowArmed),
|
|
@@ -709,13 +712,13 @@ Accepted values: ${Object.entries(SLOT_RECIPES).map(([type, values]) => `${type}
|
|
|
709
712
|
|
|
710
713
|
Reads the activity's procedure steps LIVE from the installed agent-workflow-engine
|
|
711
714
|
(references/procedures.md), resolves the effective recipe per slot from
|
|
712
|
-
${CONFIG_REL} + the read-only backend detector plus the executor-vehicle survey, and prints
|
|
715
|
+
${CONFIG_REL} + the read-only backend detector plus the executor-vehicle survey (carry) and the author-vehicle survey (author), and prints
|
|
713
716
|
both. A per-run
|
|
714
717
|
--override <slot>=<value> (repeatable) overrides the configured/default recipe for that slot.
|
|
715
718
|
Read-only: never writes, never commits, never runs a subscription CLI.
|
|
716
719
|
|
|
717
720
|
Also prints the project's DECLARED source-size practice (${SOURCE_SIZE_CONFIG_REL}) when it declares
|
|
718
|
-
one — the caps, what is recorded, why the practice exists
|
|
721
|
+
one — the caps, what is recorded, and why the practice exists — as the
|
|
719
722
|
declaredPractice block (--json: the same lines under "declaredPractice"). A project with no such
|
|
720
723
|
file renders nothing; a file that cannot be read renders ONE loud UNREADABLE line and still exits 0
|
|
721
724
|
(the practice's own checker owns the exit code for its config).
|
|
@@ -742,11 +745,12 @@ export const main = (argv, ctx = {}) => {
|
|
|
742
745
|
const section = extractSection(readProceduresCanon(env, home), activity);
|
|
743
746
|
// Readiness is a SECONDARY input — it only refines the recipe. A corrupt bridge must NOT fail
|
|
744
747
|
// activity resolution as a config/engine error: the detector-failure hook floors the bridge half
|
|
745
|
-
// at not-ready and warns (exit 0), while the surveyed executor
|
|
748
|
+
// at not-ready and warns (exit 0), while the surveyed executor and author vehicles survive untouched.
|
|
746
749
|
const detectWarnings = [];
|
|
747
750
|
const detection = composeReadiness(cwd, {
|
|
748
751
|
detect,
|
|
749
752
|
surveyVehicle: ctx.surveyVehicle,
|
|
753
|
+
surveyAuthorVehicle: ctx.surveyAuthorVehicle,
|
|
750
754
|
onDetectError: (err) => detectWarnings.push(
|
|
751
755
|
`backend detection failed (${(err && err.message) || err}) — treating every bridge as not ready; recipes needing a bridge degrade to solo (the executor vehicle is unaffected).`,
|
|
752
756
|
),
|
package/tools/profile-gaps.mjs
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { EPIC_STORE, PLANS, QUEUE } from '../references/scripts/shared/index.mjs';
|
|
3
4
|
import { CANDIDATE_STATES, isDeployed, judgeCheckerGates } from './checker-gates-read.mjs';
|
|
4
5
|
import { CONFIG_REL, validateConfig } from './orchestration-config.mjs';
|
|
5
6
|
import { TIER_TARGETS, isDeclineCurrent } from './reference-profile.mjs';
|
|
6
7
|
|
|
7
8
|
const SLOTS_ID = 'epic-task-slots';
|
|
8
9
|
const STORE_ID = 'epic-store-seeded';
|
|
9
|
-
const STORE_PATH = 'docs/ai/epics';
|
|
10
10
|
const CHECKER_GATES_ID = 'checker-gates-declared';
|
|
11
11
|
const QUEUE_SEED_ID = 'named-queue-row-seed';
|
|
12
|
-
const PLANS_PATH = 'docs/plans';
|
|
13
|
-
const QUEUE_PATH = 'docs/plans/queue.md';
|
|
14
12
|
const QUEUE_SEED_PATH = fileURLToPath(new URL('../references/authoring/QUEUE_TEMPLATE.md', import.meta.url));
|
|
15
13
|
const ABSENT_ARM_CODES = new Set(['ENOENT', 'ENOTDIR']);
|
|
16
14
|
const TIER_PREVIEW_PATH = fileURLToPath(new URL('./tier-preview.mjs', import.meta.url));
|
|
@@ -111,7 +109,7 @@ const detectStore = ({ root, deps }) => {
|
|
|
111
109
|
if (!isDeployed(root, deps)) return reportUndecidable(REASONS.noDeployment);
|
|
112
110
|
let stat;
|
|
113
111
|
try {
|
|
114
|
-
stat = deps.lstatSync(resolve(root,
|
|
112
|
+
stat = deps.lstatSync(resolve(root, EPIC_STORE));
|
|
115
113
|
} catch (error) {
|
|
116
114
|
if (error?.code === MISSING_FILE_CODE) return { verdict: VERDICTS.absent };
|
|
117
115
|
return reportUndecidable(REASONS.storeUnreadable);
|
|
@@ -146,7 +144,7 @@ const detectQueueSeed = ({ root, deps }) => {
|
|
|
146
144
|
if (!isDeployed(root, deps)) return reportUndecidable(REASONS.noDeployment);
|
|
147
145
|
let plans;
|
|
148
146
|
try {
|
|
149
|
-
plans = deps.lstatSync(resolve(root,
|
|
147
|
+
plans = deps.lstatSync(resolve(root, PLANS));
|
|
150
148
|
} catch (error) {
|
|
151
149
|
return ABSENT_ARM_CODES.has(error?.code) ? absentUnlessSeedUnreadable(deps) : reportUndecidable(REASONS.plansUnreadable);
|
|
152
150
|
}
|
|
@@ -154,7 +152,7 @@ const detectQueueSeed = ({ root, deps }) => {
|
|
|
154
152
|
if (!plans.isDirectory()) return reportUndecidable(REASONS.plansNotDirectory);
|
|
155
153
|
let queue;
|
|
156
154
|
try {
|
|
157
|
-
queue = deps.lstatSync(resolve(root,
|
|
155
|
+
queue = deps.lstatSync(resolve(root, QUEUE));
|
|
158
156
|
} catch (error) {
|
|
159
157
|
return error?.code === MISSING_FILE_CODE ? absentUnlessSeedUnreadable(deps) : reportUndecidable(REASONS.queueUnreadable);
|
|
160
158
|
}
|
|
@@ -7,6 +7,8 @@ export const RULES_PRIORS = Object.freeze([
|
|
|
7
7
|
Object.freeze({ theme: 'project-layout', release: '14.37.0', sha256: 'b79f19a9e0583f1e0619ee6aca06feb2c359b9655f1d260e87d8d5647bd1de19' }),
|
|
8
8
|
Object.freeze({ theme: 'project-layout', release: '19.4.0', sha256: 'ec4ef10c05ba365e73df96d175042314ea120f3fe1c946fdd94d3d1237de8be9' }),
|
|
9
9
|
Object.freeze({ theme: 'communication', release: '20.0.0', sha256: 'ce0ebcab194b21fedd96c389daefb92be3cf2b5fe15f3c40b0485c32a2575e1f' }),
|
|
10
|
+
Object.freeze({ theme: 'lens', release: '20.0.0', sha256: 'd0cd7c6f602710f3d292644f78d2e9ccf569b1ce9a9d00bcb2e9cfd831e18703' }),
|
|
11
|
+
Object.freeze({ theme: 'story-sessions', release: '20.0.0', sha256: '696fc850b04c91ed4fe6b5d370835c420163a729cef3803d57ed86b06bde6b49' }),
|
|
10
12
|
]);
|
|
11
13
|
|
|
12
14
|
// isKnownPrior(theme, bytes, catalog?) → true exactly when the bytes hash to an entry of that theme.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// The theme registry: pure data and pure derivation. Every surface that names a theme or its files
|
|
2
2
|
// reads this list, never a second copy. Contract: docs/ai/specs/kit/project-rules/themes.md.
|
|
3
3
|
|
|
4
|
+
import { RULES, RULES_EFFECTIVE, RULES_LOCAL, RULES_RECORD } from '../../references/scripts/shared/index.mjs';
|
|
5
|
+
|
|
4
6
|
const START = '**Start of every session**';
|
|
5
7
|
const BEFORE = '**Before any code change**';
|
|
6
8
|
|
|
@@ -17,11 +19,11 @@ export const THEMES = Object.freeze([
|
|
|
17
19
|
// The line that opens every theme template's body and the kit block's body; a suite pins every copy.
|
|
18
20
|
export const PRECEDENCE_LINE = "The kit block of AGENTS.md is the kit's and is rewritten on every upgrade; it and docs/ai/rules/effective/ govern over any copy of kit text elsewhere in this project's files; text of your own goes outside the block, and a change to a kit rule goes in its theme's file under docs/ai/rules/local/.";
|
|
19
21
|
|
|
20
|
-
export const RECORD_PATH =
|
|
22
|
+
export const RECORD_PATH = RULES_RECORD;
|
|
21
23
|
|
|
22
24
|
export const themePaths = (name) => Object.freeze({
|
|
23
|
-
kit:
|
|
24
|
-
local:
|
|
25
|
-
effective:
|
|
25
|
+
kit: `${RULES}/${name}.md`,
|
|
26
|
+
local: `${RULES_LOCAL}/${name}.md`,
|
|
27
|
+
effective: `${RULES_EFFECTIVE}/${name}.md`,
|
|
26
28
|
record: RECORD_PATH,
|
|
27
29
|
});
|
package/tools/recipes.mjs
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { existsSync, readFileSync } from 'node:fs';
|
|
6
6
|
import { dirname, join, resolve } from 'node:path';
|
|
7
|
+
import { GIT_DIR } from '../references/scripts/shared/index.mjs';
|
|
7
8
|
import { settingsSnapshot, DEFAULT_BUNDLE_ROOT } from './bridge-settings-read.mjs';
|
|
8
9
|
import { isDirectRun } from './direct-run.mjs';
|
|
9
10
|
import {
|
|
@@ -11,18 +12,22 @@ import {
|
|
|
11
12
|
POLICY_ACTIVITIES,
|
|
12
13
|
SLOT_RECIPES,
|
|
13
14
|
SUBAGENT_RECIPE,
|
|
15
|
+
AUTHOR_SUBAGENT_RECIPE,
|
|
14
16
|
CARRY_ROLE,
|
|
17
|
+
AUTHOR_ROLE,
|
|
15
18
|
EXECUTOR_PROVIDER,
|
|
16
19
|
SWITCH_DEFAULT,
|
|
17
20
|
isSwitchSlot,
|
|
21
|
+
slotRole,
|
|
18
22
|
withVehicle,
|
|
23
|
+
withAuthorVehicle,
|
|
19
24
|
vehicleDegradeReason,
|
|
20
25
|
EXECUTOR_APPLY,
|
|
21
26
|
safeLine,
|
|
22
27
|
DISPLAY_ALIASES,
|
|
23
28
|
BACKEND_PRIORITY,
|
|
24
29
|
} from './carriers.mjs';
|
|
25
|
-
import { surveyExecutorVehicle, surveyVehicle } from './cheap-agents-read.mjs';
|
|
30
|
+
import { surveyExecutorVehicle, surveyAuthorVehicle, surveyVehicle } from './cheap-agents-read.mjs';
|
|
26
31
|
import { obligationsOf } from './review-roster.mjs';
|
|
27
32
|
import { resolveRoster, activeLineCell, remedyFor } from './review-roster-resolve.mjs';
|
|
28
33
|
import { posturesByBackend } from './bridge-posture.mjs';
|
|
@@ -46,11 +51,12 @@ const UNWIRED = 'not wired';
|
|
|
46
51
|
const UNCHECKED = 'unchecked';
|
|
47
52
|
const NOT_COVERED = 'not covered';
|
|
48
53
|
|
|
49
|
-
// Keyed by readiness-array provider name; executor
|
|
54
|
+
// Keyed by readiness-array provider name; executor and author are the sole providers of their roles.
|
|
50
55
|
export const BACKEND_ROLES = {
|
|
51
56
|
[CODEX]: ['execute', 'review'],
|
|
52
57
|
[AGY]: ['review', 'probe'],
|
|
53
58
|
[EXECUTOR_PROVIDER]: [CARRY_ROLE],
|
|
59
|
+
[AUTHOR_ROLE]: [AUTHOR_ROLE],
|
|
54
60
|
};
|
|
55
61
|
|
|
56
62
|
// Review obligations from the CONFIGURED activity's review recipe — the RAW config value, never
|
|
@@ -132,7 +138,11 @@ export const RECIPES = [
|
|
|
132
138
|
SUBAGENT_RECIPE,
|
|
133
139
|
];
|
|
134
140
|
|
|
135
|
-
const recipeById = (id) =>
|
|
141
|
+
const recipeById = (id, role) => id === SUBAGENT_RECIPE.id && role === AUTHOR_ROLE
|
|
142
|
+
? AUTHOR_SUBAGENT_RECIPE
|
|
143
|
+
: RECIPES.find((r) => r.id === id);
|
|
144
|
+
|
|
145
|
+
const planDescriptors = [...RECIPES, AUTHOR_SUBAGENT_RECIPE];
|
|
136
146
|
|
|
137
147
|
// ── pure planner ───────────────────────────────────────────────────────────────
|
|
138
148
|
|
|
@@ -153,13 +163,14 @@ const isSatisfiable = (recipe, detection) =>
|
|
|
153
163
|
const degradeReason = (recipe, detection) => {
|
|
154
164
|
const providers = providersOf(recipe.role, detection);
|
|
155
165
|
if (providers.length === 0) {
|
|
156
|
-
|
|
166
|
+
const detail = recipe.id === SUBAGENT_RECIPE.id ? ` — ${vehicleDegradeReason(null, EXECUTOR_APPLY, recipe.role)}` : '';
|
|
167
|
+
return `${recipe.title} needs a provider providing ${recipe.role}, but no provider provides it${detail}`;
|
|
157
168
|
}
|
|
158
169
|
const ready = providers.filter((b) => b.readiness === READY);
|
|
159
170
|
const detail = providers
|
|
160
171
|
.filter((b) => b.readiness !== READY)
|
|
161
|
-
.map((b) => (
|
|
162
|
-
? vehicleDegradeReason(b.vehicle, EXECUTOR_APPLY)
|
|
172
|
+
.map((b) => (recipe.id === SUBAGENT_RECIPE.id
|
|
173
|
+
? vehicleDegradeReason(b.vehicle, EXECUTOR_APPLY, recipe.role)
|
|
163
174
|
: `${DISPLAY_ALIASES[b.name] ?? b.name}: ${remedyFor({ readiness: b.readiness })}`))
|
|
164
175
|
.join('; ');
|
|
165
176
|
return `${recipe.title} needs ${recipe.minBackends} provider(s) providing ${recipe.role}, but only ${ready.length} ready${detail ? ` — ${detail}` : ''}`;
|
|
@@ -180,19 +191,19 @@ const dispatchFor = (recipe, detection) => {
|
|
|
180
191
|
const QUOTA_NOTE = "Each bridge runs the host posture the user set; a weaker model is the user's bridge setting, never a per-call choice.";
|
|
181
192
|
const COUNCIL_QUOTA_NOTE = "Council spends two backends' quota for one decision — reserve it for changes that justify the cost.";
|
|
182
193
|
|
|
183
|
-
// The quota reminder rides a subscription-BACKEND dispatch only: the
|
|
184
|
-
// bridge quota, and
|
|
194
|
+
// The quota reminder rides a subscription-BACKEND dispatch only: the vehicles spend no
|
|
195
|
+
// bridge quota, and their recipes are frontier ones, so a bridge-posture reminder would not apply to them.
|
|
185
196
|
const notesFor = (recipe, dispatch) => {
|
|
186
197
|
const notes = [];
|
|
187
|
-
if (dispatch.some((d) => d.
|
|
198
|
+
if (dispatch.some((d) => BACKEND_PRIORITY.includes(d.backend))) notes.push(QUOTA_NOTE);
|
|
188
199
|
if (recipe.id === 'council') notes.push(COUNCIL_QUOTA_NOTE);
|
|
189
200
|
if (dispatch.some((d) => d.backend === AGY) && BACKEND_META[AGY].health) notes.push(BACKEND_META[AGY].health);
|
|
190
201
|
return notes;
|
|
191
202
|
};
|
|
192
203
|
|
|
193
204
|
// planRecipe → pure plan: walks the degradation chain, a stated reason per step, then dispatches.
|
|
194
|
-
export const planRecipe = (recipe, detection) => {
|
|
195
|
-
const requested = typeof recipe === 'string' ? recipeById(recipe) : recipe;
|
|
205
|
+
export const planRecipe = (recipe, detection, role) => {
|
|
206
|
+
const requested = typeof recipe === 'string' ? recipeById(recipe, role) : recipe;
|
|
196
207
|
if (!requested) throw new Error(`unknown recipe: ${recipe}`);
|
|
197
208
|
let current = requested;
|
|
198
209
|
const degradation = [];
|
|
@@ -204,6 +215,7 @@ export const planRecipe = (recipe, detection) => {
|
|
|
204
215
|
const dispatch = dispatchFor(current, detection);
|
|
205
216
|
return {
|
|
206
217
|
requested: requested.id,
|
|
218
|
+
role: requested.role,
|
|
207
219
|
effective: current.id,
|
|
208
220
|
degraded: current.id !== requested.id,
|
|
209
221
|
degradation,
|
|
@@ -307,7 +319,7 @@ export const resolveActivityRecipe = ({ config = {}, readiness = [], activity, s
|
|
|
307
319
|
return { recipe: requested, source, degradedFrom: null, reason: null, overrideUnsatisfied: false };
|
|
308
320
|
}
|
|
309
321
|
|
|
310
|
-
const plan = planRecipe(requested, readiness);
|
|
322
|
+
const plan = planRecipe(requested, readiness, slotRole(activity, slot));
|
|
311
323
|
const degraded = plan.degraded;
|
|
312
324
|
return {
|
|
313
325
|
recipe: plan.effective,
|
|
@@ -333,9 +345,10 @@ export const composeConfiguredPosture = (ctx = {}) => {
|
|
|
333
345
|
};
|
|
334
346
|
|
|
335
347
|
// The bridge half of a readiness array: every backend-status render lists BRIDGES (the things
|
|
336
|
-
// `/agent-workflow-kit backends` sets up); the
|
|
337
|
-
// mode, and only the recipe lattice sees
|
|
338
|
-
|
|
348
|
+
// `/agent-workflow-kit backends` sets up); the vehicles are carriers, judged by the agents
|
|
349
|
+
// mode, and only the recipe lattice sees them.
|
|
350
|
+
const VEHICLE_PROVIDERS = [EXECUTOR_PROVIDER, AUTHOR_ROLE];
|
|
351
|
+
export const bridgeEntries = (readiness) => readiness.filter((b) => !VEHICLE_PROVIDERS.includes(b.name));
|
|
339
352
|
|
|
340
353
|
export const composeStatusLine = (detection, recommendation, settings = null, autonomy = null, posture = null, wiring = null) => {
|
|
341
354
|
// A raw env value may carry newlines/control chars — collapse them so the one-line contract holds.
|
|
@@ -383,7 +396,7 @@ const formatAutonomySegment = (a) => {
|
|
|
383
396
|
const projectTopOf = (cwd) => {
|
|
384
397
|
let dir = resolve(cwd);
|
|
385
398
|
for (;;) {
|
|
386
|
-
if (existsSync(join(dir,
|
|
399
|
+
if (existsSync(join(dir, GIT_DIR))) return dir;
|
|
387
400
|
const parent = dirname(dir);
|
|
388
401
|
if (parent === dir) return resolve(cwd);
|
|
389
402
|
dir = parent;
|
|
@@ -434,7 +447,7 @@ export const composeActiveRecipeLine = ({ config, source } = {}, detection, auto
|
|
|
434
447
|
config: config ?? {}, readiness: detection, activity, slot,
|
|
435
448
|
surveyLens: rosterDeps?.surveyLens, postures: rosterDeps?.postures,
|
|
436
449
|
});
|
|
437
|
-
const dispatch = isSwitchSlot(slotType) || r.roster ? [] : planRecipe(r.recipe, detection).dispatch;
|
|
450
|
+
const dispatch = isSwitchSlot(slotType) || r.roster ? [] : planRecipe(r.recipe, detection, slotRole(activity, slot)).dispatch;
|
|
438
451
|
const wrappers = dispatch.map((d) => wrapperCmdFor(d.backend, d.role)).filter(Boolean);
|
|
439
452
|
const srcLabel = r.source === 'config' ? 'configured' : 'computed default';
|
|
440
453
|
const renderedValue = r.roster
|
|
@@ -476,7 +489,7 @@ export const buildReport = (detection, settings = null, autonomy = null, posture
|
|
|
476
489
|
summary,
|
|
477
490
|
})),
|
|
478
491
|
recommendation,
|
|
479
|
-
plans:
|
|
492
|
+
plans: planDescriptors.map((r) => planRecipe(r, detection)),
|
|
480
493
|
// The --json envelope must never expose a status line staler than the --status-line surface.
|
|
481
494
|
statusLine: composeStatusLine(detection, recommendation, settings, autonomy, posture, wiring),
|
|
482
495
|
...(wiring == null ? {} : { wiring }),
|
|
@@ -486,10 +499,10 @@ export const buildReport = (detection, settings = null, autonomy = null, posture
|
|
|
486
499
|
// Deterministic human advisor text: the recipes, the recommendation, and the per-recipe plan here.
|
|
487
500
|
export const formatRecipes = (detection, wiring = null) => {
|
|
488
501
|
const lines = [
|
|
489
|
-
'agent-workflow orchestration recipes (read-only — the orchestrator executes via the bridge skills or the
|
|
502
|
+
'agent-workflow orchestration recipes (read-only — the orchestrator executes via the bridge skills, the executor vehicle for carry or the author vehicle for author, and always commits)',
|
|
490
503
|
'',
|
|
491
504
|
];
|
|
492
|
-
for (const r of RECIPES) lines.push(` ${r.title} (${r.id}) — ${r.summary}`);
|
|
505
|
+
for (const r of RECIPES) lines.push(` ${r.title} (${r.id}) — ${r.summary}${r.id === SUBAGENT_RECIPE.id ? ` For author: ${AUTHOR_SUBAGENT_RECIPE.summary}` : ''}`);
|
|
493
506
|
const rec = wiring == null ? recommendRecipe(detection) : recommendWiredRecipe(detection, wiring);
|
|
494
507
|
lines.push('', `recommended here: ${rec.recipe} — ${rec.clause}`);
|
|
495
508
|
for (const entry of orderedWiringEntries(wiring)) {
|
|
@@ -503,13 +516,14 @@ export const formatRecipes = (detection, wiring = null) => {
|
|
|
503
516
|
if (entry.state === UNCHECKED) lines.push(` ${UNCHECKED}: ${alias} — ${entry.reason}`);
|
|
504
517
|
}
|
|
505
518
|
lines.push('', 'plan for the current environment:');
|
|
506
|
-
for (const r of
|
|
507
|
-
const p = planRecipe(r
|
|
519
|
+
for (const r of planDescriptors) {
|
|
520
|
+
const p = planRecipe(r, detection);
|
|
508
521
|
const arrow = p.degraded ? ` → ${p.effective}` : '';
|
|
509
522
|
const who = p.dispatch.length
|
|
510
523
|
? p.dispatch.map((d) => `${d.display} ${d.role}${d.vehicle ? ` (vehicle ${d.vehicle})` : ''}`).join(', ')
|
|
511
524
|
: 'orchestrator only';
|
|
512
|
-
|
|
525
|
+
const roleLabel = r.id === SUBAGENT_RECIPE.id ? ` (${p.role})` : '';
|
|
526
|
+
lines.push(` ${r.title}${roleLabel}${arrow}: ${who}`);
|
|
513
527
|
for (const step of p.degradation) lines.push(` ↳ ${step.reason}`);
|
|
514
528
|
for (const note of p.notes) lines.push(` • ${note}`);
|
|
515
529
|
}
|
|
@@ -521,20 +535,21 @@ export const formatRecipes = (detection, wiring = null) => {
|
|
|
521
535
|
const KNOWN_ARGS = new Set(['--help', '-h', '--json', '--status-line', '--active-line']);
|
|
522
536
|
const EXCLUSIVE_ARGS = ['--json', '--status-line', '--active-line']; // each owns stdout whole
|
|
523
537
|
|
|
524
|
-
// The readiness array EVERY mode composes: the detected backends plus the executor
|
|
525
|
-
//
|
|
538
|
+
// The readiness array EVERY mode composes: the detected backends plus the executor and author vehicles as the
|
|
539
|
+
// sole providers of their roles. The vehicles are surveyed first, and a bridge detector
|
|
526
540
|
// failure reaches `deps.onDetectError` exactly once (default: a loud stderr line) while the
|
|
527
|
-
//
|
|
528
|
-
//
|
|
541
|
+
// vehicles' readiness survives it — so a caller's fail-closed state for bridges never masks either
|
|
542
|
+
// vehicle, and the reverse. `deps` is also the seam a test injects a fake survey or detector through.
|
|
529
543
|
export const composeReadiness = (cwd, deps = {}) => {
|
|
530
544
|
const survey = (deps.surveyVehicle ?? surveyExecutorVehicle)(cwd, deps);
|
|
545
|
+
const authorSurvey = (deps.surveyAuthorVehicle ?? surveyAuthorVehicle)(cwd, deps);
|
|
531
546
|
let detection = [];
|
|
532
547
|
try {
|
|
533
548
|
detection = (deps.detect ?? detectBackends)();
|
|
534
549
|
} catch (err) {
|
|
535
550
|
(deps.onDetectError ?? ((e) => console.error(`[agent-workflow-kit] backend detection failed: ${e.message}`)))(err);
|
|
536
551
|
}
|
|
537
|
-
return withVehicle(detection, survey);
|
|
552
|
+
return withAuthorVehicle(withVehicle(detection, survey), authorSurvey);
|
|
538
553
|
};
|
|
539
554
|
|
|
540
555
|
// The wiring the status line, --json and the default output render. Lazy imports: the leaf reaches
|
|
@@ -554,7 +569,7 @@ Usage:
|
|
|
554
569
|
node recipes.mjs [--json | --status-line | --active-line]
|
|
555
570
|
|
|
556
571
|
Lists the five recipes (Solo / Reviewed / Council / Delegated / Subagent) and, from the read-only
|
|
557
|
-
backend detector plus the executor
|
|
572
|
+
backend detector plus the executor vehicle (carry) and author vehicle (author) surveys, plans + recommends one for the current
|
|
558
573
|
environment. --status-line prints exactly ONE
|
|
559
574
|
line — the machine-composed backend-status summary the bootstrap/upgrade reports paste verbatim
|
|
560
575
|
(incl. the per-activity autonomy segment: effective levels + render-sync state, honest
|