@primitive.ai/prim 0.1.0-alpha.109 → 0.1.0-alpha.110

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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-EZXEWFDG.js";
4
4
  import {
5
5
  scrubEnvironmentPaths
6
- } from "./chunk-YQFJUBNU.js";
6
+ } from "./chunk-KQ4WBK5R.js";
7
7
  import {
8
8
  isValidRepoSyncId
9
9
  } from "./chunk-XG7S3LIL.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isDemoStatusResponse
3
- } from "./chunk-GFJ4QIVR.js";
3
+ } from "./chunk-UDBBJWQH.js";
4
4
  import {
5
5
  inspectHookRuntime
6
6
  } from "./chunk-PO5QAYD7.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  formatStatusline
3
- } from "./chunk-RXD6LFA2.js";
3
+ } from "./chunk-GA2RXPJL.js";
4
4
  import {
5
5
  getSiteUrl,
6
6
  isSessionEnded,
@@ -11,7 +11,7 @@ import {
11
11
  saveRun,
12
12
  sessionExcluded,
13
13
  sessionKey
14
- } from "./chunk-LFZYNNQQ.js";
14
+ } from "./chunk-5BLGBSDM.js";
15
15
  import {
16
16
  packageVersion
17
17
  } from "./chunk-XG7S3LIL.js";
@@ -113,6 +113,18 @@ function blockingReason(results) {
113
113
  const parts = results.filter((result) => result.verdict === "ask" || result.verdict === "deny").flatMap((result) => [result.reason, result.additionalContext]).filter((value) => value.length > 0);
114
114
  return [...new Set(parts)].join("\n\n") || "[primitive] conflict detected (no detail available)";
115
115
  }
116
+ function approvalReason(results) {
117
+ const summaries = results.filter((result) => result.verdict === "ask" || result.verdict === "deny").map((result) => result.reason).filter(Boolean);
118
+ return [
119
+ ...new Set(summaries),
120
+ "Approve runs this edit once; it does not change these decisions."
121
+ ].join("\n");
122
+ }
123
+ function agentContext(results) {
124
+ return [...new Set(results.map((result) => result.additionalContext).filter(Boolean))].join(
125
+ "\n\n"
126
+ );
127
+ }
116
128
  function advisoryNote(aggregate, results) {
117
129
  const details = results.flatMap((result) => [
118
130
  ...aggregate === "warn" ? [result.reason] : [],
@@ -122,7 +134,18 @@ function advisoryNote(aggregate, results) {
122
134
  return [...new Set(details.filter((value) => value.length > 0))].join("\n\n");
123
135
  }
124
136
  function buildHookOutput(aggregate, results) {
125
- if (aggregate === "deny" || aggregate === "ask") {
137
+ if (aggregate === "ask") {
138
+ const context = agentContext(results);
139
+ return {
140
+ hookSpecificOutput: {
141
+ hookEventName: "PreToolUse",
142
+ permissionDecision: "ask",
143
+ permissionDecisionReason: approvalReason(results),
144
+ ...context ? { additionalContext: context } : {}
145
+ }
146
+ };
147
+ }
148
+ if (aggregate === "deny") {
126
149
  return {
127
150
  hookSpecificOutput: {
128
151
  hookEventName: "PreToolUse",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  boundedHealthError
3
- } from "./chunk-GFJ4QIVR.js";
3
+ } from "./chunk-UDBBJWQH.js";
4
4
  import {
5
5
  stripControlChars
6
6
  } from "./chunk-2IRLFOEL.js";
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  analyzeShellTargets,
6
6
  extractFileTargets
7
- } from "./chunk-D24AUSVP.js";
7
+ } from "./chunk-CTRAJCPN.js";
8
8
  import {
9
9
  scrubEnvironmentPaths
10
- } from "./chunk-YQFJUBNU.js";
10
+ } from "./chunk-KQ4WBK5R.js";
11
11
  import {
12
12
  cachedCollectScopeAdmits
13
- } from "./chunk-GFJ4QIVR.js";
13
+ } from "./chunk-UDBBJWQH.js";
14
14
  import {
15
15
  canonicalRepositoryPath,
16
16
  currentBranch,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  boundedHealthError
3
- } from "./chunk-GFJ4QIVR.js";
3
+ } from "./chunk-UDBBJWQH.js";
4
4
  import {
5
5
  terminalSafeLine
6
6
  } from "./chunk-2IRLFOEL.js";