@namzu/sdk 64.0.0 → 64.2.0

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.
Files changed (132) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/agents/file-definitions.d.ts +10 -0
  3. package/dist/agents/file-definitions.d.ts.map +1 -1
  4. package/dist/agents/file-definitions.js +10 -2
  5. package/dist/agents/file-definitions.js.map +1 -1
  6. package/dist/plugin/file-change-hooks.d.ts +53 -0
  7. package/dist/plugin/file-change-hooks.d.ts.map +1 -0
  8. package/dist/plugin/file-change-hooks.js +111 -0
  9. package/dist/plugin/file-change-hooks.js.map +1 -0
  10. package/dist/plugin/file-change-watch.d.ts +111 -0
  11. package/dist/plugin/file-change-watch.d.ts.map +1 -0
  12. package/dist/plugin/file-change-watch.js +324 -0
  13. package/dist/plugin/file-change-watch.js.map +1 -0
  14. package/dist/plugin/index.d.ts +10 -1
  15. package/dist/plugin/index.d.ts.map +1 -1
  16. package/dist/plugin/index.js +7 -1
  17. package/dist/plugin/index.js.map +1 -1
  18. package/dist/plugin/lifecycle.d.ts +60 -1
  19. package/dist/plugin/lifecycle.d.ts.map +1 -1
  20. package/dist/plugin/lifecycle.js +118 -7
  21. package/dist/plugin/lifecycle.js.map +1 -1
  22. package/dist/plugin/loader.d.ts.map +1 -1
  23. package/dist/plugin/loader.js +24 -1
  24. package/dist/plugin/loader.js.map +1 -1
  25. package/dist/plugin/session-hook-env.d.ts +140 -0
  26. package/dist/plugin/session-hook-env.d.ts.map +1 -0
  27. package/dist/plugin/session-hook-env.js +458 -0
  28. package/dist/plugin/session-hook-env.js.map +1 -0
  29. package/dist/plugin/shell-hook-env.d.ts +107 -0
  30. package/dist/plugin/shell-hook-env.d.ts.map +1 -0
  31. package/dist/plugin/shell-hook-env.js +272 -0
  32. package/dist/plugin/shell-hook-env.js.map +1 -0
  33. package/dist/plugin/shell-hook.d.ts +105 -2
  34. package/dist/plugin/shell-hook.d.ts.map +1 -1
  35. package/dist/plugin/shell-hook.js +282 -24
  36. package/dist/plugin/shell-hook.js.map +1 -1
  37. package/dist/plugin/worktree-hook-answer.d.ts +26 -0
  38. package/dist/plugin/worktree-hook-answer.d.ts.map +1 -0
  39. package/dist/plugin/worktree-hook-answer.js +132 -0
  40. package/dist/plugin/worktree-hook-answer.js.map +1 -0
  41. package/dist/public-runtime.d.ts +4 -4
  42. package/dist/public-runtime.d.ts.map +1 -1
  43. package/dist/public-runtime.js +4 -4
  44. package/dist/public-runtime.js.map +1 -1
  45. package/dist/public-types.d.ts +7 -1
  46. package/dist/public-types.d.ts.map +1 -1
  47. package/dist/runtime/query/executor.d.ts +8 -1
  48. package/dist/runtime/query/executor.d.ts.map +1 -1
  49. package/dist/runtime/query/executor.js +4 -0
  50. package/dist/runtime/query/executor.js.map +1 -1
  51. package/dist/runtime/query/index.d.ts +9 -0
  52. package/dist/runtime/query/index.d.ts.map +1 -1
  53. package/dist/runtime/query/index.js +20 -0
  54. package/dist/runtime/query/index.js.map +1 -1
  55. package/dist/runtime/query/tooling.d.ts +8 -1
  56. package/dist/runtime/query/tooling.d.ts.map +1 -1
  57. package/dist/runtime/query/tooling.js +6 -0
  58. package/dist/runtime/query/tooling.js.map +1 -1
  59. package/dist/session/workspace/hooked-driver.d.ts +72 -0
  60. package/dist/session/workspace/hooked-driver.d.ts.map +1 -0
  61. package/dist/session/workspace/hooked-driver.js +204 -0
  62. package/dist/session/workspace/hooked-driver.js.map +1 -0
  63. package/dist/session/workspace/index.d.ts +2 -0
  64. package/dist/session/workspace/index.d.ts.map +1 -1
  65. package/dist/session/workspace/index.js +1 -0
  66. package/dist/session/workspace/index.js.map +1 -1
  67. package/dist/skills/index.d.ts +1 -1
  68. package/dist/skills/index.d.ts.map +1 -1
  69. package/dist/skills/index.js +1 -1
  70. package/dist/skills/index.js.map +1 -1
  71. package/dist/skills/loader.d.ts +22 -0
  72. package/dist/skills/loader.d.ts.map +1 -1
  73. package/dist/skills/loader.js +41 -0
  74. package/dist/skills/loader.js.map +1 -1
  75. package/dist/tools/builtins/bash-cwd.d.ts +6 -1
  76. package/dist/tools/builtins/bash-cwd.d.ts.map +1 -1
  77. package/dist/tools/builtins/bash-cwd.js +27 -2
  78. package/dist/tools/builtins/bash-cwd.js.map +1 -1
  79. package/dist/tools/builtins/bash.js +1 -1
  80. package/dist/tools/builtins/bash.js.map +1 -1
  81. package/dist/tools/builtins/skill.d.ts.map +1 -1
  82. package/dist/tools/builtins/skill.js +114 -17
  83. package/dist/tools/builtins/skill.js.map +1 -1
  84. package/dist/types/plugin/index.d.ts +75 -2
  85. package/dist/types/plugin/index.d.ts.map +1 -1
  86. package/dist/types/plugin/index.js +5 -0
  87. package/dist/types/plugin/index.js.map +1 -1
  88. package/dist/types/session/records.d.ts +73 -1
  89. package/dist/types/session/records.d.ts.map +1 -1
  90. package/dist/types/session/records.js +25 -0
  91. package/dist/types/session/records.js.map +1 -1
  92. package/dist/types/skills/index.d.ts +8 -0
  93. package/dist/types/skills/index.d.ts.map +1 -1
  94. package/dist/types/skills/index.js.map +1 -1
  95. package/dist/types/tool/index.d.ts +97 -0
  96. package/dist/types/tool/index.d.ts.map +1 -1
  97. package/dist/types/tool/index.js.map +1 -1
  98. package/dist/types/workspace/ref.d.ts +6 -0
  99. package/dist/types/workspace/ref.d.ts.map +1 -1
  100. package/dist/utils/frontmatter.d.ts +16 -0
  101. package/dist/utils/frontmatter.d.ts.map +1 -1
  102. package/dist/utils/frontmatter.js +31 -1
  103. package/dist/utils/frontmatter.js.map +1 -1
  104. package/package.json +1 -1
  105. package/src/agents/file-definitions.ts +17 -2
  106. package/src/plugin/file-change-hooks.ts +131 -0
  107. package/src/plugin/file-change-watch.ts +367 -0
  108. package/src/plugin/index.ts +39 -1
  109. package/src/plugin/lifecycle.ts +162 -8
  110. package/src/plugin/loader.ts +22 -1
  111. package/src/plugin/session-hook-env.ts +475 -0
  112. package/src/plugin/shell-hook-env.ts +335 -0
  113. package/src/plugin/shell-hook.ts +416 -24
  114. package/src/plugin/worktree-hook-answer.ts +142 -0
  115. package/src/public-runtime.ts +33 -0
  116. package/src/public-types.ts +20 -1
  117. package/src/runtime/query/executor.ts +12 -0
  118. package/src/runtime/query/index.ts +28 -0
  119. package/src/runtime/query/tooling.ts +19 -1
  120. package/src/session/workspace/hooked-driver.ts +272 -0
  121. package/src/session/workspace/index.ts +7 -0
  122. package/src/skills/index.ts +3 -0
  123. package/src/skills/loader.ts +47 -0
  124. package/src/tools/builtins/bash-cwd.ts +25 -1
  125. package/src/tools/builtins/bash.ts +1 -1
  126. package/src/tools/builtins/skill.ts +138 -27
  127. package/src/types/plugin/index.ts +84 -1
  128. package/src/types/session/records.ts +28 -0
  129. package/src/types/skills/index.ts +9 -0
  130. package/src/types/tool/index.ts +105 -0
  131. package/src/types/workspace/ref.ts +6 -0
  132. package/src/utils/frontmatter.ts +52 -1
