@brainervirus/workit-core 5.0.0 → 6.0.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/package.json +1 -1
- package/src/autonomy.ts +309 -44
- package/src/core/context-read.ts +144 -0
- package/src/core/methods.ts +7 -4
- package/src/core/store-lock.ts +1 -1
- package/src/core/task-context.ts +1 -1
- package/src/core/task-contract.ts +8 -130
- package/src/core/task-engine.ts +57 -879
- package/src/core/task-evaluation.ts +63 -5
- package/src/core/task-store.ts +2 -107
- package/src/core/workers.ts +12 -158
- package/src/core/workspaces.ts +15 -0
- package/src/core/youtrack-writes.ts +92 -0
- package/src/core.ts +2 -79
- package/src/forge/pr-ops.ts +2 -2
- package/src/hooks/handle.ts +1 -1
- package/src/hooks/hosts/claude-code.ts +0 -8
- package/src/hooks/hosts/codex.ts +2 -11
- package/src/hooks/hosts/cursor.ts +0 -8
- package/src/hooks/hosts/opencode.ts +0 -8
- package/src/hooks/hosts/pi.ts +0 -10
- package/templates/workit-contract.md +3 -2
- package/src/core/authority.ts +0 -1033
- package/src/core/auto-approval.ts +0 -338
- package/src/core/external-action-effects.ts +0 -2441
- package/src/core/external-action.ts +0 -1204
package/src/forge/pr-ops.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// The merge call carries the head SHA (GitHub `sha=`, GitLab `sha=`), so a
|
|
16
16
|
// head that moves after the gates refuses instead of merging unverified code.
|
|
17
17
|
// --delete-branch deletes with a lease on that same SHA.
|
|
18
|
-
import { requireGrant } from "../autonomy";
|
|
18
|
+
import { requireGrant, type AutonomySource } from "../autonomy";
|
|
19
19
|
import { isProtectedTarget } from "../core/branch";
|
|
20
20
|
import { vcsConfig } from "../core/vcs-config";
|
|
21
21
|
import { deleteRemoteBranch } from "../git/ops";
|
|
@@ -257,7 +257,7 @@ export type MergeOutcome = {
|
|
|
257
257
|
method: MergeMethod;
|
|
258
258
|
mergeSha: string | null;
|
|
259
259
|
verdict: { required: boolean; accepted: boolean; verdictId: string | null };
|
|
260
|
-
grant: { source:
|
|
260
|
+
grant: { source: AutonomySource };
|
|
261
261
|
deletedBranch: boolean | { error: string };
|
|
262
262
|
recorded: { id: string } | { error: string };
|
|
263
263
|
};
|
package/src/hooks/handle.ts
CHANGED
|
@@ -36,7 +36,7 @@ const subagentStartText = (
|
|
|
36
36
|
): string => {
|
|
37
37
|
if (host === "claude_code" && event.agentType === CLAUDE_WORKTREE_IMPLEMENTER)
|
|
38
38
|
return `Workit observed ${descriptor.label} subagent ${event.agentId} (${event.agentType}) working in its own git worktree: it may edit and commit there, within its brief's scope. Before the first commit, switch to a policy-compliant branch with \`workit git branch <branch> --base <base>\` (e.g. feature/<slug>); branch policy hooks still deny protected or non-compliant branches. Never record a verdict on your own work. Never push, open a PR, or merge unless the brief asks for it.`;
|
|
39
|
-
const readOnly = `Workit observed ${descriptor.label} subagent ${event.agentId} (${event.agentType}) as read-only/agent-guided
|
|
39
|
+
const readOnly = `Workit observed ${descriptor.label} subagent ${event.agentId} (${event.agentType}) as read-only/agent-guided.`;
|
|
40
40
|
if (
|
|
41
41
|
host === "claude_code" &&
|
|
42
42
|
event.agentType &&
|
|
@@ -60,14 +60,6 @@ export const CLAUDE_CODE_DESCRIPTOR: HostDescriptor = {
|
|
|
60
60
|
shellAvailable: "native",
|
|
61
61
|
perEventCost: "low",
|
|
62
62
|
capabilities: [
|
|
63
|
-
{
|
|
64
|
-
name: "interactive_decision",
|
|
65
|
-
surface: "AskUserQuestion",
|
|
66
|
-
refs: ["AskUserQuestion"],
|
|
67
|
-
requires: [],
|
|
68
|
-
assurance: "agent_guided",
|
|
69
|
-
reason: "Claude Code hooks expose no native question answer receipt",
|
|
70
|
-
},
|
|
71
63
|
{
|
|
72
64
|
name: "known_product_writes",
|
|
73
65
|
surface: "PreToolUse",
|
package/src/hooks/hosts/codex.ts
CHANGED
|
@@ -77,14 +77,6 @@ export const CODEX_DESCRIPTOR: HostDescriptor = {
|
|
|
77
77
|
shellAvailable: "native",
|
|
78
78
|
perEventCost: "low",
|
|
79
79
|
capabilities: [
|
|
80
|
-
{
|
|
81
|
-
name: "interactive_decision",
|
|
82
|
-
surface: "Question",
|
|
83
|
-
refs: ["Question"],
|
|
84
|
-
requires: [],
|
|
85
|
-
assurance: "agent_guided",
|
|
86
|
-
reason: "Codex hooks expose no native arbitrary-question answer receipt",
|
|
87
|
-
},
|
|
88
80
|
{
|
|
89
81
|
name: "known_product_writes",
|
|
90
82
|
surface: "PreToolUse",
|
|
@@ -111,7 +103,7 @@ export const CODEX_DESCRIPTOR: HostDescriptor = {
|
|
|
111
103
|
requires: ["event:subagent.start", "event:subagent.stop"],
|
|
112
104
|
observed: ["subagent.start", "subagent.stop"],
|
|
113
105
|
assurance: "agent_guided",
|
|
114
|
-
reason: "Codex reports stable child identities, but cannot block creation
|
|
106
|
+
reason: "Codex reports stable child identities, but cannot block creation",
|
|
115
107
|
unavailableReason: "Codex subagent lifecycle hooks are untrusted or incomplete",
|
|
116
108
|
},
|
|
117
109
|
{
|
|
@@ -292,7 +284,6 @@ export const codexAdapter: HostAdapter = {
|
|
|
292
284
|
};
|
|
293
285
|
},
|
|
294
286
|
render,
|
|
295
|
-
// Without a session id there is no actor to bind a writer to.
|
|
296
287
|
addendum: (input) =>
|
|
297
|
-
`<workit-codex-mutations>Codex MCP is read-only: unattested callers cannot mutate. Run workit verbs with the workit CLI on the shell (node_modules/.bin/workit, or npx -y @brainervirus/workit-cli): check, git branch|commit|push, pr, ci, stack, ledger, handoff; task-family mutations take --json
|
|
288
|
+
`<workit-codex-mutations>Codex MCP is read-only: unattested callers cannot mutate. Run workit verbs with the workit CLI on the shell (node_modules/.bin/workit, or npx -y @brainervirus/workit-cli): check, git branch|commit|push, pr, ci, stack, ledger, handoff; task-family mutations take --json${input.session.id ? ` --actor ${input.session.id}` : ""}. A verifier or reviewer records workit ledger verdict under a session the lead assigns (WORKIT_SESSION_ID=<lead>-v<n>), never the author's. Merge and release need a workspace grant (workit grant show); a question answer is not host permission.</workit-codex-mutations>`,
|
|
298
289
|
};
|
|
@@ -78,14 +78,6 @@ export const CURSOR_DESCRIPTOR: HostDescriptor = {
|
|
|
78
78
|
// Every hook spawns `npx -y --prefer-online …@latest`: a registry round-trip per event.
|
|
79
79
|
perEventCost: "npx-network",
|
|
80
80
|
capabilities: [
|
|
81
|
-
{
|
|
82
|
-
name: "interactive_decision",
|
|
83
|
-
surface: "AskQuestion",
|
|
84
|
-
refs: ["AskQuestion"],
|
|
85
|
-
requires: [],
|
|
86
|
-
assurance: "agent_guided",
|
|
87
|
-
reason: "Cursor does not expose AskQuestion answers to Workit hooks or MCP",
|
|
88
|
-
},
|
|
89
81
|
{
|
|
90
82
|
name: "known_product_writes",
|
|
91
83
|
surface: "preToolUse",
|
|
@@ -40,14 +40,6 @@ export const OPENCODE_DESCRIPTOR: HostDescriptor = {
|
|
|
40
40
|
shellAvailable: "native",
|
|
41
41
|
perEventCost: "low",
|
|
42
42
|
capabilities: [
|
|
43
|
-
{
|
|
44
|
-
name: "interactive_decision",
|
|
45
|
-
surface: "question",
|
|
46
|
-
refs: ["question"],
|
|
47
|
-
requires: ["interaction.questions"],
|
|
48
|
-
assurance: "enforced",
|
|
49
|
-
reason: "native question answers are observed by tool.execute.after and consumed once",
|
|
50
|
-
},
|
|
51
43
|
{
|
|
52
44
|
name: "known_product_writes",
|
|
53
45
|
surface: "edit/shell",
|
package/src/hooks/hosts/pi.ts
CHANGED
|
@@ -49,16 +49,6 @@ export const PI_DESCRIPTOR: HostDescriptor = {
|
|
|
49
49
|
reason:
|
|
50
50
|
"Pi exposes a before-tool boundary for known built-in write tools; it enforces project trust while file targets stay host-policy.",
|
|
51
51
|
},
|
|
52
|
-
{
|
|
53
|
-
name: "interactive_decision",
|
|
54
|
-
surface: "ui.confirm",
|
|
55
|
-
refs: ["ui.confirm"],
|
|
56
|
-
requires: ["interaction.questions"],
|
|
57
|
-
observed: ["ui"],
|
|
58
|
-
assurance: "enforced",
|
|
59
|
-
reason: "Pi supplies a native confirmation receipt when dialog UI is available.",
|
|
60
|
-
unavailableReason: "Pi is running without dialog UI, so required decisions need user input.",
|
|
61
|
-
},
|
|
62
52
|
{
|
|
63
53
|
name: "arbitrary_shell_write",
|
|
64
54
|
surface: "bash",
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Workit keeps one accountable lead and one shared task state. Inspect current
|
|
4
4
|
task state before acting; use only the shared operations for task, policy,
|
|
5
|
-
evidence, finding, decision, worker,
|
|
5
|
+
evidence, finding, decision, worker, and state changes. Authority is
|
|
6
6
|
bounded by the requested scope, current revision, caller/session provenance, and
|
|
7
|
-
observed capabilities
|
|
7
|
+
observed capabilities; delivery is bounded by the workspace autonomy grants
|
|
8
|
+
(`workit grant show`). Never claim host enforcement or evidence that the host
|
|
8
9
|
cannot provide. Preserve unresolved requirements, gaps, and uncertain workers.
|
|
9
10
|
|
|
10
11
|
Focused methods are loaded only when the resolved policy requires them. A method
|