specrails-core 5.6.0 → 6.0.1
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/change-scope.d.ts +63 -0
- package/dist/agent-runtime/change-scope.js +297 -0
- 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 +4 -5
- 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 +16 -5
- package/dist/agent-runtime/compact/environment.js +32 -3
- 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 +6 -3
- package/dist/agent-runtime/config.js +0 -1
- package/dist/agent-runtime/core-host.d.ts +2 -2
- package/dist/agent-runtime/core-host.js +2 -3
- 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 +5 -3
- package/dist/agent-runtime/graph/convergence.d.ts +26 -0
- package/dist/agent-runtime/graph/convergence.js +62 -0
- package/dist/agent-runtime/graph/nodes.d.ts +1 -1
- package/dist/agent-runtime/graph/nodes.js +170 -24
- 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 +6 -1
- package/dist/agent-runtime/graph/state.js +2 -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 +11 -5
- package/dist/agent-runtime/prompts.js +46 -17
- 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 +19 -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 +9 -5
- 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.d.ts +11 -0
- package/dist/{installer/runtime → pipeline}/pipeline-state.js +56 -5
- package/dist/shared/args.d.ts +18 -0
- package/dist/shared/args.js +53 -0
- package/integration-contract.json +11 -47
- 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
|
@@ -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
|
|
@@ -98,7 +98,11 @@ function tokenReaches(token, file, root, discovery) {
|
|
|
98
98
|
* file. Unknown ⇒ true: only an enumerating command can prove absence.
|
|
99
99
|
*/
|
|
100
100
|
export function commandReachesTest(root, command, file) {
|
|
101
|
-
|
|
101
|
+
// Path arguments are relative to the directory the command runs in (a
|
|
102
|
+
// package inside a larger checkout), while reported files are relative to
|
|
103
|
+
// the checkout: compare both from the command's directory.
|
|
104
|
+
const base = path.resolve(root, command.cwd ?? '.');
|
|
105
|
+
const target = posix(path.relative(base, path.resolve(root, file)));
|
|
102
106
|
let judged = false;
|
|
103
107
|
for (const tokens of segments(expandCommandText(root, command))) {
|
|
104
108
|
if (!tokens.length)
|
|
@@ -117,7 +121,7 @@ export function commandReachesTest(root, command, file) {
|
|
|
117
121
|
if (!paths.some(token => TEST_FILE_PATTERN.test(posix(token)) || token.includes('*') || token.endsWith('...')))
|
|
118
122
|
continue;
|
|
119
123
|
judged = true;
|
|
120
|
-
if (paths.some(token => tokenReaches(token, target,
|
|
124
|
+
if (paths.some(token => tokenReaches(token, target, base, discovery)))
|
|
121
125
|
return true;
|
|
122
126
|
}
|
|
123
127
|
return !judged;
|
|
@@ -144,4 +148,3 @@ export function unreachedTestFiles(root, commands, reported) {
|
|
|
144
148
|
export function unreachedTestsReason(files) {
|
|
145
149
|
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
150
|
}
|
|
147
|
-
//# sourceMappingURL=test-reachability.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
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';
|
|
5
5
|
import { type RuntimeIdentity } from './runtime-identity.js';
|
|
6
6
|
import type { WorkflowEvent, WorkflowSpan, WorkflowState } from './workflow-types.js';
|
|
7
7
|
export declare const RUNTIME_API_VERSION = 1;
|
|
8
|
-
export declare const CORE_WORKFLOW_VERSION = "
|
|
8
|
+
export declare const CORE_WORKFLOW_VERSION = "7";
|
|
9
9
|
export declare const CORE_PACKAGE_VERSION: string;
|
|
10
10
|
export declare function coreRuntimeIdentity(): RuntimeIdentity;
|
|
11
11
|
export { parseAgentObject };
|
|
@@ -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';
|
|
@@ -15,7 +15,7 @@ import { assertEffortSupported } from './capabilities.js';
|
|
|
15
15
|
import { runtimePackageIntegrity } from './runtime-identity.js';
|
|
16
16
|
import { readWorkflowState, runWorkflow } from './workflow.js';
|
|
17
17
|
export const RUNTIME_API_VERSION = 1;
|
|
18
|
-
export const CORE_WORKFLOW_VERSION = '
|
|
18
|
+
export const CORE_WORKFLOW_VERSION = '7';
|
|
19
19
|
export const CORE_PACKAGE_VERSION = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')).version;
|
|
20
20
|
export function coreRuntimeIdentity() {
|
|
21
21
|
return { packageVersion: CORE_PACKAGE_VERSION, workflowVersion: CORE_WORKFLOW_VERSION, instructionsVersion: String(ROLE_INSTRUCTIONS_VERSION), packageIntegrity: runtimePackageIntegrity(), apiVersion: 1 };
|
|
@@ -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,8 @@ 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
|
+
import { assertProposalInScope, withScopeDefault } from '../change-scope.js';
|
|
6
7
|
export const SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
7
8
|
export function object(value) {
|
|
8
9
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
@@ -105,8 +106,10 @@ export function proposedVerification(context, configured, verification) {
|
|
|
105
106
|
throw new Error('Invalid proposed verification command');
|
|
106
107
|
return { repositoryId: command.repositoryId, command: command.command, args: command.args, ...(typeof command.cwd === 'string' && command.cwd ? { cwd: command.cwd } : {}) };
|
|
107
108
|
}).filter(command => !covered.has(command.repositoryId) && context.repositories.some(repository => repository.id === command.repositoryId));
|
|
109
|
+
for (const command of proposed)
|
|
110
|
+
assertProposalInScope(context, command, 'proposed verification command');
|
|
108
111
|
if (proposed.length)
|
|
109
|
-
validateVerificationRequest(context, { kind: 'scoped', commands: proposed });
|
|
112
|
+
validateVerificationRequest(context, { kind: 'scoped', commands: proposed.map(command => withScopeDefault(context, command)) });
|
|
110
113
|
return proposed;
|
|
111
114
|
}
|
|
112
115
|
/** Publish an archive prepared by the real CLI. The durable write set makes a
|
|
@@ -209,4 +212,3 @@ export async function archive(context, change, signal) {
|
|
|
209
212
|
transitionPipeline(context, 'ci', 'skipped');
|
|
210
213
|
}
|
|
211
214
|
}
|
|
212
|
-
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { VerificationReceipt } from '../../pipeline/pipeline-state.js';
|
|
2
|
+
import type { WorkflowState } from '../workflow-types.js';
|
|
3
|
+
/** One verify visit, as the convergence guard remembers it. */
|
|
4
|
+
export interface VerifyOutcome {
|
|
5
|
+
at: string;
|
|
6
|
+
candidateHash: string;
|
|
7
|
+
planHash: string;
|
|
8
|
+
passed: boolean;
|
|
9
|
+
/** Normalized identity of the first failure: the command plus its output with volatile details removed. */
|
|
10
|
+
signature?: string;
|
|
11
|
+
summary?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Verify visits since the latest explicit resume: a human continuing a blocked run grants a fresh budget, as for attempts. */
|
|
14
|
+
export declare function outcomesSinceResume(history: readonly VerifyOutcome[], checkpoint: WorkflowState): VerifyOutcome[];
|
|
15
|
+
/** Identity and one-line description of a failed receipt (or of a host finding that failed a green receipt). */
|
|
16
|
+
export declare function describeFailure(receipt: Pick<VerificationReceipt, 'commands' | 'reason'>, roots: readonly string[], finding?: string): {
|
|
17
|
+
signature: string;
|
|
18
|
+
summary: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Why the failure just recorded (`current`, not yet in `history`) proves the
|
|
22
|
+
* correction loop is not converging, or undefined when another round can help.
|
|
23
|
+
*/
|
|
24
|
+
export declare function divergence(history: readonly VerifyOutcome[], current: VerifyOutcome): string | undefined;
|
|
25
|
+
/** The same test for a candidate that has not been verified again yet: an unchanged failed candidate is not worth a new run. */
|
|
26
|
+
export declare function unchangedFailure(history: readonly VerifyOutcome[], candidateHash: string, planHash: string): VerifyOutcome | undefined;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { fingerprint } from '../durable-store.js';
|
|
2
|
+
/** Verify visits since the latest explicit resume: a human continuing a blocked run grants a fresh budget, as for attempts. */
|
|
3
|
+
export function outcomesSinceResume(history, checkpoint) {
|
|
4
|
+
const resumed = [...checkpoint.events].reverse().find(event => event.type === 'workflow_resumed');
|
|
5
|
+
return history.filter(entry => !resumed || entry.at >= resumed.timestamp);
|
|
6
|
+
}
|
|
7
|
+
function normalized(output, roots) {
|
|
8
|
+
let text = output.replace(/\u001b\[[0-9;?]*[A-Za-z]/g, '');
|
|
9
|
+
for (const root of [...roots].sort((a, b) => b.length - a.length))
|
|
10
|
+
text = text.split(root).join('<repo>');
|
|
11
|
+
return text.split(/\r?\n/)
|
|
12
|
+
.map(line => line.replace(/\b[0-9a-f]{7,64}\b/gi, '#').replace(/\d+(?:[.,]\d+)*/g, '0').replace(/\s+/g, ' ').trim())
|
|
13
|
+
.filter(Boolean).slice(-40).join('\n');
|
|
14
|
+
}
|
|
15
|
+
/** The last line that says what went wrong, bounded. */
|
|
16
|
+
function headline(output) {
|
|
17
|
+
const lines = output.replace(/\u001b\[[0-9;?]*[A-Za-z]/g, '').split(/\r?\n/).map(line => line.trim()).filter(Boolean);
|
|
18
|
+
const telling = [...lines].reverse().find(line => /error|fail|✕|×|not found|cannot|denied|refused|forbidden|unauthori[sz]ed/i.test(line));
|
|
19
|
+
return (telling ?? lines.at(-1) ?? '').slice(0, 300);
|
|
20
|
+
}
|
|
21
|
+
/** Identity and one-line description of a failed receipt (or of a host finding that failed a green receipt). */
|
|
22
|
+
export function describeFailure(receipt, roots, finding) {
|
|
23
|
+
if (finding)
|
|
24
|
+
return { signature: fingerprint({ finding: normalized(finding, roots) }), summary: finding.slice(0, 300) };
|
|
25
|
+
const failed = receipt.commands.find(command => command.exitCode !== 0);
|
|
26
|
+
if (!failed)
|
|
27
|
+
return { signature: fingerprint({ reason: receipt.reason ?? 'verification failed' }), summary: receipt.reason ?? 'verification failed' };
|
|
28
|
+
const name = failed.label ?? [failed.command, ...failed.args].join(' ');
|
|
29
|
+
const detail = headline(failed.output);
|
|
30
|
+
return {
|
|
31
|
+
signature: fingerprint({ check: failed.key ?? [failed.command, ...failed.args, failed.cwd], exitCode: failed.exitCode, output: normalized(failed.output, roots) }),
|
|
32
|
+
summary: `${name} exited ${failed.exitCode}${detail ? `: ${detail}` : ''}`.slice(0, 400),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Why the failure just recorded (`current`, not yet in `history`) proves the
|
|
37
|
+
* correction loop is not converging, or undefined when another round can help.
|
|
38
|
+
*/
|
|
39
|
+
export function divergence(history, current) {
|
|
40
|
+
if (current.passed || !current.signature)
|
|
41
|
+
return undefined;
|
|
42
|
+
const cycle = history.find(entry => !entry.passed && entry.candidateHash === current.candidateHash && entry.planHash === current.planHash);
|
|
43
|
+
if (cycle)
|
|
44
|
+
return `The correction round returned the change to a state that already failed verification (${current.summary}). Running the same checks again cannot pass.`;
|
|
45
|
+
let repeats = 0;
|
|
46
|
+
for (const entry of [...history].reverse()) {
|
|
47
|
+
if (entry.passed || entry.signature !== current.signature)
|
|
48
|
+
break;
|
|
49
|
+
repeats++;
|
|
50
|
+
}
|
|
51
|
+
if (repeats >= 2)
|
|
52
|
+
return `The same verification failure survived ${repeats} correction rounds unchanged (${current.summary}). It is most likely outside what this change can fix: a pre-existing failure, another package, or the environment.`;
|
|
53
|
+
const previous = history.at(-1);
|
|
54
|
+
if (previous?.passed && history.some(entry => !entry.passed && entry.signature === current.signature)) {
|
|
55
|
+
return `A review correction brought back a verification failure that an earlier correction had fixed (${current.summary}). The review request and the checks pull in opposite directions; decide which one applies before resuming.`;
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
/** The same test for a candidate that has not been verified again yet: an unchanged failed candidate is not worth a new run. */
|
|
60
|
+
export function unchangedFailure(history, candidateHash, planHash) {
|
|
61
|
+
return [...history].reverse().find(entry => !entry.passed && entry.candidateHash === candidateHash && entry.planHash === planHash);
|
|
62
|
+
}
|
|
@@ -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';
|