specrails-core 5.2.3 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/bin/specrails-core.mjs +5 -0
- package/dist/agent-runtime/cli-executor.d.ts +34 -0
- package/dist/agent-runtime/cli-executor.js +335 -0
- package/dist/agent-runtime/cli-executor.js.map +1 -0
- package/dist/agent-runtime/cli-process.d.ts +32 -0
- package/dist/agent-runtime/cli-process.js +159 -0
- package/dist/agent-runtime/cli-process.js.map +1 -0
- package/dist/agent-runtime/cli.d.ts +38 -0
- package/dist/agent-runtime/cli.js +168 -0
- package/dist/agent-runtime/cli.js.map +1 -0
- package/dist/agent-runtime/config.d.ts +7 -0
- package/dist/agent-runtime/config.js +162 -0
- package/dist/agent-runtime/config.js.map +1 -0
- package/dist/agent-runtime/core-host.d.ts +33 -0
- package/dist/agent-runtime/core-host.js +97 -0
- package/dist/agent-runtime/core-host.js.map +1 -0
- package/dist/agent-runtime/durable-store.d.ts +22 -0
- package/dist/agent-runtime/durable-store.js +205 -0
- package/dist/agent-runtime/durable-store.js.map +1 -0
- package/dist/agent-runtime/executor-types.d.ts +92 -0
- package/dist/agent-runtime/executor-types.js +29 -0
- package/dist/agent-runtime/executor-types.js.map +1 -0
- package/dist/agent-runtime/executors.d.ts +22 -0
- package/dist/agent-runtime/executors.js +44 -0
- package/dist/agent-runtime/executors.js.map +1 -0
- package/dist/agent-runtime/gemini-policy.d.ts +8 -0
- package/dist/agent-runtime/gemini-policy.js +36 -0
- package/dist/agent-runtime/gemini-policy.js.map +1 -0
- package/dist/agent-runtime/graph/artifacts.d.ts +40 -0
- package/dist/agent-runtime/graph/artifacts.js +179 -0
- package/dist/agent-runtime/graph/artifacts.js.map +1 -0
- package/dist/agent-runtime/graph/nodes.d.ts +36 -0
- package/dist/agent-runtime/graph/nodes.js +274 -0
- package/dist/agent-runtime/graph/nodes.js.map +1 -0
- package/dist/agent-runtime/graph/review-policy.d.ts +18 -0
- package/dist/agent-runtime/graph/review-policy.js +32 -0
- package/dist/agent-runtime/graph/review-policy.js.map +1 -0
- package/dist/agent-runtime/graph/roles.d.ts +44 -0
- package/dist/agent-runtime/graph/roles.js +126 -0
- package/dist/agent-runtime/graph/roles.js.map +1 -0
- package/dist/agent-runtime/graph/state.d.ts +75 -0
- package/dist/agent-runtime/graph/state.js +23 -0
- package/dist/agent-runtime/graph/state.js.map +1 -0
- package/dist/agent-runtime/graph-checkpointer.d.ts +61 -0
- package/dist/agent-runtime/graph-checkpointer.js +137 -0
- package/dist/agent-runtime/graph-checkpointer.js.map +1 -0
- package/dist/agent-runtime/index.d.ts +14 -0
- package/dist/agent-runtime/index.js +15 -0
- package/dist/agent-runtime/index.js.map +1 -0
- package/dist/agent-runtime/kimi-acp.d.ts +7 -0
- package/dist/agent-runtime/kimi-acp.js +179 -0
- package/dist/agent-runtime/kimi-acp.js.map +1 -0
- package/dist/agent-runtime/openai-executor.d.ts +18 -0
- package/dist/agent-runtime/openai-executor.js +174 -0
- package/dist/agent-runtime/openai-executor.js.map +1 -0
- package/dist/agent-runtime/prompts.d.ts +40 -0
- package/dist/agent-runtime/prompts.js +291 -0
- package/dist/agent-runtime/prompts.js.map +1 -0
- package/dist/agent-runtime/workflow-types.d.ts +210 -0
- package/dist/agent-runtime/workflow-types.js +2 -0
- package/dist/agent-runtime/workflow-types.js.map +1 -0
- package/dist/agent-runtime/workflow.d.ts +17 -0
- package/dist/agent-runtime/workflow.js +609 -0
- package/dist/agent-runtime/workflow.js.map +1 -0
- package/dist/agent-runtime/workspace-tools.d.ts +25 -0
- package/dist/agent-runtime/workspace-tools.js +120 -0
- package/dist/agent-runtime/workspace-tools.js.map +1 -0
- package/dist/installer/cli.d.ts +35 -0
- package/dist/installer/cli.js +3 -0
- package/dist/installer/cli.js.map +1 -1
- package/dist/installer/commands/doctor.d.ts +27 -0
- package/dist/installer/commands/framework.d.ts +85 -0
- package/dist/installer/commands/init.d.ts +147 -0
- package/dist/installer/commands/update.d.ts +56 -0
- package/dist/installer/commands/v5-migration.d.ts +32 -0
- package/dist/installer/phases/framework-lifecycle.d.ts +53 -0
- package/dist/installer/phases/install-config.d.ts +64 -0
- package/dist/installer/phases/manifest.d.ts +45 -0
- package/dist/installer/phases/prereqs.d.ts +51 -0
- package/dist/installer/phases/provider-detect.d.ts +89 -0
- package/dist/installer/phases/scaffold.d.ts +211 -0
- package/dist/installer/runtime/kimi.d.ts +84 -0
- package/dist/installer/runtime/pipeline-state.d.ts +210 -0
- package/dist/installer/runtime/pipeline-state.js +46 -22
- package/dist/installer/runtime/pipeline-state.js.map +1 -1
- package/dist/installer/util/errors.d.ts +46 -0
- package/dist/installer/util/exec.d.ts +41 -0
- package/dist/installer/util/fs.d.ts +153 -0
- package/dist/installer/util/git.d.ts +44 -0
- package/dist/installer/util/install-transaction.d.ts +29 -0
- package/dist/installer/util/logger.d.ts +31 -0
- package/dist/installer/util/paths.d.ts +34 -0
- package/dist/installer/util/prompts.d.ts +23 -0
- package/dist/installer/util/registry.d.ts +174 -0
- package/dist/installer/util/template.d.ts +23 -0
- package/docs/README.md +1 -0
- package/docs/agent-runtime.md +268 -0
- package/integration-contract.json +79 -7
- package/package.json +16 -1
- package/schemas/agent-runtime.schema.json +55 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PipelineContext } from '../../installer/runtime/pipeline-state.js';
|
|
2
|
+
import type { ExecutorRegistry } from '../executors.js';
|
|
3
|
+
import { type AgentEvent, type AgentResult, type AgentRole, type AgentUsage, type RuntimeConfig } from '../executor-types.js';
|
|
4
|
+
import type { WorkflowStepContext } from '../workflow-types.js';
|
|
5
|
+
/** Executor failures that mean "this session cannot be continued", not "the role failed". */
|
|
6
|
+
export declare const SESSION_FALLBACK_CODES: Set<string>;
|
|
7
|
+
export interface InvokeOptions {
|
|
8
|
+
prompt: string;
|
|
9
|
+
/** Parse the reply as one JSON object and hand it to `accept`. */
|
|
10
|
+
structured?: boolean;
|
|
11
|
+
/** Structured, but an unparseable reply is accepted as prose instead of repaired (`accept` gets `undefined`). */
|
|
12
|
+
lenient?: boolean;
|
|
13
|
+
outputSchema?: Record<string, unknown>;
|
|
14
|
+
resumeSessionId?: string;
|
|
15
|
+
/** Full prompt for a fresh session when the resumed session is unavailable. */
|
|
16
|
+
fallbackPrompt?: string;
|
|
17
|
+
}
|
|
18
|
+
export type InvokeOutcome<T> = {
|
|
19
|
+
ok: true;
|
|
20
|
+
value: T;
|
|
21
|
+
text: string;
|
|
22
|
+
result: AgentResult;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
error: string;
|
|
26
|
+
};
|
|
27
|
+
/** Validates and converts a role's reply. Throwing `Invalid|Expected|requires|Duplicate|malformed` requests one repair turn. */
|
|
28
|
+
export type Accept<T> = (output: Record<string, unknown> | undefined, text: string, result: AgentResult) => T;
|
|
29
|
+
export type RoleInvoker = <T>(role: AgentRole, step: WorkflowStepContext, options: InvokeOptions, accept: Accept<T>) => Promise<InvokeOutcome<T>>;
|
|
30
|
+
export interface RoleInvokerDeps {
|
|
31
|
+
context: PipelineContext;
|
|
32
|
+
config: RuntimeConfig;
|
|
33
|
+
registry: ExecutorRegistry;
|
|
34
|
+
onAgentEvent?: (role: AgentRole, event: AgentEvent) => void;
|
|
35
|
+
}
|
|
36
|
+
export declare function sumUsage(a: AgentUsage, b: AgentUsage): AgentUsage;
|
|
37
|
+
/**
|
|
38
|
+
* One role turn against the configured executor: budget-aware request, live
|
|
39
|
+
* event forwarding with repository-relative paths, structured parsing with a
|
|
40
|
+
* single in-session repair turn, and session fallback for corrections. Usage
|
|
41
|
+
* is reported to the step as soon as each provider call returns, so a later
|
|
42
|
+
* interrupt or failure never loses spend.
|
|
43
|
+
*/
|
|
44
|
+
export declare function createRoleInvoker(deps: RoleInvokerDeps): RoleInvoker;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { AgentExecutionError } from '../executor-types.js';
|
|
3
|
+
import { repairInstructions } from '../prompts.js';
|
|
4
|
+
import { parseAgentObject } from './artifacts.js';
|
|
5
|
+
/** Executor failures that mean "this session cannot be continued", not "the role failed". */
|
|
6
|
+
export const SESSION_FALLBACK_CODES = new Set(['provider_execution_error', 'provider_spawn_error', 'incomplete_response', 'invalid_response', 'provider_not_found']);
|
|
7
|
+
const REPAIRABLE = /Invalid|Expected|requires|Duplicate|malformed/i;
|
|
8
|
+
export function sumUsage(a, b) {
|
|
9
|
+
const add = (x, y) => x === null || y === null ? null : x + y;
|
|
10
|
+
return { inputTokens: add(a.inputTokens, b.inputTokens), outputTokens: add(a.outputTokens, b.outputTokens), costUsd: add(a.costUsd, b.costUsd) };
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One role turn against the configured executor: budget-aware request, live
|
|
14
|
+
* event forwarding with repository-relative paths, structured parsing with a
|
|
15
|
+
* single in-session repair turn, and session fallback for corrections. Usage
|
|
16
|
+
* is reported to the step as soon as each provider call returns, so a later
|
|
17
|
+
* interrupt or failure never loses spend.
|
|
18
|
+
*/
|
|
19
|
+
export function createRoleInvoker(deps) {
|
|
20
|
+
const { context, config, registry } = deps;
|
|
21
|
+
const roots = [...context.repositories.map(repo => repo.path)].sort((a, b) => b.length - a.length);
|
|
22
|
+
const relativize = (detail) => {
|
|
23
|
+
// Host logs read better with repository-relative paths; the tool call itself is unchanged.
|
|
24
|
+
for (const root of roots) {
|
|
25
|
+
if (detail === root)
|
|
26
|
+
return context.repositories.length > 1 ? path.basename(root) : '.';
|
|
27
|
+
if (detail.startsWith(root + path.sep))
|
|
28
|
+
return (context.repositories.length > 1 ? path.basename(root) + path.sep : '') + detail.slice(root.length + 1);
|
|
29
|
+
}
|
|
30
|
+
return detail;
|
|
31
|
+
};
|
|
32
|
+
const forward = (role, structured) => (event) => {
|
|
33
|
+
// The final JSON of a structured role is an artifact, not narration; the host
|
|
34
|
+
// reports what it did with it instead of echoing it into the log.
|
|
35
|
+
if (structured && event.kind === 'text' && /^\s*(\{|```)/.test(event.text ?? ''))
|
|
36
|
+
return;
|
|
37
|
+
const shaped = event.kind === 'tool-start' && event.detail ? { ...event, detail: relativize(event.detail) } : event;
|
|
38
|
+
try {
|
|
39
|
+
deps.onAgentEvent?.(role, shaped);
|
|
40
|
+
}
|
|
41
|
+
catch { /* Observer cannot replay agent effects. */ }
|
|
42
|
+
};
|
|
43
|
+
const note = (role, text) => { try {
|
|
44
|
+
deps.onAgentEvent?.(role, { kind: 'text', text });
|
|
45
|
+
}
|
|
46
|
+
catch { /* Observer cannot replay agent effects. */ } };
|
|
47
|
+
const execute = async (role, step, prompt, structured, extra) => {
|
|
48
|
+
const selected = config.agents[role];
|
|
49
|
+
const budget = step.remainingBudget();
|
|
50
|
+
try {
|
|
51
|
+
const result = await registry.execute(selected.provider, {
|
|
52
|
+
role, prompt, cwd: context.artifactRoot, allowedRoots: context.repositories.map(repo => repo.path),
|
|
53
|
+
model: selected.model, maxTurns: selected.maxTurns, signal: step.signal,
|
|
54
|
+
timeoutMs: config.limits?.timeoutMs,
|
|
55
|
+
maxTokens: budget.maxTokens, maxCostUsd: budget.maxCostUsd,
|
|
56
|
+
...extra, onEvent: forward(role, structured),
|
|
57
|
+
});
|
|
58
|
+
step.reportUsage(result.usage);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
if (error instanceof AgentExecutionError)
|
|
63
|
+
step.reportUsage(error.usage);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return async (role, step, options, accept) => {
|
|
68
|
+
const structured = options.structured === true;
|
|
69
|
+
try {
|
|
70
|
+
let result;
|
|
71
|
+
if (options.resumeSessionId && options.fallbackPrompt) {
|
|
72
|
+
// A correction pass continues the role's own session: the work it did and
|
|
73
|
+
// the reasons behind it are already in context.
|
|
74
|
+
try {
|
|
75
|
+
result = await execute(role, step, options.prompt, structured, { resumeSessionId: options.resumeSessionId, outputSchema: options.outputSchema });
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (!(error instanceof AgentExecutionError) || !SESSION_FALLBACK_CODES.has(error.code))
|
|
79
|
+
throw error;
|
|
80
|
+
note(role, `Previous ${role} session is unavailable; starting a fresh ${role} turn with the same instructions.`);
|
|
81
|
+
result = await execute(role, step, options.fallbackPrompt, structured, { outputSchema: options.outputSchema });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
result = await execute(role, step, options.prompt, structured, { resumeSessionId: options.resumeSessionId, outputSchema: options.outputSchema });
|
|
86
|
+
}
|
|
87
|
+
if (!structured)
|
|
88
|
+
return { ok: true, value: accept(undefined, result.text, result), text: result.text, result };
|
|
89
|
+
let output, problem;
|
|
90
|
+
try {
|
|
91
|
+
output = result.structured ?? parseAgentObject(result.text);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
problem = error instanceof Error ? error.message : String(error);
|
|
95
|
+
}
|
|
96
|
+
if (!output && options.lenient)
|
|
97
|
+
return { ok: true, value: accept(undefined, result.text, result), text: result.text, result };
|
|
98
|
+
if (output) {
|
|
99
|
+
try {
|
|
100
|
+
return { ok: true, value: accept(output, result.text, result), text: result.text, result };
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
problem = error instanceof Error ? error.message : String(error);
|
|
104
|
+
if (!REPAIRABLE.test(problem))
|
|
105
|
+
return { ok: false, error: problem };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// One bounded repair turn inside the same session: the role keeps its work
|
|
109
|
+
// and only resends the object. Without a session the role starts over once.
|
|
110
|
+
if (!result.sessionId)
|
|
111
|
+
return { ok: false, error: problem ?? 'Unusable structured reply' };
|
|
112
|
+
note(role, `The ${role} reply was not a valid result (${problem}); asking the same session to resend it.`);
|
|
113
|
+
const repaired = await execute(role, step, repairInstructions(role, problem), structured, { resumeSessionId: result.sessionId, outputSchema: options.outputSchema });
|
|
114
|
+
try {
|
|
115
|
+
return { ok: true, value: accept(repaired.structured ?? parseAgentObject(repaired.text), repaired.text, repaired), text: repaired.text, result: repaired };
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
return { ok: false, error: error instanceof Error ? error.message : String(error) };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
return { ok: false, error: error instanceof Error ? error.message : String(error) };
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../../src/agent-runtime/graph/roles.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAG5B,OAAO,EAAE,mBAAmB,EAA0F,MAAM,sBAAsB,CAAA;AAClJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEjD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,0BAA0B,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,oBAAoB,CAAC,CAAC,CAAA;AA2BpK,MAAM,UAAU,GAAG,gDAAgD,CAAA;AAEnE,MAAM,UAAU,QAAQ,CAAC,CAAa,EAAE,CAAa;IACnD,MAAM,GAAG,GAAG,CAAC,CAAgB,EAAE,CAAgB,EAAiB,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAC1G,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC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EAAE,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;YAAC,CAAC;YAClK,OAAO,KAAK,EAAE,CAAC;gBAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA;YAAC,CAAC;QACvG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA;QACrF,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { VerificationCommand } from '../../installer/runtime/pipeline-state.js';
|
|
2
|
+
export type DesignConfidence = 'high' | 'medium' | 'low';
|
|
3
|
+
export interface ArchitectureRecord {
|
|
4
|
+
change: string;
|
|
5
|
+
tasks: number;
|
|
6
|
+
specs: string[];
|
|
7
|
+
confidence: DesignConfidence;
|
|
8
|
+
/** The single blocking question the architect could not answer from the code. */
|
|
9
|
+
question?: string;
|
|
10
|
+
/** True when a low-confidence design proceeded on stated assumptions instead of asking. */
|
|
11
|
+
assumed?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface DeveloperRecord {
|
|
14
|
+
summary: string;
|
|
15
|
+
provider: string;
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
files: string[];
|
|
18
|
+
tests: string[];
|
|
19
|
+
verification?: string;
|
|
20
|
+
incomplete: Array<{
|
|
21
|
+
task: string;
|
|
22
|
+
reason: string;
|
|
23
|
+
}>;
|
|
24
|
+
/** False when the provider returned prose instead of the structured summary. */
|
|
25
|
+
structured: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface VerificationRecord {
|
|
28
|
+
valid: boolean;
|
|
29
|
+
reason?: string;
|
|
30
|
+
receiptId?: string;
|
|
31
|
+
incompleteTasks?: string[];
|
|
32
|
+
unverifiedRepositories: string[];
|
|
33
|
+
commands: Array<{
|
|
34
|
+
repositoryId: string;
|
|
35
|
+
command: string;
|
|
36
|
+
args: string[];
|
|
37
|
+
exitCode: number | null;
|
|
38
|
+
output: string;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
export interface ReviewRecord {
|
|
42
|
+
approved: boolean;
|
|
43
|
+
summary: string;
|
|
44
|
+
issues: string[];
|
|
45
|
+
score: number;
|
|
46
|
+
aspects: Record<string, number>;
|
|
47
|
+
candidateHash?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ArchiveRecord {
|
|
50
|
+
archivePath: string;
|
|
51
|
+
deliveryOwner: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The Core implementation graph state. Every field is plain JSON so LangGraph
|
|
55
|
+
* checkpoints, the host ledger and the CLI status share one representation.
|
|
56
|
+
* Channel names never collide with node names (LangGraph forbids it).
|
|
57
|
+
*/
|
|
58
|
+
export declare const CoreState: import("@langchain/langgraph").AnnotationRoot<{
|
|
59
|
+
/** The frozen verification plan: configured commands plus the architect's proposals. */
|
|
60
|
+
plan: import("@langchain/langgraph").BaseChannel<VerificationCommand[], VerificationCommand[] | import("@langchain/langgraph").OverwriteValue<VerificationCommand[]>, unknown>;
|
|
61
|
+
unverifiedRepositories: import("@langchain/langgraph").BaseChannel<string[], string[] | import("@langchain/langgraph").OverwriteValue<string[]>, unknown>;
|
|
62
|
+
architecture: import("@langchain/langgraph").BaseChannel<ArchitectureRecord | null, ArchitectureRecord | import("@langchain/langgraph").OverwriteValue<ArchitectureRecord | null> | null, unknown>;
|
|
63
|
+
development: import("@langchain/langgraph").BaseChannel<DeveloperRecord | null, DeveloperRecord | import("@langchain/langgraph").OverwriteValue<DeveloperRecord | null> | null, unknown>;
|
|
64
|
+
verifyResult: import("@langchain/langgraph").BaseChannel<VerificationRecord | null, VerificationRecord | import("@langchain/langgraph").OverwriteValue<VerificationRecord | null> | null, unknown>;
|
|
65
|
+
review: import("@langchain/langgraph").BaseChannel<ReviewRecord | null, ReviewRecord | import("@langchain/langgraph").OverwriteValue<ReviewRecord | null> | null, unknown>;
|
|
66
|
+
/** Answers the requester gave to architect questions, oldest first. */
|
|
67
|
+
answers: import("@langchain/langgraph").BaseChannel<string[], string[] | import("@langchain/langgraph").OverwriteValue<string[]>, unknown>;
|
|
68
|
+
/** Autonomous investigation passes the architect already spent on a low-confidence design. */
|
|
69
|
+
deepenPasses: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
70
|
+
archived: import("@langchain/langgraph").BaseChannel<ArchiveRecord | null, ArchiveRecord | import("@langchain/langgraph").OverwriteValue<ArchiveRecord | null> | null, unknown>;
|
|
71
|
+
}>;
|
|
72
|
+
export type CoreStateType = typeof CoreState.State;
|
|
73
|
+
export type CoreStateUpdate = typeof CoreState.Update;
|
|
74
|
+
export type CoreNodeId = 'architect' | 'developer' | 'verify' | 'reviewer' | 'archive';
|
|
75
|
+
export declare const CORE_NODE_ORDER: readonly CoreNodeId[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Annotation } from '@langchain/langgraph';
|
|
2
|
+
const replace = () => ({ reducer: (_previous, next) => next });
|
|
3
|
+
/**
|
|
4
|
+
* The Core implementation graph state. Every field is plain JSON so LangGraph
|
|
5
|
+
* checkpoints, the host ledger and the CLI status share one representation.
|
|
6
|
+
* Channel names never collide with node names (LangGraph forbids it).
|
|
7
|
+
*/
|
|
8
|
+
export const CoreState = Annotation.Root({
|
|
9
|
+
/** The frozen verification plan: configured commands plus the architect's proposals. */
|
|
10
|
+
plan: Annotation({ ...replace(), default: () => [] }),
|
|
11
|
+
unverifiedRepositories: Annotation({ ...replace(), default: () => [] }),
|
|
12
|
+
architecture: Annotation({ ...replace(), default: () => null }),
|
|
13
|
+
development: Annotation({ ...replace(), default: () => null }),
|
|
14
|
+
verifyResult: Annotation({ ...replace(), default: () => null }),
|
|
15
|
+
review: Annotation({ ...replace(), default: () => null }),
|
|
16
|
+
/** Answers the requester gave to architect questions, oldest first. */
|
|
17
|
+
answers: Annotation({ reducer: (previous, next) => [...previous, ...next], default: () => [] }),
|
|
18
|
+
/** Autonomous investigation passes the architect already spent on a low-confidence design. */
|
|
19
|
+
deepenPasses: Annotation({ ...replace(), default: () => 0 }),
|
|
20
|
+
archived: Annotation({ ...replace(), default: () => null }),
|
|
21
|
+
});
|
|
22
|
+
export const CORE_NODE_ORDER = ['architect', 'developer', 'verify', 'reviewer', 'archive'];
|
|
23
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/agent-runtime/graph/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AA2CjD,MAAM,OAAO,GAAG,GAAM,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,SAAY,EAAE,IAAO,EAAK,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;AAE1E;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC;IACvC,wFAAwF;IACxF,IAAI,EAAE,UAAU,CAAwB,EAAE,GAAG,OAAO,EAAyB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;IACnG,sBAAsB,EAAE,UAAU,CAAW,EAAE,GAAG,OAAO,EAAY,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;IAC3F,YAAY,EAAE,UAAU,CAA4B,EAAE,GAAG,OAAO,EAA6B,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACrH,WAAW,EAAE,UAAU,CAAyB,EAAE,GAAG,OAAO,EAA0B,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IAC9G,YAAY,EAAE,UAAU,CAA4B,EAAE,GAAG,OAAO,EAA6B,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACrH,MAAM,EAAE,UAAU,CAAsB,EAAE,GAAG,OAAO,EAAuB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IACnG,uEAAuE;IACvE,OAAO,EAAE,UAAU,CAAW,EAAE,OAAO,EAAE,CAAC,QAAkB,EAAE,IAAc,EAAY,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;IACvI,8FAA8F;IAC9F,YAAY,EAAE,UAAU,CAAS,EAAE,GAAG,OAAO,EAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IAC5E,QAAQ,EAAE,UAAU,CAAuB,EAAE,GAAG,OAAO,EAAwB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;CACxG,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,eAAe,GAA0B,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { BaseCheckpointSaver, type ChannelVersions, type Checkpoint, type CheckpointListOptions, type CheckpointMetadata, type CheckpointTuple, type PendingWrite } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
3
|
+
/** One serialized LangGraph value: the serializer's type tag plus base64 bytes. */
|
|
4
|
+
export interface SerializedBlob {
|
|
5
|
+
type: string;
|
|
6
|
+
data: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SerializedCheckpointEntry {
|
|
9
|
+
threadId: string;
|
|
10
|
+
ns: string;
|
|
11
|
+
id: string;
|
|
12
|
+
parentId?: string;
|
|
13
|
+
checkpoint: SerializedBlob;
|
|
14
|
+
metadata: SerializedBlob;
|
|
15
|
+
}
|
|
16
|
+
export interface SerializedWriteEntry {
|
|
17
|
+
threadId: string;
|
|
18
|
+
ns: string;
|
|
19
|
+
checkpointId: string;
|
|
20
|
+
taskId: string;
|
|
21
|
+
idx: number;
|
|
22
|
+
channel: string;
|
|
23
|
+
value: SerializedBlob;
|
|
24
|
+
}
|
|
25
|
+
/** The complete LangGraph checkpoint history of one run, as stored inside the run envelope. */
|
|
26
|
+
export interface SerializedGraphStore {
|
|
27
|
+
format: 1;
|
|
28
|
+
checkpoints: SerializedCheckpointEntry[];
|
|
29
|
+
writes: SerializedWriteEntry[];
|
|
30
|
+
}
|
|
31
|
+
export interface GraphStoreIO {
|
|
32
|
+
/** The store persisted with the run, or undefined for a new run. */
|
|
33
|
+
load(): SerializedGraphStore | undefined;
|
|
34
|
+
/** Persist the complete store. The engine writes it atomically with the ledger. */
|
|
35
|
+
save(store: SerializedGraphStore): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* LangGraph checkpointer whose whole history lives inside the run's durable
|
|
39
|
+
* envelope. Every checkpoint or pending write is persisted through the same
|
|
40
|
+
* atomic file write as the host ledger, so traversal state and receipts can
|
|
41
|
+
* never disagree after a crash. Values are serialized by LangGraph's own
|
|
42
|
+
* serializer and stored as base64 so the envelope stays plain JSON.
|
|
43
|
+
*/
|
|
44
|
+
export declare class FileCheckpointSaver extends BaseCheckpointSaver {
|
|
45
|
+
private readonly io;
|
|
46
|
+
private readonly checkpoints;
|
|
47
|
+
private readonly writes;
|
|
48
|
+
constructor(io: GraphStoreIO);
|
|
49
|
+
/** A JSON snapshot of the complete store. */
|
|
50
|
+
serialize(): SerializedGraphStore;
|
|
51
|
+
private dump;
|
|
52
|
+
private load;
|
|
53
|
+
private persist;
|
|
54
|
+
private tuple;
|
|
55
|
+
private entries;
|
|
56
|
+
getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined>;
|
|
57
|
+
list(config: RunnableConfig, options?: CheckpointListOptions): AsyncGenerator<CheckpointTuple>;
|
|
58
|
+
put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, _newVersions: ChannelVersions): Promise<RunnableConfig>;
|
|
59
|
+
putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
|
|
60
|
+
deleteThread(threadId: string): Promise<void>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { BaseCheckpointSaver, copyCheckpoint, WRITES_IDX_MAP, } from '@langchain/langgraph-checkpoint';
|
|
2
|
+
const SAFE_KEY = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/;
|
|
3
|
+
function key(...parts) { return JSON.stringify(parts); }
|
|
4
|
+
function assertKey(field, value, allowEmpty = false) {
|
|
5
|
+
if (typeof value !== 'string' || (!allowEmpty && !value) || (value && !SAFE_KEY.test(value)))
|
|
6
|
+
throw new Error(`Invalid checkpoint ${field}`);
|
|
7
|
+
return value;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* LangGraph checkpointer whose whole history lives inside the run's durable
|
|
11
|
+
* envelope. Every checkpoint or pending write is persisted through the same
|
|
12
|
+
* atomic file write as the host ledger, so traversal state and receipts can
|
|
13
|
+
* never disagree after a crash. Values are serialized by LangGraph's own
|
|
14
|
+
* serializer and stored as base64 so the envelope stays plain JSON.
|
|
15
|
+
*/
|
|
16
|
+
export class FileCheckpointSaver extends BaseCheckpointSaver {
|
|
17
|
+
io;
|
|
18
|
+
checkpoints = new Map();
|
|
19
|
+
writes = new Map();
|
|
20
|
+
constructor(io) {
|
|
21
|
+
super();
|
|
22
|
+
this.io = io;
|
|
23
|
+
const stored = io.load();
|
|
24
|
+
if (stored) {
|
|
25
|
+
if (stored.format !== 1 || !Array.isArray(stored.checkpoints) || !Array.isArray(stored.writes))
|
|
26
|
+
throw new Error('Invalid graph checkpoint store');
|
|
27
|
+
for (const entry of stored.checkpoints)
|
|
28
|
+
this.checkpoints.set(key(entry.threadId, entry.ns, entry.id), entry);
|
|
29
|
+
for (const entry of stored.writes)
|
|
30
|
+
this.writes.set(key(entry.threadId, entry.ns, entry.checkpointId, entry.taskId, String(entry.idx)), entry);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** A JSON snapshot of the complete store. */
|
|
34
|
+
serialize() {
|
|
35
|
+
return { format: 1, checkpoints: [...this.checkpoints.values()], writes: [...this.writes.values()] };
|
|
36
|
+
}
|
|
37
|
+
async dump(value) {
|
|
38
|
+
const [type, bytes] = await this.serde.dumpsTyped(value);
|
|
39
|
+
return { type, data: Buffer.from(bytes).toString('base64') };
|
|
40
|
+
}
|
|
41
|
+
async load(blob) {
|
|
42
|
+
return await this.serde.loadsTyped(blob.type, Buffer.from(blob.data, 'base64'));
|
|
43
|
+
}
|
|
44
|
+
persist() { return this.io.save(this.serialize()); }
|
|
45
|
+
async tuple(entry) {
|
|
46
|
+
const pendingWrites = await Promise.all([...this.writes.values()]
|
|
47
|
+
.filter(write => write.threadId === entry.threadId && write.ns === entry.ns && write.checkpointId === entry.id)
|
|
48
|
+
.map(async (write) => [write.taskId, write.channel, await this.load(write.value)]));
|
|
49
|
+
const result = {
|
|
50
|
+
config: { configurable: { thread_id: entry.threadId, checkpoint_ns: entry.ns, checkpoint_id: entry.id } },
|
|
51
|
+
checkpoint: await this.load(entry.checkpoint),
|
|
52
|
+
metadata: await this.load(entry.metadata),
|
|
53
|
+
pendingWrites,
|
|
54
|
+
};
|
|
55
|
+
if (entry.parentId !== undefined)
|
|
56
|
+
result.parentConfig = { configurable: { thread_id: entry.threadId, checkpoint_ns: entry.ns, checkpoint_id: entry.parentId } };
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
entries(threadId, ns) {
|
|
60
|
+
return [...this.checkpoints.values()]
|
|
61
|
+
.filter(entry => (threadId === undefined || entry.threadId === threadId) && (ns === undefined || entry.ns === ns))
|
|
62
|
+
.sort((a, b) => b.id.localeCompare(a.id));
|
|
63
|
+
}
|
|
64
|
+
async getTuple(config) {
|
|
65
|
+
const threadId = assertKey('thread_id', config.configurable?.thread_id);
|
|
66
|
+
const ns = assertKey('checkpoint_ns', config.configurable?.checkpoint_ns ?? '', true);
|
|
67
|
+
const checkpointId = config.configurable?.checkpoint_id;
|
|
68
|
+
if (checkpointId !== undefined) {
|
|
69
|
+
const entry = this.checkpoints.get(key(threadId, ns, assertKey('checkpoint_id', checkpointId)));
|
|
70
|
+
return entry ? this.tuple(entry) : undefined;
|
|
71
|
+
}
|
|
72
|
+
const latest = this.entries(threadId, ns)[0];
|
|
73
|
+
return latest ? this.tuple(latest) : undefined;
|
|
74
|
+
}
|
|
75
|
+
async *list(config, options) {
|
|
76
|
+
const threadId = config.configurable?.thread_id;
|
|
77
|
+
const ns = config.configurable?.checkpoint_ns;
|
|
78
|
+
const only = config.configurable?.checkpoint_id;
|
|
79
|
+
const before = options?.before?.configurable?.checkpoint_id;
|
|
80
|
+
let remaining = options?.limit;
|
|
81
|
+
for (const entry of this.entries(threadId, ns)) {
|
|
82
|
+
if (only !== undefined && entry.id !== only)
|
|
83
|
+
continue;
|
|
84
|
+
if (before !== undefined && entry.id >= before)
|
|
85
|
+
continue;
|
|
86
|
+
const tuple = await this.tuple(entry);
|
|
87
|
+
if (options?.filter && !Object.entries(options.filter).every(([name, value]) => tuple.metadata?.[name] === value))
|
|
88
|
+
continue;
|
|
89
|
+
if (remaining !== undefined) {
|
|
90
|
+
if (remaining <= 0)
|
|
91
|
+
break;
|
|
92
|
+
remaining -= 1;
|
|
93
|
+
}
|
|
94
|
+
yield tuple;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async put(config, checkpoint, metadata, _newVersions) {
|
|
98
|
+
const threadId = assertKey('thread_id', config.configurable?.thread_id);
|
|
99
|
+
const ns = assertKey('checkpoint_ns', config.configurable?.checkpoint_ns ?? '', true);
|
|
100
|
+
const id = assertKey('checkpoint_id', checkpoint.id);
|
|
101
|
+
const parentId = config.configurable?.checkpoint_id;
|
|
102
|
+
const entry = {
|
|
103
|
+
threadId, ns, id, ...(parentId !== undefined ? { parentId } : {}),
|
|
104
|
+
checkpoint: await this.dump(copyCheckpoint(checkpoint)), metadata: await this.dump(metadata),
|
|
105
|
+
};
|
|
106
|
+
this.checkpoints.set(key(threadId, ns, id), entry);
|
|
107
|
+
await this.persist();
|
|
108
|
+
return { configurable: { thread_id: threadId, checkpoint_ns: ns, checkpoint_id: id } };
|
|
109
|
+
}
|
|
110
|
+
async putWrites(config, writes, taskId) {
|
|
111
|
+
const threadId = assertKey('thread_id', config.configurable?.thread_id);
|
|
112
|
+
const ns = assertKey('checkpoint_ns', config.configurable?.checkpoint_ns ?? '', true);
|
|
113
|
+
const checkpointId = assertKey('checkpoint_id', config.configurable?.checkpoint_id);
|
|
114
|
+
assertKey('task_id', taskId);
|
|
115
|
+
let changed = false;
|
|
116
|
+
for (const [index, [channel, value]] of writes.entries()) {
|
|
117
|
+
const idx = WRITES_IDX_MAP[channel] ?? index;
|
|
118
|
+
const writeKey = key(threadId, ns, checkpointId, taskId, String(idx));
|
|
119
|
+
if (idx >= 0 && this.writes.has(writeKey))
|
|
120
|
+
continue;
|
|
121
|
+
this.writes.set(writeKey, { threadId, ns, checkpointId, taskId, idx, channel, value: await this.dump(value) });
|
|
122
|
+
changed = true;
|
|
123
|
+
}
|
|
124
|
+
if (changed)
|
|
125
|
+
await this.persist();
|
|
126
|
+
}
|
|
127
|
+
async deleteThread(threadId) {
|
|
128
|
+
for (const [name, entry] of this.checkpoints)
|
|
129
|
+
if (entry.threadId === threadId)
|
|
130
|
+
this.checkpoints.delete(name);
|
|
131
|
+
for (const [name, entry] of this.writes)
|
|
132
|
+
if (entry.threadId === threadId)
|
|
133
|
+
this.writes.delete(name);
|
|
134
|
+
await this.persist();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=graph-checkpointer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-checkpointer.js","sourceRoot":"","sources":["../../src/agent-runtime/graph-checkpointer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAAE,cAAc,EAAE,cAAc,GAEpD,MAAM,iCAAiC,CAAA;AAmCxC,MAAM,QAAQ,GAAG,qCAAqC,CAAA;AACtD,SAAS,GAAG,CAAC,GAAG,KAAe,IAAY,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA,CAAC,CAAC;AACzE,SAAS,SAAS,CAAC,KAAa,EAAE,KAAc,EAAE,UAAU,GAAG,KAAK;IAClE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAA;IAC5I,OAAO,KAAK,CAAA;AACd,CAAC;AAED;;;;;;GAMG;AACH,MAAM,OAAO,mBAAoB,SAAQ,mBAAmB;IAI7B;IAHZ,WAAW,GAAG,IAAI,GAAG,EAAqC,CAAA;IAC1D,MAAM,GAAG,IAAI,GAAG,EAAgC,CAAA;IAEjE,YAA6B,EAAgB;QAC3C,KAAK,EAAE,CAAA;QADoB,OAAE,GAAF,EAAE,CAAc;QAE3C,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,EAAE,CAAA;QACxB,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,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IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAClG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Hosts define graph state with LangGraph's Annotation without a direct LangGraph dependency. */
|
|
2
|
+
export { Annotation } from '@langchain/langgraph';
|
|
3
|
+
export * from './executor-types.js';
|
|
4
|
+
export * from './config.js';
|
|
5
|
+
export * from './executors.js';
|
|
6
|
+
export * from './workflow.js';
|
|
7
|
+
export * from './core-host.js';
|
|
8
|
+
export * from './graph/state.js';
|
|
9
|
+
export { coreNodes, developerRecord, buildAcceptanceReport, MAX_DEEPEN_PASSES, type CoreNodeDeps } from './graph/nodes.js';
|
|
10
|
+
export { DEFAULT_REVIEW_POLICY, REVIEW_ASPECTS, evaluateReview, resolveReviewPolicy, type ReviewAspect, type ReviewPolicy } from './graph/review-policy.js';
|
|
11
|
+
export { createRoleInvoker, type Accept, type InvokeOptions, type InvokeOutcome, type RoleInvoker, type RoleInvokerDeps } from './graph/roles.js';
|
|
12
|
+
export { parseAgentObject } from './graph/artifacts.js';
|
|
13
|
+
export { FileCheckpointSaver, type GraphStoreIO, type SerializedGraphStore } from './graph-checkpointer.js';
|
|
14
|
+
export { ARCHITECT_OUTPUT_SCHEMA, DEVELOPER_OUTPUT_SCHEMA, REVIEW_OUTPUT_SCHEMA, ROLE_INSTRUCTIONS_VERSION, correctionInstructions, deepenInstructions, repairInstructions, roleInstructions, type FrozenCriterion, type RoleFeedback, type RoleInstructionOptions, } from './prompts.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Hosts define graph state with LangGraph's Annotation without a direct LangGraph dependency. */
|
|
2
|
+
export { Annotation } from '@langchain/langgraph';
|
|
3
|
+
export * from './executor-types.js';
|
|
4
|
+
export * from './config.js';
|
|
5
|
+
export * from './executors.js';
|
|
6
|
+
export * from './workflow.js';
|
|
7
|
+
export * from './core-host.js';
|
|
8
|
+
export * from './graph/state.js';
|
|
9
|
+
export { coreNodes, developerRecord, buildAcceptanceReport, MAX_DEEPEN_PASSES } from './graph/nodes.js';
|
|
10
|
+
export { DEFAULT_REVIEW_POLICY, REVIEW_ASPECTS, evaluateReview, resolveReviewPolicy } from './graph/review-policy.js';
|
|
11
|
+
export { createRoleInvoker } from './graph/roles.js';
|
|
12
|
+
export { parseAgentObject } from './graph/artifacts.js';
|
|
13
|
+
export { FileCheckpointSaver } from './graph-checkpointer.js';
|
|
14
|
+
export { ARCHITECT_OUTPUT_SCHEMA, DEVELOPER_OUTPUT_SCHEMA, REVIEW_OUTPUT_SCHEMA, ROLE_INSTRUCTIONS_VERSION, correctionInstructions, deepenInstructions, repairInstructions, roleInstructions, } from './prompts.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent-runtime/index.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,qBAAqB,EAAE,iBAAiB,EAAqB,MAAM,kBAAkB,CAAA;AAC1H,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAwC,MAAM,0BAA0B,CAAA;AAC3J,OAAO,EAAE,iBAAiB,EAA+F,MAAM,kBAAkB,CAAA;AACjJ,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAgD,MAAM,yBAAyB,CAAA;AAC3G,OAAO,EACL,uBAAuB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,yBAAyB,EACjG,sBAAsB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,gBAAgB,GACjF,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type AgentRequest, type AgentResult } from './executor-types.js';
|
|
2
|
+
import { type CliProcessRunner } from './cli-process.js';
|
|
3
|
+
/** Native ACP v1 keeps Kimi 0.27 read-only roles usable without a platform skill or a model call during capability negotiation. */
|
|
4
|
+
export declare function executeKimiReadonlyAcp(request: AgentRequest, options?: {
|
|
5
|
+
runProcess?: CliProcessRunner;
|
|
6
|
+
env?: NodeJS.ProcessEnv;
|
|
7
|
+
}): Promise<AgentResult>;
|