@open-agent-toolkit/cli 0.2.62 → 0.2.63
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/assets/bundle-metadata.json +1 -1
- package/assets/docs/cli-utilities/config-and-local-state.md +1 -0
- package/assets/docs/cli-utilities/configuration.md +10 -8
- package/assets/docs/cli-utilities/project-log.md +16 -0
- package/assets/docs/cli-utilities/workflow-gates.md +124 -16
- package/assets/docs/provider-sync/commands.md +3 -0
- package/assets/docs/provider-sync/instruction-sync.md +107 -0
- package/assets/docs/reference/cli-reference.md +16 -6
- package/assets/docs/reference/oat-directory-structure.md +32 -31
- package/assets/docs/workflows/projects/lifecycle.md +45 -0
- package/assets/docs/workflows/projects/picking-up-projects.md +14 -0
- package/assets/docs/workflows/skills/explainer-kit.md +10 -4
- package/assets/docs/workflows/skills/repo-improve.md +15 -1
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/oat-explainer-kit/SKILL.md +14 -1
- package/assets/skills/oat-explainer-kit/references/config-contract.md +12 -0
- package/assets/skills/oat-explainer-kit/references/lifecycle-contract.md +57 -10
- package/assets/skills/oat-explainer-kit/scripts/check-terminal-outcome.mjs +28 -5
- package/assets/skills/oat-explainer-kit/scripts/probe-recap-seams.mjs +371 -0
- package/assets/skills/oat-explainer-kit/scripts/resolve-intent.mjs +123 -1
- package/assets/skills/oat-project-autonomous/SKILL.md +10 -1
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +121 -121
- package/assets/skills/oat-project-complete/SKILL.md +134 -4
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +121 -121
- package/assets/skills/oat-project-implement/SKILL.md +1 -1
- package/assets/skills/oat-project-implement/references/completion-and-closeout.md +38 -6
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +121 -121
- package/assets/skills/oat-project-lite/references/docs/autonomy-contract.md +121 -121
- package/assets/skills/oat-project-next/SKILL.md +62 -19
- package/assets/skills/oat-project-plan/SKILL.md +31 -5
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +121 -121
- package/assets/skills/oat-project-progress/SKILL.md +12 -3
- package/assets/skills/oat-project-quick-start/SKILL.md +264 -4
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +121 -121
- package/assets/skills/oat-project-summary/SKILL.md +34 -23
- package/assets/skills/oat-repo-improve/SKILL.md +40 -5
- package/assets/skills/oat-repo-improve/references/plan-template.md +84 -7
- package/dist/commands/config/index.d.ts +1 -0
- package/dist/commands/config/index.d.ts.map +1 -1
- package/dist/commands/config/index.js +401 -18
- package/dist/commands/gate/index.d.ts +3 -1
- package/dist/commands/gate/index.d.ts.map +1 -1
- package/dist/commands/gate/index.js +699 -211
- package/dist/commands/init/tools/shared/skill-script-references.d.ts +126 -0
- package/dist/commands/init/tools/shared/skill-script-references.d.ts.map +1 -0
- package/dist/commands/init/tools/shared/skill-script-references.js +311 -0
- package/dist/commands/instructions/instructions.types.d.ts +63 -0
- package/dist/commands/instructions/instructions.types.d.ts.map +1 -1
- package/dist/commands/instructions/instructions.utils.d.ts +51 -2
- package/dist/commands/instructions/instructions.utils.d.ts.map +1 -1
- package/dist/commands/instructions/instructions.utils.js +201 -4
- package/dist/commands/instructions/sync/sync.d.ts.map +1 -1
- package/dist/commands/instructions/sync/sync.js +12 -1
- package/dist/commands/instructions/validate/validate.d.ts.map +1 -1
- package/dist/commands/instructions/validate/validate.js +12 -1
- package/dist/commands/project/log/append.d.ts +195 -0
- package/dist/commands/project/log/append.d.ts.map +1 -1
- package/dist/commands/project/log/append.js +1034 -11
- package/dist/config/oat-config.d.ts +41 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +111 -0
- package/package.json +2 -2
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-flight capability probe for the provider-neutral seams a lifecycle
|
|
3
|
+
* `project-recap` run requires.
|
|
4
|
+
*
|
|
5
|
+
* The probe is pure: it inspects only the inputs a caller would hand to
|
|
6
|
+
* `runOatExplainer`, applying the same resolution and exclusivity rules
|
|
7
|
+
* `scripts/run.mjs` applies at runtime. It never imports a module, calls a
|
|
8
|
+
* callback, validates a browser-session brand, or touches the filesystem.
|
|
9
|
+
*
|
|
10
|
+
* Three outcomes are kept distinct and are never conflated:
|
|
11
|
+
*
|
|
12
|
+
* - `missing` — no provider is supplied for a seam this mode requires. This is
|
|
13
|
+
* the only outcome that may become a recordable `skip` / `capability_probe`
|
|
14
|
+
* intent (`code: 'seams-unavailable'`).
|
|
15
|
+
* - `invalid` — a seam is supplied but violates a resolution rule (both a
|
|
16
|
+
* callback and a module path, a non-function callback, an empty module path,
|
|
17
|
+
* or an unsupported `coreOptions` route). It fails closed with the same
|
|
18
|
+
* message the runtime would raise (`code: 'seams-invalid'`) and is never a
|
|
19
|
+
* skip.
|
|
20
|
+
* - runtime failure — an unloadable module, a non-function export, an unbranded
|
|
21
|
+
* browser session, or a failed generation. The probe never observes these
|
|
22
|
+
* because it never loads or calls anything, so a failed run after a passing
|
|
23
|
+
* probe stays `failed`.
|
|
24
|
+
*
|
|
25
|
+
* Each seam has its own classifier that mirrors its `run.mjs` resolver check by
|
|
26
|
+
* check and in the same order, because the resolvers do not share one order:
|
|
27
|
+
* `resolveLifecycleCritic` counts only function/truthy candidates before it
|
|
28
|
+
* type-checks, while the author, visual critic, and set planner type-check the
|
|
29
|
+
* callback before they reject a direct-plus-module conflict. Keep each
|
|
30
|
+
* classifier aligned with the resolver named in its comment.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const MODES = new Set(['interactive', 'unattended']);
|
|
34
|
+
|
|
35
|
+
const isSet = (value) => value !== undefined;
|
|
36
|
+
|
|
37
|
+
const invalid = (reason, message) => ({ status: 'invalid', reason, message });
|
|
38
|
+
const supplied = () => ({ status: 'supplied' });
|
|
39
|
+
const absent = () => ({ status: 'absent' });
|
|
40
|
+
|
|
41
|
+
function badModulePath(value) {
|
|
42
|
+
return typeof value !== 'string' || value.trim().length === 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Mirrors `run.mjs#resolveLifecycleAuthor`. */
|
|
46
|
+
function classifyAuthor({ author, authorModulePath }, coreOptions) {
|
|
47
|
+
if (isSet(coreOptions.author)) {
|
|
48
|
+
return invalid(
|
|
49
|
+
'unsupported-core-option',
|
|
50
|
+
'coreOptions.author is not supported at the OAT adapter boundary; supply author directly.',
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
if (isSet(author) && typeof author !== 'function') {
|
|
54
|
+
return invalid(
|
|
55
|
+
'callback-not-a-function',
|
|
56
|
+
'author must be a function when supplied.',
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (isSet(author) && isSet(authorModulePath)) {
|
|
60
|
+
return invalid(
|
|
61
|
+
'multiple-sources',
|
|
62
|
+
'Supply only one provider-neutral author callback or author module entry point.',
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
if (!isSet(author) && !isSet(authorModulePath)) return absent();
|
|
66
|
+
if (isSet(authorModulePath) && badModulePath(authorModulePath)) {
|
|
67
|
+
return invalid(
|
|
68
|
+
'empty-module-path',
|
|
69
|
+
'authorModulePath must be a non-empty path.',
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return supplied();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Mirrors `run.mjs#resolveLifecycleCritic`.
|
|
77
|
+
*
|
|
78
|
+
* `resolveLifecycleCritic` returns `null` rather than throwing when no critic is
|
|
79
|
+
* supplied, so treating the critic as required looks stricter than the adapter
|
|
80
|
+
* resolver in isolation. It is not, for the runs this probe serves: an
|
|
81
|
+
* artifact-bound lifecycle closeout recap passes no `suppliedFactBasePath`, so
|
|
82
|
+
* `bindProjectSources` binds it `factBase.mode: 'federated'`
|
|
83
|
+
* (`bind-project-sources.mjs`), and the core throws for a federated fact base
|
|
84
|
+
* with no critic (`explainer-kit/scripts/lib/fact-base.mjs`). Such a host cannot
|
|
85
|
+
* produce a recap today; probing the critic turns that mid-run core failure into
|
|
86
|
+
* a pre-flight capability skip. (A `supplied` fact base is a different
|
|
87
|
+
* invocation path and does skip the core's critic check, but no lifecycle recap
|
|
88
|
+
* caller uses it.) Do not "fix" this to match `resolveLifecycleCritic` — that
|
|
89
|
+
* would reintroduce an unrunnable recap.
|
|
90
|
+
*/
|
|
91
|
+
function classifyCritic({ critic, criticModulePath }, coreOptions) {
|
|
92
|
+
// The runtime counts only candidates that already look usable, so a
|
|
93
|
+
// non-function callback beside a module path is a type error rather than a
|
|
94
|
+
// conflict.
|
|
95
|
+
const candidates = [
|
|
96
|
+
typeof critic === 'function' ? critic : null,
|
|
97
|
+
typeof coreOptions.critic === 'function' ? coreOptions.critic : null,
|
|
98
|
+
criticModulePath ? criticModulePath : null,
|
|
99
|
+
].filter(Boolean);
|
|
100
|
+
if (candidates.length > 1) {
|
|
101
|
+
return invalid(
|
|
102
|
+
'multiple-sources',
|
|
103
|
+
'Supply only one provider-neutral critic callback or critic module entry point.',
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
if (isSet(critic) && typeof critic !== 'function') {
|
|
107
|
+
return invalid(
|
|
108
|
+
'callback-not-a-function',
|
|
109
|
+
'critic must be a function when supplied.',
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (isSet(coreOptions.critic) && typeof coreOptions.critic !== 'function') {
|
|
113
|
+
return invalid(
|
|
114
|
+
'callback-not-a-function',
|
|
115
|
+
'coreOptions.critic must be a function when supplied.',
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
if (isSet(criticModulePath)) {
|
|
119
|
+
return badModulePath(criticModulePath)
|
|
120
|
+
? invalid(
|
|
121
|
+
'empty-module-path',
|
|
122
|
+
'criticModulePath must be a non-empty path.',
|
|
123
|
+
)
|
|
124
|
+
: supplied();
|
|
125
|
+
}
|
|
126
|
+
// `coreOptions.critic` is the documented compatibility route, so it satisfies
|
|
127
|
+
// the seam rather than invalidating it.
|
|
128
|
+
return (critic ?? coreOptions.critic) ? supplied() : absent();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Mirrors `run.mjs#resolveLifecycleBrowserSession`. */
|
|
132
|
+
function classifyBrowserSession(
|
|
133
|
+
{
|
|
134
|
+
browserSession,
|
|
135
|
+
browserSessionModulePath,
|
|
136
|
+
browserProbe,
|
|
137
|
+
browserProbeModulePath,
|
|
138
|
+
},
|
|
139
|
+
coreOptions,
|
|
140
|
+
) {
|
|
141
|
+
if (isSet(coreOptions.browserProbe)) {
|
|
142
|
+
return invalid(
|
|
143
|
+
'unsupported-core-option',
|
|
144
|
+
'coreOptions.browserProbe is not supported at the OAT adapter boundary; supply browserSession directly.',
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
if (isSet(browserProbe) || isSet(browserProbeModulePath)) {
|
|
148
|
+
return invalid(
|
|
149
|
+
'unsupported-input',
|
|
150
|
+
'Bare browserProbe callbacks are not supported at the OAT adapter boundary; supply a branded browserSession created by createBrowserProbeSession().',
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
if (isSet(coreOptions.browserSession)) {
|
|
154
|
+
return invalid(
|
|
155
|
+
'unsupported-core-option',
|
|
156
|
+
'coreOptions.browserSession is not supported at the OAT adapter boundary; supply browserSession directly.',
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
if (isSet(browserSession) && isSet(browserSessionModulePath)) {
|
|
160
|
+
return invalid(
|
|
161
|
+
'multiple-sources',
|
|
162
|
+
'Supply only one browser session descriptor or browser session module entry point.',
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
if (isSet(browserSessionModulePath)) {
|
|
166
|
+
return badModulePath(browserSessionModulePath)
|
|
167
|
+
? invalid(
|
|
168
|
+
'empty-module-path',
|
|
169
|
+
'browserSessionModulePath must be a non-empty path.',
|
|
170
|
+
)
|
|
171
|
+
: supplied();
|
|
172
|
+
}
|
|
173
|
+
// A browser session is a descriptor the runtime resolves by truthiness, so a
|
|
174
|
+
// falsy one raises the same "requires exactly one" error as supplying none.
|
|
175
|
+
// Classifying it invalid would fail the unattended completion this probe
|
|
176
|
+
// exists to unblock.
|
|
177
|
+
return browserSession ? supplied() : absent();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Mirrors `run.mjs#resolveLifecycleVisualCritic` and `resolveProviderCallback`. */
|
|
181
|
+
function classifyVisualCritic(
|
|
182
|
+
{ visualCritic, visualCriticModulePath },
|
|
183
|
+
coreOptions,
|
|
184
|
+
) {
|
|
185
|
+
if (isSet(coreOptions.visualCritic)) {
|
|
186
|
+
return invalid(
|
|
187
|
+
'unsupported-core-option',
|
|
188
|
+
'coreOptions.visualCritic is not supported at the OAT adapter boundary; supply visualCritic directly.',
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
if (isSet(visualCritic) && typeof visualCritic !== 'function') {
|
|
192
|
+
return invalid(
|
|
193
|
+
'callback-not-a-function',
|
|
194
|
+
'visualCritic must be a function when supplied.',
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
if (isSet(visualCritic) && isSet(visualCriticModulePath)) {
|
|
198
|
+
return invalid(
|
|
199
|
+
'multiple-sources',
|
|
200
|
+
'Supply only one provider-neutral visual critic callback or visual critic module entry point.',
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
if (!isSet(visualCriticModulePath)) {
|
|
204
|
+
return visualCritic ? supplied() : absent();
|
|
205
|
+
}
|
|
206
|
+
return badModulePath(visualCriticModulePath)
|
|
207
|
+
? invalid(
|
|
208
|
+
'empty-module-path',
|
|
209
|
+
'visualCriticModulePath must be a non-empty path.',
|
|
210
|
+
)
|
|
211
|
+
: supplied();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Mirrors `run.mjs#resolveLifecycleSetPlanner`. */
|
|
215
|
+
function classifyPlanSet({ planSet, planSetModulePath }, coreOptions) {
|
|
216
|
+
if (isSet(coreOptions.planSet)) {
|
|
217
|
+
return invalid(
|
|
218
|
+
'unsupported-core-option',
|
|
219
|
+
'coreOptions.planSet is not supported at the OAT adapter boundary; supply planSet directly.',
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
if (isSet(planSet) && typeof planSet !== 'function') {
|
|
223
|
+
return invalid(
|
|
224
|
+
'callback-not-a-function',
|
|
225
|
+
'planSet must be a function when supplied.',
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
if (isSet(planSet) && isSet(planSetModulePath)) {
|
|
229
|
+
return invalid(
|
|
230
|
+
'multiple-sources',
|
|
231
|
+
'Supply only one provider-neutral set planner callback or set planner module entry point.',
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
if (!isSet(planSet) && !isSet(planSetModulePath)) return absent();
|
|
235
|
+
if (isSet(planSetModulePath) && badModulePath(planSetModulePath)) {
|
|
236
|
+
return invalid(
|
|
237
|
+
'empty-module-path',
|
|
238
|
+
'planSetModulePath must be a non-empty path.',
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
return supplied();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The five seams an unattended `project-recap` requires, in report order.
|
|
246
|
+
*
|
|
247
|
+
* `requiredIn` mirrors the adapter contract: the author and the fact critic are
|
|
248
|
+
* required by every federated adapter run, while the browser session, visual
|
|
249
|
+
* critic, and set planner are required only for unattended project recaps.
|
|
250
|
+
*/
|
|
251
|
+
const SEAMS = [
|
|
252
|
+
{
|
|
253
|
+
id: 'author',
|
|
254
|
+
requiredIn: ['interactive', 'unattended'],
|
|
255
|
+
classify: classifyAuthor,
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: 'critic',
|
|
259
|
+
requiredIn: ['interactive', 'unattended'],
|
|
260
|
+
classify: classifyCritic,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: 'browserSession',
|
|
264
|
+
requiredIn: ['unattended'],
|
|
265
|
+
classify: classifyBrowserSession,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: 'visualCritic',
|
|
269
|
+
requiredIn: ['unattended'],
|
|
270
|
+
classify: classifyVisualCritic,
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
id: 'planSet',
|
|
274
|
+
requiredIn: ['unattended'],
|
|
275
|
+
classify: classifyPlanSet,
|
|
276
|
+
},
|
|
277
|
+
];
|
|
278
|
+
|
|
279
|
+
export const RECAP_SEAM_IDS = Object.freeze(SEAMS.map((seam) => seam.id));
|
|
280
|
+
export const RECAP_PROBE_CODES = Object.freeze([
|
|
281
|
+
'seams-ok',
|
|
282
|
+
'seams-unavailable',
|
|
283
|
+
'seams-invalid',
|
|
284
|
+
]);
|
|
285
|
+
|
|
286
|
+
export function probeRecapSeams(inputs = {}) {
|
|
287
|
+
if (!inputs || typeof inputs !== 'object' || Array.isArray(inputs)) {
|
|
288
|
+
throw new TypeError('Seam probe inputs must be an object.');
|
|
289
|
+
}
|
|
290
|
+
const { mode = 'unattended', coreOptions = {} } = inputs;
|
|
291
|
+
if (!MODES.has(mode)) {
|
|
292
|
+
throw new Error(`Unsupported lifecycle mode: ${String(mode)}`);
|
|
293
|
+
}
|
|
294
|
+
if (!coreOptions || typeof coreOptions !== 'object') {
|
|
295
|
+
throw new TypeError('coreOptions must be an object when supplied.');
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const missing = [];
|
|
299
|
+
const invalidSeams = [];
|
|
300
|
+
const resolved = [];
|
|
301
|
+
|
|
302
|
+
for (const seam of SEAMS) {
|
|
303
|
+
const outcome = seam.classify(inputs, coreOptions);
|
|
304
|
+
if (outcome.status === 'invalid') {
|
|
305
|
+
invalidSeams.push({
|
|
306
|
+
seam: seam.id,
|
|
307
|
+
reason: outcome.reason,
|
|
308
|
+
message: outcome.message,
|
|
309
|
+
});
|
|
310
|
+
} else if (outcome.status === 'supplied') {
|
|
311
|
+
resolved.push(seam.id);
|
|
312
|
+
} else if (seam.requiredIn.includes(mode)) {
|
|
313
|
+
missing.push(seam.id);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Invalid outranks missing: a broken configuration must fail closed rather
|
|
318
|
+
// than degrade into a capability skip.
|
|
319
|
+
if (invalidSeams.length > 0) {
|
|
320
|
+
return {
|
|
321
|
+
ok: false,
|
|
322
|
+
mode,
|
|
323
|
+
code: 'seams-invalid',
|
|
324
|
+
missing,
|
|
325
|
+
invalid: invalidSeams,
|
|
326
|
+
resolved,
|
|
327
|
+
message: `Recap seam configuration is invalid: ${invalidSeams
|
|
328
|
+
.map((entry) => entry.message)
|
|
329
|
+
.join(' ')}`,
|
|
330
|
+
guidance:
|
|
331
|
+
'Correct the reported seam configuration. A configured-but-invalid seam fails closed and is never a capability skip.',
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
if (missing.length > 0) {
|
|
336
|
+
return {
|
|
337
|
+
ok: false,
|
|
338
|
+
mode,
|
|
339
|
+
code: 'seams-unavailable',
|
|
340
|
+
missing,
|
|
341
|
+
invalid: invalidSeams,
|
|
342
|
+
resolved,
|
|
343
|
+
message: `No provider is configured for ${formatList(missing)}, so ${article(mode)} ${mode} project recap cannot run on this host.`,
|
|
344
|
+
guidance:
|
|
345
|
+
mode === 'unattended'
|
|
346
|
+
? `Configure ${formatList(missing)} to generate an unattended project recap, or let autonomous resolution record the recap as skip / capability_probe.`
|
|
347
|
+
: `Configure ${formatList(missing)} to generate an interactive project recap, or record an interactive skip decision.`,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return {
|
|
352
|
+
ok: true,
|
|
353
|
+
mode,
|
|
354
|
+
code: 'seams-ok',
|
|
355
|
+
missing,
|
|
356
|
+
invalid: invalidSeams,
|
|
357
|
+
resolved,
|
|
358
|
+
message: `Every ${mode} project recap seam resolves on this host.`,
|
|
359
|
+
guidance: null,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** `unattended` and `interactive` both take "an"; keep the surface grammatical. */
|
|
364
|
+
function article(mode) {
|
|
365
|
+
return /^[aeiou]/i.test(mode) ? 'an' : 'a';
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function formatList(values) {
|
|
369
|
+
if (values.length === 1) return values[0];
|
|
370
|
+
return `${values.slice(0, -1).join(', ')} and ${values.at(-1)}`;
|
|
371
|
+
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { RECAP_PROBE_CODES, RECAP_SEAM_IDS } from './probe-recap-seams.mjs';
|
|
2
|
+
|
|
1
3
|
const PRODUCTS = new Set(['projectExplainer', 'projectRecap']);
|
|
2
4
|
const MODES = new Set(['interactive', 'autonomous']);
|
|
3
5
|
const PREFERENCES = new Set(['always', 'ask', 'never']);
|
|
4
6
|
const DECISIONS = new Set(['generate', 'skip']);
|
|
5
|
-
const SOURCES = new Set([
|
|
7
|
+
const SOURCES = new Set([
|
|
8
|
+
'interactive',
|
|
9
|
+
'kickoff_prompt',
|
|
10
|
+
'autonomous_policy',
|
|
11
|
+
'capability_probe',
|
|
12
|
+
]);
|
|
6
13
|
const ALLOWED_PAIRS = Object.freeze({
|
|
7
14
|
projectExplainer: new Set([
|
|
8
15
|
'generate:interactive',
|
|
@@ -13,6 +20,7 @@ const ALLOWED_PAIRS = Object.freeze({
|
|
|
13
20
|
'generate:interactive',
|
|
14
21
|
'skip:interactive',
|
|
15
22
|
'generate:autonomous_policy',
|
|
23
|
+
'skip:capability_probe',
|
|
16
24
|
]),
|
|
17
25
|
});
|
|
18
26
|
const ISO_TIMESTAMP_PATTERN =
|
|
@@ -25,6 +33,7 @@ export function resolveIntent({
|
|
|
25
33
|
preference,
|
|
26
34
|
kickoffRequest = false,
|
|
27
35
|
answer,
|
|
36
|
+
seamProbe,
|
|
28
37
|
now = new Date().toISOString(),
|
|
29
38
|
}) {
|
|
30
39
|
assertProduct(product);
|
|
@@ -39,6 +48,19 @@ export function resolveIntent({
|
|
|
39
48
|
if (typeof kickoffRequest !== 'boolean') {
|
|
40
49
|
throw new TypeError('kickoffRequest must be a boolean.');
|
|
41
50
|
}
|
|
51
|
+
if (seamProbe !== undefined) {
|
|
52
|
+
assertSeamProbe(seamProbe);
|
|
53
|
+
if (product !== 'projectRecap') {
|
|
54
|
+
throw new Error(
|
|
55
|
+
'Seam probe results apply only to projectRecap resolution.',
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
if (mode !== 'autonomous') {
|
|
59
|
+
throw new Error(
|
|
60
|
+
'Seam probe results apply only to autonomous projectRecap resolution.',
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
42
64
|
|
|
43
65
|
if (mode === 'autonomous') {
|
|
44
66
|
if (answer !== undefined) {
|
|
@@ -49,6 +71,7 @@ export function resolveIntent({
|
|
|
49
71
|
state,
|
|
50
72
|
preference,
|
|
51
73
|
kickoffRequest,
|
|
74
|
+
seamProbe,
|
|
52
75
|
now,
|
|
53
76
|
});
|
|
54
77
|
}
|
|
@@ -149,10 +172,30 @@ function resolveAutonomous({
|
|
|
149
172
|
state,
|
|
150
173
|
preference,
|
|
151
174
|
kickoffRequest,
|
|
175
|
+
seamProbe,
|
|
152
176
|
now,
|
|
153
177
|
}) {
|
|
154
178
|
if (product === 'projectRecap') {
|
|
155
179
|
const warnings = [];
|
|
180
|
+
if (seamProbe !== undefined && seamProbe.ok !== true) {
|
|
181
|
+
if (seamProbe.code !== 'seams-unavailable') {
|
|
182
|
+
const error = new Error(
|
|
183
|
+
`Project recap seams are configured but invalid, so the recap fails closed rather than resolving a capability skip: ${seamProbe.message ?? seamProbe.code}`,
|
|
184
|
+
);
|
|
185
|
+
error.code = 'E_RECAP_SEAMS_INVALID';
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
warnings.push(
|
|
189
|
+
`Autonomous project recap skipped: no provider is configured for ${formatSeams(seamProbe.missing)}.`,
|
|
190
|
+
);
|
|
191
|
+
return result(
|
|
192
|
+
product,
|
|
193
|
+
'skip',
|
|
194
|
+
'capability_probe',
|
|
195
|
+
createRecord(product, 'skip', 'capability_probe', now),
|
|
196
|
+
warnings,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
156
199
|
if (state?.decision === 'skip') {
|
|
157
200
|
warnings.push(
|
|
158
201
|
'Autonomous project recap policy overrode a lower-precedence skip decision.',
|
|
@@ -206,6 +249,85 @@ function result(
|
|
|
206
249
|
};
|
|
207
250
|
}
|
|
208
251
|
|
|
252
|
+
/**
|
|
253
|
+
* A seam probe result is a decision input, so a malformed one must fail rather
|
|
254
|
+
* than silently degrade into either a skip or a forced generate.
|
|
255
|
+
*/
|
|
256
|
+
function assertSeamProbe(seamProbe) {
|
|
257
|
+
if (
|
|
258
|
+
!seamProbe ||
|
|
259
|
+
typeof seamProbe !== 'object' ||
|
|
260
|
+
Array.isArray(seamProbe) ||
|
|
261
|
+
typeof seamProbe.ok !== 'boolean' ||
|
|
262
|
+
!RECAP_PROBE_CODES.includes(seamProbe.code)
|
|
263
|
+
) {
|
|
264
|
+
throw new TypeError(
|
|
265
|
+
'seamProbe must be a probeRecapSeams result with ok and a known code.',
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
// A recap that runs from this decision runs unattended, so an interactive
|
|
269
|
+
// probe is the wrong evidence: it checks only the author and critic and would
|
|
270
|
+
// report a host with no set planner as fully available.
|
|
271
|
+
if (seamProbe.mode !== 'unattended') {
|
|
272
|
+
throw new TypeError(
|
|
273
|
+
'seamProbe must come from an unattended probe of the recap seams.',
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
if (
|
|
277
|
+
!Array.isArray(seamProbe.missing) ||
|
|
278
|
+
!Array.isArray(seamProbe.invalid) ||
|
|
279
|
+
!Array.isArray(seamProbe.resolved)
|
|
280
|
+
) {
|
|
281
|
+
throw new TypeError(
|
|
282
|
+
'seamProbe must partition the canonical recap seams into missing, invalid, and resolved.',
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
// Enforce the partition this message promises: every canonical seam appears
|
|
286
|
+
// in exactly one bucket. Without the disjointness and coverage checks, a
|
|
287
|
+
// forged result can claim a seam is both missing and resolved (yielding a
|
|
288
|
+
// capability skip the probe would never emit), or pad `resolved` with
|
|
289
|
+
// duplicates of one seam to fake full availability and force a generate.
|
|
290
|
+
const claimed = [
|
|
291
|
+
...seamProbe.missing,
|
|
292
|
+
...seamProbe.invalid.map((entry) => entry?.seam),
|
|
293
|
+
...seamProbe.resolved,
|
|
294
|
+
];
|
|
295
|
+
const distinct = new Set(claimed);
|
|
296
|
+
if (
|
|
297
|
+
distinct.size !== claimed.length ||
|
|
298
|
+
distinct.size !== RECAP_SEAM_IDS.length ||
|
|
299
|
+
!RECAP_SEAM_IDS.every((seam) => distinct.has(seam))
|
|
300
|
+
) {
|
|
301
|
+
throw new TypeError(
|
|
302
|
+
'seamProbe must partition the canonical recap seams into missing, invalid, and resolved.',
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
// The result is a discriminated union, so each code must carry exactly the
|
|
306
|
+
// evidence it claims. A half-populated object must never reach the skip
|
|
307
|
+
// branch and forge a capability skip out of an invalid seam.
|
|
308
|
+
const consistent =
|
|
309
|
+
seamProbe.code === 'seams-ok'
|
|
310
|
+
? seamProbe.ok === true &&
|
|
311
|
+
seamProbe.missing.length === 0 &&
|
|
312
|
+
seamProbe.invalid.length === 0 &&
|
|
313
|
+
seamProbe.resolved.length === RECAP_SEAM_IDS.length
|
|
314
|
+
: seamProbe.ok === false &&
|
|
315
|
+
(seamProbe.code === 'seams-unavailable'
|
|
316
|
+
? seamProbe.missing.length > 0 && seamProbe.invalid.length === 0
|
|
317
|
+
: seamProbe.invalid.length > 0);
|
|
318
|
+
if (!consistent) {
|
|
319
|
+
throw new TypeError(
|
|
320
|
+
'An unsatisfied seamProbe must list the seams its code claims.',
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function formatSeams(seams) {
|
|
326
|
+
if (!Array.isArray(seams) || seams.length === 0) return 'a required seam';
|
|
327
|
+
if (seams.length === 1) return seams[0];
|
|
328
|
+
return `${seams.slice(0, -1).join(', ')} and ${seams.at(-1)}`;
|
|
329
|
+
}
|
|
330
|
+
|
|
209
331
|
function assertProduct(product) {
|
|
210
332
|
if (!PRODUCTS.has(product)) {
|
|
211
333
|
throw new Error(`Unsupported lifecycle product: ${String(product)}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: oat-project-autonomous
|
|
3
|
-
version: 1.0.
|
|
3
|
+
version: 1.0.13
|
|
4
4
|
description: Use when a user explicitly asks to run an OAT project autonomously end-to-end. Activates session-only autonomy, resumes the correct lifecycle phase, and drives the existing OAT skills through final PR or a reported boundary.
|
|
5
5
|
argument-hint: '<goal | project-slug | ticket-ref>'
|
|
6
6
|
disable-model-invocation: true
|
|
@@ -267,6 +267,15 @@ Reassert this forced recap intent on resume; a stale lower-precedence skip is ov
|
|
|
267
267
|
The autonomous mode policy has precedence over project state and workflow
|
|
268
268
|
preference, so `never` does not suppress the recap.
|
|
269
269
|
|
|
270
|
+
Kickoff persists the forced `generate` intent without probing seams, because the
|
|
271
|
+
host that runs the recap is the one that matters and closeout is where it runs.
|
|
272
|
+
The closeout recap gate probes seam availability and may resolve a recordable
|
|
273
|
+
`skip` with source `capability_probe` on a host where a required seam is
|
|
274
|
+
unavailable. That later capability skip is the only thing that overrides this
|
|
275
|
+
forced intent, it is decided before any run rather than from a failed one, and
|
|
276
|
+
it never blocks unattended completion. Do not reassert `generate` over a
|
|
277
|
+
recorded `capability_probe` skip within the same closeout.
|
|
278
|
+
|
|
270
279
|
Resolve and persist `projectExplainer` as `generate` with source `kickoff_prompt` only when the kickoff request explicitly asks for a project explainer.
|
|
271
280
|
A general autonomous goal, project creation, or normal planning does not count as an explainer request.
|
|
272
281
|
When no explicit kickoff explainer request exists, do not persist a project-explainer intent record.
|