@primitive.ai/prim 0.1.0-alpha.120 → 0.1.0-alpha.122
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 +45 -9
- package/SKILL.md +7 -2
- package/dist/{chunk-P2O7NLVN.js → chunk-4GYJHN26.js} +117 -18
- package/dist/{chunk-VOC4KOOP.js → chunk-4M23K2KZ.js} +2 -2
- package/dist/{chunk-NQFRQ56V.js → chunk-4NUGCUQC.js} +2 -2
- package/dist/{chunk-GYQOZGGF.js → chunk-5ME3WD3P.js} +2 -2
- package/dist/{chunk-CCGFRNAA.js → chunk-7LXRFXZG.js} +248 -127
- package/dist/{chunk-MWNRXAEB.js → chunk-AKGRY7OU.js} +1 -1
- package/dist/{chunk-D235RJNO.js → chunk-DQ4I3FLF.js} +3 -3
- package/dist/{chunk-R2NUH4B7.js → chunk-FT673ALA.js} +2 -2
- package/dist/{chunk-TC4FTRYO.js → chunk-HG7FJK7R.js} +2 -2
- package/dist/{chunk-5BQ2NEMP.js → chunk-HLMC7VS4.js} +2615 -941
- package/dist/{chunk-L52OD62C.js → chunk-JYPVPYW3.js} +14 -8
- package/dist/{chunk-2AKDX4RU.js → chunk-JZC2LHS6.js} +1 -1
- package/dist/{chunk-SLDZJD6Q.js → chunk-NMZSCSMY.js} +1 -1
- package/dist/{chunk-LTTF4MBE.js → chunk-OXW6PSPT.js} +2 -2
- package/dist/{chunk-EYBE724K.js → chunk-QG3GASJO.js} +4 -4
- package/dist/{chunk-A6M2M5A2.js → chunk-RRAC76LJ.js} +1 -1
- package/dist/{chunk-U67RBNIZ.js → chunk-S3ZIMGXV.js} +1 -1
- package/dist/{chunk-HXICZG5J.js → chunk-T2T45KF6.js} +4 -4
- package/dist/{chunk-LBCPRHNG.js → chunk-WN7OURQ3.js} +1 -1
- package/dist/{chunk-YTF6OCF3.js → chunk-ZQ7UK5US.js} +5 -5
- package/dist/daemon/server.js +2603 -867
- package/dist/hook-runtime/daemon/server.js +2603 -867
- package/dist/hook-runtime/hooks/post-commit.js +2671 -935
- package/dist/hook-runtime/hooks/post-rewrite.js +2664 -928
- package/dist/hook-runtime/hooks/post-tool-use.js +2606 -870
- package/dist/hook-runtime/hooks/pre-commit.js +9 -5
- package/dist/hook-runtime/hooks/pre-tool-use-worker.js +2625 -947
- package/dist/hook-runtime/hooks/prim-hook.js +2609 -873
- package/dist/hook-runtime/hooks/session-end.js +75 -13
- package/dist/hook-runtime/hooks/session-start.js +2801 -1056
- package/dist/hook-runtime/index.js +3741 -1556
- package/dist/hook-runtime/statusline-main.js +76 -14
- package/dist/hooks/post-commit.js +7 -7
- package/dist/hooks/post-rewrite.js +6 -6
- package/dist/hooks/post-tool-use.js +15 -15
- package/dist/hooks/pre-commit.js +4 -4
- package/dist/hooks/pre-tool-use-worker.js +9 -9
- package/dist/hooks/prim-hook.js +17 -17
- package/dist/hooks/session-end.js +4 -4
- package/dist/hooks/session-start.js +11 -11
- package/dist/index.js +419 -112
- package/dist/statusline-main.js +76 -14
- package/package.json +4 -2
- package/skills/prim-welcome/SKILL.md +197 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
inspectHookRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AKGRY7OU.js";
|
|
4
4
|
import {
|
|
5
5
|
isDemoStatusResponse
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HLMC7VS4.js";
|
|
7
7
|
import {
|
|
8
8
|
atomicWriteFile,
|
|
9
9
|
primConfigDirectory,
|
|
10
10
|
withFileLock,
|
|
11
11
|
withFileLockSync
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4GYJHN26.js";
|
|
13
13
|
|
|
14
14
|
// src/hooks/pre-tool-use-scoring.ts
|
|
15
15
|
import { isAbsolute, relative, sep } from "path";
|
|
@@ -1241,14 +1241,14 @@ function readRun(id) {
|
|
|
1241
1241
|
"cleanup",
|
|
1242
1242
|
"completed",
|
|
1243
1243
|
"skipped"
|
|
1244
|
-
].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)) {
|
|
1244
|
+
].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) || run.welcomeRepo !== void 0 && (typeof run.welcomeRepo !== "string" || !run.welcomeRepo.startsWith("/"))) {
|
|
1245
1245
|
throw new Error("invalid demo run state");
|
|
1246
1246
|
}
|
|
1247
1247
|
return run;
|
|
1248
1248
|
}
|
|
1249
1249
|
var saveRun = (run) => saveDemoJson(runPath(run.id), run);
|
|
1250
1250
|
var lockRun = (id, action) => withFileLockSync(`${runPath(id)}.lock`, () => action(readRun(id)), { timeoutMs: 500 });
|
|
1251
|
-
function prepareRun(agent, terminal = false) {
|
|
1251
|
+
function prepareRun(agent, terminal = false, welcomeRepo) {
|
|
1252
1252
|
const run = {
|
|
1253
1253
|
version: 2,
|
|
1254
1254
|
id: randomUUID(),
|
|
@@ -1256,7 +1256,8 @@ function prepareRun(agent, terminal = false) {
|
|
|
1256
1256
|
terminal,
|
|
1257
1257
|
agent,
|
|
1258
1258
|
preparationKey: preparationKey(agent),
|
|
1259
|
-
launcher: [process.execPath, resolve2(process.argv[1])]
|
|
1259
|
+
launcher: [process.execPath, resolve2(process.argv[1])],
|
|
1260
|
+
...welcomeRepo ? { welcomeRepo } : {}
|
|
1260
1261
|
};
|
|
1261
1262
|
saveRun(run);
|
|
1262
1263
|
return run;
|
|
@@ -1303,10 +1304,13 @@ function onboardingFinished() {
|
|
|
1303
1304
|
function finishOnboarding(outcome) {
|
|
1304
1305
|
saveDemoJson(join(demoDirectory(), "onboarding.json"), { outcome });
|
|
1305
1306
|
}
|
|
1306
|
-
function
|
|
1307
|
+
function runIds() {
|
|
1307
1308
|
const path = join(demoDirectory(), "runs");
|
|
1308
1309
|
if (!existsSync(path)) return [];
|
|
1309
|
-
return readdirSync(path).filter((name) => name.endsWith(".json") && RUN_ID.test(name.slice(0, -5))).map((name) => name.slice(0, -5))
|
|
1310
|
+
return readdirSync(path).filter((name) => name.endsWith(".json") && RUN_ID.test(name.slice(0, -5))).map((name) => name.slice(0, -5));
|
|
1311
|
+
}
|
|
1312
|
+
function pendingRuns() {
|
|
1313
|
+
return runIds().filter((id) => !["completed", "skipped"].includes(readRun(id).stage));
|
|
1310
1314
|
}
|
|
1311
1315
|
function sessionKey(agent, session) {
|
|
1312
1316
|
return createHash("sha256").update(`${agent}\0${session}`).digest("hex");
|
|
@@ -1419,6 +1423,7 @@ export {
|
|
|
1419
1423
|
demoteForMode,
|
|
1420
1424
|
analyzeShellTargets,
|
|
1421
1425
|
RUN_ID,
|
|
1426
|
+
demoDirectory,
|
|
1422
1427
|
runPath,
|
|
1423
1428
|
readDemoJson,
|
|
1424
1429
|
saveDemoJson,
|
|
@@ -1433,6 +1438,7 @@ export {
|
|
|
1433
1438
|
demoResumeCommand,
|
|
1434
1439
|
onboardingFinished,
|
|
1435
1440
|
finishOnboarding,
|
|
1441
|
+
runIds,
|
|
1436
1442
|
pendingRuns,
|
|
1437
1443
|
sessionKey,
|
|
1438
1444
|
exclusionPath,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSiteUrl
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S3ZIMGXV.js";
|
|
4
4
|
import {
|
|
5
5
|
atomicWriteFile,
|
|
6
6
|
ensureDurableDirectory,
|
|
7
7
|
jwtOrganizationId,
|
|
8
8
|
primConfigDirectory,
|
|
9
9
|
resolveAuthCredential
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4GYJHN26.js";
|
|
11
11
|
|
|
12
12
|
// src/journal.ts
|
|
13
13
|
import {
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
analyzeShellTargets,
|
|
6
6
|
extractFileTargets
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JYPVPYW3.js";
|
|
8
8
|
import {
|
|
9
9
|
scrubEnvironmentPaths
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4NUGCUQC.js";
|
|
11
11
|
import {
|
|
12
12
|
cachedCollectScopeAdmits
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HLMC7VS4.js";
|
|
14
14
|
import {
|
|
15
15
|
canonicalRepositoryPath,
|
|
16
16
|
currentBranch,
|
|
17
17
|
isRepoActiveForCapture,
|
|
18
18
|
relatedWorktreeTarget,
|
|
19
19
|
repoSyncId
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4GYJHN26.js";
|
|
21
21
|
|
|
22
22
|
// src/hooks/file-refs.ts
|
|
23
23
|
var MAX_PREFLIGHT_FILE_TARGETS = 25;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatStatusline
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5ME3WD3P.js";
|
|
4
4
|
import {
|
|
5
5
|
daemonPrincipalsMatch,
|
|
6
6
|
daemonRequest,
|
|
7
7
|
resolveDaemonPrincipal
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NMZSCSMY.js";
|
|
9
9
|
import {
|
|
10
10
|
getSiteUrl,
|
|
11
11
|
isSessionEnded,
|
|
12
12
|
terminalSafeText
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-S3ZIMGXV.js";
|
|
14
14
|
import {
|
|
15
15
|
decisionIngestionStatus,
|
|
16
16
|
gitToplevel,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
primConfigDirectory,
|
|
19
19
|
repositoryBindingState,
|
|
20
20
|
withFileLock
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-4GYJHN26.js";
|
|
22
22
|
|
|
23
23
|
// src/hooks/codex-context.ts
|
|
24
24
|
import { createHash, randomBytes as randomBytes2 } from "crypto";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
analyzeShellTargets,
|
|
3
3
|
extractFileTargets
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JYPVPYW3.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_RULES,
|
|
7
7
|
scrub
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4NUGCUQC.js";
|
|
9
9
|
import {
|
|
10
10
|
boundedHealthError,
|
|
11
11
|
isPreflightResponseV4
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HLMC7VS4.js";
|
|
13
13
|
import {
|
|
14
14
|
getClient,
|
|
15
15
|
terminalSafeLine
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-S3ZIMGXV.js";
|
|
17
17
|
import {
|
|
18
18
|
canonicalGitRoot,
|
|
19
19
|
canonicalRepositoryPath
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4GYJHN26.js";
|
|
21
21
|
|
|
22
22
|
// src/hooks/approval-copy.ts
|
|
23
23
|
var MAX_EXCERPT_CHARS = 80;
|