pi-spine 2.18.0 → 2.20.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/bin/spine-batch.mjs +15 -5
- package/bin/spine-gate.mjs +18 -3
- package/bin/spine-status.mjs +63 -2
- package/package.json +1 -1
- package/skills/create-spine-tasks/references/prompt-template.md +16 -1
- package/src/batch/contract-exec.mjs +19 -18
- package/src/batch/diagnosis-handoff-packet.mjs +148 -0
- package/src/batch/diagnosis-suggested-command.mjs +177 -0
- package/src/batch/diagnosis.mjs +12 -168
- package/src/batch/engine-lanes/commit.mjs +6 -0
- package/src/batch/engine-lanes/matrix-run.mjs +238 -22
- package/src/batch/engine-lanes/matrix.mjs +33 -2
- package/src/batch/gate-posture-approve.mjs +16 -2
- package/src/batch/lane-commit.mjs +27 -12
- package/src/batch/readers/spine-state.mjs +4 -0
- package/src/batch/resume-multi-lanes.mjs +31 -0
- package/src/batch/resume.mjs +79 -59
- package/src/batch/retry-row.mjs +328 -0
- package/src/batch/retry.mjs +114 -44
- package/src/batch/state-guards.mjs +4 -5
- package/src/batch/state-io.mjs +2 -2
- package/src/batch/worker-host.mjs +3 -0
- package/src/batch/worker-spawn.mjs +14 -0
- package/src/cli/handoff.mjs +124 -10
- package/src/cli/issue-draft.mjs +59 -7
- package/src/metrics/quota-probes.mjs +44 -0
- package/src/tasks/packet/parse-prompt.mjs +17 -0
- package/src/tasks/packet/validate-contract.mjs +1 -0
- package/templates/agents/supervisor.md +1 -1
- package/templates/tasks/CONTEXT.md +4 -0
|
@@ -60,6 +60,7 @@ export function resolveWorkerLaunchScript(projectRoot, config = {}) {
|
|
|
60
60
|
* @param {string[]} [params.fileScopePaths]
|
|
61
61
|
* @param {object} [params.config]
|
|
62
62
|
* @param {number} [params.piTimeoutMs]
|
|
63
|
+
* @param {Record<string, string>} [params.extraEnv] Extra child env (matrix row identity, #229)
|
|
63
64
|
*/
|
|
64
65
|
export function buildWorkerChildEnv({
|
|
65
66
|
taskFolder,
|
|
@@ -72,6 +73,7 @@ export function buildWorkerChildEnv({
|
|
|
72
73
|
fileScopePaths = [],
|
|
73
74
|
config = {},
|
|
74
75
|
piTimeoutMs,
|
|
76
|
+
extraEnv,
|
|
75
77
|
}) {
|
|
76
78
|
const runner = path.join(PACKAGE_ROOT, "bin", "spine-worker-runner.mjs");
|
|
77
79
|
/** @type {NodeJS.ProcessEnv} */
|
|
@@ -104,6 +106,12 @@ export function buildWorkerChildEnv({
|
|
|
104
106
|
process.env.SPINE_WORKER_PI_TIMEOUT_MS ?? piTimeoutMs,
|
|
105
107
|
);
|
|
106
108
|
}
|
|
109
|
+
// Optional caller-supplied additions (matrix row identity, #229). Assigned
|
|
110
|
+
// last so explicit extras win, and omitted entirely for existing callers so
|
|
111
|
+
// the env stays byte-identical to the pre-#229 behavior.
|
|
112
|
+
if (extraEnv && typeof extraEnv === "object") {
|
|
113
|
+
Object.assign(env, extraEnv);
|
|
114
|
+
}
|
|
107
115
|
return env;
|
|
108
116
|
}
|
|
109
117
|
|
|
@@ -121,6 +129,7 @@ export function buildWorkerChildEnv({
|
|
|
121
129
|
* @param {string[]} [params.fileScopePaths]
|
|
122
130
|
* @param {object} [params.config]
|
|
123
131
|
* @param {number} [params.piTimeoutMs]
|
|
132
|
+
* @param {Record<string, string>} [params.extraEnv] Extra child env (matrix row identity, #229)
|
|
124
133
|
*/
|
|
125
134
|
export function spawnWorkerChild({
|
|
126
135
|
worktreePath,
|
|
@@ -135,6 +144,7 @@ export function spawnWorkerChild({
|
|
|
135
144
|
fileScopePaths = [],
|
|
136
145
|
config = {},
|
|
137
146
|
piTimeoutMs,
|
|
147
|
+
extraEnv,
|
|
138
148
|
}) {
|
|
139
149
|
const runner = path.join(PACKAGE_ROOT, "bin", "spine-worker-runner.mjs");
|
|
140
150
|
const env = buildWorkerChildEnv({
|
|
@@ -148,6 +158,7 @@ export function spawnWorkerChild({
|
|
|
148
158
|
fileScopePaths,
|
|
149
159
|
config,
|
|
150
160
|
piTimeoutMs,
|
|
161
|
+
extraEnv,
|
|
151
162
|
});
|
|
152
163
|
const args = useStub ? ["--stub"] : ["--pi"];
|
|
153
164
|
|
|
@@ -316,6 +327,7 @@ export function collectChildOutput(child, liveLogWriter) {
|
|
|
316
327
|
* @param {string[]} [params.fileScopePaths]
|
|
317
328
|
* @param {object} [params.config]
|
|
318
329
|
* @param {object} [params.workerBackendDeps]
|
|
330
|
+
* @param {Record<string, string>} [params.extraEnv] Extra child env (matrix row identity, #229)
|
|
319
331
|
*/
|
|
320
332
|
export function spawnWorkerHandle({
|
|
321
333
|
worktreePath,
|
|
@@ -331,6 +343,7 @@ export function spawnWorkerHandle({
|
|
|
331
343
|
fileScopePaths = [],
|
|
332
344
|
config,
|
|
333
345
|
workerBackendDeps,
|
|
346
|
+
extraEnv,
|
|
334
347
|
}) {
|
|
335
348
|
const journal =
|
|
336
349
|
projectRoot && batchId
|
|
@@ -370,6 +383,7 @@ export function spawnWorkerHandle({
|
|
|
370
383
|
laneCorrelationId,
|
|
371
384
|
fileScopePaths,
|
|
372
385
|
config,
|
|
386
|
+
extraEnv,
|
|
373
387
|
});
|
|
374
388
|
}
|
|
375
389
|
|
package/src/cli/handoff.mjs
CHANGED
|
@@ -123,6 +123,75 @@ function formatPendingTasks(pendingTasks) {
|
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Derive SBAR Background facts from journal tail, phase, and pending tasks
|
|
128
|
+
* when the diagnose packet fields (#278 / SP-745) are absent.
|
|
129
|
+
*
|
|
130
|
+
* @param {{ phase?: string|null, pendingTasks?: object[], journalTail?: object[] }} data
|
|
131
|
+
* @returns {string[]}
|
|
132
|
+
*/
|
|
133
|
+
function deriveBackgroundFacts(data) {
|
|
134
|
+
const facts = [];
|
|
135
|
+
if (data.phase) {
|
|
136
|
+
facts.push(`Phase: ${data.phase}`);
|
|
137
|
+
}
|
|
138
|
+
const pendingTaskIds = (data.pendingTasks ?? [])
|
|
139
|
+
.map((task) => task.taskId)
|
|
140
|
+
.filter((taskId) => typeof taskId === "string" && taskId.length > 0);
|
|
141
|
+
if (pendingTaskIds.length) {
|
|
142
|
+
facts.push(`Pending tasks: ${pendingTaskIds.join(", ")}`);
|
|
143
|
+
}
|
|
144
|
+
const journalTail = data.journalTail ?? [];
|
|
145
|
+
const lastEntry = journalTail[journalTail.length - 1];
|
|
146
|
+
if (lastEntry?.type) {
|
|
147
|
+
const suffix = lastEntry.taskId
|
|
148
|
+
? ` ${lastEntry.taskId}`
|
|
149
|
+
: lastEntry.laneId
|
|
150
|
+
? ` ${lastEntry.laneId}`
|
|
151
|
+
: "";
|
|
152
|
+
facts.push(`Last journal event: ${lastEntry.type}${suffix}`);
|
|
153
|
+
}
|
|
154
|
+
return facts;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Resolve SBAR Background facts: map the diagnose packet `background` field
|
|
159
|
+
* (#278 / SP-745) when present, else derive from journalTail + phase +
|
|
160
|
+
* pendingTasks. Returns an empty array when nothing decision-relevant is
|
|
161
|
+
* known — renderers must show explicit `(none)` in that case (#279).
|
|
162
|
+
*
|
|
163
|
+
* @param {{ background?: unknown, phase?: string|null, pendingTasks?: object[], journalTail?: object[] }} data
|
|
164
|
+
* @returns {string[]}
|
|
165
|
+
*/
|
|
166
|
+
export function resolveBackgroundFacts(data) {
|
|
167
|
+
if (Array.isArray(data.background)) {
|
|
168
|
+
const mapped = data.background.filter(
|
|
169
|
+
(fact) => typeof fact === "string" && fact.trim().length > 0,
|
|
170
|
+
);
|
|
171
|
+
if (mapped.length) return mapped;
|
|
172
|
+
}
|
|
173
|
+
return deriveBackgroundFacts(data);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Resolve SBAR Assessment rationale: map the diagnose packet
|
|
178
|
+
* `assessmentReason` field (#278 / SP-745) when present, else derive from
|
|
179
|
+
* diagnosis + headline.
|
|
180
|
+
*
|
|
181
|
+
* @param {{ assessmentReason?: unknown, diagnosis?: string|null, headline?: string|null }} data
|
|
182
|
+
* @returns {string}
|
|
183
|
+
*/
|
|
184
|
+
export function resolveAssessmentReason(data) {
|
|
185
|
+
if (typeof data.assessmentReason === "string" && data.assessmentReason.trim().length > 0) {
|
|
186
|
+
return data.assessmentReason;
|
|
187
|
+
}
|
|
188
|
+
const diagnosis = data.diagnosis ?? "idle";
|
|
189
|
+
if (diagnosis === "idle") {
|
|
190
|
+
return "No active batch signals observed; reconcile found nothing to recover";
|
|
191
|
+
}
|
|
192
|
+
return `Reconcile signals selected "${diagnosis}"${data.headline ? ` — ${data.headline}` : ""}`;
|
|
193
|
+
}
|
|
194
|
+
|
|
126
195
|
/**
|
|
127
196
|
* Assemble structured handoff data from reconciliation, batch-state, and journal.
|
|
128
197
|
*
|
|
@@ -144,6 +213,16 @@ export function assembleHandoffData(projectRoot, batchId) {
|
|
|
144
213
|
pendingTasks: [],
|
|
145
214
|
laneSummary: [],
|
|
146
215
|
journalTail: [],
|
|
216
|
+
background: resolveBackgroundFacts({
|
|
217
|
+
background: reconciliation.background,
|
|
218
|
+
pendingTasks: [],
|
|
219
|
+
journalTail: [],
|
|
220
|
+
}),
|
|
221
|
+
assessmentReason: resolveAssessmentReason({
|
|
222
|
+
assessmentReason: reconciliation.assessmentReason,
|
|
223
|
+
diagnosis: "idle",
|
|
224
|
+
headline: reconciliation.headline,
|
|
225
|
+
}),
|
|
147
226
|
restoreCommands: buildRestoreCommands(reconciliation),
|
|
148
227
|
idle: true,
|
|
149
228
|
handoffPath: resolveHandoffPath(projectRoot),
|
|
@@ -183,6 +262,18 @@ export function assembleHandoffData(projectRoot, batchId) {
|
|
|
183
262
|
const journalTail = readJournalTail(journalEvents, JOURNAL_TAIL_LIMIT).map(formatJournalTailEntry);
|
|
184
263
|
|
|
185
264
|
const diagnosis = reconciliation.diagnosis ?? "idle";
|
|
265
|
+
const phase = reconciliation.phase ?? batch?.phase ?? null;
|
|
266
|
+
const background = resolveBackgroundFacts({
|
|
267
|
+
background: reconciliation.background,
|
|
268
|
+
phase,
|
|
269
|
+
pendingTasks,
|
|
270
|
+
journalTail,
|
|
271
|
+
});
|
|
272
|
+
const assessmentReason = resolveAssessmentReason({
|
|
273
|
+
assessmentReason: reconciliation.assessmentReason,
|
|
274
|
+
diagnosis,
|
|
275
|
+
headline: reconciliation.headline,
|
|
276
|
+
});
|
|
186
277
|
|
|
187
278
|
return redactHandoffSecrets({
|
|
188
279
|
generatedAt,
|
|
@@ -194,9 +285,11 @@ export function assembleHandoffData(projectRoot, batchId) {
|
|
|
194
285
|
pendingTasks,
|
|
195
286
|
laneSummary,
|
|
196
287
|
journalTail,
|
|
288
|
+
background,
|
|
289
|
+
assessmentReason,
|
|
197
290
|
restoreCommands: buildRestoreCommands(reconciliation),
|
|
198
291
|
batchStatePath,
|
|
199
|
-
phase
|
|
292
|
+
phase,
|
|
200
293
|
idle: diagnosis === "idle",
|
|
201
294
|
handoffPath: resolveHandoffPath(projectRoot),
|
|
202
295
|
});
|
|
@@ -215,6 +308,18 @@ function findLaneNumber(laneSummary, taskId) {
|
|
|
215
308
|
return null;
|
|
216
309
|
}
|
|
217
310
|
|
|
311
|
+
/**
|
|
312
|
+
* Render SBAR-shaped recommendation commands (suggested command + unique
|
|
313
|
+
* alternatives).
|
|
314
|
+
*
|
|
315
|
+
* @param {{ suggestedCommand?: string|null, alternatives?: string[] }} data
|
|
316
|
+
* @returns {string[]}
|
|
317
|
+
*/
|
|
318
|
+
function buildRecommendationCommands(data) {
|
|
319
|
+
const candidates = [data.suggestedCommand, ...(data.alternatives ?? [])];
|
|
320
|
+
return [...new Set(candidates.filter((command) => typeof command === "string" && command.trim().length > 0))];
|
|
321
|
+
}
|
|
322
|
+
|
|
218
323
|
/**
|
|
219
324
|
* @param {ReturnType<typeof assembleHandoffData>} data
|
|
220
325
|
*/
|
|
@@ -225,18 +330,27 @@ export function renderHandoffMarkdown(data) {
|
|
|
225
330
|
`**Generated at:** ${data.generatedAt}`,
|
|
226
331
|
`**Batch ID:** ${data.batchId ?? "—"}`,
|
|
227
332
|
"",
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
""
|
|
231
|
-
"## Suggested command",
|
|
232
|
-
data.suggestedCommand,
|
|
333
|
+
// SBAR order (#279): Situation → Background → Assessment → Recommendation.
|
|
334
|
+
"## Situation",
|
|
335
|
+
`**${data.diagnosis ?? "idle"}** — ${data.headline ?? "—"}`,
|
|
233
336
|
"",
|
|
234
|
-
"##
|
|
337
|
+
"## Background",
|
|
235
338
|
];
|
|
236
339
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
340
|
+
const backgroundFacts = resolveBackgroundFacts(data);
|
|
341
|
+
if (backgroundFacts.length) {
|
|
342
|
+
for (const fact of backgroundFacts) {
|
|
343
|
+
lines.push(`- ${fact}`);
|
|
344
|
+
}
|
|
345
|
+
} else {
|
|
346
|
+
lines.push("- (none)");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
lines.push("", "## Assessment", resolveAssessmentReason(data), "", "## Recommendation");
|
|
350
|
+
const recommendations = buildRecommendationCommands(data);
|
|
351
|
+
if (recommendations.length) {
|
|
352
|
+
for (const command of recommendations) {
|
|
353
|
+
lines.push(`- ${command}`);
|
|
240
354
|
}
|
|
241
355
|
} else {
|
|
242
356
|
lines.push("- (none)");
|
package/src/cli/issue-draft.mjs
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
assembleHandoffData,
|
|
13
13
|
redactHandoffSecrets,
|
|
14
14
|
redactHandoffText,
|
|
15
|
+
resolveAssessmentReason,
|
|
16
|
+
resolveBackgroundFacts,
|
|
15
17
|
} from "./handoff.mjs";
|
|
16
18
|
|
|
17
19
|
const VALID_ISSUE_TYPES = new Set(["bug", "enhancement", "question"]);
|
|
@@ -36,13 +38,15 @@ function formatDoctorSummary(doctorResult) {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
41
|
+
* Situation block for the issue draft (#279): current-state snapshot without
|
|
42
|
+
* the suggested command, which the Recommendation section owns.
|
|
43
|
+
*
|
|
39
44
|
* @param {ReturnType<typeof reconcileBatch>} reconciliation
|
|
40
45
|
*/
|
|
41
46
|
function formatDiagnosisBlock(reconciliation) {
|
|
42
47
|
const lines = [
|
|
43
48
|
`- **Diagnosis:** ${reconciliation.diagnosis ?? "idle"}`,
|
|
44
49
|
`- **Headline:** ${reconciliation.headline ?? "—"}`,
|
|
45
|
-
`- **Suggested command:** ${reconciliation.suggestedCommand ?? "—"}`,
|
|
46
50
|
];
|
|
47
51
|
if (reconciliation.batchId) {
|
|
48
52
|
lines.push(`- **Batch ID:** ${reconciliation.batchId}`);
|
|
@@ -95,13 +99,34 @@ function readPackageVersion() {
|
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
/**
|
|
98
|
-
* Render
|
|
102
|
+
* Render a value as markdown bullet lines, or explicit `(none)` when empty.
|
|
103
|
+
*
|
|
104
|
+
* @param {unknown} value
|
|
105
|
+
* @returns {string}
|
|
106
|
+
*/
|
|
107
|
+
function orNoneBullets(value) {
|
|
108
|
+
if (Array.isArray(value)) {
|
|
109
|
+
const entries = value.filter((entry) => typeof entry === "string" && entry.trim().length > 0);
|
|
110
|
+
return entries.length ? entries.map((entry) => `- ${entry}`).join("\n") : "(none)";
|
|
111
|
+
}
|
|
112
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
113
|
+
return `- ${value}`;
|
|
114
|
+
}
|
|
115
|
+
return "(none)";
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Render issue draft markdown sections for GitHub filing. SBAR-shaped per
|
|
120
|
+
* #279: Situation → Background → Assessment → Recommendation.
|
|
99
121
|
*
|
|
100
122
|
* @param {object} sections
|
|
101
123
|
* @param {string} sections.summary
|
|
102
124
|
* @param {string} sections.environment
|
|
125
|
+
* @param {string} sections.situation
|
|
126
|
+
* @param {unknown} [sections.background]
|
|
127
|
+
* @param {string} [sections.assessment]
|
|
128
|
+
* @param {unknown} [sections.recommendation]
|
|
103
129
|
* @param {string} sections.commandsRun
|
|
104
|
-
* @param {string} sections.diagnosis
|
|
105
130
|
* @param {string} sections.journalExcerpt
|
|
106
131
|
* @param {string} [sections.expected]
|
|
107
132
|
* @param {string} [sections.actual]
|
|
@@ -114,12 +139,21 @@ export function formatIssueDraftMarkdown(sections) {
|
|
|
114
139
|
"## Environment",
|
|
115
140
|
sections.environment,
|
|
116
141
|
"",
|
|
142
|
+
"## Situation",
|
|
143
|
+
sections.situation,
|
|
144
|
+
"",
|
|
145
|
+
"## Background",
|
|
146
|
+
orNoneBullets(sections.background),
|
|
147
|
+
"",
|
|
148
|
+
"## Assessment",
|
|
149
|
+
sections.assessment && sections.assessment.trim().length > 0 ? sections.assessment : "(none)",
|
|
150
|
+
"",
|
|
151
|
+
"## Recommendation",
|
|
152
|
+
orNoneBullets(sections.recommendation),
|
|
153
|
+
"",
|
|
117
154
|
"## Commands run",
|
|
118
155
|
sections.commandsRun,
|
|
119
156
|
"",
|
|
120
|
-
"## Diagnosis",
|
|
121
|
-
sections.diagnosis,
|
|
122
|
-
"",
|
|
123
157
|
"## Journal excerpt",
|
|
124
158
|
sections.journalExcerpt,
|
|
125
159
|
"",
|
|
@@ -161,8 +195,26 @@ export function buildIssueDraftBody(options) {
|
|
|
161
195
|
"",
|
|
162
196
|
formatDoctorSummary(doctorResult),
|
|
163
197
|
].join("\n"),
|
|
198
|
+
situation: formatDiagnosisBlock(reconciliation),
|
|
199
|
+
background: resolveBackgroundFacts({
|
|
200
|
+
background: reconciliation.background,
|
|
201
|
+
phase: reconciliation.phase ?? null,
|
|
202
|
+
pendingTasks: handoff.pendingTasks,
|
|
203
|
+
journalTail: handoff.journalTail,
|
|
204
|
+
}),
|
|
205
|
+
assessment: resolveAssessmentReason({
|
|
206
|
+
assessmentReason: reconciliation.assessmentReason,
|
|
207
|
+
diagnosis: reconciliation.diagnosis,
|
|
208
|
+
headline: reconciliation.headline,
|
|
209
|
+
}),
|
|
210
|
+
recommendation: [
|
|
211
|
+
...new Set(
|
|
212
|
+
[reconciliation.suggestedCommand, ...(reconciliation.alternatives ?? [])].filter(
|
|
213
|
+
(command) => typeof command === "string" && command.trim().length > 0,
|
|
214
|
+
),
|
|
215
|
+
),
|
|
216
|
+
],
|
|
164
217
|
commandsRun: formatCommandsRun(reconciliation),
|
|
165
|
-
diagnosis: formatDiagnosisBlock(reconciliation),
|
|
166
218
|
journalExcerpt: formatJournalExcerpt(handoff),
|
|
167
219
|
expected: "(describe expected behavior)",
|
|
168
220
|
actual: "(describe actual behavior)",
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
* (`sk-ant-api...`) are never sent to the Admin API. GitHub Copilot is only
|
|
21
21
|
* probed when the auth entry carries a PAT plus an explicit org or enterprise
|
|
22
22
|
* context; user-level entries without that scope degrade to `absent`.
|
|
23
|
+
*
|
|
24
|
+
* Google is permanently `absent` (SP-748): Google ships no public usage or
|
|
25
|
+
* quota endpoint that authenticates with the AI Studio API key class pi
|
|
26
|
+
* stores, and the AI Studio dashboards that show usage are HTML consoles
|
|
27
|
+
* this project never scrapes. See `probeGoogle` for the research conclusion.
|
|
23
28
|
*/
|
|
24
29
|
|
|
25
30
|
import fs from "node:fs";
|
|
@@ -43,6 +48,7 @@ export const PROBE_POOLS = {
|
|
|
43
48
|
cursor: "cursor",
|
|
44
49
|
anthropic: "anthropic",
|
|
45
50
|
githubCopilot: "github-copilot",
|
|
51
|
+
google: "google",
|
|
46
52
|
};
|
|
47
53
|
|
|
48
54
|
/**
|
|
@@ -432,6 +438,41 @@ async function probeGitHubCopilot(auth, fetch) {
|
|
|
432
438
|
}
|
|
433
439
|
}
|
|
434
440
|
|
|
441
|
+
/**
|
|
442
|
+
* Google probe — permanently `absent` (SP-748, closes #277 with a documented
|
|
443
|
+
* won't-scrape rationale).
|
|
444
|
+
*
|
|
445
|
+
* Research conclusion (verified 2026-09-05): Google publishes no public usage
|
|
446
|
+
* or quota endpoint that authenticates with the credential class pi stores in
|
|
447
|
+
* `auth.json` (`{ "google": { "type": "api_key", "key": "AIza..." } }`, an
|
|
448
|
+
* AI Studio standard API key):
|
|
449
|
+
*
|
|
450
|
+
* - The Generative Language API reference (ai.google.dev/api) documents only
|
|
451
|
+
* inference and platform endpoints (interactions, generateContent,
|
|
452
|
+
* batch, embeddings, files, caches, countTokens); there is no usage-report
|
|
453
|
+
* or quota resource.
|
|
454
|
+
* - Rate limits and usage are published solely through AI Studio HTML
|
|
455
|
+
* dashboards (aistudio.google.com/rate-limit), which this project never
|
|
456
|
+
* scrapes.
|
|
457
|
+
* - The programmatic alternatives (Cloud Monitoring `request_count` metrics,
|
|
458
|
+
* Service Usage `consumerQuotaMetrics`) require GCP OAuth credentials with
|
|
459
|
+
* cloud-platform scope — a different credential class — and expose quota
|
|
460
|
+
* limits, not current usage.
|
|
461
|
+
*
|
|
462
|
+
* The probe therefore fails closed without reading the credential or touching
|
|
463
|
+
* the network, so the `google` pool keeps its offline estimate. When Google
|
|
464
|
+
* ships a public usage/quota endpoint for this key class, implement it here
|
|
465
|
+
* following the Z.ai/Kimi adapter pattern: explicit fields only, never invent
|
|
466
|
+
* a limit or remaining percentage, and never include secrets in the result.
|
|
467
|
+
*
|
|
468
|
+
* @param {object | null} _auth
|
|
469
|
+
* @param {typeof globalThis.fetch} _fetch
|
|
470
|
+
* @returns {Promise<ProbeResult>}
|
|
471
|
+
*/
|
|
472
|
+
async function probeGoogle(_auth, _fetch) {
|
|
473
|
+
return { poolId: "google", source: "absent" };
|
|
474
|
+
}
|
|
475
|
+
|
|
435
476
|
/**
|
|
436
477
|
* Run the optional provider probes and return a map keyed by pool id.
|
|
437
478
|
*
|
|
@@ -450,6 +491,7 @@ export async function runQuotaProbes({
|
|
|
450
491
|
PROBE_POOLS.cursor,
|
|
451
492
|
PROBE_POOLS.anthropic,
|
|
452
493
|
PROBE_POOLS.githubCopilot,
|
|
494
|
+
PROBE_POOLS.google,
|
|
453
495
|
],
|
|
454
496
|
} = {}) {
|
|
455
497
|
const auth = loadAuthCredentials(authPath);
|
|
@@ -467,6 +509,8 @@ export async function runQuotaProbes({
|
|
|
467
509
|
results.anthropic = await probeAnthropic(auth, fetch);
|
|
468
510
|
} else if (provider === PROBE_POOLS.githubCopilot) {
|
|
469
511
|
results["github-copilot"] = await probeGitHubCopilot(auth, fetch);
|
|
512
|
+
} else if (provider === PROBE_POOLS.google) {
|
|
513
|
+
results.google = await probeGoogle(auth, fetch);
|
|
470
514
|
}
|
|
471
515
|
}
|
|
472
516
|
|
|
@@ -30,6 +30,7 @@ export const CONTRACT_FIELD_NAMES = Object.freeze([
|
|
|
30
30
|
"artifactsMustExist",
|
|
31
31
|
"stallTimeoutMinutes",
|
|
32
32
|
"extendGraceOnFileScope",
|
|
33
|
+
"matrixMaxParallel",
|
|
33
34
|
]);
|
|
34
35
|
|
|
35
36
|
const CONTRACT_KNOWN_FIELDS = new Set(CONTRACT_FIELD_NAMES);
|
|
@@ -286,6 +287,7 @@ function collectDuplicateStepNumberErrors(steps) {
|
|
|
286
287
|
* artifactsMustExist: string[],
|
|
287
288
|
* stallTimeoutMinutes: number | null,
|
|
288
289
|
* extendGraceOnFileScope: boolean | null,
|
|
290
|
+
* matrixMaxParallel: number | null,
|
|
289
291
|
* rawTableValid: boolean,
|
|
290
292
|
* errors: string[],
|
|
291
293
|
* unknownFields: string[],
|
|
@@ -309,6 +311,7 @@ export function parseContract(markdown) {
|
|
|
309
311
|
artifactsMustExist: [],
|
|
310
312
|
stallTimeoutMinutes: null,
|
|
311
313
|
extendGraceOnFileScope: null,
|
|
314
|
+
matrixMaxParallel: null,
|
|
312
315
|
rawTableValid: false,
|
|
313
316
|
errors: [],
|
|
314
317
|
unknownFields: [],
|
|
@@ -509,6 +512,20 @@ function applyContractField(parsed, field, rawValue) {
|
|
|
509
512
|
parsed.errors.push("Contract extendGraceOnFileScope must be true or false");
|
|
510
513
|
return;
|
|
511
514
|
}
|
|
515
|
+
case "matrixMaxParallel": {
|
|
516
|
+
const rawParallel = parseContractScalar(value);
|
|
517
|
+
if (!/^\d+$/.test(rawParallel)) {
|
|
518
|
+
parsed.errors.push("Contract matrixMaxParallel must be a positive integer");
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
const parallel = Number(rawParallel);
|
|
522
|
+
if (parallel < 1) {
|
|
523
|
+
parsed.errors.push("Contract matrixMaxParallel must be a positive integer");
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
parsed.matrixMaxParallel = parallel;
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
512
529
|
default:
|
|
513
530
|
return;
|
|
514
531
|
}
|
|
@@ -219,6 +219,7 @@ function isContractTableEmpty(parsed) {
|
|
|
219
219
|
parsed.fileScopeMustNotChange.length === 0 &&
|
|
220
220
|
parsed.minLineCoverage === null &&
|
|
221
221
|
parsed.artifactsMustExist.length === 0 &&
|
|
222
|
+
parsed.matrixMaxParallel === null &&
|
|
222
223
|
(parsed.unknownFields?.length ?? 0) === 0
|
|
223
224
|
);
|
|
224
225
|
}
|
|
@@ -44,7 +44,7 @@ The engine journals `supervisor.started` (batchId, model, pid) when the monitor
|
|
|
44
44
|
| `limbo_stale` / `completed_manual` | `dismiss` or `complete --detect-manual-merge` |
|
|
45
45
|
| `failed` / `aborted` | `retry`, `resume --force`, or `dismiss` |
|
|
46
46
|
|
|
47
|
-
Full operator procedures: [operator runbook](../../docs/adoption/operator-runbook.md).
|
|
47
|
+
Full operator procedures: [operator runbook](../../docs/adoption/operator-runbook.md). Handoff quality bar (#282): incomplete handoff = missing any of Situation / Background / Assessment / Recommendation — see the [runbook handoff packet](../../docs/adoption/operator-runbook.md#operator-handoff-packet-282).
|
|
48
48
|
|
|
49
49
|
In pi: `/spine-status` mirrors reconciliation; `/spine-dashboard` opens the dashboard.
|
|
50
50
|
|
|
@@ -18,6 +18,10 @@ Greenfield pi-spine project. Add phase tables and task rows as you decompose wor
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
## Authoring notes
|
|
22
|
+
|
|
23
|
+
- New packets: use `**Risk:**` (severity/blast, pairs with **Score**) and `**Problem theory:**` (working diagnosis) in the Review Level block instead of the legacy overloaded `**Assessment:**` ([pi-spine #281](https://github.com/beettlle/pi-spine/issues/281)). Legacy `**Assessment:**` packets remain valid — do not rewrite them.
|
|
24
|
+
|
|
21
25
|
## Execution policy
|
|
22
26
|
|
|
23
27
|
**Operator runbook:** [`docs/adoption/operator-runbook.md`](../docs/adoption/operator-runbook.md) — install, preflight, start/monitor, land loop, gate races, resume/dismiss/complete, dashboard, troubleshooting.
|