@@ -0,0 +1,272 @@
1
+ /**
2
+ * The environment a shell hook command is started with, beyond what the
3
+ * kernel always sets: the entry's own `env` map, and variables a moved
4
+ * command expects.
5
+ *
6
+ * A hooks block brought from elsewhere often starts a command with a variable
7
+ * for the project folder, named for the tool it was written for. That tool's
8
+ * name is not ours to know, so the rule here reads the shape of the name: a
9
+ * variable the command or its arguments refer to, that is not set, and whose
10
+ * name ends in one of {@link MOVED_FOLDER_ENDINGS}, is set to that folder.
11
+ * Nothing already set is ever replaced.
12
+ */
13
+ /** A name a hook is started with that `env` may not replace: the kernel sets these itself. */
14
+ export const SHELL_HOOK_RESERVED_ENV = [
15
+ 'NAMZU_HOOK_EVENT',
16
+ 'NAMZU_SESSION_ID',
17
+ 'NAMZU_PROJECT_DIR',
18
+ 'NAMZU_TURN_ID',
19
+ 'NAMZU_TOOL_NAME',
20
+ 'NAMZU_TOOL_PATH',
21
+ 'NAMZU_ENV_FILE',
22
+ 'NAMZU_STARTED_BY_SESSION',
23
+ ];
24
+ /** Endings read by shape; the name looked for is the whole variable name. */
25
+ export const MOVED_FOLDER_ENDINGS = [
26
+ { ending: '_PROJECT_DIR', folder: 'project' },
27
+ // A plugin's own folder and the folder kept for its data. These are set only
28
+ // for a hook entry a plugin ships; a name like this in a config file's entry
29
+ // has no folder to stand for and is left unset (and reported).
30
+ { ending: '_PLUGIN_ROOT', folder: 'plugin' },
31
+ { ending: '_PLUGIN_DATA', folder: 'pluginData' },
32
+ // A skill's own folder, for a hook that came from a skill. A skill moved as
33
+ // written names its folder `..._PLUGIN_ROOT` (see `movedFolderFor`); it has
34
+ // no data folder, so `_PLUGIN_DATA` is never given to one.
35
+ { ending: '_SKILL_ROOT', folder: 'skill' },
36
+ // The file a hook may append `export NAME=value` lines to, on the events
37
+ // that have one (`session_start`, `cwd_changed`, `file_changed`): the same
38
+ // file `NAMZU_ENV_FILE` names. On any other event there is no such file and
39
+ // the name is left unset (and reported).
40
+ { ending: '_ENV_FILE', folder: 'envFile' },
41
+ ];
42
+ /**
43
+ * The folder a variable name stands for, or `undefined` when it has none here.
44
+ * A skill's folder answers `_SKILL_ROOT` and also `_PLUGIN_ROOT`, unless the
45
+ * entry belongs to a plugin (then `_PLUGIN_ROOT` is the plugin's folder).
46
+ */
47
+ export function movedFolderFor(name, folders) {
48
+ const moved = MOVED_FOLDER_ENDINGS.find((each) => name.endsWith(each.ending));
49
+ if (moved === undefined)
50
+ return undefined;
51
+ if (moved.folder === 'plugin')
52
+ return folders.plugin ?? folders.skill;
53
+ return folders[moved.folder];
54
+ }
55
+ /** Whether a variable name stands for a plugin folder by its ending. */
56
+ export function isPluginFolderVariable(name) {
57
+ return MOVED_FOLDER_ENDINGS.some((each) => (each.folder === 'plugin' || each.folder === 'pluginData') && name.endsWith(each.ending));
58
+ }
59
+ /**
60
+ * `${NAME}` and `$NAME` in a command or argument, for a name that ends in
61
+ * `_PLUGIN_ROOT` or `_PLUGIN_DATA`, become the folder's path, so an entry in
62
+ * the exec form (which no shell reads) finds its own folder too. A reference
63
+ * with a modifier (`${NAME:-x}`) is left to the shell, which has the variable.
64
+ */
65
+ export function substitutePluginFolders(text, folders) {
66
+ if (folders === undefined)
67
+ return text;
68
+ return text.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g, (whole, braced, bare) => {
69
+ const name = (braced ?? bare);
70
+ const moved = MOVED_FOLDER_ENDINGS.find((each) => name.endsWith(each.ending));
71
+ if (moved === undefined)
72
+ return whole;
73
+ if (moved.folder === 'plugin')
74
+ return folders.root;
75
+ if (moved.folder === 'pluginData')
76
+ return folders.dataDir;
77
+ return whole;
78
+ });
79
+ }
80
+ /**
81
+ * For the exec form, which no shell reads: `${NAME}` and `$NAME` for a name
82
+ * that ends in one of {@link MOVED_FOLDER_ENDINGS} become the value the hook is
83
+ * started with (`env` is the environment {@link movedEnvironment} built, so a
84
+ * value the entry or the host already set wins). A reference with a modifier is
85
+ * left as written, as is a name with no value.
86
+ */
87
+ export function substituteMovedFolders(text, env) {
88
+ return text.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g, (whole, braced, bare) => {
89
+ const name = (braced ?? bare);
90
+ if (!MOVED_FOLDER_ENDINGS.some((each) => name.endsWith(each.ending)))
91
+ return whole;
92
+ return env[name] ?? whole;
93
+ });
94
+ }
95
+ /**
96
+ * The program that reads a shell hook's command, found on the host's own
97
+ * `PATH`. An entry may set `PATH` in its `env` to something that does not hold
98
+ * `sh`; the command is still read by it, so the shell is looked up before that
99
+ * `env` is applied. `undefined` when no change is needed or none is found.
100
+ */
101
+ export function shellPathOutsideEnv(name, hostPath, startedWith, isExecutable, separator) {
102
+ if (hostPath === undefined || hostPath === startedWith)
103
+ return undefined;
104
+ for (const dir of hostPath.split(separator)) {
105
+ if (dir === '')
106
+ continue;
107
+ const candidate = `${dir.replace(/[\\/]$/, '')}/${name}`;
108
+ if (isExecutable(candidate))
109
+ return candidate;
110
+ }
111
+ return undefined;
112
+ }
113
+ const NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
114
+ /** What is wrong with an `env` name, or `undefined` when it can be used. */
115
+ export function shellHookEnvNameProblem(name) {
116
+ if (!NAME.test(name)) {
117
+ return 'is not a valid variable name (letters, digits and underscores, not starting with a digit)';
118
+ }
119
+ if (SHELL_HOOK_RESERVED_ENV.includes(name)) {
120
+ return 'is set by Namzu for every hook and cannot be replaced';
121
+ }
122
+ return undefined;
123
+ }
124
+ /** The problems in an `env` value as a whole, each naming the variable. Empty when it is usable. */
125
+ export function shellHookEnvProblems(env) {
126
+ if (env === null || typeof env !== 'object' || Array.isArray(env)) {
127
+ return ['must be a mapping of variable names to text'];
128
+ }
129
+ const problems = [];
130
+ for (const [name, value] of Object.entries(env)) {
131
+ const bad = shellHookEnvNameProblem(name);
132
+ if (bad !== undefined)
133
+ problems.push(`${JSON.stringify(name)} ${bad}`);
134
+ else if (typeof value !== 'string')
135
+ problems.push(`${JSON.stringify(name)} must be text`);
136
+ }
137
+ return problems;
138
+ }
139
+ // `$NAME`, `${NAME}` and `${NAME<modifier>}`: group 2 is the modifier text.
140
+ const REFERENCE = /\$(?:\{([A-Za-z_][A-Za-z0-9_]*)([^}]*)\}|([A-Za-z_][A-Za-z0-9_]*))/g;
141
+ /**
142
+ * The variables the texts refer to, in order of first appearance. A reference
143
+ * with a default (`${NAME:-x}`, `${NAME-x}`, `${NAME:+x}`, `${NAME=x}`) is
144
+ * left out unless `withDefaults` is set: it works without the variable.
145
+ */
146
+ export function referencedVariables(texts, options = {}) {
147
+ const seen = new Set();
148
+ for (const text of texts) {
149
+ for (const match of text.matchAll(REFERENCE)) {
150
+ const name = match[1] ?? match[3];
151
+ if (name === undefined)
152
+ continue;
153
+ const modifier = match[2] ?? '';
154
+ const hasDefault = /^:?[-+=]/.test(modifier);
155
+ if (hasDefault && options.withDefaults !== true)
156
+ continue;
157
+ seen.add(name);
158
+ }
159
+ }
160
+ return [...seen];
161
+ }
162
+ /**
163
+ * Whether the command text itself gives the variable a value (`NAME=...`,
164
+ * `for NAME in`, `select NAME in`, `read NAME`, `getopts opts NAME`).
165
+ */
166
+ export function assignedWithin(texts, name) {
167
+ const assign = new RegExp(`(?<![A-Za-z0-9_$])${name}=`);
168
+ const loop = new RegExp(`\\b(?:for|select)\\s+${name}\\b`);
169
+ const read = new RegExp(`\\bread\\s+(?:-\\w+\\s+)*(?:[A-Za-z_][A-Za-z0-9_]*\\s+)*${name}\\b`);
170
+ const opts = new RegExp(`\\bgetopts\\s+\\S+\\s+${name}\\b`);
171
+ return texts.some((text) => assign.test(text) || loop.test(text) || read.test(text) || opts.test(text));
172
+ }
173
+ /** Variables a shell sets or keeps for itself; a command that reads one is not missing a value. */
174
+ const SHELL_OWN_VARIABLES = new Set([
175
+ 'BASH',
176
+ 'BASHOPTS',
177
+ 'BASHPID',
178
+ 'BASH_ARGC',
179
+ 'BASH_ARGV',
180
+ 'BASH_COMMAND',
181
+ 'BASH_LINENO',
182
+ 'BASH_REMATCH',
183
+ 'BASH_SOURCE',
184
+ 'BASH_SUBSHELL',
185
+ 'BASH_VERSINFO',
186
+ 'BASH_VERSION',
187
+ 'COLUMNS',
188
+ 'EUID',
189
+ 'FUNCNAME',
190
+ 'GROUPS',
191
+ 'HOSTNAME',
192
+ 'HOSTTYPE',
193
+ 'IFS',
194
+ 'LINENO',
195
+ 'LINES',
196
+ 'MACHTYPE',
197
+ 'OLDPWD',
198
+ 'OPTARG',
199
+ 'OPTERR',
200
+ 'OPTIND',
201
+ 'OSTYPE',
202
+ 'PIPESTATUS',
203
+ 'PPID',
204
+ 'PS1',
205
+ 'PS2',
206
+ 'PS4',
207
+ 'PWD',
208
+ 'RANDOM',
209
+ 'REPLY',
210
+ 'SECONDS',
211
+ 'SHELLOPTS',
212
+ 'SHLVL',
213
+ 'UID',
214
+ ]);
215
+ /** Whether the name is one a shell keeps for itself (`RANDOM`, `PPID`, `PWD`, ...). */
216
+ export function isShellOwnVariable(name) {
217
+ return SHELL_OWN_VARIABLES.has(name);
218
+ }
219
+ /** `$NAME` and `${NAME}` in an `env` value become the value the hook already has; any other text stays as written. */
220
+ export function expandHookEnvValue(value, have) {
221
+ return value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g, (whole, braced, bare) => {
222
+ const found = have[(braced ?? bare)];
223
+ return found === undefined ? whole : found;
224
+ });
225
+ }
226
+ /**
227
+ * Layer the entry's `env` map and the by-shape variables over `base` (the
228
+ * inherited environment with the kernel's own variables). `kernel` holds the
229
+ * variables the kernel always sets; they are applied last and win.
230
+ */
231
+ export function movedEnvironment(entry, base, kernel, folders) {
232
+ const env = { ...base };
233
+ if (entry.env !== null && typeof entry.env === 'object' && !Array.isArray(entry.env)) {
234
+ for (const [name, value] of Object.entries(entry.env)) {
235
+ if (shellHookEnvNameProblem(name) !== undefined || typeof value !== 'string')
236
+ continue;
237
+ env[name] = expandHookEnvValue(value, base);
238
+ }
239
+ }
240
+ Object.assign(env, kernel);
241
+ const texts = [entry.command, ...(entry.args ?? [])];
242
+ const unset = [];
243
+ for (const name of referencedVariables(texts)) {
244
+ if (env[name] !== undefined)
245
+ continue;
246
+ const folder = movedFolderFor(name, folders);
247
+ if (folder !== undefined)
248
+ env[name] = folder;
249
+ else if (!assignedWithin(texts, name) && !isShellOwnVariable(name))
250
+ unset.push(name);
251
+ }
252
+ return { env, unset };
253
+ }
254
+ /**
255
+ * The sentence added to a hook's failure when it could not find what it ran
256
+ * and its command refers to variables that are set nowhere; `undefined` when
257
+ * the failure does not look like a missing program or file, or nothing is unset.
258
+ */
259
+ export function hookUnsetVariableHint(outcome) {
260
+ const unset = outcome.unsetVariables ?? [];
261
+ if (unset.length === 0)
262
+ return undefined;
263
+ const notFound = (outcome.spawnError !== undefined && /ENOENT/.test(outcome.spawnError)) ||
264
+ outcome.exitCode === 127 ||
265
+ /no such file|not found/i.test(outcome.stderr);
266
+ if (!notFound)
267
+ return undefined;
268
+ const shown = unset.slice(0, 3).map((name) => `$${name}`);
269
+ const more = unset.length > 3 ? ` and ${unset.length - 3} more` : '';
270
+ return `its command refers to ${shown.join(', ')}${more}, which ${unset.length === 1 ? 'is' : 'are'} not set for hooks: give ${unset.length === 1 ? 'it' : 'each'} a value with the entry's "env" key`;
271
+ }
272
+ //# sourceMappingURL=shell-hook-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-hook-env.js","sourceRoot":"","sources":["../../src/plugin/shell-hook-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACzD,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,eAAe;IACf,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,0BAA0B;CAC1B,CAAA;AAKD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,oBAAoB,GAG3B;IACL,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE;IAC7C,6EAA6E;IAC7E,6EAA6E;IAC7E,+DAA+D;IAC/D,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE;IAC5C,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE;IAChD,4EAA4E;IAC5E,4EAA4E;IAC5E,2DAA2D;IAC3D,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE;IAC1C,yEAAyE;IACzE,2EAA2E;IAC3E,4EAA4E;IAC5E,yCAAyC;IACzC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE;CAC1C,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC7B,IAAY,EACZ,OAAuD;IAEvD,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7E,IAAI,KAAK,KA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;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;IACzD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;IACpE,OAAO,yBAAyB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,WACtD,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAC7B,4BAA4B,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,qCAAqC,CAAA;AACpG,CAAC"}
@@ -105,16 +105,18 @@
105
105
  * and does not block: one that could not answer in time has not answered no.
