@primitive.ai/prim 0.1.0-alpha.105 → 0.1.0-alpha.106
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/README.md +32 -18
- package/SKILL.md +54 -57
- package/dist/{chunk-IDMLJ4TM.js → chunk-4CO4A6NR.js} +1 -1
- package/dist/{chunk-H6JAQVW4.js → chunk-6VFUHQ4J.js} +1 -1
- package/dist/{chunk-5HFTJEA6.js → chunk-72CQVK4E.js} +1 -1
- package/dist/{chunk-6WCBVSND.js → chunk-7GSBXHK4.js} +67 -5
- package/dist/{chunk-GSBHBU7N.js → chunk-FFYZ3XMX.js} +1469 -533
- package/dist/{chunk-LNFWFYSN.js → chunk-HT2CJ3YD.js} +14 -17
- package/dist/{chunk-MZEVEPL3.js → chunk-LVRD562C.js} +1 -1
- package/dist/{chunk-C4D2LMTS.js → chunk-TPWJQD5E.js} +1 -1
- package/dist/{chunk-RCFDZ4DY.js → chunk-XY4CRWTF.js} +3 -3
- package/dist/daemon/server.js +1457 -531
- package/dist/hook-runtime/daemon/server.js +1457 -531
- package/dist/hook-runtime/hooks/post-commit.js +1454 -528
- package/dist/hook-runtime/hooks/post-rewrite.js +1454 -528
- package/dist/hook-runtime/hooks/post-tool-use.js +4916 -3958
- package/dist/hook-runtime/hooks/pre-tool-use.js +3110 -2150
- package/dist/hook-runtime/hooks/prim-hook.js +2660 -1700
- package/dist/hook-runtime/hooks/session-start.js +1454 -528
- package/dist/hook-runtime/index.js +1998 -936
- package/dist/hooks/post-commit.js +3 -3
- package/dist/hooks/post-rewrite.js +3 -3
- package/dist/hooks/post-tool-use.js +9 -9
- package/dist/hooks/pre-tool-use.js +6 -6
- package/dist/hooks/prim-hook.js +8 -8
- package/dist/hooks/session-start.js +3 -3
- package/dist/index.js +479 -371
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,24 +45,38 @@ skill, and the welcome:
|
|
|
45
45
|
prim setup # add --agent cursor, codex, or hermes; --no-daemon explicitly opts out
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
After successful setup,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
After successful setup, the optional **author story** puts you in a new engineer's
|
|
49
|
+
shoes in a disposable project:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
Implement CSV export → Your earlier Decision blocks email → Adhere or supersede
|
|
53
|
+
→ Real outcome email
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Enter the feature prompt in the same agent chat. The real semantic evaluator checks
|
|
57
|
+
it against your private, fictional prior Decision. Choose a name-only export or
|
|
58
|
+
approve the displayed replacement with your own short reason. A real email explains
|
|
59
|
+
what your Decision protected or why it changed. Continue once that email is queued;
|
|
60
|
+
queued and provider-accepted do not mean delivered to your inbox.
|
|
61
|
+
|
|
62
|
+
The compact diagrams and actual file evidence live in each JSON `presentation`.
|
|
63
|
+
Your agent renders them once. After owned-file cleanup, participants without real
|
|
64
|
+
Decisions enter the existing individually approved creation flow. Existing Decisions
|
|
65
|
+
remain intact; unavailable history is not treated as an empty graph.
|
|
66
|
+
|
|
67
|
+
Use `prim setup --skip-demo` to remember a skip, or
|
|
68
|
+
`prim demo --agent <claude|codex|cursor|hermes>` to replay. Direct terminal `prim demo`
|
|
69
|
+
uses the same prompts. Setup defaults to compact diagnostics; `prim setup --details`
|
|
70
|
+
shows full child output. Default agent setup returns one JSON result with `welcome`,
|
|
71
|
+
`onboarding`, and its `nextAction`. Existing completed tours do not replay automatically.
|
|
72
|
+
|
|
73
|
+
Agent hooks must acknowledge isolation before any sample is shown. Passive capture
|
|
74
|
+
then stays excluded for this session, including resumes; start a new session to
|
|
75
|
+
resume it. Other sessions, real-work enforcement and explicitly approved real
|
|
76
|
+
Decision creation remain available. Synthetic records never join the team's graph.
|
|
77
|
+
This exercises a real evaluator and demo-only blocking policy, not native production
|
|
78
|
+
Enforcement or live ingestion. Backend/email unavailability leaves the optional
|
|
79
|
+
story pending while successful setup remains successful.
|
|
66
80
|
|
|
67
81
|
Or run the steps individually:
|
|
68
82
|
|
package/SKILL.md
CHANGED
|
@@ -144,63 +144,60 @@ Treat changes to shared agent instructions and standards—such as `AGENTS.md`,
|
|
|
144
144
|
|
|
145
145
|
Apply the same attention during non-code deliberation: planning or “grill me” workflows, spec refinement, behavior design, PR planning or review, and conversations imported from Granola or other connected sources. These workflows can settle important forks before any code changes. Accumulate the confirmed decisions and record them at a natural phase or task boundary; do not interrupt or call Primitive after every answer.
|
|
146
146
|
|
|
147
|
-
### Onboarding:
|
|
148
|
-
|
|
149
|
-
After successful `prim setup`, follow
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
agent>` with `--capture-excluded` when this session ran the tour. An unfinished
|
|
202
|
-
tour is listed in `recoverableRuns`; use its skip command for cleanup before replay.
|
|
203
|
-
Do not begin real-memory proposals while the tour is pending.
|
|
147
|
+
### Onboarding: experience your Decision protecting a teammate
|
|
148
|
+
|
|
149
|
+
After successful `prim setup`, follow its `nextAction` automatically; the `onboarding`
|
|
150
|
+
object contains the preparation instructions.
|
|
151
|
+
Pass your agent explicitly: Claude, Codex, Cursor and Hermes use the same sequence.
|
|
152
|
+
Run each generated command exactly as a standalone invocation. The first action
|
|
153
|
+
establishes capture isolation before the story is revealed. Do not delegate, wrap
|
|
154
|
+
commands, read fixtures, or manufacture an acknowledgment. If pending, use the
|
|
155
|
+
returned isolation reason and diagnostic action. Unknown trust is not proof that
|
|
156
|
+
hooks are disabled; for Codex, check `/hooks` and approve only if prompted.
|
|
157
|
+
|
|
158
|
+
Render each `presentation` once as Markdown, preserving diagrams and file evidence.
|
|
159
|
+
Do not echo JSON/STDERR, expand the records, or add a prose recap. Keep the
|
|
160
|
+
**Fictional project · real conflict check** label. This uses the production semantic
|
|
161
|
+
evaluator on private demo records and a demo-only blocking policy; native production
|
|
162
|
+
hooks did not supply the verdict. Production outcomes still vary by agent and
|
|
163
|
+
Decision state, including Claude's permission prompt.
|
|
164
|
+
|
|
165
|
+
The participant is the fictional earlier author, now playing a new engineer in this
|
|
166
|
+
same chat. At `awaitUserPrompt`, show the copyable CSV-export task and **wait for the
|
|
167
|
+
user to enter it**. Only then run `attemptAction`. Do not auto-submit it, ask them to
|
|
168
|
+
adopt the prior Decision, or implement the feature yourself.
|
|
169
|
+
|
|
170
|
+
At the actual block, show the unchanged file and ask **Adhere or Supersede?**
|
|
171
|
+
Adhere uses `choices.adhere`. Supersede approves the displayed replacement,
|
|
172
|
+
**Allow customer names and email addresses in CSV exports**, and requires a short
|
|
173
|
+
reason in the user's own words. Append `'--reason'` and their single-quoted reason
|
|
174
|
+
to `choices.supersede.command`; escape any apostrophe as `'\''`, matching the
|
|
175
|
+
command's existing shell quoting. Never invent a reason or execute a placeholder.
|
|
176
|
+
Do not call production `reconcile` or `decisions create` for these samples.
|
|
177
|
+
|
|
178
|
+
An unavailable or uncertain judgment remains pending; never invent a block or pass.
|
|
179
|
+
Use `statusAction` for diagnosis and the returned action for recovery. A resolution
|
|
180
|
+
retry uses the same approved bytes and completion receipt. Show success **before**
|
|
181
|
+
following welcome. Continue when the real outcome email is durably queued; provider
|
|
182
|
+
acceptance is not inbox delivery. Cleanup errors retain the path and defer seeding.
|
|
183
|
+
|
|
184
|
+
After completion or explicit skip, follow the exact welcome `nextAction` once.
|
|
185
|
+
It preserves the executable and agent and requests `--after-demo`. Its viewer-based
|
|
186
|
+
`org` result governs the transition: `seed` proposes one real Decision for individual
|
|
187
|
+
approval; `active` continues real work; `unknown` reports unavailable history and
|
|
188
|
+
must never be treated as empty. Do not repeat the feed or seed from fictional data.
|
|
189
|
+
|
|
190
|
+
Passive capture stays excluded for this session, including resumes. Start a new
|
|
191
|
+
session to resume capture; other sessions and real-work enforcement stay active.
|
|
192
|
+
Explicitly approved real Decisions remain available here. Never save this story,
|
|
193
|
+
its Decisions, reason or outcome to repository memory or the real Decision graph.
|
|
194
|
+
|
|
195
|
+
Setup runs the optional story once per local OS-user configuration. `setup --skip-demo`
|
|
196
|
+
remembers a skip; `prim demo --agent <claude|codex|cursor|hermes>` explicitly replays.
|
|
197
|
+
Old completion markers do not force a replay. `recoverableRuns` offers cleanup of
|
|
198
|
+
unfinished runs, including legacy local tours; it does not gate a fresh tour.
|
|
199
|
+
A missing backend/email configuration leaves the optional story pending while setup
|
|
200
|
+
remains successful. Surface the returned remedy or offer its skip action.
|
|
204
201
|
|
|
205
202
|
### Onboarding: seed the graph from memory, one proposal at a time
|
|
206
203
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isDemoStatusResponse
|
|
3
|
+
} from "./chunk-FFYZ3XMX.js";
|
|
1
4
|
import {
|
|
2
5
|
atomicWriteFile,
|
|
3
6
|
primConfigDirectory,
|
|
7
|
+
withFileLock,
|
|
4
8
|
withFileLockSync
|
|
5
9
|
} from "./chunk-XG7S3LIL.js";
|
|
6
10
|
|
|
@@ -25,7 +29,17 @@ function saveDemoJson(path, value) {
|
|
|
25
29
|
}
|
|
26
30
|
function readRun(id) {
|
|
27
31
|
const run = readDemoJson(runPath(id));
|
|
28
|
-
if (
|
|
32
|
+
if (![1, 2].includes(run.version) || run.id !== id || ![
|
|
33
|
+
"prepared",
|
|
34
|
+
"proposal",
|
|
35
|
+
"conflict",
|
|
36
|
+
"prompt",
|
|
37
|
+
"approved",
|
|
38
|
+
"applied",
|
|
39
|
+
"cleanup",
|
|
40
|
+
"completed",
|
|
41
|
+
"skipped"
|
|
42
|
+
].includes(run.stage) || run.needsStatus !== void 0 && typeof run.needsStatus !== "boolean" || run.server !== void 0 && !isDemoStatusResponse(run.server) || run.receipt !== void 0 && (!Number.isSafeInteger(run.receipt.revision) || run.receipt.revision < 0 || !/^[a-f0-9]{64}$/u.test(run.receipt.appliedDigest)) || typeof run.terminal !== "boolean" || !Array.isArray(run.launcher) || run.launcher.length !== 2 || run.launcher.some((value) => typeof value !== "string" || !value.startsWith("/")) || run.agent !== void 0 && !["claude_code", "codex", "cursor", "hermes"].includes(run.agent)) {
|
|
29
43
|
throw new Error("invalid demo run state");
|
|
30
44
|
}
|
|
31
45
|
return run;
|
|
@@ -34,7 +48,7 @@ var saveRun = (run) => saveDemoJson(runPath(run.id), run);
|
|
|
34
48
|
var lockRun = (id, action) => withFileLockSync(`${runPath(id)}.lock`, () => action(readRun(id)), { timeoutMs: 500 });
|
|
35
49
|
function prepareRun(agent, terminal = false) {
|
|
36
50
|
const run = {
|
|
37
|
-
version:
|
|
51
|
+
version: 2,
|
|
38
52
|
id: randomUUID(),
|
|
39
53
|
stage: "prepared",
|
|
40
54
|
terminal,
|
|
@@ -45,13 +59,31 @@ function prepareRun(agent, terminal = false) {
|
|
|
45
59
|
return run;
|
|
46
60
|
}
|
|
47
61
|
var quote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
48
|
-
function demoCommand(run, action, choice) {
|
|
62
|
+
function demoCommand(run, action, choice, reason) {
|
|
49
63
|
return [
|
|
50
64
|
...run.launcher,
|
|
51
65
|
"demo",
|
|
52
66
|
action,
|
|
53
67
|
run.id,
|
|
54
|
-
...choice === void 0 ? [] : ["--choice", choice]
|
|
68
|
+
...choice === void 0 ? [] : ["--choice", choice],
|
|
69
|
+
...reason === void 0 ? [] : ["--reason", reason]
|
|
70
|
+
].map(quote).join(" ");
|
|
71
|
+
}
|
|
72
|
+
function demoWelcomeCommand(run) {
|
|
73
|
+
return [
|
|
74
|
+
process.execPath,
|
|
75
|
+
resolve(process.argv[1]),
|
|
76
|
+
"welcome",
|
|
77
|
+
"--after-demo",
|
|
78
|
+
...run.agent ? ["--agent", run.agent === "claude_code" ? "claude" : run.agent] : [],
|
|
79
|
+
...run.binding ? ["--capture-excluded"] : []
|
|
80
|
+
].map(quote).join(" ");
|
|
81
|
+
}
|
|
82
|
+
function demoDiagnosticCommand(run) {
|
|
83
|
+
return [
|
|
84
|
+
process.execPath,
|
|
85
|
+
resolve(process.argv[1]),
|
|
86
|
+
...run.agent ? [run.agent === "claude_code" ? "claude" : run.agent, "status"] : ["doctor"]
|
|
55
87
|
].map(quote).join(" ");
|
|
56
88
|
}
|
|
57
89
|
function onboardingFinished() {
|
|
@@ -88,6 +120,32 @@ function sessionExcluded(agent, session) {
|
|
|
88
120
|
}
|
|
89
121
|
return true;
|
|
90
122
|
}
|
|
123
|
+
var lockRunAsync = (id, action) => withFileLock(`${runPath(id)}.lock`, () => action(readRun(id)), { timeoutMs: 500 });
|
|
124
|
+
function demoArgv(command) {
|
|
125
|
+
const result = [];
|
|
126
|
+
let i = 0;
|
|
127
|
+
while (i < command.length) {
|
|
128
|
+
if (command[i++] !== "'") return;
|
|
129
|
+
let value = "";
|
|
130
|
+
let closed = false;
|
|
131
|
+
while (i < command.length) {
|
|
132
|
+
if (command.slice(i, i + 4) === "'\\''") {
|
|
133
|
+
value += "'";
|
|
134
|
+
i += 4;
|
|
135
|
+
} else if (command[i] === "'") {
|
|
136
|
+
i++;
|
|
137
|
+
closed = true;
|
|
138
|
+
break;
|
|
139
|
+
} else {
|
|
140
|
+
value += command[i++];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (!closed) return;
|
|
144
|
+
result.push(value);
|
|
145
|
+
if (i === command.length) return result;
|
|
146
|
+
if (command[i++] !== " " || i === command.length) return;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
91
149
|
|
|
92
150
|
export {
|
|
93
151
|
RUN_ID,
|
|
@@ -98,10 +156,14 @@ export {
|
|
|
98
156
|
lockRun,
|
|
99
157
|
prepareRun,
|
|
100
158
|
demoCommand,
|
|
159
|
+
demoWelcomeCommand,
|
|
160
|
+
demoDiagnosticCommand,
|
|
101
161
|
onboardingFinished,
|
|
102
162
|
finishOnboarding,
|
|
103
163
|
pendingRuns,
|
|
104
164
|
sessionKey,
|
|
105
165
|
exclusionPath,
|
|
106
|
-
sessionExcluded
|
|
166
|
+
sessionExcluded,
|
|
167
|
+
lockRunAsync,
|
|
168
|
+
demoArgv
|
|
107
169
|
};
|