self-evolving-workflow 0.0.0-stage → 0.1.3
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/LICENSE +27 -0
- package/README.md +90 -2
- package/dist/agent-memory-prompts.d.ts +13 -0
- package/dist/agent-memory-prompts.js +55 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/closeout.d.ts +105 -0
- package/dist/closeout.js +479 -0
- package/dist/code.d.ts +39 -0
- package/dist/code.js +124 -0
- package/dist/common.d.ts +9 -0
- package/dist/common.js +42 -0
- package/dist/context-envelope.d.ts +59 -0
- package/dist/context-envelope.js +23 -0
- package/dist/host-adapters.d.ts +34 -0
- package/dist/host-adapters.js +151 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.js +90 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +13 -0
- package/dist/knowledge-cli.d.ts +183 -0
- package/dist/knowledge-cli.js +654 -0
- package/dist/knowledge-reads.d.ts +71 -0
- package/dist/knowledge-reads.js +193 -0
- package/dist/memory.d.ts +97 -0
- package/dist/memory.js +250 -0
- package/dist/retrospective.d.ts +57 -0
- package/dist/retrospective.js +248 -0
- package/dist/search.d.ts +36 -0
- package/dist/search.js +112 -0
- package/dist/skill-addition.d.ts +25 -0
- package/dist/skill-addition.js +89 -0
- package/dist/skill-design.d.ts +96 -0
- package/dist/skill-design.js +226 -0
- package/dist/skill-replay.d.ts +55 -0
- package/dist/skill-replay.js +451 -0
- package/dist/skill-route.d.ts +30 -0
- package/dist/skill-route.js +75 -0
- package/dist/transcript-evidence.d.ts +3 -0
- package/dist/transcript-evidence.js +58 -0
- package/dist/upstream/chunker.d.ts +24 -0
- package/dist/upstream/chunker.js +96 -0
- package/dist/upstream/file-protocol.d.ts +45 -0
- package/dist/upstream/file-protocol.js +117 -0
- package/dist/upstream/frontmatter.d.ts +47 -0
- package/dist/upstream/frontmatter.js +86 -0
- package/dist/upstream/graph-search.d.ts +33 -0
- package/dist/upstream/graph-search.js +67 -0
- package/dist/upstream/l1-extraction.d.ts +26 -0
- package/dist/upstream/l1-extraction.js +405 -0
- package/dist/upstream/llm.d.ts +8 -0
- package/dist/upstream/llm.js +1 -0
- package/dist/upstream/merge.d.ts +50 -0
- package/dist/upstream/merge.js +153 -0
- package/dist/upstream/prompts.d.ts +53 -0
- package/dist/upstream/prompts.js +185 -0
- package/dist/upstream/search-utils.d.ts +34 -0
- package/dist/upstream/search-utils.js +55 -0
- package/dist/upstream/slug.d.ts +26 -0
- package/dist/upstream/slug.js +103 -0
- package/dist/upstream/template.d.ts +29 -0
- package/dist/upstream/template.js +80 -0
- package/dist/upstream/tokenize.d.ts +4 -0
- package/dist/upstream/tokenize.js +29 -0
- package/dist/wiki-change.d.ts +76 -0
- package/dist/wiki-change.js +299 -0
- package/dist/wiki-entry.d.ts +26 -0
- package/dist/wiki-entry.js +93 -0
- package/dist/wiki-ingest.d.ts +12 -0
- package/dist/wiki-ingest.js +126 -0
- package/dist/wiki-migration.d.ts +16 -0
- package/dist/wiki-migration.js +268 -0
- package/dist/wiki-tokens.d.ts +1 -0
- package/dist/wiki-tokens.js +46 -0
- package/dist/wiki.d.ts +103 -0
- package/dist/wiki.js +330 -0
- package/dist/workflow-cli.d.ts +2 -0
- package/dist/workflow-cli.js +258 -0
- package/dist/workflow-install.d.ts +36 -0
- package/dist/workflow-install.js +148 -0
- package/dist/workflow-knowledge.d.ts +16 -0
- package/dist/workflow-knowledge.js +24 -0
- package/dist/workflow-mcp.d.ts +2 -0
- package/dist/workflow-mcp.js +144 -0
- package/dist/workflow-names.d.ts +4 -0
- package/dist/workflow-names.js +18 -0
- package/dist/workflow-runtime.d.ts +622 -0
- package/dist/workflow-runtime.js +627 -0
- package/dist/workflow-skills.d.ts +48 -0
- package/dist/workflow-skills.js +141 -0
- package/package.json +76 -4
- package/skills/ew-odyssey/SKILL.md +237 -0
- package/skills/ew-odyssey/references/audit-artifacts.md +7 -0
- package/skills/ew-odyssey/references/odyssey-base-codex.md +3 -0
- package/skills/ew-odyssey/references/odyssey-base.md +278 -0
- package/skills/ew-odyssey/references/odyssey-debug.codex.md +305 -0
- package/skills/ew-odyssey/references/odyssey-debug.md +283 -0
- package/skills/ew-odyssey/references/odyssey-defensive.codex.md +395 -0
- package/skills/ew-odyssey/references/odyssey-defensive.md +369 -0
- package/skills/ew-odyssey/references/odyssey-improve.codex.md +270 -0
- package/skills/ew-odyssey/references/odyssey-improve.md +248 -0
- package/skills/ew-odyssey/references/odyssey-planex.codex.md +352 -0
- package/skills/ew-odyssey/references/odyssey-planex.md +312 -0
- package/skills/ew-odyssey/references/odyssey-review.codex.md +283 -0
- package/skills/ew-odyssey/references/odyssey-review.md +251 -0
- package/skills/ew-odyssey/references/odyssey-security.md +249 -0
- package/skills/ew-odyssey/references/odyssey-ui.codex.md +294 -0
- package/skills/ew-odyssey/references/odyssey-ui.md +250 -0
- package/skills/ew-odyssey/references/prepare/odyssey-debug.md +105 -0
- package/skills/ew-odyssey/references/prepare/odyssey-defensive.md +121 -0
- package/skills/ew-odyssey/references/prepare/odyssey-improve.md +93 -0
- package/skills/ew-odyssey/references/prepare/odyssey-planex.md +104 -0
- package/skills/ew-odyssey/references/prepare/odyssey-review.md +98 -0
- package/skills/ew-odyssey/references/prepare/odyssey-security.md +94 -0
- package/skills/ew-odyssey/references/prepare/odyssey-ui.md +87 -0
- package/skills/ew-orchestrate/SKILL.md +236 -0
- package/skills/ew-orchestrate/references/auto-policy.md +165 -0
- package/skills/ew-orchestrate/references/companion-route.md +52 -0
- package/skills/ew-orchestrate/references/ew-orchestrate.md +27 -0
- package/skills/ew-orchestrate/references/goal.md +53 -0
- package/skills/ew-orchestrate/references/knowledge-route.md +163 -0
- package/skills/ew-orchestrate/references/orchestrator-run-loop.md +36 -0
- package/skills/ew-orchestrate/references/planning.md +137 -0
- package/skills/ew-orchestrate/steps/ew-analyze/SKILL.md +62 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/boundary-grill.md +50 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/issue-gaps-analyze.md +59 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/prepare.md +42 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/workflow.md +401 -0
- package/skills/ew-orchestrate/steps/ew-brainstorm/SKILL.md +32 -0
- package/skills/ew-orchestrate/steps/ew-companion/SKILL.md +9 -0
- package/skills/ew-orchestrate/steps/ew-execute/SKILL.md +71 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/prepare.md +69 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/workflow.md +373 -0
- package/skills/ew-orchestrate/steps/ew-plan/SKILL.md +102 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/boundary-grill.md +50 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/prepare.md +51 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/tdd.md +53 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/workflow.md +278 -0
- package/skills/ew-orchestrate/steps/ew-review/SKILL.md +44 -0
- package/skills/ew-orchestrate/steps/ew-review/references/odyssey-base-codex.md +3 -0
- package/skills/ew-orchestrate/steps/ew-review/references/prepare.md +76 -0
- package/skills/ew-orchestrate/steps/ew-review/references/workflow.md +283 -0
- package/skills/ew-skill-design/SKILL.md +28 -0
- package/skills/ew-skill-design/references/package-contract.md +28 -0
- package/skills/ew-skill-design/references/validation.md +7 -0
- package/skills/team-swarm/SKILL.md +231 -0
- package/skills/team-swarm/references/mcp-coordination.md +10 -0
- package/skills/team-swarm/roles/analyst/role.md +181 -0
- package/skills/team-swarm/roles/ant/role.md +149 -0
- package/skills/team-swarm/roles/coordinator/commands/converge.md +154 -0
- package/skills/team-swarm/roles/coordinator/commands/init-swarm.md +134 -0
- package/skills/team-swarm/roles/coordinator/commands/iterate.md +202 -0
- package/skills/team-swarm/roles/coordinator/role.md +228 -0
- package/skills/team-swarm/roles/scorer/role.md +150 -0
- package/skills/team-swarm/scripts/aco.py +646 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +111 -0
- package/skills/team-swarm/scripts/test_aco.py +606 -0
- package/skills/team-swarm/specs/ant-output-schema.md +127 -0
- package/skills/team-swarm/specs/convergence-criteria.md +108 -0
- package/skills/team-swarm/specs/pheromone-schema.md +125 -0
- package/skills/team-swarm/specs/swarm-config-template.json +71 -0
- package/skills/team-swarm/specs/swarm-protocol.md +123 -0
- package/skills/workflow-closeout/SKILL.md +10 -0
- package/skills/workflow-evolve/SKILL.md +79 -0
- package/skills/workflow-evolve/references/agy-gate.md +27 -0
- package/skills/workflow-evolve/references/auto-loop.md +20 -0
- package/skills/workflow-evolve/references/history-review.md +14 -0
- package/skills/workflow-evolve/scripts/codex-memory-replay.mjs +76 -0
- package/skills/workflow-evolve/scripts/codex-replay.mjs +1 -0
- package/skills/workflow-evolve/scripts/evolve-loop.mjs +259 -0
- package/skills/workflow-evolve/scripts/memory-codex-mcp.mjs +124 -0
- package/workflows/index.json +23 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { lstatSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { buildSessionSignalPrompt } from './agent-memory-prompts.js';
|
|
4
|
+
import { parseReceipt, readSessionTransitions, readSkillExecution } from './closeout.js';
|
|
5
|
+
import { InputError, requireText } from './common.js';
|
|
6
|
+
import { extractMemoryInputs, validateConversationMessages } from './memory.js';
|
|
7
|
+
import { readCompletionTranscriptRefs, readTranscriptSnapshots } from './transcript-evidence.js';
|
|
8
|
+
import { validateKnowledgeReads } from './knowledge-reads.js';
|
|
9
|
+
import { readEvolveSessions } from './workflow-runtime.js';
|
|
10
|
+
function signalKind(value) {
|
|
11
|
+
switch (value) {
|
|
12
|
+
case 'correction':
|
|
13
|
+
case 'error':
|
|
14
|
+
case 'retry':
|
|
15
|
+
case 'aborted':
|
|
16
|
+
case 'verified_fix':
|
|
17
|
+
case 'workflow_issue':
|
|
18
|
+
return value;
|
|
19
|
+
default:
|
|
20
|
+
return 'unclassified';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function extractSignals(messages, session, model, evidenceRuns = new Map()) {
|
|
24
|
+
if (!messages.length)
|
|
25
|
+
return [];
|
|
26
|
+
const extracted = await extractMemoryInputs(messages, {
|
|
27
|
+
llm: model(), session, agentMemoryPrompt: buildSessionSignalPrompt(),
|
|
28
|
+
});
|
|
29
|
+
const signals = extracted.flatMap(item => item.id && item.sourceMessageIds?.length
|
|
30
|
+
? [{
|
|
31
|
+
id: item.id, kind: signalKind(item.type), summary: item.content, sources: item.sourceMessageIds,
|
|
32
|
+
runIds: [...new Set(item.sourceMessageIds.flatMap(id => evidenceRuns.get(id) ?? []))].sort(),
|
|
33
|
+
}]
|
|
34
|
+
: []);
|
|
35
|
+
return [...new Map(signals.map(signal => [signal.id, signal])).values()];
|
|
36
|
+
}
|
|
37
|
+
export async function reviewSkillExecution(wiki, project, execution, model) {
|
|
38
|
+
project = requireText(project, 'source project ID');
|
|
39
|
+
execution = requireText(execution, 'Skill execution ID');
|
|
40
|
+
const completion = readSkillExecution(wiki, project, execution);
|
|
41
|
+
validateConversationMessages(completion.messages);
|
|
42
|
+
const messages = completion.messages.map(message => ({ ...message, id: `receipt:${project}:${completion.id}#${message.id}` }));
|
|
43
|
+
if (completion.knowledgeReads) {
|
|
44
|
+
messages.push({
|
|
45
|
+
id: `receipt:${project}:${completion.id}#knowledge-reads`, role: 'tool',
|
|
46
|
+
timestamp: completion.timestamp, content: knowledgeReadsMessage(completion.knowledgeReads),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
execution, receipt: completion.id, skill: completion.skill, evidence: messages.length,
|
|
51
|
+
signals: await extractSignals(messages, completion.id, model),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function readSkillReference(value) {
|
|
55
|
+
if (value === undefined)
|
|
56
|
+
return undefined;
|
|
57
|
+
if (!value || typeof value !== 'object')
|
|
58
|
+
throw new InputError('Invalid Run Skill reference');
|
|
59
|
+
const source = value;
|
|
60
|
+
const commit = requireText(source.commit, 'Skill commit');
|
|
61
|
+
const tree = requireText(source.tree, 'Skill tree');
|
|
62
|
+
const objectId = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
|
|
63
|
+
if (!objectId.test(commit) || !objectId.test(tree))
|
|
64
|
+
throw new InputError('Invalid Skill Git object ID');
|
|
65
|
+
return {
|
|
66
|
+
skill_id: requireText(source.skill_id, 'Skill ID'), commit, tree,
|
|
67
|
+
package_path: requireText(source.package_path, 'Skill package path'), entry: requireText(source.entry, 'Skill entry'),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function readSkillFiles(value, run) {
|
|
71
|
+
if (!value || typeof value !== 'object')
|
|
72
|
+
throw new InputError(`Invalid Skill reads for Run ${run.id}`);
|
|
73
|
+
const reads = value;
|
|
74
|
+
const reference = readSkillReference(reads.reference);
|
|
75
|
+
if (!run.skillRef || !reference || JSON.stringify(reference) !== JSON.stringify(run.skillRef) ||
|
|
76
|
+
!Array.isArray(reads.reads) || !Array.isArray(reads.missing) || reads.missing.length !== 0) {
|
|
77
|
+
throw new InputError(`Skill reads do not match the sealed Run ${run.id}`);
|
|
78
|
+
}
|
|
79
|
+
const files = new Map();
|
|
80
|
+
for (const entry of reads.reads) {
|
|
81
|
+
if (!entry || typeof entry !== 'object')
|
|
82
|
+
throw new InputError(`Invalid Skill read for Run ${run.id}`);
|
|
83
|
+
const path = requireText(entry.path, 'Skill read path');
|
|
84
|
+
const sha256 = requireText(entry.sha256, 'Skill read hash');
|
|
85
|
+
if (path.includes('\\') || path.split('/').some(part => !part || part === '.' || part === '..') ||
|
|
86
|
+
!/\.md$/i.test(path) || !/^sha256:[a-f0-9]{64}$/.test(sha256) ||
|
|
87
|
+
(files.has(path) && files.get(path) !== sha256)) {
|
|
88
|
+
throw new InputError(`Invalid Skill read for Run ${run.id}: ${path}`);
|
|
89
|
+
}
|
|
90
|
+
files.set(path, sha256);
|
|
91
|
+
}
|
|
92
|
+
if (!files.has(reference.entry))
|
|
93
|
+
throw new InputError(`Missing Skill entry read for Run ${run.id}`);
|
|
94
|
+
return [...files].map(([path, sha256]) => ({ path, sha256 }));
|
|
95
|
+
}
|
|
96
|
+
function knowledgeReadsMessage(receipt) {
|
|
97
|
+
const searches = receipt.searches.map(search => `${search.search_id} ${search.source} "${search.query}" (${search.total_hits} hits: ${search.returned_ids.join(', ') || 'none'})`).join('; ');
|
|
98
|
+
const reads = receipt.reads.map(read => `${read.kind}:${read.id}${read.from_search_id ? ` from ${read.from_search_id}` : ''}`).join(', ') || 'none';
|
|
99
|
+
const constraints = receipt.constraints_bound.map(item => item.knowledge_id).join(', ') || 'none';
|
|
100
|
+
const reuse = receipt.priors_reuse?.map(item => `${item.artifact_id} from ${item.producer_run_id} (${item.content_sha256})`).join(', ');
|
|
101
|
+
return `Knowledge searches: ${searches || 'none'}. Knowledge reads: ${reads}. Bound constraints: ${constraints}.` +
|
|
102
|
+
(reuse ? ` Reused session priors: ${reuse}.` : '');
|
|
103
|
+
}
|
|
104
|
+
export async function reviewSession(root, session, options) {
|
|
105
|
+
session = requireText(session, 'Session ID');
|
|
106
|
+
if (!/^[a-z0-9][a-z0-9_-]*$/i.test(session))
|
|
107
|
+
throw new InputError('Invalid Session ID');
|
|
108
|
+
const [native] = readEvolveSessions(root, session);
|
|
109
|
+
if (native) {
|
|
110
|
+
const evidenceRuns = new Map();
|
|
111
|
+
const messages = [];
|
|
112
|
+
const runs = native.runs.map(run => {
|
|
113
|
+
const timestamp = run.finished_at ?? native.created_at;
|
|
114
|
+
const source = `evolve:${session}#${run.id}`;
|
|
115
|
+
const record = (id, content, related = [run.id]) => {
|
|
116
|
+
messages.push({ id, timestamp, role: 'tool', content });
|
|
117
|
+
evidenceRuns.set(id, related);
|
|
118
|
+
};
|
|
119
|
+
if (run.summary)
|
|
120
|
+
record(source, `${run.task.command} ${run.status}. ${run.summary}`);
|
|
121
|
+
if (run.retry_of_run_id)
|
|
122
|
+
record(source + ':retry', `Run ${run.id} retries ${run.retry_of_run_id}.`, [run.id, run.retry_of_run_id]);
|
|
123
|
+
const files = Object.entries(run.reads).map(([path, sha256]) => ({ path, sha256 }));
|
|
124
|
+
const readSource = source + ':skill-reads';
|
|
125
|
+
if (files.length)
|
|
126
|
+
record(readSource, 'Opened Skill documents: ' + files.map(file => file.path).join(', '));
|
|
127
|
+
const knowledgeSource = source + ':knowledge-reads';
|
|
128
|
+
if (run.knowledge_reads)
|
|
129
|
+
record(knowledgeSource, knowledgeReadsMessage(run.knowledge_reads));
|
|
130
|
+
const { skill_id, commit, tree, package_path, entry } = run.skill;
|
|
131
|
+
return {
|
|
132
|
+
id: run.id, command: run.task.command, source, retryOf: run.retry_of_run_id,
|
|
133
|
+
skillRef: { skill_id, commit, tree, package_path, entry },
|
|
134
|
+
...(files.length ? { skillReads: { source: readSource, files } } : {}),
|
|
135
|
+
...(run.knowledge_reads ? { knowledgeReads: { source: knowledgeSource, receipt: run.knowledge_reads } } : {}),
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
for (const message of options.transcript ?? []) {
|
|
139
|
+
messages.push({ ...message, id: `conversation:${session}#${message.id}` });
|
|
140
|
+
}
|
|
141
|
+
validateConversationMessages(messages);
|
|
142
|
+
return { session, evidence: messages.length, runs, signals: await extractSignals(messages, session, options.model, evidenceRuns) };
|
|
143
|
+
}
|
|
144
|
+
const directory = join(root, '.workflow', 'sessions', session);
|
|
145
|
+
if (!lstatSync(directory, { throwIfNoEntry: false })?.isDirectory()) {
|
|
146
|
+
throw new InputError(`Session not found: ${session}`);
|
|
147
|
+
}
|
|
148
|
+
const evidence = new Map();
|
|
149
|
+
const evidenceRuns = new Map();
|
|
150
|
+
const runs = new Map();
|
|
151
|
+
const blocked = new Set();
|
|
152
|
+
const summarizedRuns = new Set();
|
|
153
|
+
let completedRefs;
|
|
154
|
+
for (const { receipt, result, id } of readSessionTransitions(directory)) {
|
|
155
|
+
if (receipt.target_type === 'orchestration' && receipt.target_id === session && result.status === 'completed') {
|
|
156
|
+
if (result.evolve_transcript_refs !== undefined || Array.isArray(result.evolve_evidence)) {
|
|
157
|
+
completedRefs = readCompletionTranscriptRefs(result.evolve_transcript_refs);
|
|
158
|
+
}
|
|
159
|
+
for (const message of parseReceipt(receipt).messages) {
|
|
160
|
+
const run = /^run:(.+):summary$/.exec(message.id)?.[1];
|
|
161
|
+
if (run && summarizedRuns.has(run))
|
|
162
|
+
continue;
|
|
163
|
+
const source = `receipt:${id}#${message.id}`;
|
|
164
|
+
evidence.set(source, { ...message, id: source });
|
|
165
|
+
if (run)
|
|
166
|
+
evidenceRuns.set(source, [run]);
|
|
167
|
+
}
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (typeof result.run_id !== 'string')
|
|
171
|
+
continue;
|
|
172
|
+
const run = result.run_id;
|
|
173
|
+
if ((receipt.target_type === 'run' && receipt.target_id === run) ||
|
|
174
|
+
(receipt.target_type === 'orchestration' && receipt.target_id === session)) {
|
|
175
|
+
if (Array.isArray(receipt.evidence_refs)) {
|
|
176
|
+
for (const ref of receipt.evidence_refs) {
|
|
177
|
+
if (typeof ref !== 'string' || !ref.startsWith('transcript:'))
|
|
178
|
+
continue;
|
|
179
|
+
const linked = evidenceRuns.get(ref) ?? [];
|
|
180
|
+
if (!linked.includes(run))
|
|
181
|
+
evidenceRuns.set(ref, [...linked, run]);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const source = `receipt:${id}#run:${run}`;
|
|
186
|
+
const timestamp = requireText(receipt.recorded_at, 'Run transition time');
|
|
187
|
+
const sealed = result.status === 'sealed' && ((receipt.target_type === 'orchestration' && receipt.target_id === session && result.operation === 'run-complete-and-seal') ||
|
|
188
|
+
(receipt.target_type === 'run' && receipt.target_id === run && result.operation === 'run-recovery-seal'));
|
|
189
|
+
const reviewedRun = runs.get(run);
|
|
190
|
+
if (sealed && reviewedRun?.skillRef && result.skill_reads !== undefined) {
|
|
191
|
+
const files = readSkillFiles(result.skill_reads, reviewedRun);
|
|
192
|
+
const readSource = `receipt:${id}#skill-reads:${run}`;
|
|
193
|
+
reviewedRun.skillReads = { source: readSource, files };
|
|
194
|
+
evidence.set(readSource, {
|
|
195
|
+
id: readSource, role: 'tool', timestamp,
|
|
196
|
+
content: `Run ${run} opened Skill documents: ${files.map(file => file.path).join(', ')}.`,
|
|
197
|
+
});
|
|
198
|
+
evidenceRuns.set(readSource, [run]);
|
|
199
|
+
}
|
|
200
|
+
if (sealed && reviewedRun && result.knowledge_reads !== undefined) {
|
|
201
|
+
const receipt = validateKnowledgeReads(result.knowledge_reads);
|
|
202
|
+
const knowledgeSource = `receipt:${id}#knowledge-reads:${run}`;
|
|
203
|
+
reviewedRun.knowledgeReads = { source: knowledgeSource, receipt };
|
|
204
|
+
evidence.set(knowledgeSource, {
|
|
205
|
+
id: knowledgeSource, role: 'tool', timestamp, content: knowledgeReadsMessage(receipt),
|
|
206
|
+
});
|
|
207
|
+
evidenceRuns.set(knowledgeSource, [run]);
|
|
208
|
+
}
|
|
209
|
+
const record = (content, runIds = [run]) => {
|
|
210
|
+
evidence.set(source, { id: source, content, timestamp, role: 'tool' });
|
|
211
|
+
evidenceRuns.set(source, runIds);
|
|
212
|
+
};
|
|
213
|
+
if (receipt.target_type === 'orchestration' && receipt.target_id === session &&
|
|
214
|
+
result.run_already_created === true && result.task && typeof result.task === 'object') {
|
|
215
|
+
const command = requireText(result.task.command, 'Run command');
|
|
216
|
+
const retryOf = result.retry_of_run_id === undefined ? undefined : requireText(result.retry_of_run_id, 'prior Run ID');
|
|
217
|
+
const skillRef = readSkillReference(result.skill_ref);
|
|
218
|
+
runs.set(run, { id: run, command, skillRef, retryOf, source });
|
|
219
|
+
if (retryOf)
|
|
220
|
+
record(`Run ${run} (${command}) retries ${retryOf}.`, [run, retryOf]);
|
|
221
|
+
}
|
|
222
|
+
else if (receipt.target_type === 'run' && receipt.target_id === run) {
|
|
223
|
+
const status = result.status;
|
|
224
|
+
const recovered = status === 'running' && blocked.delete(run);
|
|
225
|
+
if (status === 'blocked')
|
|
226
|
+
blocked.add(run);
|
|
227
|
+
if (status === 'blocked' || status === 'failed' || status === 'cancelled' || recovered) {
|
|
228
|
+
record(`Run ${run} ${recovered ? 'resumed after a block' : `became ${status}`}. Reason: ${requireText(receipt.reason, 'Run transition reason')}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else if (receipt.target_type === 'orchestration' && receipt.target_id === session &&
|
|
232
|
+
result.operation === 'run-complete-and-seal' && result.status === 'sealed' && typeof result.summary === 'string') {
|
|
233
|
+
record(`Run ${run} completed. Summary: ${requireText(result.summary, 'Run summary')}`);
|
|
234
|
+
summarizedRuns.add(run);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
for (const message of readTranscriptSnapshots(directory, completedRefs))
|
|
238
|
+
evidence.set(message.id, message);
|
|
239
|
+
for (const message of options.transcript ?? []) {
|
|
240
|
+
const id = `conversation:${session}#${requireText(message.id, 'message ID')}`;
|
|
241
|
+
if (evidence.has(id))
|
|
242
|
+
throw new InputError(`Duplicate conversation message: ${message.id}`);
|
|
243
|
+
evidence.set(id, { ...message, id });
|
|
244
|
+
}
|
|
245
|
+
const messages = [...evidence.values()].sort((left, right) => new Date(left.timestamp).getTime() - new Date(right.timestamp).getTime());
|
|
246
|
+
return { session, evidence: messages.length, runs: [...runs.values()],
|
|
247
|
+
signals: await extractSignals(messages, session, options.model, evidenceRuns) };
|
|
248
|
+
}
|
package/dist/search.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type AgentMemoryContextScope, type AgentMemoryEnvelope } from './context-envelope.js';
|
|
2
|
+
import type { CodeGraph } from './code.js';
|
|
3
|
+
import type { MemorySearchOptions, MemoryStore } from './memory.js';
|
|
4
|
+
import type { Wiki, WikiSearchOptions } from './wiki.js';
|
|
5
|
+
import type { WikiContext } from './wiki-entry.js';
|
|
6
|
+
import type { KnowledgeReads } from './knowledge-reads.js';
|
|
7
|
+
export interface SearchSources {
|
|
8
|
+
code?: CodeGraph;
|
|
9
|
+
wiki?: Wiki;
|
|
10
|
+
memory?: MemoryStore;
|
|
11
|
+
}
|
|
12
|
+
export type SearchScope = keyof SearchSources | 'all';
|
|
13
|
+
export interface SearchOptions {
|
|
14
|
+
scope?: SearchScope;
|
|
15
|
+
limit?: number;
|
|
16
|
+
wiki?: Omit<WikiSearchOptions, 'limit'>;
|
|
17
|
+
memory?: Omit<MemorySearchOptions, 'limit'>;
|
|
18
|
+
knowledgeReads?: KnowledgeReads;
|
|
19
|
+
}
|
|
20
|
+
export interface ContextOptions {
|
|
21
|
+
limit?: number;
|
|
22
|
+
context?: WikiContext;
|
|
23
|
+
wiki?: Omit<WikiSearchOptions, 'limit'>;
|
|
24
|
+
memory?: Omit<MemorySearchOptions, 'limit'>;
|
|
25
|
+
contextScope?: AgentMemoryContextScope;
|
|
26
|
+
includeWorkingMemory?: boolean;
|
|
27
|
+
knowledgeReads?: KnowledgeReads;
|
|
28
|
+
}
|
|
29
|
+
export interface SearchResults {
|
|
30
|
+
code?: Awaited<ReturnType<CodeGraph['search']>>;
|
|
31
|
+
wiki?: ReturnType<Wiki['search']>;
|
|
32
|
+
memory?: Awaited<ReturnType<MemoryStore['search']>>;
|
|
33
|
+
}
|
|
34
|
+
export declare function parseScope(scope: string): SearchScope;
|
|
35
|
+
export declare function search(sources: SearchSources, query: string, options?: SearchOptions): Promise<SearchResults>;
|
|
36
|
+
export declare function context(sources: SearchSources, query: string, options?: ContextOptions): Promise<AgentMemoryEnvelope>;
|
package/dist/search.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { createAgentMemoryEnvelope, } from './context-envelope.js';
|
|
3
|
+
import { InputError, NotFoundError, requireText, searchLimit } from './common.js';
|
|
4
|
+
export function parseScope(scope) {
|
|
5
|
+
if (scope === 'all' || scope === 'code' || scope === 'wiki' || scope === 'memory')
|
|
6
|
+
return scope;
|
|
7
|
+
throw new InputError('scope must be all, code, wiki or memory');
|
|
8
|
+
}
|
|
9
|
+
export async function search(sources, query, options = {}) {
|
|
10
|
+
const text = requireText(query, 'query');
|
|
11
|
+
const limit = searchLimit(options.limit);
|
|
12
|
+
const scope = parseScope(options.scope ?? 'all');
|
|
13
|
+
if (scope !== 'all' && !sources[scope])
|
|
14
|
+
throw new NotFoundError(`Search source is not configured: ${scope}`);
|
|
15
|
+
const wiki = scope === 'all' || scope === 'wiki' ? sources.wiki?.search(text, { ...options.wiki, limit }) : undefined;
|
|
16
|
+
const [code, memory] = await Promise.all([
|
|
17
|
+
scope === 'all' || scope === 'code' ? sources.code?.search(text, limit) : undefined,
|
|
18
|
+
scope === 'all' || scope === 'memory' ? sources.memory?.search(text, { ...options.memory, limit }) : undefined,
|
|
19
|
+
]);
|
|
20
|
+
const tracker = options.knowledgeReads;
|
|
21
|
+
if (tracker && wiki) {
|
|
22
|
+
tracker.recordSearch({
|
|
23
|
+
source: 'wiki', query: text, filters: options.wiki,
|
|
24
|
+
returnedIds: wiki.results.map(hit => hit.id),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (tracker && code) {
|
|
28
|
+
const returnedIds = Array.isArray(code) ? code.flatMap(item => {
|
|
29
|
+
if (!item || typeof item !== 'object')
|
|
30
|
+
return [];
|
|
31
|
+
const id = item.id ?? item.node?.id;
|
|
32
|
+
return typeof id === 'string' ? [id] : [];
|
|
33
|
+
}) : [];
|
|
34
|
+
tracker.recordSearch({ source: 'code', query: text, returnedIds });
|
|
35
|
+
}
|
|
36
|
+
if (tracker && memory) {
|
|
37
|
+
tracker.recordSearch({
|
|
38
|
+
source: 'memory', query: text, filters: options.memory,
|
|
39
|
+
returnedIds: memory.results.map(hit => hit.id),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return { ...(code && { code }), ...(wiki && { wiki }), ...(memory && { memory }) };
|
|
43
|
+
}
|
|
44
|
+
export async function context(sources, query, options = {}) {
|
|
45
|
+
const text = requireText(query, 'query');
|
|
46
|
+
const limit = searchLimit(options.limit);
|
|
47
|
+
const wikiContext = options.context ?? {};
|
|
48
|
+
const constraints = sources.wiki?.constraints(wikiContext).slice(0, limit) ?? [];
|
|
49
|
+
const references = sources.wiki?.references(text, wikiContext, { ...options.wiki, limit }).results ?? [];
|
|
50
|
+
const workingMemories = options.includeWorkingMemory && sources.memory
|
|
51
|
+
? (await sources.memory.search(text, { ...options.memory, limit })).results
|
|
52
|
+
: [];
|
|
53
|
+
const tracker = options.knowledgeReads;
|
|
54
|
+
if (tracker) {
|
|
55
|
+
for (const constraint of constraints) {
|
|
56
|
+
tracker.bindConstraint({
|
|
57
|
+
knowledgeId: constraint.id,
|
|
58
|
+
scope: constraint.entry?.scope ?? [],
|
|
59
|
+
categories: constraint.entry?.categories,
|
|
60
|
+
content: constraint.body,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (sources.wiki) {
|
|
64
|
+
tracker.recordSearch({
|
|
65
|
+
source: 'wiki_references', query: text,
|
|
66
|
+
filters: { ...wikiContext, ...options.wiki },
|
|
67
|
+
returnedIds: references.map(hit => hit.id),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (options.includeWorkingMemory && sources.memory) {
|
|
71
|
+
tracker.recordSearch({
|
|
72
|
+
source: 'memory', query: text, filters: options.memory,
|
|
73
|
+
returnedIds: workingMemories.map(memory => memory.id),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return createAgentMemoryEnvelope({
|
|
78
|
+
contextScope: options.contextScope,
|
|
79
|
+
constraints: constraints.map(page => ({
|
|
80
|
+
knowledge_id: page.id,
|
|
81
|
+
title: page.title,
|
|
82
|
+
mode: 'constraint',
|
|
83
|
+
authority: 'binding',
|
|
84
|
+
scope: page.entry?.scope ?? [],
|
|
85
|
+
...(page.entry?.categories ? { categories: page.entry.categories } : {}),
|
|
86
|
+
content: page.body,
|
|
87
|
+
content_sha256: `sha256:${createHash('sha256').update(page.body).digest('hex')}`,
|
|
88
|
+
sources: page.sources,
|
|
89
|
+
source_count: page.sources.length,
|
|
90
|
+
})),
|
|
91
|
+
references: references.map(hit => ({
|
|
92
|
+
knowledge_id: hit.id,
|
|
93
|
+
title: hit.title,
|
|
94
|
+
mode: 'reference',
|
|
95
|
+
authority: 'advisory',
|
|
96
|
+
score: hit.score,
|
|
97
|
+
hop: hit.hop,
|
|
98
|
+
snippet: hit.snippet,
|
|
99
|
+
sources: hit.sources,
|
|
100
|
+
related_knowledge_ids: hit.related.map(related => related.id),
|
|
101
|
+
})),
|
|
102
|
+
workingMemories: workingMemories.map(memory => ({
|
|
103
|
+
memory_id: memory.id,
|
|
104
|
+
session_id: memory.session,
|
|
105
|
+
type: memory.type,
|
|
106
|
+
authority: 'unverified_episodic',
|
|
107
|
+
content: memory.content,
|
|
108
|
+
source_ids: memory.sourceMessageIds,
|
|
109
|
+
linked_knowledge_id: null,
|
|
110
|
+
})),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type SkillPriority = 'high' | 'normal' | 'low';
|
|
2
|
+
export declare const learningIndex = "references/learnings/index.md";
|
|
3
|
+
export declare function learningDocument(id: string): string;
|
|
4
|
+
export declare function draftSkillAddition(input: {
|
|
5
|
+
entry: string;
|
|
6
|
+
priority: SkillPriority;
|
|
7
|
+
instruction: string;
|
|
8
|
+
sources: string[];
|
|
9
|
+
when?: string;
|
|
10
|
+
}): {
|
|
11
|
+
baseline: {
|
|
12
|
+
path: string;
|
|
13
|
+
sha256: string;
|
|
14
|
+
};
|
|
15
|
+
changes: {
|
|
16
|
+
path: string;
|
|
17
|
+
content: string;
|
|
18
|
+
}[];
|
|
19
|
+
when?: string | undefined;
|
|
20
|
+
id: string;
|
|
21
|
+
priority: SkillPriority;
|
|
22
|
+
sources: string[];
|
|
23
|
+
instruction: string;
|
|
24
|
+
};
|
|
25
|
+
export type SkillAddition = ReturnType<typeof draftSkillAddition>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { lstatSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { InputError, requireText } from './common.js';
|
|
5
|
+
export const learningIndex = 'references/learnings/index.md';
|
|
6
|
+
export function learningDocument(id) {
|
|
7
|
+
return `references/learnings/${id}.md`;
|
|
8
|
+
}
|
|
9
|
+
function readOptionalDocument(path) {
|
|
10
|
+
const info = lstatSync(path, { throwIfNoEntry: false });
|
|
11
|
+
if (info && !info.isFile())
|
|
12
|
+
throw new InputError(`Expected a regular Skill Markdown file: ${path}`);
|
|
13
|
+
return info ? readFileSync(path, 'utf8') : undefined;
|
|
14
|
+
}
|
|
15
|
+
function appendBlock(baseline, marker, block) {
|
|
16
|
+
if (!baseline.includes(marker))
|
|
17
|
+
return `${baseline.trimEnd()}\n\n${block}\n`;
|
|
18
|
+
if (!baseline.replace(/\r\n/g, '\n').includes(block)) {
|
|
19
|
+
throw new InputError('Existing Skill learning block differs from this draft');
|
|
20
|
+
}
|
|
21
|
+
return baseline;
|
|
22
|
+
}
|
|
23
|
+
export function draftSkillAddition(input) {
|
|
24
|
+
const entry = resolve(input.entry);
|
|
25
|
+
if (!lstatSync(entry, { throwIfNoEntry: false })?.isFile())
|
|
26
|
+
throw new InputError('Expected a regular Skill Markdown file');
|
|
27
|
+
const baseline = readFileSync(entry, 'utf8');
|
|
28
|
+
const instruction = requireText(input.instruction, 'Skill instruction');
|
|
29
|
+
const when = input.when === undefined ? undefined : requireText(input.when, 'learning trigger');
|
|
30
|
+
const sources = [...new Set(input.sources.map(source => requireText(source, 'evidence reference')))].sort();
|
|
31
|
+
if (!sources.length)
|
|
32
|
+
throw new InputError('At least one evidence reference is required');
|
|
33
|
+
if (/[\r\n]/.test(sources.join('')) || /<!--\s*\/?evolve:learning\b/.test(instruction)) {
|
|
34
|
+
throw new InputError('Evidence references must use one line and instructions must omit learning markers');
|
|
35
|
+
}
|
|
36
|
+
if (when && (/[\r\n]/.test(when) || /<!--/.test(when)))
|
|
37
|
+
throw new InputError('A learning trigger must use one line');
|
|
38
|
+
if (input.priority === 'high' && (/[\r\n]/.test(instruction) || [...instruction].length > 280)) {
|
|
39
|
+
throw new InputError('A high-priority inline addition must be one instruction under 281 characters');
|
|
40
|
+
}
|
|
41
|
+
const id = createHash('sha256').update(JSON.stringify([input.priority, instruction, sources, when])).digest('hex').slice(0, 20);
|
|
42
|
+
const start = `<!-- evolve:learning:${id} -->`;
|
|
43
|
+
const end = '<!-- /evolve:learning -->';
|
|
44
|
+
const relative = learningDocument(id);
|
|
45
|
+
const details = `# Skill learning\n\n${when ? `When: ${when}\n\n` : ''}${instruction}\n\n## Evidence\n\n${sources.map(source => `- ${source}`).join('\n')}\n`;
|
|
46
|
+
const packageRoot = dirname(entry);
|
|
47
|
+
const changes = [];
|
|
48
|
+
if (input.priority !== 'high') {
|
|
49
|
+
for (const directory of ['references', 'references/learnings']) {
|
|
50
|
+
const info = lstatSync(resolve(packageRoot, directory), { throwIfNoEntry: false });
|
|
51
|
+
if (info && !info.isDirectory())
|
|
52
|
+
throw new InputError(`Expected a regular Skill reference directory: ${directory}`);
|
|
53
|
+
}
|
|
54
|
+
const path = resolve(packageRoot, relative);
|
|
55
|
+
const existing = readOptionalDocument(path);
|
|
56
|
+
if (existing !== undefined && existing.replace(/\r\n/g, '\n') !== details) {
|
|
57
|
+
throw new InputError(`Existing Skill learning document differs from this draft: ${relative}`);
|
|
58
|
+
}
|
|
59
|
+
changes.push({ path, content: details });
|
|
60
|
+
}
|
|
61
|
+
if (input.priority === 'low') {
|
|
62
|
+
const indexPath = resolve(packageRoot, learningIndex);
|
|
63
|
+
const index = readOptionalDocument(indexPath) ?? '# Optional Skill references\n';
|
|
64
|
+
const title = [...(when ?? instruction).split(/\r?\n/, 1)[0]].slice(0, 100).join('').replace(/[&<>()[\]\\`*_]/g, '\\$&');
|
|
65
|
+
const indexContent = appendBlock(index, start, `${start}\n- [${title}](./${id}.md)\n${end}`);
|
|
66
|
+
const indexMarker = '<!-- evolve:learning:index -->';
|
|
67
|
+
const entryContent = appendBlock(baseline, indexMarker, `${indexMarker}\n[Optional Skill references](${learningIndex}) for tasks that explicitly need additional examples or troubleshooting.\n${end}`);
|
|
68
|
+
if (indexContent !== index)
|
|
69
|
+
changes.push({ path: indexPath, content: indexContent });
|
|
70
|
+
if (entryContent !== baseline)
|
|
71
|
+
changes.unshift({ path: entry, content: entryContent });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const body = input.priority === 'high' ? instruction
|
|
75
|
+
: `[Read the workflow learning](${relative}) when ${when ?? 'the documented conditions apply'}.`;
|
|
76
|
+
const addition = `${start}\n${body}\n${end}`;
|
|
77
|
+
let content = appendBlock(baseline, start, addition);
|
|
78
|
+
if (input.priority === 'high' && content !== baseline) {
|
|
79
|
+
const frontmatter = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/.exec(baseline)?.[0] ?? '';
|
|
80
|
+
content = `${frontmatter}\n${addition}\n\n${baseline.slice(frontmatter.length)}`;
|
|
81
|
+
}
|
|
82
|
+
changes.unshift({ path: entry, content });
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
id, priority: input.priority, sources, instruction, ...(when ? { when } : {}),
|
|
86
|
+
baseline: { path: entry, sha256: createHash('sha256').update(baseline).digest('hex') },
|
|
87
|
+
changes,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { SkillRouteDecision } from './skill-route.js';
|
|
2
|
+
export declare const SKILL_DESIGN_TASK_VERSION = "skill-design-task/1.0";
|
|
3
|
+
export declare const SKILL_DESIGN_RECEIPT_VERSION = "skill-design-receipt/1.0";
|
|
4
|
+
export interface SkillDesignTask {
|
|
5
|
+
schema_version: typeof SKILL_DESIGN_TASK_VERSION;
|
|
6
|
+
id: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
route: 'skill-design';
|
|
9
|
+
source: {
|
|
10
|
+
closeout_id: string;
|
|
11
|
+
candidate_id: string;
|
|
12
|
+
evidence: string[];
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
target: {
|
|
16
|
+
skill_id?: string;
|
|
17
|
+
skill_version?: string;
|
|
18
|
+
entry?: string;
|
|
19
|
+
};
|
|
20
|
+
design_request: {
|
|
21
|
+
reasons: string[];
|
|
22
|
+
instruction: string;
|
|
23
|
+
acceptance: string[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface SkillDesignReceipt {
|
|
27
|
+
schema_version: typeof SKILL_DESIGN_RECEIPT_VERSION;
|
|
28
|
+
id: string;
|
|
29
|
+
task_id: string;
|
|
30
|
+
status: 'designed' | 'reviewed' | 'replayed' | 'applied' | 'rolled_back';
|
|
31
|
+
runner: {
|
|
32
|
+
path: string;
|
|
33
|
+
sha256: string;
|
|
34
|
+
};
|
|
35
|
+
design: {
|
|
36
|
+
schema_version: 'skill-design/1.0';
|
|
37
|
+
task_id: string;
|
|
38
|
+
draft: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
review?: {
|
|
41
|
+
status: 'passed';
|
|
42
|
+
checks: string[];
|
|
43
|
+
};
|
|
44
|
+
replay_receipt_id?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function createSkillDesignTask(root: string, input: {
|
|
47
|
+
closeoutId: string;
|
|
48
|
+
candidateId: string;
|
|
49
|
+
content: string;
|
|
50
|
+
sources: string[];
|
|
51
|
+
decision: SkillRouteDecision;
|
|
52
|
+
skillId?: string;
|
|
53
|
+
skillVersion?: string;
|
|
54
|
+
}): {
|
|
55
|
+
id: string;
|
|
56
|
+
path: string;
|
|
57
|
+
task: SkillDesignTask;
|
|
58
|
+
replayed: boolean;
|
|
59
|
+
};
|
|
60
|
+
export declare function readSkillDesignTask(root: string, id: string): SkillDesignTask;
|
|
61
|
+
export declare function runSkillDesign(root: string, taskId: string, runnerPath: string): {
|
|
62
|
+
path: string;
|
|
63
|
+
replayed: boolean;
|
|
64
|
+
schema_version: typeof SKILL_DESIGN_RECEIPT_VERSION;
|
|
65
|
+
id: string;
|
|
66
|
+
task_id: string;
|
|
67
|
+
status: "designed" | "reviewed" | "replayed" | "applied" | "rolled_back";
|
|
68
|
+
runner: {
|
|
69
|
+
path: string;
|
|
70
|
+
sha256: string;
|
|
71
|
+
};
|
|
72
|
+
design: {
|
|
73
|
+
schema_version: "skill-design/1.0";
|
|
74
|
+
task_id: string;
|
|
75
|
+
draft: Record<string, unknown>;
|
|
76
|
+
};
|
|
77
|
+
review?: {
|
|
78
|
+
status: "passed";
|
|
79
|
+
checks: string[];
|
|
80
|
+
};
|
|
81
|
+
replay_receipt_id?: string;
|
|
82
|
+
};
|
|
83
|
+
export declare function reviewSkillDesign(root: string, designId: string): SkillDesignReceipt;
|
|
84
|
+
export declare function replaySkillDesign(root: string, designId: string, options: {
|
|
85
|
+
runner: string;
|
|
86
|
+
scenarios: unknown;
|
|
87
|
+
}): SkillDesignReceipt & {
|
|
88
|
+
replay: Record<string, unknown>;
|
|
89
|
+
};
|
|
90
|
+
export declare function applySkillDesign(root: string, designId: string, rollback?: boolean): {
|
|
91
|
+
design_id: string;
|
|
92
|
+
replay_receipt_id: string;
|
|
93
|
+
id: string;
|
|
94
|
+
commit: string;
|
|
95
|
+
replayed: boolean;
|
|
96
|
+
};
|