@primitive.ai/prim 0.1.0-alpha.107 → 0.1.0-alpha.108
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 +1 -1
- package/SKILL.md +8 -5
- package/dist/{chunk-6VFUHQ4J.js → chunk-AIAYIXBJ.js} +1 -1
- package/dist/{chunk-7NNJ67YN.js → chunk-D24AUSVP.js} +1 -1
- package/dist/{chunk-4CO4A6NR.js → chunk-EQYIPUFX.js} +1 -1
- package/dist/{chunk-6L7EYXVF.js → chunk-FDXDV2AT.js} +3 -3
- package/dist/{chunk-FFYZ3XMX.js → chunk-GFJ4QIVR.js} +210 -117
- package/dist/{chunk-P5I4HGMW.js → chunk-LFZYNNQQ.js} +1 -1
- package/dist/{chunk-TPWJQD5E.js → chunk-QJOK2VOE.js} +1 -1
- package/dist/{chunk-72CQVK4E.js → chunk-RXD6LFA2.js} +1 -1
- package/dist/{chunk-LVRD562C.js → chunk-YQFJUBNU.js} +1 -1
- package/dist/daemon/server.js +210 -117
- package/dist/hook-runtime/daemon/server.js +210 -117
- package/dist/hook-runtime/hooks/post-commit.js +210 -117
- package/dist/hook-runtime/hooks/post-rewrite.js +210 -117
- package/dist/hook-runtime/hooks/post-tool-use.js +210 -117
- package/dist/hook-runtime/hooks/pre-tool-use.js +210 -117
- package/dist/hook-runtime/hooks/prim-hook.js +210 -117
- package/dist/hook-runtime/hooks/session-start.js +210 -117
- package/dist/hook-runtime/index.js +259 -140
- 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 +53 -27
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
commitAttributionFromEnvironment,
|
|
10
10
|
toCommitMove
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-AIAYIXBJ.js";
|
|
12
12
|
import {
|
|
13
13
|
getOrCreateWorkspaceId
|
|
14
14
|
} from "../chunk-EZXEWFDG.js";
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
appendMove,
|
|
17
17
|
resolveOrg
|
|
18
18
|
} from "../chunk-JJI7FU24.js";
|
|
19
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-YQFJUBNU.js";
|
|
20
20
|
import {
|
|
21
21
|
cachedCollectScopeAdmits
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-GFJ4QIVR.js";
|
|
23
23
|
import "../chunk-2IRLFOEL.js";
|
|
24
24
|
import {
|
|
25
25
|
githubRepositoryFullName,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
canonicalRewritePairs,
|
|
7
7
|
toRewriteMove
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-AIAYIXBJ.js";
|
|
9
9
|
import {
|
|
10
10
|
getOrCreateWorkspaceId
|
|
11
11
|
} from "../chunk-EZXEWFDG.js";
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
appendMove,
|
|
14
14
|
resolveOrg
|
|
15
15
|
} from "../chunk-JJI7FU24.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-YQFJUBNU.js";
|
|
17
17
|
import {
|
|
18
18
|
cachedCollectScopeAdmits
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-GFJ4QIVR.js";
|
|
20
20
|
import "../chunk-2IRLFOEL.js";
|
|
21
21
|
import {
|
|
22
22
|
githubRepositoryFullName,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
requireDurableIngestAcknowledgement
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-EQYIPUFX.js";
|
|
5
5
|
import {
|
|
6
6
|
enrichHookPayloadWithFileRefs,
|
|
7
7
|
preserveHookFileMetadata
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-FDXDV2AT.js";
|
|
9
9
|
import {
|
|
10
10
|
postToolInvocationId,
|
|
11
11
|
toMove,
|
|
12
12
|
toolOutcomeFor
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-AIAYIXBJ.js";
|
|
14
14
|
import {
|
|
15
15
|
getOrCreateWorkspaceId
|
|
16
16
|
} from "../chunk-EZXEWFDG.js";
|
|
@@ -20,21 +20,21 @@ import {
|
|
|
20
20
|
} from "../chunk-JJI7FU24.js";
|
|
21
21
|
import {
|
|
22
22
|
observeDemoInvocation
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-D24AUSVP.js";
|
|
24
24
|
import {
|
|
25
25
|
appendCodexContext,
|
|
26
26
|
prepareCodexContext
|
|
27
|
-
} from "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
27
|
+
} from "../chunk-QJOK2VOE.js";
|
|
28
|
+
import "../chunk-LFZYNNQQ.js";
|
|
29
|
+
import "../chunk-RXD6LFA2.js";
|
|
30
30
|
import {
|
|
31
31
|
scrubFromCwd
|
|
32
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-YQFJUBNU.js";
|
|
33
33
|
import {
|
|
34
34
|
bold,
|
|
35
35
|
cachedCollectScopeAdmits,
|
|
36
36
|
color
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-GFJ4QIVR.js";
|
|
38
38
|
import {
|
|
39
39
|
getClient,
|
|
40
40
|
terminalSafeLine
|
|
@@ -13,22 +13,22 @@ import {
|
|
|
13
13
|
failOpenOutput,
|
|
14
14
|
observeDemoInvocation,
|
|
15
15
|
readHookMode
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-D24AUSVP.js";
|
|
17
17
|
import {
|
|
18
18
|
appendCodexContext,
|
|
19
19
|
hasVisibleCodexMessage,
|
|
20
20
|
prepareCodexContext
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-QJOK2VOE.js";
|
|
22
|
+
import "../chunk-LFZYNNQQ.js";
|
|
23
|
+
import "../chunk-RXD6LFA2.js";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_RULES,
|
|
26
26
|
scrub
|
|
27
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-YQFJUBNU.js";
|
|
28
28
|
import {
|
|
29
29
|
boundedHealthError,
|
|
30
30
|
cachedCollectScopeAdmits
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-GFJ4QIVR.js";
|
|
32
32
|
import {
|
|
33
33
|
HttpError,
|
|
34
34
|
getClient
|
package/dist/hooks/prim-hook.js
CHANGED
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
enrichHookPayloadWithFileRefs,
|
|
20
20
|
preserveHookFileMetadata
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-FDXDV2AT.js";
|
|
22
22
|
import {
|
|
23
23
|
postToolInvocationId,
|
|
24
24
|
shouldFlushAfter,
|
|
25
25
|
toMove
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-AIAYIXBJ.js";
|
|
27
27
|
import {
|
|
28
28
|
getOrCreateWorkspaceId
|
|
29
29
|
} from "../chunk-EZXEWFDG.js";
|
|
@@ -33,19 +33,19 @@ import {
|
|
|
33
33
|
} from "../chunk-JJI7FU24.js";
|
|
34
34
|
import {
|
|
35
35
|
observeDemoInvocation
|
|
36
|
-
} from "../chunk-
|
|
36
|
+
} from "../chunk-D24AUSVP.js";
|
|
37
37
|
import {
|
|
38
38
|
prepareCodexContext
|
|
39
|
-
} from "../chunk-
|
|
40
|
-
import "../chunk-
|
|
41
|
-
import "../chunk-
|
|
39
|
+
} from "../chunk-QJOK2VOE.js";
|
|
40
|
+
import "../chunk-LFZYNNQQ.js";
|
|
41
|
+
import "../chunk-RXD6LFA2.js";
|
|
42
42
|
import {
|
|
43
43
|
scrubFromCwd,
|
|
44
44
|
writeHookDebug
|
|
45
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-YQFJUBNU.js";
|
|
46
46
|
import {
|
|
47
47
|
cachedCollectScopeAdmits
|
|
48
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-GFJ4QIVR.js";
|
|
49
49
|
import "../chunk-2IRLFOEL.js";
|
|
50
50
|
import {
|
|
51
51
|
normalizeEnvelope,
|
|
@@ -28,11 +28,11 @@ import {
|
|
|
28
28
|
} from "../chunk-EZXEWFDG.js";
|
|
29
29
|
import {
|
|
30
30
|
prepareCodexContext
|
|
31
|
-
} from "../chunk-
|
|
32
|
-
import "../chunk-
|
|
31
|
+
} from "../chunk-QJOK2VOE.js";
|
|
32
|
+
import "../chunk-RXD6LFA2.js";
|
|
33
33
|
import {
|
|
34
34
|
fetchAndCacheCollectScope
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-GFJ4QIVR.js";
|
|
36
36
|
import {
|
|
37
37
|
getSiteUrl,
|
|
38
38
|
isSessionEnded
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-2EKPBZNA.js";
|
|
23
23
|
import {
|
|
24
24
|
requireDurableIngestAcknowledgement
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-EQYIPUFX.js";
|
|
26
26
|
import {
|
|
27
27
|
checkAffectedDecisions,
|
|
28
28
|
daemonOrDirectGet,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
readDemoJson,
|
|
76
76
|
readRun,
|
|
77
77
|
saveRun
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-LFZYNNQQ.js";
|
|
79
79
|
import {
|
|
80
80
|
MS_PER_SECOND,
|
|
81
81
|
deliveryBacklogState,
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
formatStatusline,
|
|
85
85
|
formatTeammates,
|
|
86
86
|
repositoryBindingDiagnosticLabel
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-RXD6LFA2.js";
|
|
88
88
|
import {
|
|
89
89
|
bold,
|
|
90
90
|
boundedHealthError,
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
isMoveIngestRequest,
|
|
110
110
|
isReconcileResolutionResponse,
|
|
111
111
|
stripAnsi
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-GFJ4QIVR.js";
|
|
113
113
|
import {
|
|
114
114
|
CliManagementResponseError,
|
|
115
115
|
HttpError,
|
|
@@ -6717,7 +6717,8 @@ var REPOSITORY_EDIT = 'import { orders } from "./shared";\nexport const saveOrde
|
|
|
6717
6717
|
|
|
6718
6718
|
// src/demo/story.ts
|
|
6719
6719
|
var DEMO_TASK = "Implement CSV export for customer records, including name and email.";
|
|
6720
|
-
var DEMO_ORIGINAL = "Exclude customer email addresses from
|
|
6720
|
+
var DEMO_ORIGINAL = "Exclude customer contact information e.g. email addresses from public-facing data pipelines";
|
|
6721
|
+
var DEMO_RATIONALE = "Customer contact details are collected for account communication, not public distribution. Keeping them out of public-facing pipelines supports our data-minimization and purpose-limitation obligations and reduces the risk of unauthorized disclosure.";
|
|
6721
6722
|
var DEMO_REPLACEMENT = "Allow customer names and email addresses in CSV exports";
|
|
6722
6723
|
var DEMO_INITIAL = '// Fictional customer export project.\nexport const customerCsv = "";\n';
|
|
6723
6724
|
var DEMO_ADHERE = '// Fictional customer export project.\nexport const customerCsv = "name\\nAvery";\n';
|
|
@@ -6861,32 +6862,53 @@ function resultFor2(run) {
|
|
|
6861
6862
|
function present(run) {
|
|
6862
6863
|
if (run.stage === "prepared") return "Tour prepared \u2192 Isolation pending \u2192 Story not started.";
|
|
6863
6864
|
if (run.stage === "skipped") return "Tour skipped. Owned sample files removed.";
|
|
6865
|
+
const server = run.server;
|
|
6866
|
+
if (!server) throw new Error("Start the story first");
|
|
6864
6867
|
if (run.stage === "prompt")
|
|
6865
|
-
return
|
|
6866
|
-
|
|
6867
|
-
Imagine you\u2019re a new engineer joining a team. In this story, you previously authored a Decision; now experience it as the new engineer. We\u2019ll email the outcome to your signed-in address.
|
|
6868
|
-
${diagram("[1 Enter task] \u2192 [2 Your Decision stops it] \u2192 [3 Choose \u2192 Email]")}
|
|
6868
|
+
return `[DEMO] How Primitive Catches Conflicts
|
|
6869
6869
|
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
${DEMO_TASK}
|
|
6874
|
-
\`\`\``;
|
|
6870
|
+
You're a new engineer on ${safeMarkdown(server.story.orgName)}'s team.
|
|
6871
|
+
And you've been tasked with implementing CSV export functionality for customer records.
|
|
6872
|
+
Enter this prompt to do so:
|
|
6873
|
+
${DEMO_TASK}`;
|
|
6875
6874
|
if (run.stage === "conflict")
|
|
6876
|
-
return
|
|
6875
|
+
return `[DEMO] Primitive Caught a Conflict
|
|
6877
6876
|
|
|
6878
|
-
|
|
6879
|
-
${
|
|
6877
|
+
You proposed:
|
|
6878
|
+
"${DEMO_TASK}"
|
|
6880
6879
|
|
|
6881
|
-
|
|
6882
|
-
|
|
6880
|
+
But this conflicts with ${safeMarkdown(server.authorName)}'s Decision from ${safeMarkdown(server.story.decisionDate)}:
|
|
6881
|
+
Intent: ${DEMO_ORIGINAL}
|
|
6882
|
+
Rationale ${DEMO_RATIONALE}
|
|
6883
6883
|
|
|
6884
|
-
\`\`\`
|
|
6884
|
+
\`\`\`
|
|
6885
6885
|
${readSample(run, "customers.ts").trimEnd()}
|
|
6886
6886
|
\`\`\`
|
|
6887
6887
|
|
|
6888
|
-
|
|
6889
|
-
|
|
6888
|
+
You can either:
|
|
6889
|
+
- Accept ${safeMarkdown(server.authorName)}'s Decision and export only names, or
|
|
6890
|
+
- Supercede ${safeMarkdown(server.authorName)}'s Decision and proceed with exporting both names and email addresses`;
|
|
6891
|
+
if (run.stage === "completed") {
|
|
6892
|
+
const accepted = server.choice === "adhere";
|
|
6893
|
+
const after = accepted ? DEMO_ADHERE : DEMO_SUPERSEDE;
|
|
6894
|
+
return `[DEMO] ${accepted ? "Accepted" : "Superceded"} ${safeMarkdown(server.authorName)}'s Decision
|
|
6895
|
+
|
|
6896
|
+
Implemented CSV Export with ${accepted ? "only names" : "both names and email addresses"}:
|
|
6897
|
+
\`\`\`
|
|
6898
|
+
${compactDiff(DEMO_INITIAL, after)}
|
|
6899
|
+
\`\`\`
|
|
6900
|
+
|
|
6901
|
+
Check ${safeMarkdown(server.story.recipient)} for details regarding this Decision.
|
|
6902
|
+
|
|
6903
|
+
Start a new session and continue working to begin capturing Decisions.
|
|
6904
|
+
Or, you can explore existing Decisions by prompting your agent e.g.:
|
|
6905
|
+
- Show me my team's recent decisions and summarize what each one settled.
|
|
6906
|
+
- Pick the most load-bearing decision in our graph and walk me through its blast radius \u2014 what would changing it disturb?
|
|
6907
|
+
- Before I refactor, check which prior decisions govern the files I'm about to touch.
|
|
6908
|
+
- Find a file governed by one of our decisions, try a conflicting edit, and show me what the conflict gate says. Don't keep the change.
|
|
6909
|
+
- Is anything in our decision graph under review or waiting on me? Show me what needs attention.`;
|
|
6910
|
+
}
|
|
6911
|
+
if (run.stage === "cleanup") {
|
|
6890
6912
|
const choice = run.server?.choice;
|
|
6891
6913
|
const after = choice === "adhere" ? DEMO_ADHERE : DEMO_SUPERSEDE;
|
|
6892
6914
|
return `${label}
|
|
@@ -6899,7 +6921,7 @@ Your Decision \u2192 ${choice === "adhere" ? "preserved" : "replacement + your r
|
|
|
6899
6921
|
${compactDiff(DEMO_INITIAL, after)}
|
|
6900
6922
|
\`\`\`
|
|
6901
6923
|
|
|
6902
|
-
|
|
6924
|
+
Sample cleanup still needs attention. ${run.server?.email === "accepted" ? "The provider accepted the email; inbox delivery is not confirmed." : "Queued is not inbox delivery."}
|
|
6903
6925
|
|
|
6904
6926
|
${run.binding ? captureNotice : "Ready for your real Decisions."}`;
|
|
6905
6927
|
}
|
|
@@ -6920,7 +6942,8 @@ function handoff(run) {
|
|
|
6920
6942
|
supersede: {
|
|
6921
6943
|
command: demoCommand(run, "resolve", "supersede"),
|
|
6922
6944
|
requiredArgument: "--reason <user-provided reason>",
|
|
6923
|
-
replacement: DEMO_REPLACEMENT
|
|
6945
|
+
replacement: DEMO_REPLACEMENT,
|
|
6946
|
+
prompt: `What's your rationale for superceding ${safeMarkdown(run.server?.authorName ?? "the author")}'s existing Decision?`
|
|
6924
6947
|
}
|
|
6925
6948
|
}
|
|
6926
6949
|
};
|
|
@@ -7120,7 +7143,7 @@ async function terminalTour(run) {
|
|
|
7120
7143
|
const show = (result) => {
|
|
7121
7144
|
const text = result.presentation.replace(/^```(?:text|ts|diff)?\n/gmu, "").replace(/```/gu, "").replace(/\*\*(.*?)\*\*/gu, (_match, title) => bold(title));
|
|
7122
7145
|
process.stderr.write(
|
|
7123
|
-
`${text.replace("
|
|
7146
|
+
`${text.replace("[DEMO] Primitive Caught a Conflict", color("[DEMO] Primitive Caught a Conflict", "red")).replace("PASS \u2014 CSV export implemented", color("PASS \u2014 CSV export implemented", "green"))}
|
|
7124
7147
|
`
|
|
7125
7148
|
);
|
|
7126
7149
|
if (["completed", "skipped"].includes(result.stage) && "nextAction" in result) {
|
|
@@ -7136,10 +7159,13 @@ async function terminalTour(run) {
|
|
|
7136
7159
|
if (task.trim() !== DEMO_TASK) return show(await advanceDemo(run.id, "skip"));
|
|
7137
7160
|
const blocked = show(await advanceDemo(run.id, "attempt"));
|
|
7138
7161
|
if (blocked.stage !== "conflict") return blocked;
|
|
7139
|
-
const
|
|
7162
|
+
const answer = (await rl.question("Accept or Supercede? [accept/supercede/skip] ")).trim().toLowerCase();
|
|
7163
|
+
const choice = answer === "accept" ? "adhere" : answer === "supercede" ? "supersede" : answer;
|
|
7140
7164
|
if (choice !== "adhere" && choice !== "supersede")
|
|
7141
7165
|
return show(await advanceDemo(run.id, "skip"));
|
|
7142
|
-
const reason = choice === "supersede" ? await rl.question(
|
|
7166
|
+
const reason = choice === "supersede" ? await rl.question(
|
|
7167
|
+
`What's your rationale for superceding ${terminalSafeLine("server" in blocked ? blocked.server?.authorName ?? "the author" : "the author")}'s existing Decision? `
|
|
7168
|
+
) : void 0;
|
|
7143
7169
|
return show(await advanceDemo(run.id, "resolve", choice, reason));
|
|
7144
7170
|
} finally {
|
|
7145
7171
|
rl.close();
|
package/package.json
CHANGED