@fro.bot/systematic 3.22.7 → 3.23.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/dist/cli.js
CHANGED
|
@@ -7512,16 +7512,16 @@ var workflowGuardModeSchema = _enum([
|
|
|
7512
7512
|
"disabled"
|
|
7513
7513
|
]);
|
|
7514
7514
|
var WorkflowGuardSchema = object({
|
|
7515
|
-
mode: workflowGuardModeSchema.default("
|
|
7516
|
-
description: "Workflow guard mode",
|
|
7515
|
+
mode: workflowGuardModeSchema.default("disabled").meta({
|
|
7516
|
+
description: "Workflow guard mode. The guard is off by default (`disabled`); set `observe` or `protected` to turn it on.",
|
|
7517
7517
|
examples: ["observe", "protected", "disabled"]
|
|
7518
7518
|
}),
|
|
7519
7519
|
debug: boolean().default(false).meta({
|
|
7520
7520
|
description: "Enable workflow guard debugging",
|
|
7521
7521
|
examples: [false, true]
|
|
7522
7522
|
})
|
|
7523
|
-
}).strict().default({ mode: "
|
|
7524
|
-
description: "Workflow guard configuration",
|
|
7523
|
+
}).strict().default({ mode: "disabled", debug: false }).meta({
|
|
7524
|
+
description: "Workflow guard configuration. The guard is off by default; `mode: observe` or `mode: protected` turns it on.",
|
|
7525
7525
|
examples: [{ mode: "observe", debug: false }]
|
|
7526
7526
|
});
|
|
7527
7527
|
var colorSchema = union([
|
|
@@ -8188,7 +8188,7 @@ var DEFAULT_CONFIG = {
|
|
|
8188
8188
|
enabled: true
|
|
8189
8189
|
},
|
|
8190
8190
|
workflow_guard: {
|
|
8191
|
-
mode: "
|
|
8191
|
+
mode: "disabled",
|
|
8192
8192
|
debug: false
|
|
8193
8193
|
},
|
|
8194
8194
|
agents: {},
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
extractCommandFrontmatter,
|
|
20
20
|
findSkillsInDir,
|
|
21
21
|
discoverSkills
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-pdbqekxp.js";
|
|
23
23
|
|
|
24
24
|
// src/index.ts
|
|
25
25
|
import { createHash as createHash4 } from "crypto";
|
|
@@ -11087,6 +11087,7 @@ function isWorkflowGuardBlockedError(value) {
|
|
|
11087
11087
|
return false;
|
|
11088
11088
|
return typeof candidate.reasonCode === "string" && REASON_CODES.has(candidate.reasonCode);
|
|
11089
11089
|
}
|
|
11090
|
+
var WORKFLOW_GUARD_GUIDANCE = `In this OpenCode session the workflow guard is on. Check the workflow guard availability once per execution unit. Guard state is per session; a child session starts \`inactive\`. \`inactive\` (reason \`no-active-epoch\`) means no guarded workflow has started in this session. It is not unavailable and not terminal: load a guarded skill to begin, and do not call \`systematic_workflow_start\` or \`systematic_workflow_complete\` before one is active. A completion rejected with \`readback-timeout\` is retryable: call \`systematic_workflow_complete\` again at most twice, then report it to the user. Probes listed in \`unconfirmedReadbacks\` on status output (\`local\`, \`pinned\`, or an operation name) are unverified until a later status call confirms them. A completion rejected with \`snapshot-blocked\` or \`stale-receipt\` is not terminal. For \`snapshot-blocked\`, read \`blockReason\` from the rejection or \`snapshotBlock.reasonCode\` from status, fix that cause in the worktree without deleting or hiding user files unless the user agrees, and call status to confirm the block is gone (when the rejection names \`blockTarget: parent-checkout\`, fix the parent checkout and retry completion instead). Files inside submodules and nested repositories count toward the snapshot limits. Operations run while blocked leave no receipts: rerun stale or missing operations, checking remote state before redoing a push or PR, then complete. If the same reason remains after one fix, report it to the user, who can disable the guard through \`systematic_workflow_control\`. A call the guard skipped or sealed after a timeout has already run: for a local call check the worktree state, for a push or PR creation check remote state (the upstream ref or the open PR), and rerun only if its effect is missing. After a rejected push, check remote state, fix the cause and retry (a first push needs \`git push -u\`); never force-push or delete a remote ref without the user's approval. If a push may have landed but left no receipt and later pushes are rejected as \`resource-mismatch\`, report it to the user. A verification that overlapped another local call is not receipted; rerun it alone once every local call from that request has returned. If the guard reports \`unavailable\` or \`guard-unavailable\`, treat it as terminal for that unit: do not retry \`systematic_workflow_start\` or \`systematic_workflow_complete\`. Use the documented unguarded fallback only when authorized, and report the unavailable state once. \`disabled\` means the user turned the guard off; do not call the workflow tools.`;
|
|
11090
11091
|
function defaultTargetObserver(targetDirectory) {
|
|
11091
11092
|
return createOpencodeOperationObserver({ targetDirectory });
|
|
11092
11093
|
}
|
|
@@ -13021,9 +13022,21 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
13021
13022
|
terminalCompletes.set(callDigest, terminal);
|
|
13022
13023
|
writeTerminalCompletionResult(output, terminal, target, terminal.title);
|
|
13023
13024
|
}
|
|
13025
|
+
function writeDisabledBlockedResult(callDigest, output, target) {
|
|
13026
|
+
const terminal = {
|
|
13027
|
+
...target ? { target } : {},
|
|
13028
|
+
status: "rejected",
|
|
13029
|
+
reasonCode: "disabled",
|
|
13030
|
+
title: "Workflow transition rejected"
|
|
13031
|
+
};
|
|
13032
|
+
terminalCompletes.set(callDigest, terminal);
|
|
13033
|
+
writeTerminalCompletionResult(output, terminal, target, terminal.title);
|
|
13034
|
+
}
|
|
13024
13035
|
function writeBlockedCompleteResult(callDigest, output, blocked) {
|
|
13025
13036
|
if (blocked?.reasonCode === "no-active-epoch") {
|
|
13026
13037
|
writeNoEpochBlockedResult(callDigest, output, blocked.target);
|
|
13038
|
+
} else if (blocked?.reasonCode === "disabled") {
|
|
13039
|
+
writeDisabledBlockedResult(callDigest, output, blocked.target);
|
|
13027
13040
|
}
|
|
13028
13041
|
}
|
|
13029
13042
|
function writeAbandonedCompletionResult(output, target, reasonCode) {
|
|
@@ -13796,6 +13809,10 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
13796
13809
|
const callDigest = digestCall(ledger, host.callID);
|
|
13797
13810
|
const pending = pendingStarts.get(callDigest);
|
|
13798
13811
|
pendingStarts.delete(callDigest);
|
|
13812
|
+
if (options.config.mode === "disabled") {
|
|
13813
|
+
writeStartResult(output, { status: "rejected", reasonCode: "disabled" });
|
|
13814
|
+
return;
|
|
13815
|
+
}
|
|
13799
13816
|
if (!pending) {
|
|
13800
13817
|
markUnavailable(afterCause("call-lifecycle-mismatch"));
|
|
13801
13818
|
return;
|
|
@@ -14065,7 +14082,11 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
14065
14082
|
markUnavailable(afterCause("call-lifecycle-mismatch"));
|
|
14066
14083
|
writeAbandonedCompletionResult(output, pending.target, "invalid-transition");
|
|
14067
14084
|
}
|
|
14068
|
-
function finishUnreplayableComplete(finalTarget, output) {
|
|
14085
|
+
function finishUnreplayableComplete(callDigest, finalTarget, output) {
|
|
14086
|
+
if (options.config.mode === "disabled") {
|
|
14087
|
+
writeDisabledBlockedResult(callDigest, output, finalTarget);
|
|
14088
|
+
return;
|
|
14089
|
+
}
|
|
14069
14090
|
markUnavailable(afterCause("call-lifecycle-mismatch"));
|
|
14070
14091
|
writeAbandonedCompletionResult(output, finalTarget, "guard-unavailable");
|
|
14071
14092
|
}
|
|
@@ -14125,10 +14146,19 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
14125
14146
|
return currentSnapshotBlock()?.reasonCode;
|
|
14126
14147
|
}
|
|
14127
14148
|
const completionFailureCause = (reasonCode) => observerReadbackFailedCause(reasonCode, "complete-readback");
|
|
14149
|
+
function finishDisabledComplete(callDigest, finalTarget, output) {
|
|
14150
|
+
const target = terminalCompletes.get(callDigest)?.target ?? blockedCompletes.get(callDigest)?.target ?? finalTarget;
|
|
14151
|
+
blockedCompletes.delete(callDigest);
|
|
14152
|
+
writeDisabledBlockedResult(callDigest, output, target);
|
|
14153
|
+
}
|
|
14128
14154
|
async function finishComplete(host, output) {
|
|
14129
14155
|
const callDigest = digestCall(ledger, host.callID);
|
|
14130
14156
|
const pending = pendingCompletes.get(callDigest);
|
|
14131
14157
|
const finalTarget = normalizeTarget(host.args);
|
|
14158
|
+
if (options.config.mode === "disabled") {
|
|
14159
|
+
finishDisabledComplete(callDigest, finalTarget, output);
|
|
14160
|
+
return;
|
|
14161
|
+
}
|
|
14132
14162
|
if (pending && (!finalTarget || finalTarget !== pending.target)) {
|
|
14133
14163
|
finishMismatchedTarget(callDigest, pending, output);
|
|
14134
14164
|
return;
|
|
@@ -14136,7 +14166,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
|
|
|
14136
14166
|
if (!pending) {
|
|
14137
14167
|
if (replayTerminalComplete(callDigest, finalTarget, output))
|
|
14138
14168
|
return;
|
|
14139
|
-
finishUnreplayableComplete(finalTarget, output);
|
|
14169
|
+
finishUnreplayableComplete(callDigest, finalTarget, output);
|
|
14140
14170
|
return;
|
|
14141
14171
|
}
|
|
14142
14172
|
const generation = unitStartGeneration;
|
|
@@ -14642,6 +14672,12 @@ function unavailableToolResult() {
|
|
|
14642
14672
|
reasonCode: "guard-unavailable"
|
|
14643
14673
|
});
|
|
14644
14674
|
}
|
|
14675
|
+
function disabledRejectionResult(title) {
|
|
14676
|
+
return {
|
|
14677
|
+
title,
|
|
14678
|
+
output: JSON.stringify({ status: "rejected", reasonCode: "disabled" })
|
|
14679
|
+
};
|
|
14680
|
+
}
|
|
14645
14681
|
function makeWorkflowTool(description, args2, getRuntime, execute) {
|
|
14646
14682
|
return {
|
|
14647
14683
|
description,
|
|
@@ -14691,7 +14727,16 @@ function makeWorkflowTool(description, args2, getRuntime, execute) {
|
|
|
14691
14727
|
}
|
|
14692
14728
|
};
|
|
14693
14729
|
}
|
|
14730
|
+
function assertDisabledGuardHasNoDependencies(options) {
|
|
14731
|
+
if (options.config.mode !== "disabled")
|
|
14732
|
+
return;
|
|
14733
|
+
const supplied = ["observer", "hostReadback", "classifier"].filter((name2) => options[name2] !== undefined);
|
|
14734
|
+
if (supplied.length === 0)
|
|
14735
|
+
return;
|
|
14736
|
+
throw new TypeError(`A disabled workflow guard must be built without ${supplied.join(", ")}`);
|
|
14737
|
+
}
|
|
14694
14738
|
function createOpencodeWorkflowGuard(options) {
|
|
14739
|
+
assertDisabledGuardHasNoDependencies(options);
|
|
14695
14740
|
const sessions = new Map;
|
|
14696
14741
|
const operationObservers = new Map;
|
|
14697
14742
|
const recoveredOperationContexts = new Map;
|
|
@@ -14712,7 +14757,7 @@ function createOpencodeWorkflowGuard(options) {
|
|
|
14712
14757
|
systematic_workflow_start: makeWorkflowTool("Request the start of a guarded workflow unit.", startToolShape, sessionRuntimeFor, (_runtime, input) => startToolSchema.safeParse(input).success ? {
|
|
14713
14758
|
title: "Workflow guard start pending",
|
|
14714
14759
|
output: JSON.stringify({ status: "pending", operation: "start" })
|
|
14715
|
-
} : {
|
|
14760
|
+
} : options.config.mode === "disabled" ? disabledRejectionResult("Workflow unit rejected") : {
|
|
14716
14761
|
title: "Workflow guard unavailable",
|
|
14717
14762
|
output: unavailableToolResult()
|
|
14718
14763
|
}),
|
|
@@ -14729,7 +14774,7 @@ function createOpencodeWorkflowGuard(options) {
|
|
|
14729
14774
|
status: "pending",
|
|
14730
14775
|
operation: "complete"
|
|
14731
14776
|
})
|
|
14732
|
-
} : {
|
|
14777
|
+
} : options.config.mode === "disabled" ? disabledRejectionResult("Workflow transition rejected") : {
|
|
14733
14778
|
title: "Workflow guard unavailable",
|
|
14734
14779
|
output: unavailableToolResult()
|
|
14735
14780
|
}),
|
|
@@ -15116,28 +15161,64 @@ var getPackageVersion = () => {
|
|
|
15116
15161
|
return "unknown";
|
|
15117
15162
|
}
|
|
15118
15163
|
};
|
|
15119
|
-
var
|
|
15164
|
+
var DISABLED_GUARD_IDENTITY = "0".repeat(64);
|
|
15165
|
+
var createHostReadback = ({
|
|
15120
15166
|
client,
|
|
15121
|
-
directory
|
|
15122
|
-
worktree
|
|
15167
|
+
directory
|
|
15123
15168
|
}) => {
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
|
|
15134
|
-
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15169
|
+
const readMessages = async (sessionID) => {
|
|
15170
|
+
const messages = client.session.messages.bind(client.session);
|
|
15171
|
+
return messages({ path: { id: sessionID }, query: { directory } });
|
|
15172
|
+
};
|
|
15173
|
+
return {
|
|
15174
|
+
readSessionParts: async (sessionID) => {
|
|
15175
|
+
const response = await readMessages(sessionID);
|
|
15176
|
+
return Array.isArray(response.data) ? response.data : [];
|
|
15177
|
+
},
|
|
15178
|
+
readSessionPartsStrict: async (sessionID) => {
|
|
15179
|
+
const response = await readMessages(sessionID);
|
|
15180
|
+
if (response.error !== undefined && response.error !== null) {
|
|
15181
|
+
throw new Error("session history read failed");
|
|
15182
|
+
}
|
|
15183
|
+
if (!Array.isArray(response.data)) {
|
|
15184
|
+
throw new Error("session history read returned malformed data");
|
|
15185
|
+
}
|
|
15186
|
+
return response.data;
|
|
15187
|
+
},
|
|
15188
|
+
listChildren: async (sessionID) => {
|
|
15189
|
+
const children = client.session.children.bind(client.session);
|
|
15190
|
+
const response = await children({
|
|
15191
|
+
path: { id: sessionID },
|
|
15192
|
+
query: { directory }
|
|
15193
|
+
});
|
|
15194
|
+
if (!Array.isArray(response.data))
|
|
15195
|
+
return [];
|
|
15196
|
+
return response.data.flatMap((entry) => {
|
|
15197
|
+
if (typeof entry !== "object" || entry === null || typeof entry.id !== "string") {
|
|
15198
|
+
return [];
|
|
15199
|
+
}
|
|
15200
|
+
return [{ sessionId: entry.id, parentID: entry.parentID }];
|
|
15201
|
+
});
|
|
15202
|
+
}
|
|
15203
|
+
};
|
|
15204
|
+
};
|
|
15205
|
+
var workflowGuardOptions = async ({ client, directory, worktree }, config, guardEnabled) => {
|
|
15206
|
+
const targetDirectory = typeof worktree === "string" ? worktree : directory;
|
|
15207
|
+
const base = {
|
|
15208
|
+
config: config.workflow_guard,
|
|
15209
|
+
registrationIdentity: registrationSourceIdentity,
|
|
15210
|
+
targetDirectory,
|
|
15211
|
+
sessionLocation: directory
|
|
15212
|
+
};
|
|
15213
|
+
if (!guardEnabled) {
|
|
15214
|
+
return {
|
|
15215
|
+
...base,
|
|
15216
|
+
workspaceIdentity: DISABLED_GUARD_IDENTITY,
|
|
15217
|
+
repositoryIdentity: DISABLED_GUARD_IDENTITY,
|
|
15218
|
+
worktreeIdentity: DISABLED_GUARD_IDENTITY
|
|
15219
|
+
};
|
|
15220
|
+
}
|
|
15221
|
+
const observer = createOpencodeOperationObserver({ targetDirectory });
|
|
15141
15222
|
let initialSnapshot;
|
|
15142
15223
|
try {
|
|
15143
15224
|
initialSnapshot = await observer.snapshot();
|
|
@@ -15152,54 +15233,44 @@ var initializePlugin = async ({
|
|
|
15152
15233
|
repositoryRevisionDigest: observer.targetDigest,
|
|
15153
15234
|
worktreeRevisionDigest: observer.targetDigest
|
|
15154
15235
|
};
|
|
15155
|
-
|
|
15156
|
-
|
|
15236
|
+
return {
|
|
15237
|
+
...base,
|
|
15157
15238
|
workspaceIdentity: initialIdentities.targetDigest,
|
|
15158
15239
|
repositoryIdentity: initialIdentities.repositoryRevisionDigest,
|
|
15159
15240
|
worktreeIdentity: initialIdentities.worktreeRevisionDigest,
|
|
15160
|
-
registrationIdentity: registrationSourceIdentity,
|
|
15161
|
-
targetDirectory: typeof worktree === "string" ? worktree : directory,
|
|
15162
|
-
sessionLocation: directory,
|
|
15163
15241
|
observer,
|
|
15164
15242
|
classifier: createReceiptClassifier(),
|
|
15165
|
-
hostReadback: (
|
|
15166
|
-
|
|
15167
|
-
|
|
15168
|
-
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15172
|
-
|
|
15173
|
-
|
|
15174
|
-
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
|
|
15178
|
-
|
|
15179
|
-
|
|
15180
|
-
|
|
15181
|
-
|
|
15182
|
-
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
if (typeof entry !== "object" || entry === null || typeof entry.id !== "string") {
|
|
15195
|
-
return [];
|
|
15196
|
-
}
|
|
15197
|
-
return [{ sessionId: entry.id, parentID: entry.parentID }];
|
|
15198
|
-
});
|
|
15199
|
-
}
|
|
15200
|
-
};
|
|
15201
|
-
})()
|
|
15243
|
+
hostReadback: createHostReadback({ client, directory })
|
|
15244
|
+
};
|
|
15245
|
+
};
|
|
15246
|
+
var composeProfileBlock = (harnessProfile, guardEnabled) => {
|
|
15247
|
+
const parts2 = [harnessProfile, guardEnabled ? WORKFLOW_GUARD_GUIDANCE : null];
|
|
15248
|
+
const present = parts2.filter((part) => part !== null);
|
|
15249
|
+
return present.length > 0 ? present.join(`
|
|
15250
|
+
|
|
15251
|
+
`) : undefined;
|
|
15252
|
+
};
|
|
15253
|
+
var initializePlugin = async ({
|
|
15254
|
+
client,
|
|
15255
|
+
directory,
|
|
15256
|
+
worktree
|
|
15257
|
+
}) => {
|
|
15258
|
+
let hasLoggedInit = false;
|
|
15259
|
+
let userOutputLimitSet = false;
|
|
15260
|
+
const skillOutputStore = createSkillOutputStore();
|
|
15261
|
+
const config = loadConfig(directory);
|
|
15262
|
+
const guardEnabled = config.workflow_guard.mode !== "disabled";
|
|
15263
|
+
const bootstrapContent = getBootstrapContent(config, {
|
|
15264
|
+
bundledSkillsDir,
|
|
15265
|
+
profileBlock: composeProfileBlock(readHarnessProfile(bundledSkillsDir, "opencode"), guardEnabled)
|
|
15266
|
+
});
|
|
15267
|
+
const configHandler = createConfigHandler({
|
|
15268
|
+
directory,
|
|
15269
|
+
bundledSkillsDir,
|
|
15270
|
+
bundledAgentsDir,
|
|
15271
|
+
bundledCommandsDir
|
|
15202
15272
|
});
|
|
15273
|
+
const workflowGuard = createOpencodeWorkflowGuard(await workflowGuardOptions({ client, directory, worktree }, config, guardEnabled));
|
|
15203
15274
|
const hooks = {
|
|
15204
15275
|
config: async (incomingConfig) => {
|
|
15205
15276
|
const configUnknown = incomingConfig;
|
|
@@ -15250,6 +15321,7 @@ var initializePlugin = async ({
|
|
|
15250
15321
|
extra: {
|
|
15251
15322
|
version: packageVersion,
|
|
15252
15323
|
bootstrapEnabled: config.bootstrap.enabled,
|
|
15324
|
+
workflowGuardMode: config.workflow_guard.mode,
|
|
15253
15325
|
disabledSkillsCount: config.disabled_skills.length,
|
|
15254
15326
|
disabledAgentsCount: config.disabled_agents.length,
|
|
15255
15327
|
disabledCommandsCount: config.disabled_commands.length
|
|
@@ -15,6 +15,7 @@ export type WorkflowGuardBlockedError = Error & {
|
|
|
15
15
|
};
|
|
16
16
|
export declare function createWorkflowGuardBlockedError(reasonCode: WorkflowReasonCode): WorkflowGuardBlockedError;
|
|
17
17
|
export declare function isWorkflowGuardBlockedError(value: unknown): value is WorkflowGuardBlockedError;
|
|
18
|
+
export declare const WORKFLOW_GUARD_GUIDANCE = "In this OpenCode session the workflow guard is on. Check the workflow guard availability once per execution unit. Guard state is per session; a child session starts `inactive`. `inactive` (reason `no-active-epoch`) means no guarded workflow has started in this session. It is not unavailable and not terminal: load a guarded skill to begin, and do not call `systematic_workflow_start` or `systematic_workflow_complete` before one is active. A completion rejected with `readback-timeout` is retryable: call `systematic_workflow_complete` again at most twice, then report it to the user. Probes listed in `unconfirmedReadbacks` on status output (`local`, `pinned`, or an operation name) are unverified until a later status call confirms them. A completion rejected with `snapshot-blocked` or `stale-receipt` is not terminal. For `snapshot-blocked`, read `blockReason` from the rejection or `snapshotBlock.reasonCode` from status, fix that cause in the worktree without deleting or hiding user files unless the user agrees, and call status to confirm the block is gone (when the rejection names `blockTarget: parent-checkout`, fix the parent checkout and retry completion instead). Files inside submodules and nested repositories count toward the snapshot limits. Operations run while blocked leave no receipts: rerun stale or missing operations, checking remote state before redoing a push or PR, then complete. If the same reason remains after one fix, report it to the user, who can disable the guard through `systematic_workflow_control`. A call the guard skipped or sealed after a timeout has already run: for a local call check the worktree state, for a push or PR creation check remote state (the upstream ref or the open PR), and rerun only if its effect is missing. After a rejected push, check remote state, fix the cause and retry (a first push needs `git push -u`); never force-push or delete a remote ref without the user's approval. If a push may have landed but left no receipt and later pushes are rejected as `resource-mismatch`, report it to the user. A verification that overlapped another local call is not receipted; rerun it alone once every local call from that request has returned. If the guard reports `unavailable` or `guard-unavailable`, treat it as terminal for that unit: do not retry `systematic_workflow_start` or `systematic_workflow_complete`. Use the documented unguarded fallback only when authorized, and report the unavailable state once. `disabled` means the user turned the guard off; do not call the workflow tools.";
|
|
18
19
|
export interface OpencodeWorkflowGuardOptions {
|
|
19
20
|
config: OpencodeWorkflowGuardConfig;
|
|
20
21
|
workspaceIdentity: string;
|
package/dist/pi.js
CHANGED
|
@@ -9453,16 +9453,16 @@ var workflowGuardModeSchema = _enum([
|
|
|
9453
9453
|
"disabled"
|
|
9454
9454
|
]);
|
|
9455
9455
|
var WorkflowGuardSchema = object({
|
|
9456
|
-
mode: workflowGuardModeSchema.default("
|
|
9457
|
-
description: "Workflow guard mode",
|
|
9456
|
+
mode: workflowGuardModeSchema.default("disabled").meta({
|
|
9457
|
+
description: "Workflow guard mode. The guard is off by default (`disabled`); set `observe` or `protected` to turn it on.",
|
|
9458
9458
|
examples: ["observe", "protected", "disabled"]
|
|
9459
9459
|
}),
|
|
9460
9460
|
debug: boolean2().default(false).meta({
|
|
9461
9461
|
description: "Enable workflow guard debugging",
|
|
9462
9462
|
examples: [false, true]
|
|
9463
9463
|
})
|
|
9464
|
-
}).strict().default({ mode: "
|
|
9465
|
-
description: "Workflow guard configuration",
|
|
9464
|
+
}).strict().default({ mode: "disabled", debug: false }).meta({
|
|
9465
|
+
description: "Workflow guard configuration. The guard is off by default; `mode: observe` or `mode: protected` turns it on.",
|
|
9466
9466
|
examples: [{ mode: "observe", debug: false }]
|
|
9467
9467
|
});
|
|
9468
9468
|
var colorSchema = union([
|
|
@@ -10021,7 +10021,7 @@ var DEFAULT_CONFIG = {
|
|
|
10021
10021
|
enabled: true
|
|
10022
10022
|
},
|
|
10023
10023
|
workflow_guard: {
|
|
10024
|
-
mode: "
|
|
10024
|
+
mode: "disabled",
|
|
10025
10025
|
debug: false
|
|
10026
10026
|
},
|
|
10027
10027
|
agents: {},
|
package/package.json
CHANGED
|
@@ -113,5 +113,3 @@ The four capabilities are subagent delegation, blocking user interaction, task t
|
|
|
113
113
|
The bootstrap inlines the active harness profile naming the exact mechanisms for this session—consult it.
|
|
114
114
|
|
|
115
115
|
When a mechanism is unavailable, present numbered options in chat and wait for questions, maintain a visible list for task tracking, and dispatch delegation sequentially or do the work inline.
|
|
116
|
-
|
|
117
|
-
Check the workflow guard availability once per execution unit. Guard state is per session; a child session starts `inactive`. `inactive` (reason `no-active-epoch`) means no guarded workflow has started in this session. It is not unavailable and not terminal: load a guarded skill to begin, and do not call `systematic_workflow_start` or `systematic_workflow_complete` before one is active. A completion rejected with `readback-timeout` is retryable: call `systematic_workflow_complete` again at most twice, then report it to the user. Probes listed in `unconfirmedReadbacks` on status output (`local`, `pinned`, or an operation name) are unverified until a later status call confirms them. A completion rejected with `snapshot-blocked` or `stale-receipt` is not terminal. For `snapshot-blocked`, read `blockReason` from the rejection or `snapshotBlock.reasonCode` from status, fix that cause in the worktree without deleting or hiding user files unless the user agrees, and call status to confirm the block is gone (when the rejection names `blockTarget: parent-checkout`, fix the parent checkout and retry completion instead). Files inside submodules and nested repositories count toward the snapshot limits. Operations run while blocked leave no receipts: rerun stale or missing operations, checking remote state before redoing a push or PR, then complete. If the same reason remains after one fix, report it to the user, who can disable the guard through `systematic_workflow_control`. A call the guard skipped or sealed after a timeout has already run: for a local call check the worktree state, for a push or PR creation check remote state (the upstream ref or the open PR), and rerun only if its effect is missing. After a rejected push, check remote state, fix the cause and retry (a first push needs `git push -u`); never force-push or delete a remote ref without the user's approval. If a push may have landed but left no receipt and later pushes are rejected as `resource-mismatch`, report it to the user. A verification that overlapped another local call is not receipted; rerun it alone once every local call from that request has returned. If the guard reports `unavailable` or `guard-unavailable`, treat it as terminal for that unit: do not retry `systematic_workflow_start` or `systematic_workflow_complete`. Use the documented unguarded fallback only when authorized, and report the unavailable state once.
|