specrails-core 5.6.0 → 6.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/README.md +27 -145
- package/bin/specrails-core.mjs +12 -554
- package/dist/agent-runtime/capabilities.js +0 -1
- package/dist/agent-runtime/cli-executor.d.ts +1 -1
- package/dist/agent-runtime/cli-executor.js +1 -2
- package/dist/agent-runtime/cli-process.js +0 -1
- package/dist/agent-runtime/cli.js +3 -4
- package/dist/agent-runtime/codex-schema.js +0 -1
- package/dist/agent-runtime/compact/architect.d.ts +3 -272
- package/dist/agent-runtime/compact/architect.js +8 -9
- package/dist/agent-runtime/compact/chat-client.d.ts +3 -3
- package/dist/agent-runtime/compact/chat-client.js +1 -2
- package/dist/agent-runtime/compact/developer.d.ts +3 -70
- package/dist/agent-runtime/compact/developer.js +13 -14
- package/dist/agent-runtime/compact/environment.d.ts +4 -5
- package/dist/agent-runtime/compact/environment.js +1 -2
- package/dist/agent-runtime/compact/exit-code-honesty.d.ts +2 -1
- package/dist/agent-runtime/compact/exit-code-honesty.js +0 -1
- package/dist/agent-runtime/compact/guarded-loop.d.ts +2 -18
- package/dist/agent-runtime/compact/guarded-loop.js +7 -8
- package/dist/agent-runtime/compact/prompt-inputs.d.ts +0 -2
- package/dist/agent-runtime/compact/prompt-inputs.js +1 -2
- package/dist/agent-runtime/compact/reviewer.d.ts +0 -13
- package/dist/agent-runtime/compact/reviewer.js +5 -6
- package/dist/agent-runtime/compact/step.d.ts +0 -1
- package/dist/agent-runtime/compact/step.js +1 -2
- package/dist/agent-runtime/compact/test-reachability.js +0 -1
- package/dist/agent-runtime/config.js +0 -1
- package/dist/agent-runtime/core-host.d.ts +1 -1
- package/dist/agent-runtime/core-host.js +1 -2
- package/dist/agent-runtime/durable-store.d.ts +0 -1
- package/dist/agent-runtime/durable-store.js +1 -2
- package/dist/agent-runtime/efficiency-summary.d.ts +2 -2
- package/dist/agent-runtime/efficiency-summary.js +1 -2
- package/dist/agent-runtime/efficiency-types.js +0 -1
- package/dist/agent-runtime/efficiency.js +0 -1
- package/dist/agent-runtime/evaluation-corpus.js +0 -1
- package/dist/agent-runtime/evaluation.d.ts +2 -1
- package/dist/agent-runtime/evaluation.js +1 -2
- package/dist/agent-runtime/executor-types.d.ts +1 -1
- package/dist/agent-runtime/executor-types.js +0 -1
- package/dist/agent-runtime/executors.js +0 -1
- package/dist/agent-runtime/gemini-policy.js +0 -1
- package/dist/agent-runtime/graph/artifacts.d.ts +1 -1
- package/dist/agent-runtime/graph/artifacts.js +1 -2
- package/dist/agent-runtime/graph/nodes.d.ts +1 -1
- package/dist/agent-runtime/graph/nodes.js +1 -2
- package/dist/agent-runtime/graph/review-policy.js +0 -1
- package/dist/agent-runtime/graph/roles.d.ts +2 -5
- package/dist/agent-runtime/graph/roles.js +2 -8
- package/dist/agent-runtime/graph/state.d.ts +1 -1
- package/dist/agent-runtime/graph/state.js +0 -1
- package/dist/agent-runtime/graph-checkpointer.d.ts +2 -1
- package/dist/agent-runtime/graph-checkpointer.js +0 -1
- package/dist/agent-runtime/guardrails.d.ts +3 -3
- package/dist/agent-runtime/guardrails.js +1 -2
- package/dist/agent-runtime/index.d.ts +1 -1
- package/dist/agent-runtime/index.js +1 -2
- package/dist/agent-runtime/kimi-acp.js +1 -2
- package/dist/agent-runtime/kimi-model.d.ts +6 -0
- package/dist/agent-runtime/kimi-model.js +12 -0
- package/dist/agent-runtime/openai-executor.d.ts +0 -9
- package/dist/agent-runtime/openai-executor.js +6 -7
- package/dist/agent-runtime/openspec-tool-server.js +1 -2
- package/dist/agent-runtime/openspec.d.ts +0 -2
- package/dist/agent-runtime/openspec.js +1 -6
- package/dist/agent-runtime/prompts.d.ts +4 -3
- package/dist/agent-runtime/prompts.js +0 -1
- package/dist/agent-runtime/provider-diagnostic.js +1 -2
- package/dist/agent-runtime/recovery.js +1 -2
- package/dist/agent-runtime/repository-context.d.ts +1 -1
- package/dist/agent-runtime/repository-context.js +0 -1
- package/dist/agent-runtime/review-context.d.ts +1 -1
- package/dist/agent-runtime/review-context.js +0 -1
- package/dist/agent-runtime/role-routing.js +0 -1
- package/dist/agent-runtime/role-state.js +0 -1
- package/dist/agent-runtime/runtime-identity.js +1 -2
- package/dist/agent-runtime/tool-event.js +0 -1
- package/dist/agent-runtime/verification-plan.d.ts +5 -4
- package/dist/agent-runtime/verification-plan.js +1 -2
- package/dist/agent-runtime/workflow-types.js +0 -1
- package/dist/agent-runtime/workflow.js +0 -1
- package/dist/agent-runtime/workspace-tools.d.ts +2 -2
- package/dist/agent-runtime/workspace-tools.js +1 -2
- package/dist/installer/cli.d.ts +3 -32
- package/dist/installer/cli.js +26 -101
- package/dist/installer/commands/framework.d.ts +4 -3
- package/dist/installer/commands/framework.js +0 -1
- package/dist/installer/commands/init.d.ts +4 -25
- package/dist/installer/commands/init.js +5 -8
- package/dist/installer/phases/framework-lifecycle.d.ts +3 -17
- package/dist/installer/phases/framework-lifecycle.js +2 -3
- package/dist/installer/phases/install-config.d.ts +7 -8
- package/dist/installer/phases/install-config.js +2 -7
- package/dist/installer/phases/manifest.d.ts +6 -7
- package/dist/installer/phases/manifest.js +2 -7
- package/dist/installer/phases/prereqs.d.ts +6 -7
- package/dist/installer/phases/prereqs.js +4 -6
- package/dist/installer/phases/provider-detect.d.ts +6 -7
- package/dist/installer/phases/provider-detect.js +2 -4
- package/dist/installer/phases/scaffold.d.ts +9 -10
- package/dist/installer/phases/scaffold.js +82 -805
- package/dist/installer/util/errors.js +0 -1
- package/dist/installer/util/exec.d.ts +3 -2
- package/dist/installer/util/exec.js +0 -1
- package/dist/installer/util/fs.d.ts +0 -10
- package/dist/installer/util/fs.js +1 -2
- package/dist/installer/util/git.js +0 -1
- package/dist/installer/util/install-transaction.d.ts +2 -2
- package/dist/installer/util/install-transaction.js +1 -2
- package/dist/installer/util/logger.d.ts +1 -3
- package/dist/installer/util/logger.js +0 -1
- package/dist/installer/util/paths.js +0 -1
- package/dist/installer/util/registry.d.ts +4 -8
- package/dist/installer/util/registry.js +2 -3
- package/dist/{installer/runtime → pipeline}/pipeline-state.js +0 -3
- package/dist/shared/args.d.ts +18 -0
- package/dist/shared/args.js +53 -0
- package/integration-contract.json +10 -46
- package/package.json +3 -10
- package/templates/agents/sr-architect.md +15 -310
- package/templates/agents/sr-developer.md +15 -269
- package/templates/agents/sr-reviewer.md +13 -367
- package/templates/codex-skills/rails/sr-architect/SKILL.md +14 -308
- package/templates/codex-skills/rails/sr-developer/SKILL.md +14 -201
- package/templates/codex-skills/rails/sr-reviewer/SKILL.md +15 -289
- package/templates/kimi/specrails/run-skill.mjs +91 -2173
- package/bin/tui-installer.mjs +0 -430
- package/commands/doctor.md +0 -62
- package/dist/agent-runtime/capabilities.js.map +0 -1
- package/dist/agent-runtime/cli-executor.js.map +0 -1
- package/dist/agent-runtime/cli-process.js.map +0 -1
- package/dist/agent-runtime/cli.js.map +0 -1
- package/dist/agent-runtime/codex-schema.js.map +0 -1
- package/dist/agent-runtime/compact/architect.js.map +0 -1
- package/dist/agent-runtime/compact/chat-client.js.map +0 -1
- package/dist/agent-runtime/compact/developer.js.map +0 -1
- package/dist/agent-runtime/compact/environment.js.map +0 -1
- package/dist/agent-runtime/compact/exit-code-honesty.js.map +0 -1
- package/dist/agent-runtime/compact/guarded-loop.js.map +0 -1
- package/dist/agent-runtime/compact/prompt-inputs.js.map +0 -1
- package/dist/agent-runtime/compact/reviewer.js.map +0 -1
- package/dist/agent-runtime/compact/step.js.map +0 -1
- package/dist/agent-runtime/compact/test-reachability.js.map +0 -1
- package/dist/agent-runtime/config.js.map +0 -1
- package/dist/agent-runtime/core-host.js.map +0 -1
- package/dist/agent-runtime/durable-store.js.map +0 -1
- package/dist/agent-runtime/efficiency-summary.js.map +0 -1
- package/dist/agent-runtime/efficiency-types.js.map +0 -1
- package/dist/agent-runtime/efficiency.js.map +0 -1
- package/dist/agent-runtime/evaluation-corpus.js.map +0 -1
- package/dist/agent-runtime/evaluation.js.map +0 -1
- package/dist/agent-runtime/executor-types.js.map +0 -1
- package/dist/agent-runtime/executors.js.map +0 -1
- package/dist/agent-runtime/gemini-policy.js.map +0 -1
- package/dist/agent-runtime/graph/artifacts.js.map +0 -1
- package/dist/agent-runtime/graph/nodes.js.map +0 -1
- package/dist/agent-runtime/graph/review-policy.js.map +0 -1
- package/dist/agent-runtime/graph/roles.js.map +0 -1
- package/dist/agent-runtime/graph/state.js.map +0 -1
- package/dist/agent-runtime/graph-checkpointer.js.map +0 -1
- package/dist/agent-runtime/guardrails.js.map +0 -1
- package/dist/agent-runtime/index.js.map +0 -1
- package/dist/agent-runtime/kimi-acp.js.map +0 -1
- package/dist/agent-runtime/openai-executor.js.map +0 -1
- package/dist/agent-runtime/openspec-tool-server.js.map +0 -1
- package/dist/agent-runtime/openspec.js.map +0 -1
- package/dist/agent-runtime/prompts.js.map +0 -1
- package/dist/agent-runtime/provider-diagnostic.js.map +0 -1
- package/dist/agent-runtime/recovery.js.map +0 -1
- package/dist/agent-runtime/repository-context.js.map +0 -1
- package/dist/agent-runtime/review-context.js.map +0 -1
- package/dist/agent-runtime/role-routing.js.map +0 -1
- package/dist/agent-runtime/role-state.js.map +0 -1
- package/dist/agent-runtime/runtime-identity.js.map +0 -1
- package/dist/agent-runtime/tool-event.js.map +0 -1
- package/dist/agent-runtime/verification-plan.js.map +0 -1
- package/dist/agent-runtime/workflow-types.js.map +0 -1
- package/dist/agent-runtime/workflow.js.map +0 -1
- package/dist/agent-runtime/workspace-tools.js.map +0 -1
- package/dist/installer/cli.js.map +0 -1
- package/dist/installer/commands/doctor.d.ts +0 -27
- package/dist/installer/commands/doctor.js +0 -615
- package/dist/installer/commands/doctor.js.map +0 -1
- package/dist/installer/commands/framework.js.map +0 -1
- package/dist/installer/commands/init.js.map +0 -1
- package/dist/installer/commands/update.d.ts +0 -56
- package/dist/installer/commands/update.js +0 -257
- package/dist/installer/commands/update.js.map +0 -1
- package/dist/installer/commands/v5-migration.d.ts +0 -32
- package/dist/installer/commands/v5-migration.js +0 -133
- package/dist/installer/commands/v5-migration.js.map +0 -1
- package/dist/installer/phases/framework-lifecycle.js.map +0 -1
- package/dist/installer/phases/install-config.js.map +0 -1
- package/dist/installer/phases/manifest.js.map +0 -1
- package/dist/installer/phases/prereqs.js.map +0 -1
- package/dist/installer/phases/provider-detect.js.map +0 -1
- package/dist/installer/phases/scaffold.js.map +0 -1
- package/dist/installer/runtime/kimi.d.ts +0 -84
- package/dist/installer/runtime/kimi.js +0 -255
- package/dist/installer/runtime/kimi.js.map +0 -1
- package/dist/installer/runtime/pipeline-state.js.map +0 -1
- package/dist/installer/util/errors.js.map +0 -1
- package/dist/installer/util/exec.js.map +0 -1
- package/dist/installer/util/fs.js.map +0 -1
- package/dist/installer/util/git.js.map +0 -1
- package/dist/installer/util/install-transaction.js.map +0 -1
- package/dist/installer/util/logger.js.map +0 -1
- package/dist/installer/util/paths.js.map +0 -1
- package/dist/installer/util/prompts.d.ts +0 -23
- package/dist/installer/util/prompts.js +0 -49
- package/dist/installer/util/prompts.js.map +0 -1
- package/dist/installer/util/registry.js.map +0 -1
- package/dist/installer/util/template.d.ts +0 -23
- package/dist/installer/util/template.js +0 -60
- package/dist/installer/util/template.js.map +0 -1
- package/docs/README.md +0 -40
- package/docs/agent-runtime-efficiency.md +0 -65
- package/docs/agent-runtime.md +0 -393
- package/docs/agents.md +0 -315
- package/docs/changelog.md +0 -168
- package/docs/ci-cd.md +0 -60
- package/docs/concepts.md +0 -183
- package/docs/customization.md +0 -363
- package/docs/deployment.md +0 -234
- package/docs/getting-started.md +0 -122
- package/docs/installation.md +0 -395
- package/docs/local-tickets.md +0 -191
- package/docs/migration-guide.md +0 -140
- package/docs/playbook-oss-maintainer.md +0 -112
- package/docs/playbook-parallel-dev.md +0 -124
- package/docs/playbook-product-discovery.md +0 -115
- package/docs/plugin-architecture.md +0 -144
- package/docs/research/codex-compatibility-analysis.md +0 -365
- package/docs/research/mcp-feasibility-analysis.md +0 -382
- package/docs/testing/test-matrix-codex.md +0 -130
- package/docs/updating.md +0 -89
- package/docs/user-docs/cli-reference.md +0 -428
- package/docs/user-docs/codex-vs-claude-code.md +0 -23
- package/docs/user-docs/core-updates.md +0 -70
- package/docs/user-docs/faq.md +0 -146
- package/docs/user-docs/getting-started-codex.md +0 -194
- package/docs/user-docs/getting-started-kimi.md +0 -423
- package/docs/user-docs/installation.md +0 -237
- package/docs/user-docs/provider-pipelines.md +0 -96
- package/docs/user-docs/quick-start.md +0 -161
- package/docs/windows.md +0 -78
- package/docs/workflows.md +0 -463
- package/schemas/profile.v1.json +0 -207
- package/templates/claude-md/CLAUDE-quickstart.md +0 -54
- package/templates/claude-md/root.md +0 -50
- package/templates/codex-skills/batch-implement/SKILL.md +0 -38
- package/templates/codex-skills/implement/SKILL.md +0 -38
- package/templates/codex-skills/retry/SKILL.md +0 -16
- package/templates/commands/specrails/compat-check.md +0 -271
- package/templates/commands/specrails/doctor.md +0 -62
- package/templates/commands/specrails/explore-spec.md +0 -173
- package/templates/commands/specrails/health-check.md +0 -527
- package/templates/commands/specrails/memory-inspect.md +0 -261
- package/templates/commands/specrails/opsx-diff.md +0 -419
- package/templates/commands/specrails/propose-spec.md +0 -102
- package/templates/commands/specrails/refactor-recommender.md +0 -169
- package/templates/commands/specrails/telemetry.md +0 -553
- package/templates/commands/specrails/why.md +0 -96
- package/templates/gemini-commands/batch-implement.toml +0 -37
- package/templates/gemini-commands/implement.toml +0 -37
- package/templates/gemini-commands/retry.toml +0 -15
- package/templates/profiles/default.json +0 -14
- package/templates/profiles/kimi-default.json +0 -15
- package/templates/rules/layer.md +0 -8
- package/templates/runtime/provider-pipeline.md +0 -113
- package/templates/security/security-exemptions.yaml +0 -20
- package/templates/settings/confidence-config.json +0 -17
- package/templates/settings/settings.json +0 -15
- /package/dist/{installer/runtime → pipeline}/pipeline-state.d.ts +0 -0
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { type AgentEvent } from '../executor-types.js';
|
|
2
2
|
import { type ChatClient, type ChatMessage } from './chat-client.js';
|
|
3
3
|
export declare const DEFAULT_CONTEXT_WINDOW_TOKENS = 32768;
|
|
4
|
-
|
|
5
|
-
export declare const REPEAT_WARN_AT = 3;
|
|
6
|
-
/** Total identical calls that abort the step. */
|
|
7
|
-
export declare const REPEAT_ABORT_AT = 5;
|
|
8
|
-
export interface ToolLoopOptions {
|
|
4
|
+
interface ToolLoopOptions {
|
|
9
5
|
client: ChatClient;
|
|
10
6
|
/** Mutated in place: assistant, tool and nudge messages are appended. */
|
|
11
7
|
messages: ChatMessage[];
|
|
@@ -34,25 +30,12 @@ export interface ToolLoopOptions {
|
|
|
34
30
|
extraCalls: number;
|
|
35
31
|
};
|
|
36
32
|
}
|
|
37
|
-
/** Default output budget of one tool turn. A tool turn should emit a tool call or a short reply, so this is a runaway guard, not a ceiling for real work; a connection whose model thinks privately (that counts against `max_tokens`) raises it with `maxOutputTokens`. */
|
|
38
|
-
export declare const TOOL_TURN_MAX_OUTPUT = 8192;
|
|
39
|
-
/**
|
|
40
|
-
* `max_tokens` counts INSIDE the context window (prompt + output ≤ window), so
|
|
41
|
-
* a budget wider than what remains makes llama.cpp refuse the request
|
|
42
|
-
* ("exceeds the available context size") instead of helping. Bound every
|
|
43
|
-
* request to the room actually left; never below a minimal useful reply.
|
|
44
|
-
*/
|
|
45
|
-
export declare function boundedOutputBudget(requested: number, contextWindowTokens: number, messages: readonly ChatMessage[]): number;
|
|
46
|
-
/** Consecutive rewrites of one path (no other tool call between them) before the loop refuses the next one. */
|
|
47
|
-
export declare const REWRITE_WARN_AT = 3;
|
|
48
33
|
export interface ToolLoopResult {
|
|
49
34
|
text: string;
|
|
50
35
|
toolCalls: number;
|
|
51
36
|
}
|
|
52
37
|
/** Estimated tokens for the transcript: chars/4, which is what small local servers count against. */
|
|
53
38
|
export declare function estimateTokens(messages: ChatMessage[]): number;
|
|
54
|
-
/** One correct example the model can copy when its arguments were rejected. */
|
|
55
|
-
export declare function toolExample(name: string): string;
|
|
56
39
|
/** Schema-level argument repair: returns the error the model receives instead of executing. */
|
|
57
40
|
export declare function validateToolArguments(name: string, raw: string, available: Set<string>): {
|
|
58
41
|
args: Record<string, unknown>;
|
|
@@ -71,3 +54,4 @@ export declare function compactMessages(messages: ChatMessage[], contextWindowTo
|
|
|
71
54
|
* context compaction against the provider's window.
|
|
72
55
|
*/
|
|
73
56
|
export declare function runToolLoop(options: ToolLoopOptions): Promise<ToolLoopResult>;
|
|
57
|
+
export {};
|
|
@@ -4,15 +4,15 @@ import { AgentExecutionError } from '../executor-types.js';
|
|
|
4
4
|
import { record } from './chat-client.js';
|
|
5
5
|
export const DEFAULT_CONTEXT_WINDOW_TOKENS = 32_768;
|
|
6
6
|
/** Consecutive identical calls answered with an error instead of executing. */
|
|
7
|
-
|
|
7
|
+
const REPEAT_WARN_AT = 3;
|
|
8
8
|
/** Total identical calls that abort the step. */
|
|
9
|
-
|
|
9
|
+
const REPEAT_ABORT_AT = 5;
|
|
10
10
|
const COMPACTION_RATIO = 0.7;
|
|
11
11
|
const PROTECTED_TAIL = 4;
|
|
12
12
|
const PLACEHOLDER_QUERIES = new Set(['.', '*', '**', '.*', '..', '?', 'query', '<query>']);
|
|
13
13
|
const NUDGE = 'Your reply was empty. Reply with the final result now, as requested; do not call tools.';
|
|
14
14
|
/** Default output budget of one tool turn. A tool turn should emit a tool call or a short reply, so this is a runaway guard, not a ceiling for real work; a connection whose model thinks privately (that counts against `max_tokens`) raises it with `maxOutputTokens`. */
|
|
15
|
-
|
|
15
|
+
const TOOL_TURN_MAX_OUTPUT = 8192;
|
|
16
16
|
/** Headroom kept between the transcript and the context window when bounding an output budget. */
|
|
17
17
|
const OUTPUT_HEADROOM_TOKENS = 512;
|
|
18
18
|
/**
|
|
@@ -21,7 +21,7 @@ const OUTPUT_HEADROOM_TOKENS = 512;
|
|
|
21
21
|
* ("exceeds the available context size") instead of helping. Bound every
|
|
22
22
|
* request to the room actually left; never below a minimal useful reply.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
function boundedOutputBudget(requested, contextWindowTokens, messages) {
|
|
25
25
|
const remaining = contextWindowTokens - estimateTokens(messages) - OUTPUT_HEADROOM_TOKENS;
|
|
26
26
|
return Math.max(256, Math.min(requested, remaining));
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ const EFFORT_STEP_DOWN = { high: 'medium', medium: 'low' };
|
|
|
29
29
|
/** Tools whose result is a pure function of the workspace: safe to answer a repeated call with a pointer to the earlier identical result. */
|
|
30
30
|
const READ_TOOLS = new Set(['read_file', 'read_lines', 'search_text', 'get_diff', 'list_files']);
|
|
31
31
|
/** Consecutive rewrites of one path (no other tool call between them) before the loop refuses the next one. */
|
|
32
|
-
|
|
32
|
+
const REWRITE_WARN_AT = 3;
|
|
33
33
|
/** Whole-file rewrites only: iterating a file with apply_patch between reads is the normal edit flow. */
|
|
34
34
|
const WRITE_TOOLS = new Set(['write_file']);
|
|
35
35
|
/** The rewrite streak keys on the file NAME: a model alternating `tests/x.test.js` with an invented `repo/tests/x.test.js` (observed, 7 rewrites) is still rewriting one file. */
|
|
@@ -58,7 +58,7 @@ export function estimateTokens(messages) {
|
|
|
58
58
|
return Math.ceil(messages.reduce((total, message) => total + JSON.stringify(message).length, 0) / 4);
|
|
59
59
|
}
|
|
60
60
|
/** One correct example the model can copy when its arguments were rejected. */
|
|
61
|
-
|
|
61
|
+
function toolExample(name) {
|
|
62
62
|
switch (name) {
|
|
63
63
|
case 'search_text': return '{"path":".","query":"functionName"}';
|
|
64
64
|
case 'read_lines': return '{"path":"src/index.ts","startLine":1,"endLine":120}';
|
|
@@ -235,7 +235,7 @@ export async function runToolLoop(options) {
|
|
|
235
235
|
options.onToolCall?.();
|
|
236
236
|
calls.set(item.id, { name: item.name, args: item.arguments });
|
|
237
237
|
options.onEvent?.(toolEvent(item.name, item.arguments));
|
|
238
|
-
const key = item.name + '
|
|
238
|
+
const key = item.name + '\0' + item.arguments.replace(/\s+/g, '');
|
|
239
239
|
consecutive = key === previous ? consecutive + 1 : 1;
|
|
240
240
|
previous = key;
|
|
241
241
|
const total = (totals.get(key) ?? 0) + 1;
|
|
@@ -317,4 +317,3 @@ export async function runToolLoop(options) {
|
|
|
317
317
|
}
|
|
318
318
|
throw new AgentExecutionError(`Agent exhausted ${options.maxTurns} turns without a final result`, 'max_turns', client.usage);
|
|
319
319
|
}
|
|
320
|
-
//# sourceMappingURL=guarded-loop.js.map
|
|
@@ -36,7 +36,5 @@ export interface PromptInputs {
|
|
|
36
36
|
status: 'added' | 'changed' | 'deleted';
|
|
37
37
|
}>;
|
|
38
38
|
}
|
|
39
|
-
/** Text of one `## Heading` section up to the next heading (or terminator), without the heading line. */
|
|
40
|
-
export declare function section(prompt: string, heading: string): string;
|
|
41
39
|
export declare function bounded(text: string, limit: number): string;
|
|
42
40
|
export declare function extractPromptInputs(prompt: string): PromptInputs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RE_REVIEW_MARKER } from '../prompts.js';
|
|
2
2
|
const STOP = /^(## |Planning policy:|Current frozen acceptance obligations)/;
|
|
3
3
|
/** Text of one `## Heading` section up to the next heading (or terminator), without the heading line. */
|
|
4
|
-
|
|
4
|
+
function section(prompt, heading) {
|
|
5
5
|
const lines = prompt.split('\n');
|
|
6
6
|
const start = lines.findIndex(line => line.trim() === heading);
|
|
7
7
|
if (start < 0)
|
|
@@ -56,4 +56,3 @@ export function extractPromptInputs(prompt) {
|
|
|
56
56
|
reReviewChanges: parseReReviewChanges(prompt),
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
//# sourceMappingURL=prompt-inputs.js.map
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import type { AgentResult } from '../executor-types.js';
|
|
2
2
|
import { type CompactEnv } from './step.js';
|
|
3
|
-
/** Tool calls the reviewer may spend inspecting beyond the supplied diff. */
|
|
4
|
-
export declare const DEFAULT_REVIEW_TOOL_BUDGET = 15;
|
|
5
|
-
/** A re-review only opens the changed files. */
|
|
6
|
-
export declare const RE_REVIEW_TOOL_BUDGET = 6;
|
|
7
|
-
/** Working-tree changes of every allowed root against HEAD, plus the content of new files, bounded. `only` restricts the diff and the new-file listing to those repository-relative paths (a re-review reads just what the fixer touched). */
|
|
8
|
-
export declare function collectDiff(roots: string[], only?: readonly string[]): string;
|
|
9
|
-
/** The gate thresholds the host rendered into the reviewer prompt (`score is at least N`, `aspect ≥ N`). */
|
|
10
|
-
export declare function reviewGateThresholds(gate: string): {
|
|
11
|
-
minScore: number;
|
|
12
|
-
aspects: Record<string, number>;
|
|
13
|
-
};
|
|
14
|
-
/** Files named by the previous review's issues (`path: what must change` lines under `## Previous review`). */
|
|
15
|
-
export declare function previousIssueFiles(feedback: string): string[];
|
|
16
3
|
/**
|
|
17
4
|
* The compact reviewer: the host supplies the diff and the frozen criteria, the
|
|
18
5
|
* model inspects read-only within a small budget, and the verdict is forced
|
|
@@ -8,14 +8,14 @@ import { hasBinaryAssets } from './architect.js';
|
|
|
8
8
|
import { bounded } from './prompt-inputs.js';
|
|
9
9
|
import { finalJson, openspecCall, strings, text, toolStep } from './step.js';
|
|
10
10
|
/** Tool calls the reviewer may spend inspecting beyond the supplied diff. */
|
|
11
|
-
|
|
11
|
+
const DEFAULT_REVIEW_TOOL_BUDGET = 15;
|
|
12
12
|
/** A re-review only opens the changed files. */
|
|
13
|
-
|
|
13
|
+
const RE_REVIEW_TOOL_BUDGET = 6;
|
|
14
14
|
const DIFF_LIMIT = 40 * 1024;
|
|
15
15
|
const UNTRACKED_LIMIT = 8 * 1024;
|
|
16
16
|
const MAX_UNTRACKED = 12;
|
|
17
17
|
/** Working-tree changes of every allowed root against HEAD, plus the content of new files, bounded. `only` restricts the diff and the new-file listing to those repository-relative paths (a re-review reads just what the fixer touched). */
|
|
18
|
-
|
|
18
|
+
function collectDiff(roots, only) {
|
|
19
19
|
// Pathspec magic stays enabled so openspec/ artifacts are excluded from the reviewed diff.
|
|
20
20
|
const env = { ...Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.toUpperCase().startsWith('GIT_'))), GIT_OPTIONAL_LOCKS: '0' };
|
|
21
21
|
const options = { encoding: 'utf8', env, windowsHide: true, timeout: 10_000, maxBuffer: 4 * 1024 * 1024 };
|
|
@@ -62,7 +62,7 @@ export function collectDiff(roots, only) {
|
|
|
62
62
|
return sections.join('\n\n');
|
|
63
63
|
}
|
|
64
64
|
/** The gate thresholds the host rendered into the reviewer prompt (`score is at least N`, `aspect ≥ N`). */
|
|
65
|
-
|
|
65
|
+
function reviewGateThresholds(gate) {
|
|
66
66
|
const minScore = Number(/score\` is at least (\d+)/.exec(gate)?.[1] ?? 0);
|
|
67
67
|
const aspects = {};
|
|
68
68
|
for (const match of gate.matchAll(/`([a-z_]+)` ≥ (\d+)/g))
|
|
@@ -70,7 +70,7 @@ export function reviewGateThresholds(gate) {
|
|
|
70
70
|
return { minScore, aspects };
|
|
71
71
|
}
|
|
72
72
|
/** Files named by the previous review's issues (`path: what must change` lines under `## Previous review`). */
|
|
73
|
-
|
|
73
|
+
function previousIssueFiles(feedback) {
|
|
74
74
|
const section = feedback.split('## Previous review')[1] ?? '';
|
|
75
75
|
return [...new Set([...section.matchAll(/(?:^|[\s-])((?:[\w.-]+\/)*[\w.-]+\.(?:[cm]?[jt]sx?|py|go|rs|java|kt|swift|cs|rb|php|c|cc|cpp|h|hpp|vue|svelte|html|css|scss|json|ya?ml|md))(?=[\s:,;)]|$)/g)].map(match => match[1].replace(/\\/g, '/')))];
|
|
76
76
|
}
|
|
@@ -175,4 +175,3 @@ export async function runCompactReviewer(env, options = {}) {
|
|
|
175
175
|
};
|
|
176
176
|
return { text: JSON.stringify(structured), usage: env.client.usage, structured };
|
|
177
177
|
}
|
|
178
|
-
//# sourceMappingURL=reviewer.js.map
|
|
@@ -26,7 +26,6 @@ export interface CompactEnv {
|
|
|
26
26
|
}
|
|
27
27
|
/** Shorthand for the guards: `on(env, 'empty-write')`. */
|
|
28
28
|
export declare function on(env: Pick<CompactEnv, 'guardrails'>, id: GuardrailId): boolean;
|
|
29
|
-
export declare const COMPACT_STANCE = "You are one step of a Specrails pipeline driven by a host program. Keep replies short and concrete. Never invent files, paths or commands: everything you state must come from the inputs or from tool results. When asked for JSON, reply with exactly one JSON object and nothing else.";
|
|
30
29
|
/** One host-driven `openspec_workflow` call, visible in the host log like a model tool call. */
|
|
31
30
|
export declare function openspecCall(env: CompactEnv, input: Parameters<OpenSpecTools['execute']>[0]): Promise<unknown>;
|
|
32
31
|
/** A tool-less structured call with one tolerant retry; the object is validated by the caller. */
|
|
@@ -6,7 +6,7 @@ import { record } from './chat-client.js';
|
|
|
6
6
|
import { runToolLoop } from './guarded-loop.js';
|
|
7
7
|
/** Shorthand for the guards: `on(env, 'empty-write')`. */
|
|
8
8
|
export function on(env, id) { return guardrailEnabled(env.guardrails, id); }
|
|
9
|
-
|
|
9
|
+
const COMPACT_STANCE = 'You are one step of a Specrails pipeline driven by a host program. Keep replies short and concrete. Never invent files, paths or commands: everything you state must come from the inputs or from tool results. When asked for JSON, reply with exactly one JSON object and nothing else.';
|
|
10
10
|
/** One host-driven `openspec_workflow` call, visible in the host log like a model tool call. */
|
|
11
11
|
export async function openspecCall(env, input) {
|
|
12
12
|
env.onEvent?.(toolEvent('openspec_workflow', input));
|
|
@@ -133,4 +133,3 @@ export function strings(value, limit, each = 1000) {
|
|
|
133
133
|
return Array.isArray(value) ? value.filter((item) => typeof item === 'string' && item.trim().length > 0).map(item => item.trim().slice(0, each)).slice(0, limit) : [];
|
|
134
134
|
}
|
|
135
135
|
export function text(value, fallback = '') { return typeof value === 'string' && value.trim() ? value.trim() : fallback; }
|
|
136
|
-
//# sourceMappingURL=step.js.map
|
|
@@ -144,4 +144,3 @@ export function unreachedTestFiles(root, commands, reported) {
|
|
|
144
144
|
export function unreachedTestsReason(files) {
|
|
145
145
|
return `Test file${files.length === 1 ? '' : 's'} written by the developer ${files.length === 1 ? 'is' : 'are'} not executed by any verification command: ${files.join(', ')}. A test nobody runs proves nothing. Wire ${files.length === 1 ? 'it' : 'them'} into the repository's test command (for example the package.json "test" script) or propose a verificationCheck that runs ${files.length === 1 ? 'it' : 'them'}, then make ${files.length === 1 ? 'it' : 'them'} pass.`;
|
|
146
146
|
}
|
|
147
|
-
//# sourceMappingURL=test-reachability.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PipelineContext } from '../
|
|
1
|
+
import { type PipelineContext } from '../pipeline/pipeline-state.js';
|
|
2
2
|
import { type ExecutorRegistry } from './executors.js';
|
|
3
3
|
import type { AgentEvent, RuntimeConfig, AgentEventRole } from './executor-types.js';
|
|
4
4
|
import { parseAgentObject } from './graph/artifacts.js';
|
|
@@ -2,7 +2,7 @@ import { fingerprint } from './durable-store.js';
|
|
|
2
2
|
import { prepareOpenSpec, roleOpenSpecContext } from './openspec.js';
|
|
3
3
|
import { existsSync, readFileSync } from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { fingerprintCandidate, initializePipeline, inspectPipeline, pipelineStateDirectory, validatePipelineContext, validateVerificationRequest, } from '../
|
|
5
|
+
import { fingerprintCandidate, initializePipeline, inspectPipeline, pipelineStateDirectory, validatePipelineContext, validateVerificationRequest, } from '../pipeline/pipeline-state.js';
|
|
6
6
|
import { normalizeRuntimeConfig } from './config.js';
|
|
7
7
|
import { createExecutorRegistry } from './executors.js';
|
|
8
8
|
import { archive, child, journal, parseAgentObject, SLUG } from './graph/artifacts.js';
|
|
@@ -137,4 +137,3 @@ export async function runCoreWorkflow(options) {
|
|
|
137
137
|
},
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
|
-
//# sourceMappingURL=core-host.js.map
|
|
@@ -9,7 +9,6 @@ export interface WorkflowEnvelope {
|
|
|
9
9
|
state: WorkflowState;
|
|
10
10
|
graph?: SerializedGraphStore;
|
|
11
11
|
}
|
|
12
|
-
export declare const ENVELOPE_FORMAT = 2;
|
|
13
12
|
/** Reject non-JSON data instead of silently changing the fingerprint on serialization. */
|
|
14
13
|
export declare function fingerprint(value: unknown): string;
|
|
15
14
|
export declare function readWorkflowEnvelope(directory: string, runId: string): Promise<WorkflowEnvelope | null>;
|
|
@@ -10,7 +10,7 @@ export class WorkflowStoreError extends Error {
|
|
|
10
10
|
this.name = 'WorkflowStoreError';
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const ENVELOPE_FORMAT = 2;
|
|
14
14
|
function errorCode(error) {
|
|
15
15
|
return typeof error === 'object' && error !== null && 'code' in error ? String(error.code) : undefined;
|
|
16
16
|
}
|
|
@@ -202,4 +202,3 @@ export async function acquireWorkflowLease(directory, runId) {
|
|
|
202
202
|
await rm(lease, { recursive: true, force: true });
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
-
//# sourceMappingURL=durable-store.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PipelineContext, type PipelineCompletion } from '../
|
|
1
|
+
import { type PipelineContext, type PipelineCompletion } from '../pipeline/pipeline-state.js';
|
|
2
2
|
import type { RuntimeConfig } from './executor-types.js';
|
|
3
3
|
import type { WorkflowState } from './workflow-types.js';
|
|
4
4
|
/** Compact derived view. Durable invocation/evidence IDs remain the accounting authority. */
|
|
@@ -21,7 +21,7 @@ export declare function efficiencySummary(state: WorkflowState, context: Pipelin
|
|
|
21
21
|
runId: string;
|
|
22
22
|
workflowVersion: string;
|
|
23
23
|
technicalAcceptance: string;
|
|
24
|
-
archive: import("../
|
|
24
|
+
archive: import("../pipeline/pipeline-state.js").PhaseStatus;
|
|
25
25
|
delivery: "pending" | "complete" | "pending-host";
|
|
26
26
|
roles: {
|
|
27
27
|
role: "architect" | "developer" | "reviewer";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readVerificationEvidence } from '../
|
|
1
|
+
import { readVerificationEvidence } from '../pipeline/pipeline-state.js';
|
|
2
2
|
import { runtimeEfficiency } from './efficiency.js';
|
|
3
3
|
/** Compact derived view. Durable invocation/evidence IDs remain the accounting authority. */
|
|
4
4
|
export function efficiencySummary(state, context, config, completion, identity) {
|
|
@@ -49,4 +49,3 @@ export function efficiencySummary(state, context, config, completion, identity)
|
|
|
49
49
|
metrics: runtimeEfficiency(state),
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
//# sourceMappingURL=efficiency-summary.js.map
|
|
@@ -32,4 +32,3 @@ export function runtimeEfficiency(state) {
|
|
|
32
32
|
const pending = state.history.some(attempt => attempt.pendingInvocations?.length);
|
|
33
33
|
return { schemaVersion: 1, total: { ...totals(state.history), durationMs: state.usage.durationMs, inputTokens: pending ? null : state.usage.inputTokens, outputTokens: pending ? null : state.usage.outputTokens, costUsd: pending ? null : state.usage.costUsd }, phases };
|
|
34
34
|
}
|
|
35
|
-
//# sourceMappingURL=efficiency.js.map
|
|
@@ -5,4 +5,3 @@ export const EVALUATION_CORPUS = [
|
|
|
5
5
|
{ id: 'verification-correction', verification: 'assert.strictEqual(api.clamp(11, 0, 10), 10)', description: 'Clamp values to both boundaries, including an already valid value.', repositories: ['math'], source: 'exports.clamp = value => value', solution: 'exports.clamp = (value, min, max) => Math.min(max, Math.max(min, value))', defects: ['exports.clamp = (value, min, max) => Math.max(min, value)', 'exports.clamp = (value, min, max) => Math.min(max, value)'], oracle: 'assert.strictEqual(api.clamp(-1, 0, 10), 0); assert.strictEqual(api.clamp(11, 0, 10), 10); assert.strictEqual(api.clamp(5, 0, 10), 5);', correction: 'verification' },
|
|
6
6
|
{ id: 'review-correction', verification: 'assert.strictEqual(typeof api.unique, "function")', description: 'Deduplicate stable values while preserving the first occurrence order.', repositories: ['collections'], source: 'exports.unique = values => values', solution: 'exports.unique = values => [...new Set(values)]', defects: ['exports.unique = values => [...new Set(values)].sort()', 'exports.unique = values => values'], oracle: 'assert.deepStrictEqual(api.unique([3, 1, 3, 2, 1]), [3, 1, 2]); assert.deepStrictEqual(api.unique([]), []);', correction: 'review' },
|
|
7
7
|
];
|
|
8
|
-
//# sourceMappingURL=evaluation-corpus.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RuntimeConfig } from './executor-types.js';
|
|
2
|
-
|
|
2
|
+
interface EvaluationOptions {
|
|
3
3
|
output: string;
|
|
4
4
|
config?: RuntimeConfig;
|
|
5
5
|
maxCostUsd?: number;
|
|
@@ -41,3 +41,4 @@ export declare function runEvaluation(options: EvaluationOptions): Promise<{
|
|
|
41
41
|
reportedSpendUsd: number;
|
|
42
42
|
observations: Record<string, unknown>[];
|
|
43
43
|
}>;
|
|
44
|
+
export {};
|
|
@@ -8,7 +8,7 @@ import { fingerprint } from './durable-store.js';
|
|
|
8
8
|
import { runCoreWorkflow, coreRuntimeIdentity } from './core-host.js';
|
|
9
9
|
import { ExecutorRegistry } from './executors.js';
|
|
10
10
|
import { OpenSpecTools } from './openspec.js';
|
|
11
|
-
import { validatePipelineContext } from '../
|
|
11
|
+
import { validatePipelineContext } from '../pipeline/pipeline-state.js';
|
|
12
12
|
import { runtimeEfficiency } from './efficiency.js';
|
|
13
13
|
function oracle(test, file) {
|
|
14
14
|
return spawnSync(process.execPath, ['-e', 'const assert = require("node:assert/strict"); const api = require(process.argv[1]);' + test.oracle, file], { encoding: 'utf8', timeout: 10000 }).status === 0;
|
|
@@ -168,4 +168,3 @@ export async function runEvaluation(options) {
|
|
|
168
168
|
rmSync(root, { recursive: true, force: true });
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
//# sourceMappingURL=evaluation.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VerificationCommand } from '../
|
|
1
|
+
import type { VerificationCommand } from '../pipeline/pipeline-state.js';
|
|
2
2
|
import type { CacheTokenUsage } from './efficiency-types.js';
|
|
3
3
|
import type { GuardrailSettings } from './guardrails.js';
|
|
4
4
|
export declare const DEFAULT_AGENT_TIMEOUT_MS: number;
|
|
@@ -33,4 +33,3 @@ export function assertGeminiAdminPolicyAvailable(options = {}) {
|
|
|
33
33
|
if (entries.some(file => file.endsWith('.toml')))
|
|
34
34
|
throw new AgentExecutionError('Gemini system policies disable per-run admin policy enforcement. Select another provider for architect/reviewer, or ask the system administrator to configure a compatible environment: ' + directory, 'provider_capability_unsupported');
|
|
35
35
|
}
|
|
36
|
-
//# sourceMappingURL=gemini-policy.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PipelineContext, type PipelineState, type VerificationCommand } from '../../
|
|
1
|
+
import { type PipelineContext, type PipelineState, type VerificationCommand } from '../../pipeline/pipeline-state.js';
|
|
2
2
|
import type { DesignConfidence } from './state.js';
|
|
3
3
|
export declare const SLUG: RegExp;
|
|
4
4
|
export declare function object(value: unknown): Record<string, unknown>;
|
|
@@ -2,7 +2,7 @@ import { artifactPath, hash, resolveOpenSpecCli, runOpenSpec } from '../openspec
|
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { cpSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { checkArchive, pipelineStateDirectory, transitionPipeline, validateVerificationRequest, } from '../../
|
|
5
|
+
import { checkArchive, pipelineStateDirectory, transitionPipeline, validateVerificationRequest, } from '../../pipeline/pipeline-state.js';
|
|
6
6
|
export const SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
7
7
|
export function object(value) {
|
|
8
8
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
@@ -209,4 +209,3 @@ export async function archive(context, change, signal) {
|
|
|
209
209
|
transitionPipeline(context, 'ci', 'skipped');
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
//# sourceMappingURL=artifacts.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type OpenSpecRoleContext } from '../openspec.js';
|
|
2
|
-
import { type AcceptanceReport, type PipelineContext } from '../../
|
|
2
|
+
import { type AcceptanceReport, type PipelineContext } from '../../pipeline/pipeline-state.js';
|
|
3
3
|
import type { AgentEventRole, AgentResult, AgentRole, RuntimeConfig } from '../executor-types.js';
|
|
4
4
|
import { type FrozenCriterion } from '../prompts.js';
|
|
5
5
|
import type { WorkflowNode, WorkflowState } from '../workflow-types.js';
|
|
@@ -2,7 +2,7 @@ import { guardrailEnabled } from '../guardrails.js';
|
|
|
2
2
|
import { addDeveloperChecks, bindPlan, expandedPlanCommands, initializeVerificationPlan, readVerificationPlan, validateProposedChecks } from '../verification-plan.js';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { OpenSpecTools } from '../openspec.js';
|
|
5
|
-
import { candidateManifest, fingerprintCandidate, frozenAcceptanceCriteria, recordAcceptance, transitionPipeline, validateAcceptanceReport, verifyPipeline, } from '../../
|
|
5
|
+
import { candidateManifest, fingerprintCandidate, frozenAcceptanceCriteria, recordAcceptance, transitionPipeline, validateAcceptanceReport, verifyPipeline, } from '../../pipeline/pipeline-state.js';
|
|
6
6
|
import { ARCHITECT_OUTPUT_SCHEMA, DEVELOPER_OUTPUT_SCHEMA, REVIEW_OUTPUT_SCHEMA, correctionInstructions, deepenInstructions, roleInstructions } from '../prompts.js';
|
|
7
7
|
import { archive, child, journal, object, parseArchitecture, proposedVerification, write, writeDesignConfidence } from './artifacts.js';
|
|
8
8
|
import { evaluateReview } from './review-policy.js';
|
|
@@ -425,4 +425,3 @@ function archiveNode(deps) {
|
|
|
425
425
|
export function coreNodes(deps) {
|
|
426
426
|
return { architect: architectNode(deps), developer: developerNode(deps), fixer: fixerNode(deps), verify: verifyNode(deps), reviewer: reviewerNode(deps), archive: archiveNode(deps) };
|
|
427
427
|
}
|
|
428
|
-
//# sourceMappingURL=nodes.js.map
|
|
@@ -29,4 +29,3 @@ export function evaluateReview(raw, policy) {
|
|
|
29
29
|
&& REVIEW_ASPECTS.every(name => scored[name] >= policy.aspects[name]);
|
|
30
30
|
return { record: { approved: raw.approved, summary: raw.summary, issues: raw.issues, score: raw.score, aspects: scored }, approved };
|
|
31
31
|
}
|
|
32
|
-
//# sourceMappingURL=review-policy.js.map
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { type InvocationKind } from '../role-routing.js';
|
|
2
|
-
import { type PipelineContext } from '../../
|
|
2
|
+
import { type PipelineContext } from '../../pipeline/pipeline-state.js';
|
|
3
3
|
import type { ExecutorRegistry } from '../executors.js';
|
|
4
|
-
import { type AgentEvent, type AgentEventRole, type AgentResult, type AgentRole, type
|
|
4
|
+
import { type AgentEvent, type AgentEventRole, type AgentResult, type AgentRole, type RuntimeConfig, type RuntimeAgentConfig } from '../executor-types.js';
|
|
5
5
|
import type { WorkflowStepContext } from '../workflow-types.js';
|
|
6
|
-
/** Executor failures that mean "this session cannot be continued", not "the role failed". */
|
|
7
|
-
export declare const SESSION_FALLBACK_CODES: Set<string>;
|
|
8
6
|
export interface InvokeOptions {
|
|
9
7
|
kind?: InvocationKind;
|
|
10
8
|
prompt: string;
|
|
@@ -41,7 +39,6 @@ export interface RoleInvokerDeps {
|
|
|
41
39
|
/** `fixer` labels the developer step's events during a correction round on the fixer stance, so a log reader sees who is acting. */
|
|
42
40
|
onAgentEvent?: (role: AgentEventRole, event: AgentEvent) => void;
|
|
43
41
|
}
|
|
44
|
-
export declare function sumUsage(a: AgentUsage, b: AgentUsage): AgentUsage;
|
|
45
42
|
/**
|
|
46
43
|
* One role turn against the configured executor: budget-aware request, live
|
|
47
44
|
* event forwarding with repository-relative paths, structured parsing with a
|
|
@@ -5,18 +5,13 @@ import { selectRoleRoute } from '../role-routing.js';
|
|
|
5
5
|
import { ROLE_SKILLS, OPENSPEC_VERSION, OpenSpecTools, OpenSpecParticipationError, openSpecRepairPrompt } from '../openspec.js';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { performance } from 'node:perf_hooks';
|
|
8
|
-
import { frozenAcceptanceCriteria, pipelineStateDirectory } from '../../
|
|
8
|
+
import { frozenAcceptanceCriteria, pipelineStateDirectory } from '../../pipeline/pipeline-state.js';
|
|
9
9
|
import { AgentExecutionError, unknownUsage } from '../executor-types.js';
|
|
10
|
-
import { sumCacheUsage } from '../efficiency-types.js';
|
|
11
10
|
import { ROLE_INSTRUCTIONS_VERSION, repairInstructions } from '../prompts.js';
|
|
12
11
|
import { parseAgentObject } from './artifacts.js';
|
|
13
12
|
/** Executor failures that mean "this session cannot be continued", not "the role failed". */
|
|
14
|
-
|
|
13
|
+
const SESSION_FALLBACK_CODES = new Set(['session_not_found', 'session_expired', 'session_unsupported']);
|
|
15
14
|
const REPAIRABLE = /Invalid|Expected|requires|Duplicate|malformed/i;
|
|
16
|
-
export function sumUsage(a, b) {
|
|
17
|
-
const add = (x, y) => x === null || y === null ? null : x + y;
|
|
18
|
-
return { inputTokens: add(a.inputTokens, b.inputTokens), outputTokens: add(a.outputTokens, b.outputTokens), costUsd: add(a.costUsd, b.costUsd), ...sumCacheUsage([a, b]) };
|
|
19
|
-
}
|
|
20
15
|
/**
|
|
21
16
|
* One role turn against the configured executor: budget-aware request, live
|
|
22
17
|
* event forwarding with repository-relative paths, structured parsing with a
|
|
@@ -195,4 +190,3 @@ export function createRoleInvoker(deps) {
|
|
|
195
190
|
}
|
|
196
191
|
};
|
|
197
192
|
}
|
|
198
|
-
//# sourceMappingURL=roles.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VerificationCommand } from '../../
|
|
1
|
+
import type { VerificationCommand } from '../../pipeline/pipeline-state.js';
|
|
2
2
|
export type DesignConfidence = 'high' | 'medium' | 'low';
|
|
3
3
|
export interface ArchitectureRecord {
|
|
4
4
|
planningDepth?: 'focused' | 'full';
|
|
@@ -21,4 +21,3 @@ export const CoreState = Annotation.Root({
|
|
|
21
21
|
});
|
|
22
22
|
/** Graph order. `fixer` is the correction node: verify (failed, tasks ticked) and reviewer (rejected) route there; it hands back to verify. */
|
|
23
23
|
export const CORE_NODE_ORDER = ['architect', 'developer', 'fixer', 'verify', 'reviewer', 'archive'];
|
|
24
|
-
//# sourceMappingURL=state.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseCheckpointSaver, type ChannelVersions, type Checkpoint, type CheckpointListOptions, type CheckpointMetadata, type CheckpointTuple, type PendingWrite } from '@langchain/langgraph-checkpoint';
|
|
2
2
|
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
3
|
/** One serialized LangGraph value: the serializer's type tag plus base64 bytes. */
|
|
4
|
-
|
|
4
|
+
interface SerializedBlob {
|
|
5
5
|
type: string;
|
|
6
6
|
data: string;
|
|
7
7
|
}
|
|
@@ -59,3 +59,4 @@ export declare class FileCheckpointSaver extends BaseCheckpointSaver {
|
|
|
59
59
|
putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
|
|
60
60
|
deleteThread(threadId: string): Promise<void>;
|
|
61
61
|
}
|
|
62
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export declare const GUARDRAIL_IDS: readonly ["plan-validation", "genuine-blocking-question", "plan-language-hint", "frozen-plan-writes", "primary-language", "duplicate-sibling", "one-test-per-module", "empty-write", "evidence-gated-ticking", "inventory-retry", "synthetic-corrections", "silent-group-closure", "verify-per-group", "test-reachability", "exit-code-honesty", "environment-repair", "lockfile-repair", "verify-idle-timeout"];
|
|
2
2
|
export type GuardrailId = (typeof GUARDRAIL_IDS)[number];
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type GuardrailPhase = 'architect' | 'developer' | 'host';
|
|
4
|
+
interface GuardrailDescriptor {
|
|
5
5
|
id: GuardrailId;
|
|
6
6
|
phase: GuardrailPhase;
|
|
7
7
|
}
|
|
8
8
|
export type GuardrailSettings = Partial<Record<GuardrailId, boolean>>;
|
|
9
9
|
/** Stable catalog (phase order = pipeline order); labels/descriptions live in the host UI so they can be localized. */
|
|
10
10
|
export declare const GUARDRAIL_CATALOG: readonly GuardrailDescriptor[];
|
|
11
|
-
export declare function isGuardrailId(value: unknown): value is GuardrailId;
|
|
12
11
|
/** A guardrail is on unless the settings say `false` explicitly. */
|
|
13
12
|
export declare function guardrailEnabled(settings: GuardrailSettings | undefined, id: GuardrailId): boolean;
|
|
14
13
|
/** Validates a raw `guardrails` object: only known ids, only booleans. Returns the normalized settings (unset ⇒ omitted). */
|
|
15
14
|
export declare function validateGuardrailSettings(value: unknown, path?: string): GuardrailSettings;
|
|
15
|
+
export {};
|
|
@@ -52,7 +52,7 @@ export const GUARDRAIL_CATALOG = [
|
|
|
52
52
|
{ id: 'lockfile-repair', phase: 'host' },
|
|
53
53
|
{ id: 'verify-idle-timeout', phase: 'host' },
|
|
54
54
|
];
|
|
55
|
-
|
|
55
|
+
function isGuardrailId(value) {
|
|
56
56
|
return typeof value === 'string' && GUARDRAIL_IDS.includes(value);
|
|
57
57
|
}
|
|
58
58
|
/** A guardrail is on unless the settings say `false` explicitly. */
|
|
@@ -73,4 +73,3 @@ export function validateGuardrailSettings(value, path = 'guardrails') {
|
|
|
73
73
|
}
|
|
74
74
|
return out;
|
|
75
75
|
}
|
|
76
|
-
//# sourceMappingURL=guardrails.js.map
|
|
@@ -17,5 +17,5 @@ export { FileCheckpointSaver, type GraphStoreIO, type SerializedGraphStore } fro
|
|
|
17
17
|
export { ARCHITECT_OUTPUT_SCHEMA, DEVELOPER_OUTPUT_SCHEMA, REVIEW_OUTPUT_SCHEMA, ROLE_INSTRUCTIONS_VERSION, rolePromptDefaults, correctionInstructions, deepenInstructions, repairInstructions, roleInstructions, type FrozenCriterion, type RoleFeedback, type RoleInstructionOptions, } from './prompts.js';
|
|
18
18
|
export { OPENSPEC_VERSION, ROLE_SKILLS, type OpenSpecRoleContext } from './openspec.js';
|
|
19
19
|
export * from './efficiency-summary.js';
|
|
20
|
-
export { readVerificationEvidence, type VerificationEvidenceQuery } from '../
|
|
20
|
+
export { readVerificationEvidence, type VerificationEvidenceQuery } from '../pipeline/pipeline-state.js';
|
|
21
21
|
export { runRecovery, recoveryRequestSchema, type RecoveryRequest } from './recovery.js';
|
|
@@ -17,6 +17,5 @@ export { FileCheckpointSaver } from './graph-checkpointer.js';
|
|
|
17
17
|
export { ARCHITECT_OUTPUT_SCHEMA, DEVELOPER_OUTPUT_SCHEMA, REVIEW_OUTPUT_SCHEMA, ROLE_INSTRUCTIONS_VERSION, rolePromptDefaults, correctionInstructions, deepenInstructions, repairInstructions, roleInstructions, } from './prompts.js';
|
|
18
18
|
export { OPENSPEC_VERSION, ROLE_SKILLS } from './openspec.js';
|
|
19
19
|
export * from './efficiency-summary.js';
|
|
20
|
-
export { readVerificationEvidence } from '../
|
|
20
|
+
export { readVerificationEvidence } from '../pipeline/pipeline-state.js';
|
|
21
21
|
export { runRecovery, recoveryRequestSchema } from './recovery.js';
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toolEvent } from './tool-event.js';
|
|
2
|
-
import { normalizeKimiCliModel } from '
|
|
2
|
+
import { normalizeKimiCliModel } from './kimi-model.js';
|
|
3
3
|
import { AgentExecutionError, unknownUsage, validateAgentRequest } from './executor-types.js';
|
|
4
4
|
import { runCliProcess } from './cli-process.js';
|
|
5
5
|
import { parseStructuredText } from './openai-executor.js';
|
|
@@ -187,4 +187,3 @@ export async function executeKimiReadonlyAcp(request, options = {}) {
|
|
|
187
187
|
request.onEvent?.({ kind: 'usage', usage });
|
|
188
188
|
return { text, usage, sessionId, structured: parseStructuredText(text) };
|
|
189
189
|
}
|
|
190
|
-
//# sourceMappingURL=kimi-acp.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configurations keep raw provider ids. At the CLI boundary only the managed
|
|
3
|
+
* Kimi aliases gain their documented `kimi-code/` namespace; custom and
|
|
4
|
+
* already-qualified ids stay byte-identical.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeKimiCliModel(model: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const OFFICIAL_SHORT_MODEL_IDS = new Set(['k3', 'kimi-for-coding', 'kimi-for-coding-highspeed']);
|
|
2
|
+
const SAFE_MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._/:-]{0,127}$/;
|
|
3
|
+
/**
|
|
4
|
+
* Configurations keep raw provider ids. At the CLI boundary only the managed
|
|
5
|
+
* Kimi aliases gain their documented `kimi-code/` namespace; custom and
|
|
6
|
+
* already-qualified ids stay byte-identical.
|
|
7
|
+
*/
|
|
8
|
+
export function normalizeKimiCliModel(model) {
|
|
9
|
+
if (!SAFE_MODEL_ID.test(model))
|
|
10
|
+
throw new Error('Kimi model id must be 1-128 characters and match [A-Za-z0-9][A-Za-z0-9._/:-]*');
|
|
11
|
+
return OFFICIAL_SHORT_MODEL_IDS.has(model) ? `kimi-code/${model}` : model;
|
|
12
|
+
}
|