@brainervirus/workit-core 2.0.1 → 2.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-core",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "private": false,
5
5
  "description": "Workit shared core — task, policy, evidence, review, decision, worker, and writer state for agentic coding workflows",
6
6
  "keywords": [
@@ -22,6 +22,14 @@ request, and a timeout is not proof that a worker stopped.
22
22
  until process exit or explicit recovery.
23
23
  4. Reconcile helper reports and run the checks appropriate to the requested
24
24
  outcome. If delegation is unavailable, continue inline when useful.
25
+ 5. Before a cross-repo mutation, resolve the actual checkout, branch and remote
26
+ from the request and current context. Ask only if competing plausible targets
27
+ remain unresolved. Branch, commit, direct push, PR-ready, merge and release
28
+ are distinct endpoints; perform only the authorized one under target rules.
29
+ Before saying done, reconcile every named deliverable against that checkout
30
+ and verify the requested result. For a push, observe the destination remote
31
+ ref and confirm it contains the delivered commit; report drift or missing
32
+ items as blockers instead of treating local success as remote delivery.
25
33
 
26
34
  Do not edit Workit metadata directly, create nested helper trees, widen paths, or
27
35
  create a second lifecycle. Read-only investigation and bounded reports do not
@@ -18,7 +18,11 @@ request. Preserve continuity when it helps; do not manufacture task mutations.
18
18
  3. For a separate request, do not silently resume an old objective. Park a
19
19
  concise checkpoint only when substantial work needs to continue later. Start
20
20
  a distinct tracked record only if the new work benefits from continuity,
21
- dependencies, coordination, or durable decisions.
21
+ dependencies, coordination, or durable decisions. For work spanning repos,
22
+ checkpoint each unfinished item with its checkout, branch, requested
23
+ deliverables, and delivery endpoint. Keep explicitly held items parked with
24
+ their resume condition until the user resumes them. A conversational
25
+ checkpoint is sufficient when no task record is needed.
22
26
  4. Before resuming a named tracked task, reconcile its checkout, branch, dirty
23
27
  state, current policy, stale evidence, uncertain effects, and ownership. Do
24
28
  not change branches, stash, fetch large histories, or seize ownership just
@@ -138,7 +138,8 @@ let imported decisions grant authority. Never turn a host deny into allow or
138
138
  claim enforcement/evidence a host cannot provide. A precise request with settled
139
139
  constraints does not need an interview. Present genuine unresolved options with
140
140
  evidence and a recommendation, then continue toward the requested delivery
141
- endpoint: investigation, implementation, PR/MR-ready, merge, or release. Run
141
+ endpoint: investigation, implementation, branch/commit/push, PR/MR-ready,
142
+ merge, or release. Run
142
143
  applicable checks and safe repairs without repeated continuation questions;
143
144
  stop for missing host authority, a new consequential choice, a conflicting edit,
144
145
  or an unresolved blocker. A tracked record may close when actual evidence
@@ -150,6 +151,12 @@ confirm the stop. Preserve unresolved requirements, gaps, and uncertain workers.
150
151
  When context changes, distinguish a quick question, same-task adjustment, and
151
152
  separate request. Answer a quick question without pausing/resuming task state;
152
153
  park a concise checkpoint only when substantial work needs to continue later.
154
+ For work spanning repositories, bind each unfinished item to its actual checkout,
155
+ branch, requested deliverables, and delivery endpoint. Preserve held items with
156
+ an explicit resume condition. Resolve competing plausible targets before a
157
+ mutation; ask only when available context cannot settle that consequential choice.
158
+ Before reporting delivery, reconcile every requested item and observe the actual
159
+ target result; a local commit alone is not evidence of a requested remote push.
153
160
 
154
161
  Skill routing: slash aliases /wk-* load on demand. Use workit-steer for a
155
162
  substantial interruption or change of direction, workit-deslop when relevant
@@ -67,6 +67,7 @@ type CompactDecision = {
67
67
  purpose: Decision["purpose"];
68
68
  status: Decision["response"];
69
69
  digest: string;
70
+ choice: string;
70
71
  references: CompactReference[];
71
72
  };
72
73
  type CompactMethod = Pick<SelectedMethod, "id" | "assurance"> & { reason: string };
@@ -100,6 +101,14 @@ const compactText = (value: string | null, limit: number): string | null =>
100
101
  })
101
102
  .slice(0, limit);
102
103
  const compactBytes = (value: string): number => new TextEncoder().encode(value).byteLength;
104
+ const compactTimestamp = (value: Utc): string =>
105
+ `${value.slice(0, 19)}.${value.slice(20, -1).padEnd(9, "0")}`;
106
+ const compactDecisionChoice = (entry: TaskView["task"]["decisions"][number]): string | null => {
107
+ const stated = entry.data.binding.statedChoice?.text;
108
+ const approved = entry.data.response === "approved" ? entry.data.binding.approvedContent : "";
109
+ const source = stated?.trim() || approved.trim() || null;
110
+ return compactText(source, COMPACT_TEXT_BYTES);
111
+ };
103
112
  const compactReference = (ref: Ref): CompactReference => {
104
113
  if (ref.kind === "file")
105
114
  return {
@@ -118,13 +127,21 @@ const compactReference = (ref: Ref): CompactReference => {
118
127
  export function compactTaskContext(view: TaskView): string {
119
128
  const decisions: CompactDecision[] = view.task.decisions
120
129
  .slice()
121
- .sort((left, right) => (left.id < right.id ? -1 : left.id > right.id ? 1 : 0))
130
+ .sort((left, right) => {
131
+ const leftAt = compactTimestamp(left.recordedAt);
132
+ const rightAt = compactTimestamp(right.recordedAt);
133
+ if (leftAt !== rightAt) return leftAt > rightAt ? -1 : 1;
134
+ return left.id < right.id ? -1 : left.id > right.id ? 1 : 0;
135
+ })
122
136
  .slice(0, COMPACT_MAX_ITEMS)
123
137
  .map((entry) => ({
124
138
  id: entry.id,
125
139
  purpose: entry.data.purpose,
126
140
  status: entry.data.response,
127
141
  digest: entry.data.digest,
142
+ choice:
143
+ compactDecisionChoice(entry) ||
144
+ `task.inspect taskId=${view.task.id} view=full; decision=${entry.id}`,
128
145
  references: entry.data.binding.contentRefs.slice(0, 1).map(compactReference),
129
146
  }));
130
147
  const methods: CompactMethod[] = view.task.policy