@namzu/sdk 69.2.0 → 69.3.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 (118) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/constants/plugin/index.d.ts +8 -0
  3. package/dist/constants/plugin/index.d.ts.map +1 -1
  4. package/dist/constants/plugin/index.js +8 -0
  5. package/dist/constants/plugin/index.js.map +1 -1
  6. package/dist/plugin/common-layout/index.d.ts +5 -0
  7. package/dist/plugin/common-layout/index.d.ts.map +1 -0
  8. package/dist/plugin/common-layout/index.js +3 -0
  9. package/dist/plugin/common-layout/index.js.map +1 -0
  10. package/dist/plugin/common-layout/mcp.d.ts +21 -0
  11. package/dist/plugin/common-layout/mcp.d.ts.map +1 -0
  12. package/dist/plugin/common-layout/mcp.js +305 -0
  13. package/dist/plugin/common-layout/mcp.js.map +1 -0
  14. package/dist/plugin/common-layout/paths.d.ts +27 -0
  15. package/dist/plugin/common-layout/paths.d.ts.map +1 -0
  16. package/dist/plugin/common-layout/paths.js +48 -0
  17. package/dist/plugin/common-layout/paths.js.map +1 -0
  18. package/dist/plugin/common-layout/read.d.ts +25 -0
  19. package/dist/plugin/common-layout/read.d.ts.map +1 -0
  20. package/dist/plugin/common-layout/read.js +1155 -0
  21. package/dist/plugin/common-layout/read.js.map +1 -0
  22. package/dist/plugin/common-layout/types.d.ts +66 -0
  23. package/dist/plugin/common-layout/types.d.ts.map +1 -0
  24. package/dist/plugin/common-layout/types.js +2 -0
  25. package/dist/plugin/common-layout/types.js.map +1 -0
  26. package/dist/plugin/common-layout-names.d.ts +65 -0
  27. package/dist/plugin/common-layout-names.d.ts.map +1 -0
  28. package/dist/plugin/common-layout-names.js +94 -0
  29. package/dist/plugin/common-layout-names.js.map +1 -0
  30. package/dist/plugin/hook-module/capabilities.d.ts +41 -0
  31. package/dist/plugin/hook-module/capabilities.d.ts.map +1 -0
  32. package/dist/plugin/hook-module/capabilities.js +438 -0
  33. package/dist/plugin/hook-module/capabilities.js.map +1 -0
  34. package/dist/plugin/hook-module/consent.d.ts +39 -0
  35. package/dist/plugin/hook-module/consent.d.ts.map +1 -0
  36. package/dist/plugin/hook-module/consent.js +59 -0
  37. package/dist/plugin/hook-module/consent.js.map +1 -0
  38. package/dist/plugin/hook-module/events.d.ts +33 -0
  39. package/dist/plugin/hook-module/events.d.ts.map +1 -0
  40. package/dist/plugin/hook-module/events.js +149 -0
  41. package/dist/plugin/hook-module/events.js.map +1 -0
  42. package/dist/plugin/hook-module/host.d.ts +79 -0
  43. package/dist/plugin/hook-module/host.d.ts.map +1 -0
  44. package/dist/plugin/hook-module/host.js +546 -0
  45. package/dist/plugin/hook-module/host.js.map +1 -0
  46. package/dist/plugin/hook-module/index.d.ts +11 -0
  47. package/dist/plugin/hook-module/index.d.ts.map +1 -0
  48. package/dist/plugin/hook-module/index.js +6 -0
  49. package/dist/plugin/hook-module/index.js.map +1 -0
  50. package/dist/plugin/hook-module/scan.d.ts +99 -0
  51. package/dist/plugin/hook-module/scan.d.ts.map +1 -0
  52. package/dist/plugin/hook-module/scan.js +789 -0
  53. package/dist/plugin/hook-module/scan.js.map +1 -0
  54. package/dist/plugin/hook-module/worker-source.d.ts +31 -0
  55. package/dist/plugin/hook-module/worker-source.d.ts.map +1 -0
  56. package/dist/plugin/hook-module/worker-source.js +498 -0
  57. package/dist/plugin/hook-module/worker-source.js.map +1 -0
  58. package/dist/plugin/index.d.ts +5 -2
  59. package/dist/plugin/index.d.ts.map +1 -1
  60. package/dist/plugin/index.js +4 -1
  61. package/dist/plugin/index.js.map +1 -1
  62. package/dist/plugin/lifecycle.d.ts +57 -0
  63. package/dist/plugin/lifecycle.d.ts.map +1 -1
  64. package/dist/plugin/lifecycle.js +92 -11
  65. package/dist/plugin/lifecycle.js.map +1 -1
  66. package/dist/plugin/loader.d.ts +30 -0
  67. package/dist/plugin/loader.d.ts.map +1 -1
  68. package/dist/plugin/loader.js +76 -19
  69. package/dist/plugin/loader.js.map +1 -1
  70. package/dist/plugin/shell-hook-env.d.ts +7 -0
  71. package/dist/plugin/shell-hook-env.d.ts.map +1 -1
  72. package/dist/plugin/shell-hook-env.js.map +1 -1
  73. package/dist/plugin/shell-hook.d.ts +10 -1
  74. package/dist/plugin/shell-hook.d.ts.map +1 -1
  75. package/dist/plugin/shell-hook.js +81 -70
  76. package/dist/plugin/shell-hook.js.map +1 -1
  77. package/dist/public-runtime.d.ts +3 -2
  78. package/dist/public-runtime.d.ts.map +1 -1
  79. package/dist/public-runtime.js +2 -2
  80. package/dist/public-runtime.js.map +1 -1
  81. package/dist/skills/loader.d.ts +8 -2
  82. package/dist/skills/loader.d.ts.map +1 -1
  83. package/dist/skills/loader.js +22 -11
  84. package/dist/skills/loader.js.map +1 -1
  85. package/dist/skills/registry.d.ts.map +1 -1
  86. package/dist/skills/registry.js +9 -1
  87. package/dist/skills/registry.js.map +1 -1
  88. package/dist/types/plugin/index.d.ts +73 -0
  89. package/dist/types/plugin/index.d.ts.map +1 -1
  90. package/dist/types/plugin/index.js +28 -6
  91. package/dist/types/plugin/index.js.map +1 -1
  92. package/dist/types/skills/index.d.ts +6 -0
  93. package/dist/types/skills/index.d.ts.map +1 -1
  94. package/package.json +2 -1
  95. package/src/constants/plugin/index.ts +9 -0
  96. package/src/plugin/common-layout/index.ts +19 -0
  97. package/src/plugin/common-layout/mcp.ts +362 -0
  98. package/src/plugin/common-layout/paths.ts +70 -0
  99. package/src/plugin/common-layout/read.ts +1282 -0
  100. package/src/plugin/common-layout/types.ts +77 -0
  101. package/src/plugin/common-layout-names.ts +108 -0
  102. package/src/plugin/hook-module/capabilities.ts +500 -0
  103. package/src/plugin/hook-module/consent.ts +96 -0
  104. package/src/plugin/hook-module/events.ts +177 -0
  105. package/src/plugin/hook-module/host.ts +649 -0
  106. package/src/plugin/hook-module/index.ts +52 -0
  107. package/src/plugin/hook-module/scan.ts +1004 -0
  108. package/src/plugin/hook-module/worker-source.ts +500 -0
  109. package/src/plugin/index.ts +13 -1
  110. package/src/plugin/lifecycle.ts +179 -17
  111. package/src/plugin/loader.ts +97 -18
  112. package/src/plugin/shell-hook-env.ts +7 -0
  113. package/src/plugin/shell-hook.ts +91 -70
  114. package/src/public-runtime.ts +35 -0
  115. package/src/skills/loader.ts +26 -9
  116. package/src/skills/registry.ts +9 -1
  117. package/src/types/plugin/index.ts +81 -24
  118. package/src/types/skills/index.ts +7 -0
