@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.
@@ -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-6WCBVSND.js";
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 ids = command.match(
23
- /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gu
24
- );
25
- if (ids?.length === 1 && existsSync(runPath(ids[0]))) {
26
- invocation = lockRun(ids[0], (run) => {
27
- const actions = [
28
- ["start"],
29
- ["confirm"],
30
- ["resolve", "repository"],
31
- ["resolve", "local-storage"],
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 (match[0] === "skip") return true;
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;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  boundedHealthError
3
- } from "./chunk-GSBHBU7N.js";
3
+ } from "./chunk-FFYZ3XMX.js";
4
4
  import {
5
5
  terminalSafeLine
6
6
  } from "./chunk-2IRLFOEL.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  formatStatusline
3
- } from "./chunk-5HFTJEA6.js";
3
+ } from "./chunk-72CQVK4E.js";
4
4
  import {
5
5
  getSiteUrl,
6
6
  isSessionEnded,
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  analyzeShellTargets,
6
6
  extractFileTargets
7
- } from "./chunk-LNFWFYSN.js";
7
+ } from "./chunk-HT2CJ3YD.js";
8
8
  import {
9
9
  scrubEnvironmentPaths
10
- } from "./chunk-MZEVEPL3.js";
10
+ } from "./chunk-LVRD562C.js";
11
11
  import {
12
12
  cachedCollectScopeAdmits
13
- } from "./chunk-GSBHBU7N.js";
13
+ } from "./chunk-FFYZ3XMX.js";
14
14
  import {
15
15
  canonicalRepositoryPath,
16
16
  currentBranch,