balladeer 1.0.14 → 1.0.16
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 +2 -0
- package/dist/behavior-map-schema.d.ts +107 -0
- package/dist/behavior-map-schema.js +232 -0
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +77 -2
- package/dist/commands/guidance.d.ts +1 -1
- package/dist/commands/guidance.js +6 -0
- package/dist/commands/judge.d.ts +271 -0
- package/dist/commands/judge.js +1170 -0
- package/dist/commands/map.d.ts +120 -0
- package/dist/commands/map.js +601 -0
- package/dist/commands/mcp.d.ts +6 -0
- package/dist/commands/mcp.js +53 -0
- package/dist/commands/offers.d.ts +265 -0
- package/dist/commands/offers.js +801 -0
- package/dist/commands/risk.d.ts +29 -0
- package/dist/commands/risk.js +133 -0
- package/dist/copy.d.ts +24 -1
- package/dist/copy.js +91 -0
- package/dist/guidance-hook.mjs +230 -74
- package/dist/guidance.d.ts +2 -0
- package/dist/guidance.js +7 -1
- package/dist/headless-agent.d.ts +166 -0
- package/dist/headless-agent.js +416 -0
- package/dist/hook-trust.d.ts +31 -0
- package/dist/hook-trust.js +63 -0
- package/dist/judge-brief.d.ts +36 -0
- package/dist/judge-brief.js +89 -0
- package/dist/judge-hook.d.ts +84 -0
- package/dist/judge-hook.js +420 -0
- package/dist/map-brief.d.ts +16 -0
- package/dist/map-brief.js +41 -0
- package/dist/offer-brief.d.ts +95 -0
- package/dist/offer-brief.js +217 -0
- package/dist/owned-process.d.ts +65 -0
- package/dist/owned-process.js +146 -0
- package/dist/promise-meaning.d.ts +126 -0
- package/dist/promise-meaning.js +292 -0
- package/dist/risk/contract.d.ts +145 -0
- package/dist/risk/contract.js +74 -0
- package/dist/risk/describe.d.ts +7 -0
- package/dist/risk/describe.js +45 -0
- package/dist/risk/diff.d.ts +26 -0
- package/dist/risk/diff.js +174 -0
- package/dist/risk/extract.d.ts +43 -0
- package/dist/risk/extract.js +336 -0
- package/dist/risk/git.d.ts +30 -0
- package/dist/risk/git.js +118 -0
- package/dist/risk/import-graph.d.ts +41 -0
- package/dist/risk/import-graph.js +487 -0
- package/dist/risk/index.d.ts +20 -0
- package/dist/risk/index.js +20 -0
- package/dist/risk/paths.d.ts +16 -0
- package/dist/risk/paths.js +73 -0
- package/dist/risk/pipeline.d.ts +47 -0
- package/dist/risk/pipeline.js +121 -0
- package/dist/risk/priors.d.ts +18 -0
- package/dist/risk/priors.js +86 -0
- package/dist/risk/resources.d.ts +56 -0
- package/dist/risk/resources.js +374 -0
- package/dist/risk/score.d.ts +85 -0
- package/dist/risk/score.js +543 -0
- package/dist/risk/symbols.d.ts +35 -0
- package/dist/risk/symbols.js +348 -0
- package/dist/risk/text.d.ts +43 -0
- package/dist/risk/text.js +277 -0
- package/dist/risk/validate.d.ts +19 -0
- package/dist/risk/validate.js +154 -0
- package/dist/scratch-worktree.d.ts +51 -0
- package/dist/scratch-worktree.js +153 -0
- package/dist/self-update.d.ts +29 -2
- package/dist/self-update.js +96 -11
- package/dist/user-scope.d.ts +2 -0
- package/dist/user-scope.js +26 -2
- package/dist/wire.d.ts +55 -2
- package/dist/wire.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type BehaviorMap } from "../behavior-map-schema.js";
|
|
2
|
+
import { type HeadlessAgentOptions, type HeadlessAgentResult, type HeadlessClient, type LoginCheck } from "../headless-agent.js";
|
|
3
|
+
import { type PromiseDocument, type PromiseReader } from "../promise-meaning.js";
|
|
4
|
+
/** Tools a map builder or a judge may use, and the ones refused whatever else is allowed. */
|
|
5
|
+
export declare const AGENT_TOOLS: readonly ["Read", "Grep", "Glob", "Bash"];
|
|
6
|
+
export declare const REFUSED_TOOL_RULES: readonly ["Bash(git push:*)", "Bash(gh:*)"];
|
|
7
|
+
export type MapArguments = Readonly<{
|
|
8
|
+
promiseId?: string;
|
|
9
|
+
all: boolean;
|
|
10
|
+
check: boolean;
|
|
11
|
+
stale: boolean;
|
|
12
|
+
fromFile?: string;
|
|
13
|
+
repo?: string;
|
|
14
|
+
out?: string;
|
|
15
|
+
client: HeadlessClient | "auto";
|
|
16
|
+
timeoutMs: number;
|
|
17
|
+
json: boolean;
|
|
18
|
+
repository?: string;
|
|
19
|
+
controlPlane: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const MAP_USAGE = " npx -y balladeer@latest map <promise id> | --all | --check | --stale\n [--from-file <promise.json>] [--repo <root>] [--out <dir>]\n [--client auto|claude|codex] [--timeout <seconds>] [--json]\n Build a behavior map for a promise with your own coding agent: where its\n behavior starts, the code on its path, what it depends on, the tests that\n exercise it and where each failing case would show. The agent works in a\n throwaway read-only checkout, on the Claude Code or Codex login already on\n this machine, and the map is written to .continuity/behavior-maps/<id>.json\n for your team to commit. It never leaves this machine. --all maps every\n agreed promise; --check reports maps whose code or meaning has moved\n (exit 1 when any has) and --stale prints just their ids, both without a\n model. --from-file reads the promise from a file instead of Balladeer.\n";
|
|
22
|
+
export declare function parseMapArguments(argv: readonly string[]): MapArguments;
|
|
23
|
+
export type MapDependencies = Readonly<{
|
|
24
|
+
runAgent?: (options: HeadlessAgentOptions) => Promise<HeadlessAgentResult>;
|
|
25
|
+
/** `null` means "no connection", without looking for one. */
|
|
26
|
+
reader?: PromiseReader | null;
|
|
27
|
+
now?: () => Date;
|
|
28
|
+
login?: LoginCheck;
|
|
29
|
+
}>;
|
|
30
|
+
export type BuildMapInput = Readonly<{
|
|
31
|
+
root: string;
|
|
32
|
+
promise: PromiseDocument;
|
|
33
|
+
client: HeadlessClient | "auto";
|
|
34
|
+
env: NodeJS.ProcessEnv;
|
|
35
|
+
timeoutMs: number;
|
|
36
|
+
prefer?: HeadlessClient;
|
|
37
|
+
login?: LoginCheck;
|
|
38
|
+
scratch?: string;
|
|
39
|
+
now?: () => Date;
|
|
40
|
+
runAgent?: (options: HeadlessAgentOptions) => Promise<HeadlessAgentResult>;
|
|
41
|
+
}>;
|
|
42
|
+
export type BuildMapResult = Readonly<{
|
|
43
|
+
ok: true;
|
|
44
|
+
map: BehaviorMap;
|
|
45
|
+
agent: HeadlessAgentResult;
|
|
46
|
+
dropped: string[];
|
|
47
|
+
/** Closed-list fields the agent filled with a word the contract does not have, read as the nearest allowed one. */
|
|
48
|
+
coerced: string[];
|
|
49
|
+
}> | Readonly<{
|
|
50
|
+
ok: false;
|
|
51
|
+
reason: string;
|
|
52
|
+
agent?: HeadlessAgentResult;
|
|
53
|
+
errors?: string[];
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* One promise's behavior map, built by the person's own agent from the code at
|
|
57
|
+
* HEAD, in a disposable checkout, and checked against the contract before it is
|
|
58
|
+
* returned. Nothing is written here; the caller decides where the map goes.
|
|
59
|
+
*/
|
|
60
|
+
export declare function buildBehaviorMap(input: BuildMapInput): Promise<BuildMapResult>;
|
|
61
|
+
export declare function agentFailure(agent: HeadlessAgentResult): string;
|
|
62
|
+
/**
|
|
63
|
+
* The agent's answer made into a map: the runner's own fields filled in, paths
|
|
64
|
+
* made repository-relative, and every entry whose file does not exist at the
|
|
65
|
+
* mapped commit dropped and named, because a map pointing at nothing reads as
|
|
66
|
+
* stale forever. The meaning excerpt is taken from the promise itself rather
|
|
67
|
+
* than from the agent's copy, so a transcription slip cannot change it.
|
|
68
|
+
*/
|
|
69
|
+
export declare function mapFromAgent(json: Record<string, unknown>, context: Readonly<{
|
|
70
|
+
promise: PromiseDocument;
|
|
71
|
+
sha: string;
|
|
72
|
+
client: HeadlessClient;
|
|
73
|
+
model: string;
|
|
74
|
+
at: string;
|
|
75
|
+
tree: string;
|
|
76
|
+
}>): {
|
|
77
|
+
map: unknown;
|
|
78
|
+
dropped: string[];
|
|
79
|
+
coerced: string[];
|
|
80
|
+
};
|
|
81
|
+
export type Staleness = Readonly<{
|
|
82
|
+
stale: boolean;
|
|
83
|
+
reasons: string[];
|
|
84
|
+
/** False when no current digest was available, so meaning drift is unanswered. */
|
|
85
|
+
digestChecked: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Whether a map still points at real code, answered without a model.
|
|
89
|
+
*
|
|
90
|
+
* Stale when a mapped symbol is no longer in its file (a plain search for its
|
|
91
|
+
* name, the way a person would grep for it), when a mapped file is gone, or,
|
|
92
|
+
* when the current digest is known, when the promise's meaning has moved on
|
|
93
|
+
* since the map was built.
|
|
94
|
+
*/
|
|
95
|
+
export declare function mapStaleness(root: string, map: BehaviorMap, currentDigest?: string): Staleness;
|
|
96
|
+
export type StoredMap = Readonly<{
|
|
97
|
+
promiseId: string;
|
|
98
|
+
path: string;
|
|
99
|
+
map?: BehaviorMap;
|
|
100
|
+
errors?: string[];
|
|
101
|
+
}>;
|
|
102
|
+
/** Every map in a directory, read and checked; an unreadable one is listed with why. */
|
|
103
|
+
export declare function readBehaviorMaps(directory: string): StoredMap[];
|
|
104
|
+
export declare function readBehaviorMap(root: string, promiseId: string): BehaviorMap | undefined;
|
|
105
|
+
export type MapOptions = Readonly<{
|
|
106
|
+
args: MapArguments;
|
|
107
|
+
cwd: string;
|
|
108
|
+
environment: NodeJS.ProcessEnv;
|
|
109
|
+
write: (text: string) => void;
|
|
110
|
+
deps?: MapDependencies;
|
|
111
|
+
}>;
|
|
112
|
+
/** `balladeer map`, from arguments already parsed. */
|
|
113
|
+
export declare function runMap(options: MapOptions): Promise<number>;
|
|
114
|
+
/** `balladeer map ...` from raw arguments, as `cli.ts` hands them over. */
|
|
115
|
+
export declare function mapCommand(argv: readonly string[], io: Readonly<{
|
|
116
|
+
cwd: string;
|
|
117
|
+
environment: NodeJS.ProcessEnv;
|
|
118
|
+
write: (text: string) => void;
|
|
119
|
+
error: (text: string) => void;
|
|
120
|
+
}>): Promise<number>;
|