106
106
  */
107
107
  import type { PluginId } from '../types/ids/index.js';
108
- import type { PluginCompactionInfo, PluginHookDefinition, PluginHookEvent, PluginHookResult, PluginNotificationInfo, PluginToolBatchCall } from '../types/plugin/index.js';
108
+ import type { PluginCompactionInfo, PluginFileChange, PluginHookDefinition, PluginHookEvent, PluginHookResult, PluginNotificationInfo, PluginToolBatchCall } from '../types/plugin/index.js';
109
109
  import type { Logger } from '../utils/logger.js';
110
110
  import type { PluginLifecycleManager } from './lifecycle.js';
111
+ import type { SessionHookEnv } from './session-hook-env.js';
112
+ import { type PluginFolders } from './shell-hook-env.js';
111
113
  import { type ShellHookToolNames } from './shell-hook-tool-names.js';
112
114
  /**
113
115
  * The events a shell hook may attach to: the ones an operator can act on
114
116
  * from a script. The model-call and iteration events stay in-process —
115
117
  * they carry the messages, and a shell is not where those go.
116
118
  */
117
- export type ShellHookEvent = Extract<PluginHookEvent, 'user_prompt_submit' | 'session_start' | 'session_end' | 'pre_tool_use' | 'post_tool_use' | 'post_tool_use_failure' | 'permission_request' | 'notification' | 'pre_compact' | 'post_compact' | 'subagent_start' | 'subagent_stop' | 'post_tool_batch' | 'permission_denied' | 'turn_failure' | 'turn_start' | 'turn_end'>;
119
+ export type ShellHookEvent = Extract<PluginHookEvent, 'user_prompt_submit' | 'session_start' | 'session_end' | 'pre_tool_use' | 'post_tool_use' | 'post_tool_use_failure' | 'permission_request' | 'notification' | 'pre_compact' | 'post_compact' | 'subagent_start' | 'subagent_stop' | 'post_tool_batch' | 'permission_denied' | 'turn_failure' | 'turn_start' | 'turn_end' | 'file_changed' | 'cwd_changed' | 'worktree_create' | 'worktree_remove'>;
118
120
  export declare const SHELL_HOOK_EVENTS: readonly ShellHookEvent[];