@@ -0,0 +1,99 @@
1
+ import type { ShellHookEvent } from '../shell-hook.js';
2
+ /** The most one scanned file, and the hooks file, may hold. */
3
+ export declare const MAX_MODULE_FILE_BYTES: number;
4
+ /** The most all the files of one module may hold together. */
5
+ export declare const MAX_MODULE_TOTAL_BYTES: number;
6
+ /** The most files one module may be made of. */
7
+ export declare const MAX_MODULE_FILES = 64;
8
+ /** The calls on `$` Namzu answers, by noun. Every other call throws where it is made. */
9
+ export declare const SUPPORTED_CAPABILITY_CALLS: Readonly<Record<string, readonly string[]>>;
10
+ /** The properties of `$.plugin` a module may read. */
11
+ export declare const PLUGIN_PROPERTIES: readonly string[];
12
+ export interface ScanRefusal {
13
+ /** The file, relative to the plugin. */
14
+ readonly file: string;
15
+ readonly line: number;
16
+ readonly message: string;
17
+ }
18
+ export interface ScannedHook {
19
+ readonly pattern: string;
20
+ readonly file: string;
21
+ readonly line: number;
22
+ /** Registered with a matcher. */
23
+ readonly matcher: boolean;
24
+ /** Given a `.catch`. */
25
+ readonly catches: boolean;
26
+ /** The Namzu events it runs on; empty when none of what it names exists here. */
27
+ readonly runs: readonly ShellHookEvent[];
28
+ /** Why the pattern runs nowhere, when it does not. */
29
+ readonly notUsed?: string;
30
+ }
31
+ export interface ScannedCall {
32
+ /** `$.fs.read`. */
33
+ readonly call: string;
34
+ readonly file: string;
35
+ readonly line: number;
36
+ /** False when Namzu has no such call; calling it throws. */
37
+ readonly supported: boolean;
38
+ /** The call sits only in hooks Namzu does not run, so it is never made. */
39
+ readonly neverRuns?: boolean;
40
+ }
41
+ /** What the worker runs: every file of the module, rewritten to run as a script. */
42
+ export interface HookModuleProgram {
43
+ /** The entry, relative to the plugin. */
44
+ readonly entry: string;
45
+ /** Plugin-relative path to rewritten source. */
46
+ readonly files: Readonly<Record<string, string>>;
47
+ }
48
+ export interface HookModuleScan {
49
+ /** The entry, relative to the plugin. */
50
+ readonly entry: string;
51
+ /** Every file the module is made of, relative to the plugin. */
52
+ readonly files: readonly string[];
53
+ readonly hooks: readonly ScannedHook[];
54
+ readonly calls: readonly ScannedCall[];
55
+ /** The variables the module reads, by literal name. */
56
+ readonly envNames: readonly string[];
57
+ readonly refusals: readonly ScanRefusal[];
58
+ /** Present when nothing was refused. */
59
+ readonly program?: HookModuleProgram;
60
+ }
61
+ export type PluginFileRead = {
62
+ readonly text: string;
63
+ readonly real: string;
64
+ } | {
65
+ readonly problem: string;
66
+ };
67
+ /**
68
+ * A plugin's file as text: a regular file inside the plugin, not a link, no
69
+ * larger than `cap`. A problem says why it was not read.
70
+ */
71
+ export declare function readPluginFile(root: string, rel: string, cap?: number): PluginFileRead;
72
+ export type HookModuleLocation = {
73
+ readonly kind: 'none';
74
+ } | {
75
+ readonly kind: 'found';
76
+ /** The hooks file that names it, relative to the plugin. */
77
+ readonly hooksFile: string;
78
+ /** As the hooks file spells it. */
79
+ readonly specifier: string;
80
+ /** Relative to the plugin, with `/`. */
81
+ readonly entry: string;
82
+ } | {
83
+ readonly kind: 'refused';
84
+ readonly hooksFile: string;
85
+ readonly message: string;
86
+ };
87
+ /**
88
+ * Read the hooks file of the common layout for the module it names: `modules`
89
+ * holds one path, relative to the folder the hooks file is in. The file is read
90
+ * as the hook entries are: no link, valid JSON, one mebibyte at most.
91
+ */
92
+ export declare function locateHookModule(root: string): HookModuleLocation;
93
+ /**
94
+ * Read a plugin's hooks module before anything runs it: the files it is made
95
+ * of, what it hooks, what it calls on `$`, and whatever the module is refused
96
+ * for. Nothing here runs the module.
97
+ */
98
+ export declare function scanHookModule(root: string, entry: string): HookModuleScan;
99
+ //# sour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