@namzu/sdk 69.3.0 → 70.0.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 (131) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/authorization/protected-paths.d.ts +24 -6
  3. package/dist/authorization/protected-paths.d.ts.map +1 -1
  4. package/dist/authorization/protected-paths.js +37 -9
  5. package/dist/authorization/protected-paths.js.map +1 -1
  6. package/dist/authorization/readonly-commands.d.ts.map +1 -1
  7. package/dist/authorization/readonly-commands.js +30 -2
  8. package/dist/authorization/readonly-commands.js.map +1 -1
  9. package/dist/authorization/shell-lexer.d.ts.map +1 -1
  10. package/dist/authorization/shell-lexer.js +263 -0
  11. package/dist/authorization/shell-lexer.js.map +1 -1
  12. package/dist/connector/web/guarded-fetch.d.ts +30 -0
  13. package/dist/connector/web/guarded-fetch.d.ts.map +1 -1
  14. package/dist/connector/web/guarded-fetch.js +85 -0
  15. package/dist/connector/web/guarded-fetch.js.map +1 -1
  16. package/dist/connector/web/index.d.ts +1 -1
  17. package/dist/connector/web/index.d.ts.map +1 -1
  18. package/dist/connector/web/index.js +1 -1
  19. package/dist/connector/web/index.js.map +1 -1
  20. package/dist/plugin/common-layout/read.js +2 -2
  21. package/dist/plugin/common-layout/read.js.map +1 -1
  22. package/dist/plugin/hook-module/capabilities.d.ts +12 -0
  23. package/dist/plugin/hook-module/capabilities.d.ts.map +1 -1
  24. package/dist/plugin/hook-module/capabilities.js +82 -10
  25. package/dist/plugin/hook-module/capabilities.js.map +1 -1
  26. package/dist/plugin/hook-module/consent.d.ts +11 -0
  27. package/dist/plugin/hook-module/consent.d.ts.map +1 -1
  28. package/dist/plugin/hook-module/consent.js +31 -0
  29. package/dist/plugin/hook-module/consent.js.map +1 -1
  30. package/dist/plugin/hook-module/host.d.ts.map +1 -1
  31. package/dist/plugin/hook-module/host.js +69 -23
  32. package/dist/plugin/hook-module/host.js.map +1 -1
  33. package/dist/plugin/hook-module/index.d.ts +1 -1
  34. package/dist/plugin/hook-module/index.d.ts.map +1 -1
  35. package/dist/plugin/hook-module/index.js +1 -1
  36. package/dist/plugin/hook-module/index.js.map +1 -1
  37. package/dist/plugin/hook-module/scan.js +1 -1
  38. package/dist/plugin/hook-module/scan.js.map +1 -1
  39. package/dist/plugin/hook-module/worker-source.d.ts +5 -4
  40. package/dist/plugin/hook-module/worker-source.d.ts.map +1 -1
  41. package/dist/plugin/hook-module/worker-source.js +198 -28
  42. package/dist/plugin/hook-module/worker-source.js.map +1 -1
  43. package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
  44. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  45. package/dist/prompt/coding-agent-doctrine.js +1 -1
  46. package/dist/provider/side-request-reasoning.d.ts.map +1 -1
  47. package/dist/provider/side-request-reasoning.js +5 -1
  48. package/dist/provider/side-request-reasoning.js.map +1 -1
  49. package/dist/public-runtime.d.ts +3 -3
  50. package/dist/public-runtime.d.ts.map +1 -1
  51. package/dist/public-runtime.js +3 -3
  52. package/dist/public-runtime.js.map +1 -1
  53. package/dist/public-tools.d.ts +1 -1
  54. package/dist/public-tools.d.ts.map +1 -1
  55. package/dist/public-tools.js +1 -1
  56. package/dist/public-tools.js.map +1 -1
  57. package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
  58. package/dist/runtime/query/auto-review/classifier.js +13 -2
  59. package/dist/runtime/query/auto-review/classifier.js.map +1 -1
  60. package/dist/runtime/query/auto-review/failure.d.ts +12 -5
  61. package/dist/runtime/query/auto-review/failure.d.ts.map +1 -1
  62. package/dist/runtime/query/auto-review/failure.js +42 -7
  63. package/dist/runtime/query/auto-review/failure.js.map +1 -1
  64. package/dist/runtime/query/executor.d.ts.map +1 -1
  65. package/dist/runtime/query/executor.js +75 -10
  66. package/dist/runtime/query/executor.js.map +1 -1
  67. package/dist/runtime/query/review-policy.d.ts +21 -3
  68. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  69. package/dist/runtime/query/review-policy.js +57 -25
  70. package/dist/runtime/query/review-policy.js.map +1 -1
  71. package/dist/runtime/query/turn/check-scope.d.ts +18 -0
  72. package/dist/runtime/query/turn/check-scope.d.ts.map +1 -0
  73. package/dist/runtime/query/turn/check-scope.js +90 -0
  74. package/dist/runtime/query/turn/check-scope.js.map +1 -0
  75. package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
  76. package/dist/runtime/query/turn/outcome-ledger.js +13 -0
  77. package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
  78. package/dist/skills/inline-shell-host.d.ts +6 -0
  79. package/dist/skills/inline-shell-host.d.ts.map +1 -1
  80. package/dist/skills/inline-shell-host.js +8 -0
  81. package/dist/skills/inline-shell-host.js.map +1 -1
  82. package/dist/skills/inline-shell.d.ts +9 -1
  83. package/dist/skills/inline-shell.d.ts.map +1 -1
  84. package/dist/skills/inline-shell.js +78 -10
  85. package/dist/skills/inline-shell.js.map +1 -1
  86. package/dist/tools/builtins/job.d.ts.map +1 -1
  87. package/dist/tools/builtins/job.js +4 -1
  88. package/dist/tools/builtins/job.js.map +1 -1
  89. package/dist/tools/builtins/skill.d.ts.map +1 -1
  90. package/dist/tools/builtins/skill.js +2 -0
  91. package/dist/tools/builtins/skill.js.map +1 -1
  92. package/dist/tools/builtins/wait-for-job.d.ts.map +1 -1
  93. package/dist/tools/builtins/wait-for-job.js +2 -1
  94. package/dist/tools/builtins/wait-for-job.js.map +1 -1
  95. package/dist/types/permission/index.d.ts +11 -2
  96. package/dist/types/permission/index.d.ts.map +1 -1
  97. package/dist/types/permission/index.js +12 -2
  98. package/dist/types/permission/index.js.map +1 -1
  99. package/dist/types/tool/index.d.ts +7 -0
  100. package/dist/types/tool/index.d.ts.map +1 -1
  101. package/dist/types/tool/index.js.map +1 -1
  102. package/package.json +1 -1
  103. package/src/authorization/protected-paths.ts +44 -9
  104. package/src/authorization/readonly-commands.ts +30 -2
  105. package/src/authorization/shell-lexer.ts +242 -0
  106. package/src/connector/web/guarded-fetch.ts +92 -0
  107. package/src/connector/web/index.ts +6 -1
  108. package/src/plugin/common-layout/read.ts +2 -2
  109. package/src/plugin/hook-module/capabilities.ts +94 -10
  110. package/src/plugin/hook-module/consent.ts +36 -0
  111. package/src/plugin/hook-module/host.ts +72 -21
  112. package/src/plugin/hook-module/index.ts +2 -0
  113. package/src/plugin/hook-module/scan.ts +2 -2
  114. package/src/plugin/hook-module/worker-source.ts +199 -28
  115. package/src/prompt/coding-agent-doctrine.ts +1 -1
  116. package/src/provider/side-request-reasoning.ts +5 -1
  117. package/src/public-runtime.ts +6 -0
  118. package/src/public-tools.ts +4 -1
  119. package/src/runtime/query/auto-review/classifier.ts +14 -2
  120. package/src/runtime/query/auto-review/failure.ts +52 -7
  121. package/src/runtime/query/executor.ts +74 -7
  122. package/src/runtime/query/review-policy.ts +72 -19
  123. package/src/runtime/query/turn/check-scope.ts +90 -0
  124. package/src/runtime/query/turn/outcome-ledger.ts +11 -0
  125. package/src/skills/inline-shell-host.ts +16 -0
  126. package/src/skills/inline-shell.ts +90 -8
  127. package/src/tools/builtins/job.ts +4 -1
  128. package/src/tools/builtins/skill.ts +2 -0
  129. package/src/tools/builtins/wait-for-job.ts +3 -1
  130. package/src/types/permission/index.ts +20 -3
  131. package/src/types/tool/index.ts +7 -0
