@gtrabanco/pi-agentic-workflow 0.13.3 → 0.15.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/README.md +3 -9
- package/dist/conductor/closeout.d.ts +18 -0
- package/dist/conductor/closeout.js +24 -0
- package/dist/conductor/decide.d.ts +25 -0
- package/dist/conductor/decide.js +104 -0
- package/dist/conductor/index.d.ts +16 -0
- package/dist/conductor/index.js +15 -0
- package/dist/conductor/invoke.d.ts +15 -0
- package/dist/conductor/invoke.js +59 -0
- package/dist/conductor/loop.d.ts +25 -0
- package/dist/conductor/loop.js +236 -0
- package/dist/conductor/sensor.d.ts +12 -0
- package/dist/conductor/sensor.js +150 -0
- package/dist/conductor/snapshot.d.ts +13 -0
- package/dist/conductor/snapshot.js +60 -0
- package/dist/conductor/types.d.ts +248 -0
- package/dist/conductor/types.js +47 -0
- package/dist/conductor/urgency.d.ts +16 -0
- package/dist/conductor/urgency.js +70 -0
- package/dist/config/merge.js +21 -1
- package/dist/config/schema.js +45 -2
- package/dist/config/types.d.ts +22 -0
- package/dist/config/types.js +7 -0
- package/dist/extension/conductor-command.d.ts +23 -0
- package/dist/extension/conductor-command.js +93 -0
- package/dist/extension/factory.js +6 -1
- package/dist/routing/types.d.ts +2 -0
- package/dist/routing/types.js +2 -0
- package/dist/runtime.d.ts +45 -0
- package/dist/runtime.js +62 -0
- package/package.json +4 -2
- package/skills/audit-docs/SKILL.md +6 -5
- package/skills/audit-pr/SKILL.md +1 -1
- package/skills/audit-pr/references/PORTABILITY.md +1 -1
- package/skills/execute-phase/SKILL.md +207 -116
- package/skills/execute-phase/references/DESCOPE.md +22 -18
- package/skills/execute-phase/references/EXECUTION_CONTRACT.md +69 -77
- package/skills/execute-phase/references/FOLDING.md +34 -47
- package/skills/execute-phase/references/PREFLIGHT.md +103 -114
- package/skills/execute-phase/references/PRE_EXECUTION_GATE.md +53 -60
- package/skills/init-workspace/SKILL.md +35 -5
- package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +5 -5
- package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +15 -8
- package/skills/init-workspace/references/PORTABILITY.md +1 -1
- package/skills/init-workspace/references/UPGRADE.md +17 -7
- package/skills/log-session/SKILL.md +4 -3
- package/skills/orchestration-envelope/references/TURN_CONTRACT.md +1 -1
- package/skills/pre-execution-review/references/LEDGERS.md +39 -39
- package/skills/pre-execution-review/references/POLICY.md +1 -0
- package/skills/review-change/SKILL.md +1 -1
- package/skills/review-change/references/PORTABILITY.md +1 -1
- package/skills/unit-lane/SKILL.md +154 -0
- package/skills/unit-lane/references/DESIGN.md +35 -0
- package/skills/unit-lane/references/DOCS.md +36 -0
- package/skills/unit-lane/references/EVIDENCE.md +34 -0
- package/skills/unit-lane/references/IMPLEMENT.md +45 -0
- package/skills/unit-lane/references/PLAN.md +38 -0
- package/skills/unit-lane/references/RELEASE.md +45 -0
- package/skills/unit-lane/references/RESEARCH.md +37 -0
- package/skills/unit-lane/references/REVIEW.md +45 -0
- package/skills/unit-lane/references/STEPS.md +23 -0
- package/skills/unit-lane/references/TESTS.md +32 -0
- package/skills/workflow-status/references/ENVELOPE_FIELDS.md +5 -6
- package/skills/workflow-status/references/SENSOR_CORE.md +16 -20
- package/skills/workflow-status/references/SENSOR_SIGNALS.md +5 -7
- package/skills/design-feature/SKILL.md +0 -231
- package/skills/design-feature/references/INTERVIEW.md +0 -74
- package/skills/design-feature/references/PORTABILITY.md +0 -15
- package/skills/design-feature/references/REPAIR.md +0 -88
- package/skills/design-feature/references/UPSERT_EXAMPLE.md +0 -8
- package/skills/design-feature/references/WRITE_AND_UPSERT.md +0 -115
- package/skills/evidence-grounding/SKILL.md +0 -174
- package/skills/evidence-grounding/references/DELEGATION.md +0 -131
- package/skills/evidence-grounding/references/READINESS.md +0 -130
- package/skills/evidence-grounding/references/ROWS.md +0 -93
- package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +0 -57
- package/skills/execute-phase/references/CLOSEOUT.md +0 -77
- package/skills/execute-phase/references/HANDOFF.md +0 -21
- package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +0 -45
- package/skills/execute-phase/references/UNIT_LOOP.md +0 -88
- package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +0 -37
- package/skills/execute-phase/references/WORKFLOWS_FIX.md +0 -43
- package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +0 -26
- package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +0 -38
- package/skills/generate-docs/SKILL.md +0 -145
- package/skills/generate-docs/references/ADAPTERS.md +0 -15
- package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +0 -33
- package/skills/generate-docs/references/GENERATION_PROCESS.md +0 -90
- package/skills/implementation-discovery/SKILL.md +0 -209
- package/skills/plan-feature/SKILL.md +0 -208
- package/skills/plan-feature/references/ROUTING.md +0 -155
- package/skills/plan-feature-from-issue/SKILL.md +0 -162
- package/skills/plan-feature-scaffold/SKILL.md +0 -112
- package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +0 -122
- package/skills/plan-fix/SKILL.md +0 -161
- package/skills/plan-fix/references/PLANNING_PROCESS.md +0 -148
- package/skills/plan-fix/references/SPEC_CONTRACT.md +0 -22
- package/skills/planning-preflight/SKILL.md +0 -130
- package/skills/replan-findings/SKILL.md +0 -131
- package/skills/replan-findings/references/PHASE_APPEND.md +0 -89
- package/skills/review-plan/SKILL.md +0 -154
- package/skills/review-plan/references/CHECKS.md +0 -111
- package/skills/review-plan/references/ENG-CHECKS.md +0 -30
- package/skills/review-plan/references/OUTPUT.md +0 -166
- package/skills/review-spec/SKILL.md +0 -145
- package/skills/review-spec/references/CHECKS.md +0 -108
- package/skills/review-spec/references/OUTPUT.md +0 -160
- package/skills/ship-roadmap/SKILL.md +0 -120
- package/skills/ship-roadmap/references/ADVANCE.md +0 -117
- package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +0 -64
- package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +0 -27
- package/skills/ship-roadmap/references/FOUNDING.md +0 -101
- package/skills/ship-roadmap/references/GUARDRAILS.md +0 -56
- package/skills/ship-roadmap/references/MODEL_ROUTING.md +0 -16
- package/skills/ship-roadmap/references/PORTABILITY.md +0 -34
- package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +0 -94
- package/skills/ship-roadmap/references/STOP_CONDITIONS.md +0 -9
- package/skills/ship-roadmap/references/TERMINAL_REPORT.md +0 -34
package/dist/config/schema.js
CHANGED
|
@@ -9,7 +9,7 @@ import { OPERATIONS, PATH_GLOB_MAX_LENGTH, PHASE_STATES, REQUIREMENTS } from "./
|
|
|
9
9
|
* strong model ran when it did not. Only a *missing* file resolves to the
|
|
10
10
|
* default, and that decision belongs to the loader.
|
|
11
11
|
*/
|
|
12
|
-
const ROOT_KEYS = new Set(["default", "commands", "onUnavailableRoute", "onSettle", "pathProtection"]);
|
|
12
|
+
const ROOT_KEYS = new Set(["default", "commands", "onUnavailableRoute", "onSettle", "pathProtection", "advance"]);
|
|
13
13
|
const ROUTE_KEYS = new Set(["model", "thinking"]);
|
|
14
14
|
const COMMAND_NAME = /^[a-z0-9][a-z0-9._-]*$/u;
|
|
15
15
|
function isRecord(value) {
|
|
@@ -41,6 +41,44 @@ function isUnavailableRoutePolicy(value) {
|
|
|
41
41
|
function isSettlePolicy(value) {
|
|
42
42
|
return SETTLE_POLICIES.includes(value);
|
|
43
43
|
}
|
|
44
|
+
/** Strict validator for the optional `advance` conductor config (feature 62). */
|
|
45
|
+
const ADVANCE_KEYS = new Set(["iterationsCap", "sensitivePaths", "securityPaths", "runLogPath"]);
|
|
46
|
+
function checkAdvance(value, path, issues) {
|
|
47
|
+
if (!isRecord(value)) {
|
|
48
|
+
issues.push({ path, message: "must be an object" });
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const out = {};
|
|
52
|
+
for (const key of Object.keys(value)) {
|
|
53
|
+
if (!ADVANCE_KEYS.has(key)) {
|
|
54
|
+
issues.push({ path: `${path}.${displayKey(key)}`, message: `unknown advance key "${key}" (allowed: iterationsCap, sensitivePaths, securityPaths, runLogPath)` });
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const v = value[key];
|
|
58
|
+
if (key === "iterationsCap") {
|
|
59
|
+
if (typeof v !== "number" || !Number.isInteger(v) || v < 1) {
|
|
60
|
+
issues.push({ path: `${path}.iterationsCap`, message: "must be a positive integer" });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
out.iterationsCap = v;
|
|
64
|
+
}
|
|
65
|
+
else if (key === "runLogPath") {
|
|
66
|
+
if (typeof v !== "string" || v.length === 0) {
|
|
67
|
+
issues.push({ path: `${path}.runLogPath`, message: "must be a non-empty string" });
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
out.runLogPath = v;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
if (!Array.isArray(v) || v.some((e) => typeof e !== "string")) {
|
|
74
|
+
issues.push({ path: `${path}.${key}`, message: "must be an array of strings" });
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
out[key] = v;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
44
82
|
/** Strict validator for the optional `pathProtection` override (feature 60, AC10). */
|
|
45
83
|
function checkPathProtection(value, path, issues) {
|
|
46
84
|
if (!isRecord(value)) {
|
|
@@ -176,7 +214,7 @@ function validateConfig(value) {
|
|
|
176
214
|
if (!ROOT_KEYS.has(key)) {
|
|
177
215
|
issues.push({
|
|
178
216
|
path: `$.${displayKey(key)}`,
|
|
179
|
-
message: `unknown config key "${key}" (allowed: default, commands, onUnavailableRoute, onSettle, pathProtection)`,
|
|
217
|
+
message: `unknown config key "${key}" (allowed: default, commands, onUnavailableRoute, onSettle, pathProtection, advance)`,
|
|
180
218
|
});
|
|
181
219
|
}
|
|
182
220
|
}
|
|
@@ -225,6 +263,11 @@ function validateConfig(value) {
|
|
|
225
263
|
config.onSettle = value.onSettle;
|
|
226
264
|
}
|
|
227
265
|
}
|
|
266
|
+
if (value.advance !== undefined) {
|
|
267
|
+
const advance = checkAdvance(value.advance, "$.advance", issues);
|
|
268
|
+
if (advance)
|
|
269
|
+
config.advance = advance;
|
|
270
|
+
}
|
|
228
271
|
if (value.pathProtection !== undefined) {
|
|
229
272
|
const override = checkPathProtection(value.pathProtection, "$.pathProtection", issues);
|
|
230
273
|
if (override)
|
package/dist/config/types.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export interface ConfigFile {
|
|
|
42
42
|
onSettle?: SettlePolicy;
|
|
43
43
|
/** The tighten-only path-protection override (feature 60, AC10). */
|
|
44
44
|
pathProtection?: PathProtectionOverride;
|
|
45
|
+
/** Conductor (advance) knobs (feature 62). */
|
|
46
|
+
advance?: AdvanceConfigFile;
|
|
45
47
|
}
|
|
46
48
|
export type UnavailableRoutePolicy = "stop" | "inherit";
|
|
47
49
|
/**
|
|
@@ -65,6 +67,10 @@ export interface EffectiveConfig {
|
|
|
65
67
|
onSettle: SettlePolicy;
|
|
66
68
|
/** The effective path-protection policy: the shipped floor tightened by any override. */
|
|
67
69
|
pathProtection: ResolvedPathPolicy;
|
|
70
|
+
/** The effective advance (conductor) knobs (feature 62). Resolved by
|
|
71
|
+
* mergeConfigs; the shipped DEFAULT_CONFIG predates it and leaves it
|
|
72
|
+
* absent — consumers fall back to DEFAULT_ADVANCE_CONFIG. */
|
|
73
|
+
advance?: AdvanceConfig;
|
|
68
74
|
}
|
|
69
75
|
export interface ConfigProblem {
|
|
70
76
|
scope: "global" | "project";
|
|
@@ -76,3 +82,19 @@ export interface ConfigPaths {
|
|
|
76
82
|
global: string;
|
|
77
83
|
project: string;
|
|
78
84
|
}
|
|
85
|
+
/** Per-iteration control knobs for the conductor loop. */
|
|
86
|
+
export interface AdvanceConfigFile {
|
|
87
|
+
iterationsCap?: number;
|
|
88
|
+
sensitivePaths?: string[];
|
|
89
|
+
securityPaths?: string[];
|
|
90
|
+
runLogPath?: string;
|
|
91
|
+
}
|
|
92
|
+
/** Effective advance configuration with all fields resolved. */
|
|
93
|
+
export interface AdvanceConfig {
|
|
94
|
+
iterationsCap: number;
|
|
95
|
+
sensitivePaths: string[];
|
|
96
|
+
securityPaths: string[];
|
|
97
|
+
runLogPath: string;
|
|
98
|
+
}
|
|
99
|
+
/** The shipped advance defaults (mirrors conductor DEFAULT_CONDUCTOR_CONFIG). */
|
|
100
|
+
export declare const DEFAULT_ADVANCE_CONFIG: Readonly<AdvanceConfig>;
|
package/dist/config/types.js
CHANGED
|
@@ -13,3 +13,10 @@ export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhig
|
|
|
13
13
|
export const MAX_MODEL_CHAIN = 4;
|
|
14
14
|
export const UNAVAILABLE_ROUTE_POLICIES = ["stop", "inherit"];
|
|
15
15
|
export const SETTLE_POLICIES = ["keep", "restore"];
|
|
16
|
+
/** The shipped advance defaults (mirrors conductor DEFAULT_CONDUCTOR_CONFIG). */
|
|
17
|
+
export const DEFAULT_ADVANCE_CONFIG = {
|
|
18
|
+
iterationsCap: 12,
|
|
19
|
+
sensitivePaths: [],
|
|
20
|
+
securityPaths: [],
|
|
21
|
+
runLogPath: ".agentic-workflow/advance-run.log",
|
|
22
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The native `advance` command wiring (feature 62).
|
|
3
|
+
*
|
|
4
|
+
* Bridges the pi-free conductor loop to a live session: real sensor spawn,
|
|
5
|
+
* real git probes, real run-log writes, real WIP-commit parking. One stage
|
|
6
|
+
* per invocation by default — the invoked skill must settle before the next
|
|
7
|
+
* sensor run can observe its effect — with `--continue` running the bounded
|
|
8
|
+
* full loop. `--fullauto`/`--unattended` switch the unattended adversarial
|
|
9
|
+
* floor on. The conductor never merges (feature 20 merge authority).
|
|
10
|
+
*/
|
|
11
|
+
import type { LoadedConfig } from "../config/load.js";
|
|
12
|
+
import type { CommandRegistrar } from "./factory.js";
|
|
13
|
+
import type { InvocationContext, ModelRef } from "../routing/types.js";
|
|
14
|
+
/** Register the native `advance` command on the shared registrar. */
|
|
15
|
+
export declare function registerAdvanceCommand<M extends ModelRef = ModelRef>(registrar: CommandRegistrar<M>, deps: {
|
|
16
|
+
surface: (ctx: InvocationContext<M>) => {
|
|
17
|
+
sendUserMessage(content: string, options?: {
|
|
18
|
+
expandPromptTemplates?: boolean;
|
|
19
|
+
}): void;
|
|
20
|
+
};
|
|
21
|
+
/** The same bound config reader the router uses (factory's `read`). */
|
|
22
|
+
readConfig: (ctx: InvocationContext<M>) => LoadedConfig;
|
|
23
|
+
}, commandNames: Set<string>): void;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The native `advance` command wiring (feature 62).
|
|
3
|
+
*
|
|
4
|
+
* Bridges the pi-free conductor loop to a live session: real sensor spawn,
|
|
5
|
+
* real git probes, real run-log writes, real WIP-commit parking. One stage
|
|
6
|
+
* per invocation by default — the invoked skill must settle before the next
|
|
7
|
+
* sensor run can observe its effect — with `--continue` running the bounded
|
|
8
|
+
* full loop. `--fullauto`/`--unattended` switch the unattended adversarial
|
|
9
|
+
* floor on. The conductor never merges (feature 20 merge authority).
|
|
10
|
+
*/
|
|
11
|
+
import { execFile } from "node:child_process";
|
|
12
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
13
|
+
import { dirname, resolve } from "node:path";
|
|
14
|
+
import { DEFAULT_ADVANCE_CONFIG } from "../config/types.js";
|
|
15
|
+
import { runtimeBin } from "../runtime.js";
|
|
16
|
+
import { runConductorLoop } from "../conductor/loop.js";
|
|
17
|
+
import { decideFromEnvelope } from "../conductor/decide.js";
|
|
18
|
+
import { invocationFromDecision } from "../conductor/invoke.js";
|
|
19
|
+
import { judgeUrgency } from "../conductor/urgency.js";
|
|
20
|
+
import { ADVANCE_COMMAND } from "../routing/types.js";
|
|
21
|
+
function git(args, cwd) {
|
|
22
|
+
return new Promise((res) => {
|
|
23
|
+
execFile("git", args, { cwd, timeout: 5_000 }, (err, stdout) => {
|
|
24
|
+
res({ ok: !err, stdout: typeof stdout === "string" ? stdout : "" });
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async function gitProbe(cwd) {
|
|
29
|
+
const status = await git(["status", "--porcelain"], cwd);
|
|
30
|
+
const ahead = await git(["rev-list", "--count", "@{upstream}..HEAD"], cwd);
|
|
31
|
+
// No upstream (or probe failure) reads as unpushed work: fail closed to partial.
|
|
32
|
+
return { porcelain: status.stdout, ahead: ahead.ok ? Number.parseInt(ahead.stdout.trim(), 10) || 0 : 1 };
|
|
33
|
+
}
|
|
34
|
+
function appendRunLog(config, cwd, line) {
|
|
35
|
+
const path = resolve(cwd, config.runLogPath ?? ".agentic-workflow/advance-run.log");
|
|
36
|
+
try {
|
|
37
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
38
|
+
appendFileSync(path, `${line}\n`, "utf8");
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// A run log that cannot be written never blocks the stage itself.
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function parkInFlight(cwd) {
|
|
45
|
+
await git(["add", "-A"], cwd);
|
|
46
|
+
await git(["commit", "-m", "wip: parked by advance (urgent interrupt)"], cwd);
|
|
47
|
+
}
|
|
48
|
+
/** Register the native `advance` command on the shared registrar. */
|
|
49
|
+
export function registerAdvanceCommand(registrar, deps, commandNames) {
|
|
50
|
+
registrar.registerCommand(ADVANCE_COMMAND, {
|
|
51
|
+
description: "Deterministic conductor: sensor → decide → invoke the next stage; stops on needs_input/stop. Never merges.",
|
|
52
|
+
handler: async (_args, ctx) => {
|
|
53
|
+
const flags = _args.split(/\s+/).filter(Boolean);
|
|
54
|
+
const attended = !flags.includes("--fullauto") && !flags.includes("--unattended");
|
|
55
|
+
const continueLoop = flags.includes("--continue");
|
|
56
|
+
// The effective advance knobs: the merged config when it carries the
|
|
57
|
+
// key, the shipped defaults otherwise.
|
|
58
|
+
let config = { ...DEFAULT_ADVANCE_CONFIG };
|
|
59
|
+
try {
|
|
60
|
+
const loaded = deps.readConfig(ctx);
|
|
61
|
+
if (loaded.ok && loaded.config.advance)
|
|
62
|
+
config = loaded.config.advance;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Config trouble falls back to the shipped advance defaults; the loop
|
|
66
|
+
// itself is fail-closed on the sensor side anyway.
|
|
67
|
+
}
|
|
68
|
+
const surface = deps.surface(ctx);
|
|
69
|
+
const result = await runConductorLoop({
|
|
70
|
+
cwd: ctx.cwd,
|
|
71
|
+
runtimeBin: runtimeBin(),
|
|
72
|
+
commandNames,
|
|
73
|
+
maxInvokes: continueLoop ? undefined : 1,
|
|
74
|
+
attended,
|
|
75
|
+
config,
|
|
76
|
+
runSensor: (cwd, bin) => import("../conductor/sensor.js").then(({ runSensor }) => runSensor(cwd, bin)),
|
|
77
|
+
decide: decideFromEnvelope,
|
|
78
|
+
invocation: invocationFromDecision,
|
|
79
|
+
judgeUrgency,
|
|
80
|
+
sendUserMessage: (invocation) => {
|
|
81
|
+
surface.sendUserMessage(invocation, { expandPromptTemplates: true });
|
|
82
|
+
return Promise.resolve({ ok: true });
|
|
83
|
+
},
|
|
84
|
+
gitProbe: () => gitProbe(ctx.cwd),
|
|
85
|
+
appendRunLog: (line) => appendRunLog(config, ctx.cwd, line),
|
|
86
|
+
parkInFlight: () => {
|
|
87
|
+
return parkInFlight(ctx.cwd);
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
ctx.notify(`${result.banner} — ${result.detail ?? ""} (iterations: ${result.iterations})`, "info");
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -2,7 +2,8 @@ import { loadConfig } from "../config/load.js";
|
|
|
2
2
|
import { readCatalogue } from "../routing/catalogue.js";
|
|
3
3
|
import { createRouter } from "../routing/dispatch.js";
|
|
4
4
|
import { dirtyWorktreeWarning, receiptGuard } from "./receipt-guard.js";
|
|
5
|
-
import { SETTINGS_COMMAND, SETTINGS_COMMAND_ALIAS } from "../routing/types.js";
|
|
5
|
+
import { ADVANCE_COMMAND, SETTINGS_COMMAND, SETTINGS_COMMAND_ALIAS } from "../routing/types.js";
|
|
6
|
+
import { registerAdvanceCommand } from "./conductor-command.js";
|
|
6
7
|
export function createExtension(deps) {
|
|
7
8
|
const { registrar, surface, skillsDir, agentDir, hint, settings } = deps;
|
|
8
9
|
const catalogue = readCatalogue(skillsDir);
|
|
@@ -21,6 +22,7 @@ export function createExtension(deps) {
|
|
|
21
22
|
};
|
|
22
23
|
const knownCommands = new Set([
|
|
23
24
|
...catalogue.commands.map((entry) => entry.name),
|
|
25
|
+
ADVANCE_COMMAND,
|
|
24
26
|
SETTINGS_COMMAND,
|
|
25
27
|
SETTINGS_COMMAND_ALIAS,
|
|
26
28
|
]);
|
|
@@ -49,6 +51,9 @@ export function createExtension(deps) {
|
|
|
49
51
|
ctx.notify(`Settings could not be opened: ${error.message}`, "error");
|
|
50
52
|
}
|
|
51
53
|
};
|
|
54
|
+
// The native conductor command (feature 62): registered in code, not derived
|
|
55
|
+
// from a skill dir, and able to invoke every catalogue command by name.
|
|
56
|
+
registerAdvanceCommand(registrar, { surface, readConfig: read }, knownCommands);
|
|
52
57
|
registrar.registerCommand(SETTINGS_COMMAND, {
|
|
53
58
|
description: "Show and configure per-command model routing",
|
|
54
59
|
handler: settingsHandler,
|
package/dist/routing/types.d.ts
CHANGED
|
@@ -90,6 +90,8 @@ export type DispatchOutcome = {
|
|
|
90
90
|
message: string;
|
|
91
91
|
};
|
|
92
92
|
/** Slash name of the settings console (SPEC S4, AC3, AC10). */
|
|
93
|
+
/** The native conductor command (feature 62): sensor → decide → invoke loop. */
|
|
94
|
+
export declare const ADVANCE_COMMAND = "advance";
|
|
93
95
|
export declare const SETTINGS_COMMAND = "agentic-workflow-settings";
|
|
94
96
|
/** Shorthand alias for the same console — a pointer to the same handler, never a separate route (OB-5, AC6). */
|
|
95
97
|
export declare const SETTINGS_COMMAND_ALIAS = "aw-settings";
|
package/dist/routing/types.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export const modelRefKey = (model) => `${model.provider}/${model.id}`;
|
|
2
2
|
/** Slash name of the settings console (SPEC S4, AC3, AC10). */
|
|
3
|
+
/** The native conductor command (feature 62): sensor → decide → invoke loop. */
|
|
4
|
+
export const ADVANCE_COMMAND = "advance";
|
|
3
5
|
export const SETTINGS_COMMAND = "agentic-workflow-settings";
|
|
4
6
|
/** Shorthand alias for the same console — a pointer to the same handler, never a separate route (OB-5, AC6). */
|
|
5
7
|
export const SETTINGS_COMMAND_ALIAS = "aw-settings";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime resolver — determines what runtime pi itself runs under so
|
|
3
|
+
* spawned children inherit the same choice.
|
|
4
|
+
*
|
|
5
|
+
* The current process is always pi (this module lives inside the package
|
|
6
|
+
* that ships with pi). Whichever runtime launched pi decides what
|
|
7
|
+
* children get:
|
|
8
|
+
* - pi installed via `bun add -g` → bun
|
|
9
|
+
* - pi installed via `npm install -g` → node
|
|
10
|
+
*
|
|
11
|
+
* `AGENTIC_WORKFLOW_RUNTIME` env override is the highest priority: it
|
|
12
|
+
* always wins, letting the operator force a specific runtime regardless
|
|
13
|
+
* of how pi was installed.
|
|
14
|
+
*
|
|
15
|
+
* Exported from the package's public entry (compiled from src/ → dist/).
|
|
16
|
+
* Intended call site: wherever the extension spawns a `.mjs` script,
|
|
17
|
+
* use `runtimeBin()` + `runtimeEnv()` instead of a hardcoded `"node"`
|
|
18
|
+
* or `"bun"`.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Detect the runtime of the *current process* (which is pi).
|
|
22
|
+
* Returns `"bun"` when `globalThis.Bun` exists, or when
|
|
23
|
+
* `process.execPath` contains the substring `"bun"`; otherwise `"node"`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectRuntime(): "bun" | "node";
|
|
26
|
+
/**
|
|
27
|
+
* Return an environment object for spawned children that ensures
|
|
28
|
+
* `AGENTIC_WORKFLOW_RUNTIME` is set.
|
|
29
|
+
*
|
|
30
|
+
* Priority:
|
|
31
|
+
* 1. If the caller passes an explicit value, use it (user override).
|
|
32
|
+
* 2. If `AGENTIC_WORKFLOW_RUNTIME` is already in `process.env`, use it.
|
|
33
|
+
* 3. Fall back to the detected runtime.
|
|
34
|
+
*
|
|
35
|
+
* Returns `{ AGENTIC_WORKFLOW_RUNTIME: "bun" | "node" }`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function runtimeEnv(overrides?: {
|
|
38
|
+
AGENTIC_WORKFLOW_RUNTIME?: "bun" | "node";
|
|
39
|
+
}): Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Return the executable name to spawn for running a script.
|
|
42
|
+
* Returns `"bun"` or `"node"` based on the detected runtime,
|
|
43
|
+
* respecting the `AGENTIC_WORKFLOW_RUNTIME` env override.
|
|
44
|
+
*/
|
|
45
|
+
export declare function runtimeBin(): "bun" | "node";
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime resolver — determines what runtime pi itself runs under so
|
|
3
|
+
* spawned children inherit the same choice.
|
|
4
|
+
*
|
|
5
|
+
* The current process is always pi (this module lives inside the package
|
|
6
|
+
* that ships with pi). Whichever runtime launched pi decides what
|
|
7
|
+
* children get:
|
|
8
|
+
* - pi installed via `bun add -g` → bun
|
|
9
|
+
* - pi installed via `npm install -g` → node
|
|
10
|
+
*
|
|
11
|
+
* `AGENTIC_WORKFLOW_RUNTIME` env override is the highest priority: it
|
|
12
|
+
* always wins, letting the operator force a specific runtime regardless
|
|
13
|
+
* of how pi was installed.
|
|
14
|
+
*
|
|
15
|
+
* Exported from the package's public entry (compiled from src/ → dist/).
|
|
16
|
+
* Intended call site: wherever the extension spawns a `.mjs` script,
|
|
17
|
+
* use `runtimeBin()` + `runtimeEnv()` instead of a hardcoded `"node"`
|
|
18
|
+
* or `"bun"`.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Detect the runtime of the *current process* (which is pi).
|
|
22
|
+
* Returns `"bun"` when `globalThis.Bun` exists, or when
|
|
23
|
+
* `process.execPath` contains the substring `"bun"`; otherwise `"node"`.
|
|
24
|
+
*/
|
|
25
|
+
export function detectRuntime() {
|
|
26
|
+
if (globalThis.Bun !== undefined) {
|
|
27
|
+
return "bun";
|
|
28
|
+
}
|
|
29
|
+
const execPath = process.execPath ?? "";
|
|
30
|
+
if (execPath.includes("bun")) {
|
|
31
|
+
return "bun";
|
|
32
|
+
}
|
|
33
|
+
return "node";
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Return an environment object for spawned children that ensures
|
|
37
|
+
* `AGENTIC_WORKFLOW_RUNTIME` is set.
|
|
38
|
+
*
|
|
39
|
+
* Priority:
|
|
40
|
+
* 1. If the caller passes an explicit value, use it (user override).
|
|
41
|
+
* 2. If `AGENTIC_WORKFLOW_RUNTIME` is already in `process.env`, use it.
|
|
42
|
+
* 3. Fall back to the detected runtime.
|
|
43
|
+
*
|
|
44
|
+
* Returns `{ AGENTIC_WORKFLOW_RUNTIME: "bun" | "node" }`.
|
|
45
|
+
*/
|
|
46
|
+
export function runtimeEnv(overrides) {
|
|
47
|
+
const value = overrides?.AGENTIC_WORKFLOW_RUNTIME ??
|
|
48
|
+
process.env.AGENTIC_WORKFLOW_RUNTIME ??
|
|
49
|
+
detectRuntime();
|
|
50
|
+
return { AGENTIC_WORKFLOW_RUNTIME: value };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Return the executable name to spawn for running a script.
|
|
54
|
+
* Returns `"bun"` or `"node"` based on the detected runtime,
|
|
55
|
+
* respecting the `AGENTIC_WORKFLOW_RUNTIME` env override.
|
|
56
|
+
*/
|
|
57
|
+
export function runtimeBin() {
|
|
58
|
+
const env = process.env.AGENTIC_WORKFLOW_RUNTIME;
|
|
59
|
+
if (env === "bun" || env === "node")
|
|
60
|
+
return env;
|
|
61
|
+
return detectRuntime();
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtrabanco/pi-agentic-workflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Pi package: canonical agentic-workflow skills, friendly slash commands, and per-command model routing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -56,7 +56,9 @@
|
|
|
56
56
|
"@earendil-works/pi-coding-agent": ">=0.87.0"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@earendil-works/pi-tui": "0.87.0"
|
|
59
|
+
"@earendil-works/pi-tui": "0.87.0",
|
|
60
|
+
"@gtrabanco/agentic-workflow": "file:../agentic-workflow",
|
|
61
|
+
"@gtrabanco/agentic-workflow-schema": "4.5.0"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@types/node": "24.13.3",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: audit-docs
|
|
3
3
|
user-invocable: true
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
argument-hint: "[--fix]"
|
|
6
6
|
author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
|
|
7
7
|
license: MIT
|
|
@@ -11,7 +11,8 @@ description: >
|
|
|
11
11
|
entries already merged/closed, broken documentation-map links, dependency
|
|
12
12
|
cycles, artifacts in the wrong language, naming-convention violations — and
|
|
13
13
|
reports them ranked by severity, fixing only low-risk items on request.
|
|
14
|
-
|
|
14
|
+
Model-agnostic: the skill inherits whatever model and effort your agent
|
|
15
|
+
session is already using.
|
|
15
16
|
Triggers: "check doc consistency", "are the docs in sync", "audit the docs",
|
|
16
17
|
"doc coherence review", "did the docs drift", "validate the roadmap".
|
|
17
18
|
---
|
|
@@ -93,12 +94,12 @@ run the command shown, don't infer.
|
|
|
93
94
|
feature/fix-scoped changes committed directly without a PR: HIGH.
|
|
94
95
|
13. **Generated-docs provenance (only when the documentation map declares a
|
|
95
96
|
`Docs site` block; otherwise state n/a).** Scan the declared content dir
|
|
96
|
-
for pages
|
|
97
|
+
for orphan pages
|
|
97
98
|
each: (a) its `source-unit` exists in the roadmap or fix index — no match
|
|
98
99
|
is an **orphan** (low: propose deletion or re-attribution); (b) the
|
|
99
100
|
unit's PR merged **after** the page's `updated` date with commits touching
|
|
100
101
|
the page's subject paths — that page is **stale** (LOW: propose
|
|
101
|
-
|
|
102
|
+
). Cite page path + unit per finding.
|
|
102
103
|
14. **Commit format & dependency discipline.** Sample the unit branches'
|
|
103
104
|
commits: `<type>(<scope>): <summary>` conventional format (violations:
|
|
104
105
|
LOW). Every `in-progress`/`done` row's `Depends on:` closure was merged —
|
|
@@ -149,7 +150,7 @@ enables:
|
|
|
149
150
|
- **No slash-command menu** — where this skill says `/<skill>`, open that
|
|
150
151
|
skill's `SKILL.md` (wherever your agent installed the skills) and follow it
|
|
151
152
|
literally, in a fresh conversation: hand-offs assume a clean context.
|
|
152
|
-
- **No per-skill `model:`/`effort:`** —
|
|
153
|
+
- **No per-skill `model:`/`effort:`** — no skill pins a tier; pick tiers yourself:
|
|
153
154
|
these are mostly mechanical cross-document checks — a mid-tier model is
|
|
154
155
|
enough; escalate to your strongest only for a deep audit.
|
|
155
156
|
|
package/skills/audit-pr/SKILL.md
CHANGED
|
@@ -7,7 +7,7 @@ enables:
|
|
|
7
7
|
- **No slash-command menu** — where this skill says `/<skill>`, open that
|
|
8
8
|
skill's `SKILL.md` (wherever your agent installed the skills) and follow it
|
|
9
9
|
literally, in a fresh conversation: hand-offs assume a clean context.
|
|
10
|
-
- **No per-skill `model:`/`effort:`** —
|
|
10
|
+
- **No per-skill `model:`/`effort:`** — no skill pins a tier; pick tiers yourself:
|
|
11
11
|
the merge gate is the highest-stakes automated verdict — run it on your
|
|
12
12
|
**strongest** model, never on the cheap tier that wrote the code.
|
|
13
13
|
- **Receipt consumption is comment-based, not forge-branded.** The
|