119
121
  /** What a failed hook does to the action it guards. */
120
122
  export type ShellHookOnFailure = 'continue' | 'block';
@@ -184,6 +186,15 @@ export interface ShellHookEntry extends ShellHookEntryBase {
184
186
  * parser. An empty list runs `command` with no arguments.
185
187
  */
186
188
  readonly args?: readonly string[];
189
+ /**
190
+ * Variables the command is started with, in addition to the ones Namzu sets
191
+ * for every hook. A value may use `$NAME` or `${NAME}` of a variable the
192
+ * hook already has (`${NAMZU_PROJECT_DIR}`); text it cannot fill stays as
193
+ * written. A name Namzu sets itself (`NAMZU_HOOK_EVENT` and the rest) cannot
194
+ * be replaced. For a script that reads a variable inside its own file, which
195
+ * no rule reading the command text can see.
196
+ */
197
+ readonly env?: Readonly<Record<string, string>>;
187
198
  /**
188
199
  * Start the command and carry on without waiting. Its exit code and output
189
200
  * decide nothing (a failure is logged), and `onFailure` is not read.
@@ -263,6 +274,26 @@ export declare function shellHookMatches(matcher: string | undefined, toolName:
263
274
  * for every name (see {@link shellHookMatches}).
264
275
  */
265
276
  export declare function shellHookMatcherProblem(matcher: string | undefined): string | undefined;
277
+ /**
278
+ * The files a `file_changed` matcher names: each part of a `|` list that is a
279
+ * path with no `*` in it (`.envrc`, `config/app.json`, `/etc/hosts`). A part
280
+ * with a `*`, a pattern, or no matcher names no file; the hook then runs only
281
+ * for the files hooks hand back with `watchPaths`. A relative path is under
282
+ * the working folder, which the host knows.
283
+ */
284
+ export declare function fileChangedMatcherPaths(matcher: string | undefined): string[];
285
+ /**
286
+ * Whether a `file_changed` hook with this matcher runs for `filePath`. The
287
+ * matcher is read as every matcher is, but against the file's base name: a
288
+ * part written as a path (`config/app.json`) stands for its base name
289
+ * (`app.json`). An unreadable pattern runs the hook.
290
+ */
291
+ export declare function fileChangedMatches(matcher: string | undefined, filePath: string | undefined): boolean;
292
+ /**
293
+ * What a `file_changed` entry's matcher does not do, or `undefined`: a matcher
294
+ * that names no file watches nothing by itself.
295
+ */
296
+ export declare function fileChangedMatcherNote(matcher: string | undefined): string | undefined;
266
297
  /**
267
298
  * Why an `if` cannot be read, or `undefined` when it can. A filter that
268
299
  * cannot be read runs the hook.
@@ -296,6 +327,8 @@ export interface ShellHookOutcome {
296
327
  readonly stdoutTruncated?: boolean;
297
328
  /** Set when the process could not be started at all. */
298
329
  readonly spawnError?: string;
330
+ /** The variables the command refers to that were set nowhere; read when the command was not found. */
331
+ readonly unsetVariables?: readonly string[];
299
332
  }