@@ -432,6 +432,8 @@ export function createSkillTool(options: SkillToolOptions = {}) {
432
432
  host: createToolSkillShellHost({
433
433
  context: input.context,
434
434
  ...(allow ? { allow } : {}),
435
+ // Only a model loaded this, so only a model can run a command in its own call.
436
+ ...(input.invokedBy === 'model' ? { handOff: true } : {}),
435
437
  }),
436
438
  commandName: input.name,
437
439
  ...(block !== undefined ? { block } : {}),
@@ -119,7 +119,9 @@ export const WaitForJobTool = defineTool({
119
119
  return {
120
120
  kind: 'generic',
121
121
  presentation: 'activity',
122
- label: `${input.output_contains === undefined ? 'Wait for background job' : 'Wait for job output'} · ${input.id ?? '(missing id)'}`,
122
+ // No id in the row: it is the model's handle on the job, not something the person reads.
123
+ label:
124
+ input.output_contains === undefined ? 'Wait for background job' : 'Wait for job output',
123
125
  }
124
126
  },
125
127
 
@@ -42,13 +42,30 @@ export const PLAN_MODE_REFUSAL_WITH_PLAN_FILE =
42
42
  * - `strict` runs only calls a rule allowed (or that only read). A skill's
43
43
  * grant is not a rule, so it never lifts this.
44
44
  *
45
- * Every other mode answers a call that no rule decided by asking a person or a
46
- * classifier, which a load cannot do; that stays the caller's refusal.
45
+ * - `classify` (auto) sends every call but a read, or one a narrow rule allows, to
46
+ * the classifier. A nested call has no classifier to go to, so it is refused,
47
+ * as the direct call would not have run unreviewed. A rule that covers a whole
48
+ * shell tool or a program that runs whatever it is given is too wide to stand
49
+ * in for the reviewer (`ruleTooWide`), as it is for a direct call.
50
+ *
51
+ * Every other mode answers a call that no rule decided by asking a person,
52
+ * which a load cannot do; that stays the caller's refusal.
47
53
  */
54
+ export const CLASSIFY_NESTED_REFUSAL =
55
+ 'auto mode reviews only the commands you run yourself, so it does not run this one from inside a skill; run it as a direct call so it can be reviewed'
56
+
48
57
  export function nestedCallModeRefusal(
49
58
  mode: string | undefined,
50
- call: { readonly readOnly: boolean; readonly allowedByRule: boolean },
59
+ call: {
60
+ readonly readOnly: boolean
61
+ readonly allowedByRule: boolean
62
+ /** The rule that allowed it covers a whole tool, or a line that launches code. */
63
+ readonly ruleTooWide?: boolean
64
+ },
51
65
  ): string | undefined {
66
+ if (mode === 'classify' && !call.readOnly && !(call.allowedByRule && call.ruleTooWide !== true)) {
67
+ return CLASSIFY_NESTED_REFUSAL
68
+ }
52
69
  if (mode === 'plan' && !call.readOnly) {
53
70
  return 'plan mode only runs commands that read, and this one can change something'
54
71
  }
@@ -637,6 +637,13 @@ export interface ToolDispatchOptions {
637
637
  * floor stopped, and never covers a call the tool declares needs approval.
638
638
  */
639
639
  readonly allow?: (call: { readonly name: string; readonly input: unknown }) => boolean
640
+ /**
641
+ * For a tool that is loading text for a model: a call that the turn's auto mode
642
+ * would send to its reviewer (and that no rule denies) is not run and not treated
643
+ * as a failure. It comes back unsuccessful with `data.handedOff === true`, so the
644
+ * caller can ask the model to make the call itself, where the reviewer sees it.
645
+ */
646
+ readonly handOff?: boolean
640
647
  /**
641
648
  * Asked after the call is allowed and before it starts. Returns `undefined`
642
649
  * to let it run, or the reason it is not to run, which comes back as the