@bluewombat/slot-kit 0.1.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 +99 -0
- package/dist/agent.d.ts +70 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +147 -0
- package/dist/agent.js.map +1 -0
- package/dist/argv.d.ts +43 -0
- package/dist/argv.d.ts.map +1 -0
- package/dist/argv.js +92 -0
- package/dist/argv.js.map +1 -0
- package/dist/emit.d.ts +61 -0
- package/dist/emit.d.ts.map +1 -0
- package/dist/emit.js +77 -0
- package/dist/emit.js.map +1 -0
- package/dist/finish.d.ts +26 -0
- package/dist/finish.d.ts.map +1 -0
- package/dist/finish.js +67 -0
- package/dist/finish.js.map +1 -0
- package/dist/glob.d.ts +3 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +37 -0
- package/dist/glob.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +36 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +72 -0
- package/dist/options.js.map +1 -0
- package/dist/plan.d.ts +23 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +94 -0
- package/dist/plan.js.map +1 -0
- package/dist/prompt.d.ts +64 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +142 -0
- package/dist/prompt.js.map +1 -0
- package/dist/role.d.ts +61 -0
- package/dist/role.d.ts.map +1 -0
- package/dist/role.js +134 -0
- package/dist/role.js.map +1 -0
- package/dist/transcript.d.ts +37 -0
- package/dist/transcript.d.ts.map +1 -0
- package/dist/transcript.js +101 -0
- package/dist/transcript.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA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,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;IACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,oDAAoD,EAAE,CAAC;IACrF,CAAC;IACD,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AAC5C,CAAC;AASD,oEAAoE;AACpE,MAAM,UAAU,aAAa,CAC3B,IAAuB,EACvB,OAAqB,EACrB,KAAwB;IAExB,MAAM,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC;IACrC,OAAO,cAAc,CAAC;QACpB,GAAG,EAAE,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC;QACzC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;QAChC,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;QAChC,GAAG,KAAK;KACT,CAAC,CAAC;AACL,CAAC"}
|
package/dist/role.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type AgentRun } from "./agent.js";
|
|
2
|
+
import { type OptionSpec, type OptionValues } from "./options.js";
|
|
3
|
+
import { type ReadTemplate, type Rendered } from "./prompt.js";
|
|
4
|
+
/**
|
|
5
|
+
* The role side of the role → agent split. A role slot fills a template and
|
|
6
|
+
* hands the rendered prompt to the agent command after `--`; the agent side
|
|
7
|
+
* (`AGENT_OPTIONS`, `readAgentPrompt`, `serializeRun`) is in `prompt.ts` and
|
|
8
|
+
* `agent.ts`. Both halves in one kit so a role written elsewhere can talk to a
|
|
9
|
+
* shipped agent, and the other way round.
|
|
10
|
+
*/
|
|
11
|
+
/** The flags every role takes: its template, and the rules it fills in. */
|
|
12
|
+
export declare const ROLE_OPTIONS: OptionSpec;
|
|
13
|
+
export type ParsedRole = {
|
|
14
|
+
ok: true;
|
|
15
|
+
options: OptionValues;
|
|
16
|
+
runner: string[];
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
reason: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* This slot's flags, and the agent command after `--`.
|
|
23
|
+
*
|
|
24
|
+
* Implementer / Breakdown flags are stripped first so `--intention` never
|
|
25
|
+
* lands in the agent argv: that command takes a filled prompt, not a Task.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseRole(argv: readonly string[], callerFlags: ReadonlySet<string>, name: string, extraSpec?: OptionSpec): ParsedRole;
|
|
28
|
+
/** The `--prompt-file` template, or the role's built-in one. */
|
|
29
|
+
export declare function loadPrompt(options: OptionValues, fallback: string): ReadTemplate;
|
|
30
|
+
/** The `--rules-file` text, or the role's built-in rules. */
|
|
31
|
+
export declare function loadRules(options: OptionValues, fallback: string): ReadTemplate;
|
|
32
|
+
/** `renderPrompt`, with the template's origin in the refusal so a typo is findable. */
|
|
33
|
+
export declare function fillPrompt(template: string, values: Record<string, string>, required: readonly string[], source: string): Rendered;
|
|
34
|
+
export type TranscriptExtras = {
|
|
35
|
+
id?: string | undefined;
|
|
36
|
+
attempt?: string | undefined;
|
|
37
|
+
context?: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
/** `--id`, `--attempt`, `--context` the agent CLI files a transcript under. */
|
|
40
|
+
export declare function transcriptArgs(argv: readonly string[], extras?: TranscriptExtras): string[];
|
|
41
|
+
export type AgentAbout = {
|
|
42
|
+
name: string;
|
|
43
|
+
bin: string;
|
|
44
|
+
};
|
|
45
|
+
export type SpawnedAgent = {
|
|
46
|
+
ok: true;
|
|
47
|
+
run: AgentRun;
|
|
48
|
+
about: AgentAbout;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
reason: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Spawn the agent command with the filled prompt as `--prompt-file`.
|
|
55
|
+
*
|
|
56
|
+
* The prompt goes in a file rather than argv so a long template cannot hit
|
|
57
|
+
* ARG_MAX. The agent's stdout is the serialized run; its stderr is inherited
|
|
58
|
+
* so the vendor's stream still reaches the operator.
|
|
59
|
+
*/
|
|
60
|
+
export declare function spawnFilled(runner: readonly string[], prompt: string, extraArgs?: readonly string[], cwd?: string): Promise<SpawnedAgent>;
|
|
61
|
+
//# sourceMappingURL=role.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAA8B,MAAM,YAAY,CAAC;AAEvE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAA4B,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAA8B,MAAM,aAAa,CAAC;AAE3F;;;;;;GAMG;AAEH,2EAA2E;AAC3E,eAAO,MAAM,YAAY,EAAE,UAG1B,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GACrD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,WAAW,EAAE,WA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AS,MAAM,EAAO,EACjC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAiCvB"}
|
package/dist/role.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { deserializeRun, readResult } from "./agent.js";
|
|
6
|
+
import { ownArgv, splitRunner, take } from "./argv.js";
|
|
7
|
+
import { parseOptions, textOption } from "./options.js";
|
|
8
|
+
import { readTemplate, renderPrompt } from "./prompt.js";
|
|
9
|
+
/**
|
|
10
|
+
* The role side of the role → agent split. A role slot fills a template and
|
|
11
|
+
* hands the rendered prompt to the agent command after `--`; the agent side
|
|
12
|
+
* (`AGENT_OPTIONS`, `readAgentPrompt`, `serializeRun`) is in `prompt.ts` and
|
|
13
|
+
* `agent.ts`. Both halves in one kit so a role written elsewhere can talk to a
|
|
14
|
+
* shipped agent, and the other way round.
|
|
15
|
+
*/
|
|
16
|
+
/** The flags every role takes: its template, and the rules it fills in. */
|
|
17
|
+
export const ROLE_OPTIONS = {
|
|
18
|
+
"--prompt-file": {},
|
|
19
|
+
"--rules-file": {},
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* This slot's flags, and the agent command after `--`.
|
|
23
|
+
*
|
|
24
|
+
* Implementer / Breakdown flags are stripped first so `--intention` never
|
|
25
|
+
* lands in the agent argv: that command takes a filled prompt, not a Task.
|
|
26
|
+
*/
|
|
27
|
+
export function parseRole(argv, callerFlags, name, extraSpec = {}) {
|
|
28
|
+
const tokens = ownArgv(argv, callerFlags);
|
|
29
|
+
const split = splitRunner(tokens);
|
|
30
|
+
if (!split.ok) {
|
|
31
|
+
return { ok: false, reason: `The ${name} needs an agent command after --.` };
|
|
32
|
+
}
|
|
33
|
+
const parsed = parseOptions(split.own, { ...ROLE_OPTIONS, ...extraSpec }, name);
|
|
34
|
+
if (!parsed.ok) {
|
|
35
|
+
return parsed;
|
|
36
|
+
}
|
|
37
|
+
return { ok: true, options: parsed.values, runner: split.runner };
|
|
38
|
+
}
|
|
39
|
+
/** The `--prompt-file` template, or the role's built-in one. */
|
|
40
|
+
export function loadPrompt(options, fallback) {
|
|
41
|
+
return readTemplate(textOption(options, "promptFile"), fallback);
|
|
42
|
+
}
|
|
43
|
+
/** The `--rules-file` text, or the role's built-in rules. */
|
|
44
|
+
export function loadRules(options, fallback) {
|
|
45
|
+
return readTemplate(textOption(options, "rulesFile"), fallback, "rules file");
|
|
46
|
+
}
|
|
47
|
+
/** `renderPrompt`, with the template's origin in the refusal so a typo is findable. */
|
|
48
|
+
export function fillPrompt(template, values, required, source) {
|
|
49
|
+
const rendered = renderPrompt(template, values, required);
|
|
50
|
+
if (!rendered.ok) {
|
|
51
|
+
return { ok: false, reason: `${rendered.reason} (${source})` };
|
|
52
|
+
}
|
|
53
|
+
return rendered;
|
|
54
|
+
}
|
|
55
|
+
/** `--id`, `--attempt`, `--context` the agent CLI files a transcript under. */
|
|
56
|
+
export function transcriptArgs(argv, extras = {}) {
|
|
57
|
+
const out = [];
|
|
58
|
+
const id = extras.id ?? take(argv, "--id");
|
|
59
|
+
const attempt = extras.attempt ?? take(argv, "--attempt");
|
|
60
|
+
const context = extras.context ?? take(argv, "--context");
|
|
61
|
+
if (id !== undefined) {
|
|
62
|
+
out.push("--id", id);
|
|
63
|
+
}
|
|
64
|
+
if (attempt !== undefined) {
|
|
65
|
+
out.push("--attempt", attempt);
|
|
66
|
+
}
|
|
67
|
+
if (context !== undefined) {
|
|
68
|
+
out.push("--context", context);
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Spawn the agent command with the filled prompt as `--prompt-file`.
|
|
74
|
+
*
|
|
75
|
+
* The prompt goes in a file rather than argv so a long template cannot hit
|
|
76
|
+
* ARG_MAX. The agent's stdout is the serialized run; its stderr is inherited
|
|
77
|
+
* so the vendor's stream still reaches the operator.
|
|
78
|
+
*/
|
|
79
|
+
export async function spawnFilled(runner, prompt, extraArgs = [], cwd = process.cwd()) {
|
|
80
|
+
const dir = mkdtempSync(join(tmpdir(), "prompt-"));
|
|
81
|
+
const promptFile = join(dir, "prompt.md");
|
|
82
|
+
writeFileSync(promptFile, prompt);
|
|
83
|
+
try {
|
|
84
|
+
const [file, ...args] = runner;
|
|
85
|
+
if (file === undefined) {
|
|
86
|
+
return { ok: false, reason: "The agent command is empty." };
|
|
87
|
+
}
|
|
88
|
+
const stdout = await collectStdout(file, [...args, "--prompt-file", promptFile, ...extraArgs], cwd);
|
|
89
|
+
if (!stdout.ok) {
|
|
90
|
+
return stdout;
|
|
91
|
+
}
|
|
92
|
+
const payload = readResult(stdout.value);
|
|
93
|
+
if (payload === undefined) {
|
|
94
|
+
return { ok: false, reason: "The agent command wrote no result." };
|
|
95
|
+
}
|
|
96
|
+
const run = deserializeRun(payload);
|
|
97
|
+
if (run === undefined) {
|
|
98
|
+
return {
|
|
99
|
+
ok: false,
|
|
100
|
+
reason: typeof payload.error === "string" ? payload.error : "The agent command wrote no result.",
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return { ok: true, run, about: aboutOf(payload) };
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
rmSync(dir, { recursive: true, force: true });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function aboutOf(payload) {
|
|
110
|
+
return {
|
|
111
|
+
name: typeof payload.name === "string" ? payload.name : "agent",
|
|
112
|
+
bin: typeof payload.bin === "string" ? payload.bin : "agent",
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function collectStdout(file, args, cwd) {
|
|
116
|
+
return new Promise((resolve) => {
|
|
117
|
+
const child = spawn(file, [...args], { cwd, stdio: ["ignore", "pipe", "inherit"] });
|
|
118
|
+
let stdout = "";
|
|
119
|
+
child.stdout?.setEncoding("utf8");
|
|
120
|
+
child.stdout?.on("data", (chunk) => {
|
|
121
|
+
stdout += chunk;
|
|
122
|
+
});
|
|
123
|
+
child.on("error", (error) => {
|
|
124
|
+
resolve({
|
|
125
|
+
ok: false,
|
|
126
|
+
reason: `Could not start the agent command at ${file}: ${error.message}`,
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
child.on("exit", () => {
|
|
130
|
+
resolve({ ok: true, value: stdout });
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=role.js.map
|
package/dist/role.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"role.js","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAiB,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAsC,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAoC,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3F;;;;;;GAMG;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,YAAY,GAAe;IACtC,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,EAAE;CACnB,CAAC;AAMF;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CACvB,IAAuB,EACvB,WAAgC,EAChC,IAAY,EACZ,YAAwB,EAAE;IAE1B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;I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O,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO;KAC7D,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,IAAY,EACZ,IAAuB,EACvB,GAAW;IAEX,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QACpF,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1B,OAAO,CAAC;gBACN,EAAE,EAAE,KAAK;gBACT,MAAM,EAAE,wCAAwC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE;aACzE,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;YACpB,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AgentRun } from "./agent.js";
|
|
2
|
+
/**
|
|
3
|
+
* One file per turn of the loop, written only when a Project asks for one.
|
|
4
|
+
*
|
|
5
|
+
* The journal Host keeps films the system: which phase ran, what each check
|
|
6
|
+
* answered. It cannot film this, because the prompt and the agent's answer
|
|
7
|
+
* exist nowhere but inside the slot — by the time a result reaches Host it is
|
|
8
|
+
* one word. Without them a loop that misbehaves cannot be read back, only
|
|
9
|
+
* guessed at.
|
|
10
|
+
*
|
|
11
|
+
* Off unless `dir` is given, and that is not caution for its own sake: a
|
|
12
|
+
* transcript is the project's own material — its code, its conventions, its
|
|
13
|
+
* failures — written to disk in the clear. Whoever turns it on should mean it.
|
|
14
|
+
*
|
|
15
|
+
* `parts` is what to keep. Timing is cheap and says nothing about the project,
|
|
16
|
+
* so it is worth keeping when the rest is not.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TRANSCRIPT_PARTS: readonly ["prompt", "stdout", "stderr", "timing"];
|
|
19
|
+
export type TranscriptPart = (typeof TRANSCRIPT_PARTS)[number];
|
|
20
|
+
export type TranscriptSpec = {
|
|
21
|
+
/** No directory, no transcript. */
|
|
22
|
+
dir?: string | undefined;
|
|
23
|
+
parts?: readonly string[] | undefined;
|
|
24
|
+
/** What this Task belongs to; one directory per context. */
|
|
25
|
+
context?: string | undefined;
|
|
26
|
+
id?: string | undefined;
|
|
27
|
+
attempt?: string | number | undefined;
|
|
28
|
+
slot?: string | undefined;
|
|
29
|
+
bin?: string | undefined;
|
|
30
|
+
args?: readonly string[] | undefined;
|
|
31
|
+
prompt?: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
export type Transcript = {
|
|
34
|
+
write: (run: AgentRun) => void;
|
|
35
|
+
};
|
|
36
|
+
export declare function openTranscript(spec: TranscriptSpec): Transcript;
|
|
37
|
+
//# sourceMappingURL=transcript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,mDAAoD,CAAC;AAElF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,MAAM,MAAM,cAAc,GAAG;IAC3B,mCAAmC;IACnC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACtC,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,CAAA;CAAE,CAAC;AAE5D,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,UAAU,CAqB/D"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* One file per turn of the loop, written only when a Project asks for one.
|
|
5
|
+
*
|
|
6
|
+
* The journal Host keeps films the system: which phase ran, what each check
|
|
7
|
+
* answered. It cannot film this, because the prompt and the agent's answer
|
|
8
|
+
* exist nowhere but inside the slot — by the time a result reaches Host it is
|
|
9
|
+
* one word. Without them a loop that misbehaves cannot be read back, only
|
|
10
|
+
* guessed at.
|
|
11
|
+
*
|
|
12
|
+
* Off unless `dir` is given, and that is not caution for its own sake: a
|
|
13
|
+
* transcript is the project's own material — its code, its conventions, its
|
|
14
|
+
* failures — written to disk in the clear. Whoever turns it on should mean it.
|
|
15
|
+
*
|
|
16
|
+
* `parts` is what to keep. Timing is cheap and says nothing about the project,
|
|
17
|
+
* so it is worth keeping when the rest is not.
|
|
18
|
+
*/
|
|
19
|
+
export const TRANSCRIPT_PARTS = ["prompt", "stdout", "stderr", "timing"];
|
|
20
|
+
export function openTranscript(spec) {
|
|
21
|
+
if (spec.dir === undefined) {
|
|
22
|
+
return { write() { } };
|
|
23
|
+
}
|
|
24
|
+
const dirName = spec.dir;
|
|
25
|
+
const parts = new Set(spec.parts ?? TRANSCRIPT_PARTS);
|
|
26
|
+
return {
|
|
27
|
+
write(run) {
|
|
28
|
+
try {
|
|
29
|
+
const dir = join(dirName, slug(spec.context ?? "no-context"));
|
|
30
|
+
mkdirSync(dir, { recursive: true });
|
|
31
|
+
const stamp = (run.startedAt ?? new Date()).toISOString().replace(/[-:]|\.\d+/g, "");
|
|
32
|
+
const name = `${slug(spec.id ?? "task")}-attempt-${spec.attempt ?? 1}-${stamp}.md`;
|
|
33
|
+
writeFileSync(join(dir, name), page(spec, run, parts));
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
// A transcript is a record of the run, not part of it. Losing one is
|
|
37
|
+
// worth a word on stderr and nothing more.
|
|
38
|
+
process.stderr.write(`Could not write the transcript: ${messageOf(error)}\n`);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function page(spec, run, parts) {
|
|
44
|
+
const lines = [`# ${spec.id ?? "task"} · attempt ${spec.attempt ?? 1}`, ""];
|
|
45
|
+
const facts = [
|
|
46
|
+
["context", spec.context],
|
|
47
|
+
["slot", spec.slot],
|
|
48
|
+
["agent", spec.bin],
|
|
49
|
+
];
|
|
50
|
+
if (parts.has("timing")) {
|
|
51
|
+
facts.push(["started", run.startedAt?.toISOString()], ["ended", run.endedAt?.toISOString()], [
|
|
52
|
+
"duration",
|
|
53
|
+
run.durationMs === undefined ? undefined : `${(run.durationMs / 1000).toFixed(1)}s`,
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
facts.push(["exit", run.error !== undefined ? `did not start: ${run.error.message}` : String(run.code)], ["signal", run.signal ?? undefined]);
|
|
57
|
+
for (const [name, value] of facts) {
|
|
58
|
+
if (value !== undefined && value !== null && value !== "") {
|
|
59
|
+
lines.push(`- ${name}: ${value}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (parts.has("prompt")) {
|
|
63
|
+
// The prompt is one of these arguments and has its own section below;
|
|
64
|
+
// repeated here it would bury the flags that say which model ran.
|
|
65
|
+
const shown = (spec.args ?? []).map((arg) => (arg === spec.prompt ? "<prompt>" : arg));
|
|
66
|
+
lines.push("", "## Invocation", "", block(shown.join(" ")));
|
|
67
|
+
lines.push("", "## Prompt", "", block(spec.prompt ?? ""));
|
|
68
|
+
}
|
|
69
|
+
if (parts.has("stdout")) {
|
|
70
|
+
lines.push("", "## stdout", "", block(run.stdout ?? ""));
|
|
71
|
+
}
|
|
72
|
+
if (parts.has("stderr")) {
|
|
73
|
+
lines.push("", "## stderr", "", block(run.stderr ?? ""));
|
|
74
|
+
}
|
|
75
|
+
return `${lines.join("\n")}\n`;
|
|
76
|
+
}
|
|
77
|
+
/** A fence longer than any run of backticks inside, so agent output survives it. */
|
|
78
|
+
function block(text) {
|
|
79
|
+
const body = text.trim();
|
|
80
|
+
if (body.length === 0) {
|
|
81
|
+
return "_(empty)_";
|
|
82
|
+
}
|
|
83
|
+
let longest = 0;
|
|
84
|
+
for (const found of body.matchAll(/`+/g)) {
|
|
85
|
+
longest = Math.max(longest, found[0].length);
|
|
86
|
+
}
|
|
87
|
+
const fence = "`".repeat(Math.max(3, longest + 1));
|
|
88
|
+
return `${fence}\n${body}\n${fence}`;
|
|
89
|
+
}
|
|
90
|
+
function slug(value) {
|
|
91
|
+
const cleaned = value
|
|
92
|
+
.trim()
|
|
93
|
+
.toLowerCase()
|
|
94
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
95
|
+
.replace(/^-+|-+$/g, "");
|
|
96
|
+
return cleaned.length === 0 ? "unnamed" : cleaned.slice(0, 80);
|
|
97
|
+
}
|
|
98
|
+
function messageOf(error) {
|
|
99
|
+
return error instanceof Error ? error.message : String(error);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=transcript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.js","sourceRoot":"","sources":["../src/transcript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAoBlF,MAAM,UAAU,cAAc,CAAC,IAAoB;IACjD,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,EAAE,KAAK,KAAI,CAAC,EAAE,CAAC;IACxB,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,IAAI,CAAC,KAAK,IAAI,gBAAgB,CAAC,CAAC;IAC9D,OAAO;QACL,KAAK,CAAC,GAAG;YACP,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,YAAY,CAAC,CAAC,CAAC;gBAC9D,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACpC,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBAC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AC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bluewombat/slot-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "What a Planner, Builder, or Gate written in Node needs to answer the Transformer that spawned it.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mason",
|
|
8
|
+
"bluewombat",
|
|
9
|
+
"plugin",
|
|
10
|
+
"slot"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"homepage": "https://github.com/tilap/bluewombat/tree/main/packages/host/slot-kit#readme",
|
|
14
|
+
"bugs": "https://github.com/tilap/bluewombat/issues",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/tilap/bluewombat.git",
|
|
18
|
+
"directory": "packages/host/slot-kit"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=24.20.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"lint": "biome check .",
|
|
39
|
+
"format": "biome check --write .",
|
|
40
|
+
"tsc": "tsc --noEmit",
|
|
41
|
+
"test": "tsx --test $(find src -name '*.test.ts')",
|
|
42
|
+
"build": "tsc -p tsconfig.build.json"
|
|
43
|
+
}
|
|
44
|
+
}
|