300
333
  export interface ShellHookInput {
301
334
  readonly event: ShellHookEvent;
@@ -310,6 +343,12 @@ export interface ShellHookInput {
310
343
  readonly endReason?: string;
311
344
  /** The folder the session was started for. Sent as `NAMZU_PROJECT_DIR`; absent, `cwd`. */
312
345
  readonly projectDir?: string;
346
+ /**
347
+ * Set for a hook entry a plugin ships: the plugin's own folder and the folder
348
+ * kept for its data. Sent as `NAMZU_PLUGIN_ROOT` and `NAMZU_PLUGIN_DATA`, and
349
+ * put in the command and arguments where they name them.
350
+ */
351
+ readonly plugin?: PluginFolders;
313
352
  /** The delegating session, on `subagent_start` and `subagent_stop`. */
314
353
  readonly parentSessionId?: string;
315
354
  /** The parent turn whose tool call spawned the child, on `subagent_start` and `subagent_stop`. */
@@ -317,6 +356,26 @@ export interface ShellHookInput {
317
356
  /** The agent the child runs, on `subagent_start` and `subagent_stop`. */
318
357
  readonly agentType?: string;
319
358
  readonly prompt?: string;
359
+ /** On `file_changed`: the file, absolute. Sent as `file_path`. */
360
+ readonly filePath?: string;
361
+ /** On `file_changed`: what happened to it. Sent as `change`. */
362
+ readonly change?: PluginFileChange;
363
+ /** On `cwd_changed`: the folder left and the folder entered. Sent as `old_cwd` and `new_cwd`. */
364
+ readonly oldCwd?: string;
365
+ readonly newCwd?: string;
366
+ /** On `worktree_create`: the suggested name. Sent as `name`. */
367
+ readonly worktreeName?: string;
368
+ /** On `worktree_create`: where a relative path is placed. Sent as `worktree_root`. */
369
+ readonly worktreeRoot?: string;
370
+ /** On `worktree_create`: the commit or branch asked for, when one was. Sent as `base_ref`. */
371
+ readonly worktreeBaseRef?: string;
372
+ /** On `worktree_remove`: the worktree. Sent as `worktree_path`. */
373
+ readonly worktreePath?: string;
374
+ /**
375
+ * The file this hook may append `export NAME=value` lines to. Sent as
376
+ * `NAMZU_ENV_FILE`; on every other event the variable is not set at all.
377
+ */
378
+ readonly envFile?: string;
320
379
  readonly compaction?: PluginCompactionInfo;
321
380
  readonly toolName?: string;
322
381
  /** The spelling `toolName` (and each `toolCalls` name) is sent in; absent is `namzu`. */
@@ -345,6 +404,14 @@ export interface ShellHookInput {
345
404
  readonly transcriptPath?: string;
346
405
  /** How tool calls are being decided right now. Sent as `permission_mode`. */
347
406
  readonly permissionMode?: string;
407
+ /**
408
+ * Variables added to a command's environment, under the ones the kernel sets
409
+ * for every hook (`NAMZU_HOOK_EVENT` and the rest, which these never
410
+ * replace). Not part of the JSON the hook reads.
411
+ */
412
+ readonly extraEnv?: Readonly<Record<string, string>>;
413
+ /** The skill's folder, when the hook came from a skill; see {@link ShellHookOptions.skillRoot}. */
414
+ readonly skillRoot?: string;
348
415
  }
349
416
  /** The JSON a hook receives on stdin (or as an HTTP body). */
350
417
  export declare function shellHookPayload(input: ShellHookInput): string;
@@ -397,6 +464,35 @@ export interface ShellHookOptions {
397
464
  * `NAMZU_PROJECT_DIR`. Absent, `cwd`.
398
465
  */
399
466
  readonly projectDir?: string;
467
+ /**
468
+ * Variables added to the environment of every command this adapter runs,
469
+ * beside the ones the kernel sets for each hook, which they never replace.
470
+ * For a host that attaches a group of hooks with something in common (a
471
+ * skill's folder).
472
+ */
473
+ readonly extraEnv?: Readonly<Record<string, string>>;
474
+ /**
475
+ * Called when a hook of this adapter was selected to run (its matcher and
476
+ * `if` allowed it), before it runs. For a host that decides what happens to
477
+ * a hook once it has run (removing it after a first successful run).
478
+ */
479
+ readonly onRun?: (info: {
480
+ readonly event: ShellHookEvent;
481
+ }) => void;
482
+ /**
483
+ * Set when the entries belong to a plugin: its own folder and the folder kept
484
+ * for its data, given to every command as `NAMZU_PLUGIN_ROOT` and
485
+ * `NAMZU_PLUGIN_DATA` and put in the command and arguments where they name
486
+ * them. The data folder is created when a command first runs.
487
+ */
488
+ readonly plugin?: PluginFolders;
489
+ /**
490
+ * Set when the entries belong to a skill: the skill's own folder. A variable
491
+ * the command refers to without it being set, whose name ends in
492
+ * `_PLUGIN_ROOT` or `_SKILL_ROOT`, is given this folder under the name the
493
+ * command used (a skill moved as written names its folder that way).
494
+ */
495
+ readonly skillRoot?: string;
400
496
  /** How a path pattern in an entry's `if` is read. Absent, such a filter runs the hook. */
401
497
  readonly pathFilter?: ShellHookPathFilter;
402
498
  /**
@@ -407,6 +503,13 @@ export interface ShellHookOptions {
407
503
  readonly defaultTimeoutMs?: {
408
504
  readonly [event in ShellHookEvent]?: number;
409
505
  };
506
+ /**
507
+ * Where the variables a hook sets for later commands are kept. With it, a
508
+ * command hook on `session_start`, `cwd_changed` or `file_changed` is
509
+ * started with `NAMZU_ENV_FILE`, and the file is read when the hook ends.
510
+ * Without it no hook gets the variable and nothing is carried.
511
+ */
512
+ readonly hookEnv?: SessionHookEnv;
410
513
  /**
411
514
  * Called when a hook of this adapter ran out its deadline and was ended.
412
515
  * `hook` is the command, URL or prompt text the entry names.
@@ -1 +1 @@
1
- {"version":3,"file":"shell-hook.d.ts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