@primitive.ai/prim 0.1.0-alpha.104 → 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 -15
- package/SKILL.md +54 -48
- 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 +1997 -909
- 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 +480 -346
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
+
RUN_ID,
|
|
3
|
+
demoArgv,
|
|
2
4
|
demoCommand,
|
|
3
5
|
exclusionPath,
|
|
4
6
|
lockRun,
|
|
@@ -7,7 +9,7 @@ import {
|
|
|
7
9
|
saveRun,
|
|
8
10
|
sessionExcluded,
|
|
9
11
|
sessionKey
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7GSBXHK4.js";
|
|
11
13
|
|
|
12
14
|
// src/demo/isolation.ts
|
|
13
15
|
import { existsSync } from "fs";
|
|
@@ -19,25 +21,20 @@ function observeDemoInvocation(envelope, agent, checkExclusion = true) {
|
|
|
19
21
|
const input = envelope.tool_input;
|
|
20
22
|
const command = input?.command;
|
|
21
23
|
if (envelope.tool_name === tool && typeof command === "string" && command.length < 8192) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
["skip"]
|
|
33
|
-
];
|
|
34
|
-
const match = actions.find(
|
|
35
|
-
([action, choice]) => demoCommand(run, action, choice) === command
|
|
36
|
-
);
|
|
24
|
+
const argv = demoArgv(command);
|
|
25
|
+
const id = argv?.[4];
|
|
26
|
+
if (id && RUN_ID.test(id) && existsSync(runPath(id))) {
|
|
27
|
+
invocation = lockRun(id, (run) => {
|
|
28
|
+
const action = argv?.[3];
|
|
29
|
+
const choice = argv?.[6];
|
|
30
|
+
const reason = argv?.[8];
|
|
31
|
+
const recognized = ["start", "attempt", "resolve", "status", "skip"].includes(action);
|
|
32
|
+
const validChoice = action !== "resolve" || choice === "adhere" || choice === "supersede" && typeof reason === "string" && reason.trim().length > 0 && reason.length <= 500;
|
|
33
|
+
const match = recognized && validChoice && demoCommand(run, action, choice, reason) === command;
|
|
37
34
|
if (run.terminal || !match) {
|
|
38
35
|
return false;
|
|
39
36
|
}
|
|
40
|
-
if (
|
|
37
|
+
if (action === "skip") return true;
|
|
41
38
|
const key = sessionKey(agent, session);
|
|
42
39
|
if (run.agent && run.agent !== agent || run.binding && run.binding !== key) {
|
|
43
40
|
run.acknowledgment = void 0;
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
analyzeShellTargets,
|
|
6
6
|
extractFileTargets
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HT2CJ3YD.js";
|
|
8
8
|
import {
|
|
9
9
|
scrubEnvironmentPaths
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-LVRD562C.js";
|
|
11
11
|
import {
|
|
12
12
|
cachedCollectScopeAdmits
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FFYZ3XMX.js";
|
|
14
14
|
import {
|
|
15
15
|
canonicalRepositoryPath,
|
|
16
16
|
currentBranch,
|