@allin-ai/agent-client 0.1.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 (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +53 -0
  3. package/bin/allinai-agent +4 -0
  4. package/dist/capabilities/context.d.ts +16 -0
  5. package/dist/capabilities/context.d.ts.map +1 -0
  6. package/dist/capabilities/context.js +98 -0
  7. package/dist/capabilities/context.js.map +1 -0
  8. package/dist/capabilities/input.d.ts +7 -0
  9. package/dist/capabilities/input.d.ts.map +1 -0
  10. package/dist/capabilities/input.js +224 -0
  11. package/dist/capabilities/input.js.map +1 -0
  12. package/dist/capabilities/manifest.d.ts +15 -0
  13. package/dist/capabilities/manifest.d.ts.map +1 -0
  14. package/dist/capabilities/manifest.js +292 -0
  15. package/dist/capabilities/manifest.js.map +1 -0
  16. package/dist/capabilities/policy.d.ts +17 -0
  17. package/dist/capabilities/policy.d.ts.map +1 -0
  18. package/dist/capabilities/policy.js +57 -0
  19. package/dist/capabilities/policy.js.map +1 -0
  20. package/dist/capabilities/shell-host.d.ts +32 -0
  21. package/dist/capabilities/shell-host.d.ts.map +1 -0
  22. package/dist/capabilities/shell-host.js +378 -0
  23. package/dist/capabilities/shell-host.js.map +1 -0
  24. package/dist/capabilities/shell-wire.d.ts +13 -0
  25. package/dist/capabilities/shell-wire.d.ts.map +1 -0
  26. package/dist/capabilities/shell-wire.js +60 -0
  27. package/dist/capabilities/shell-wire.js.map +1 -0
  28. package/dist/capabilities/types.d.ts +46 -0
  29. package/dist/capabilities/types.d.ts.map +1 -0
  30. package/dist/capabilities/types.js +7 -0
  31. package/dist/capabilities/types.js.map +1 -0
  32. package/dist/cli/commands.d.ts +83 -0
  33. package/dist/cli/commands.d.ts.map +1 -0
  34. package/dist/cli/commands.js +638 -0
  35. package/dist/cli/commands.js.map +1 -0
  36. package/dist/cli/main.d.ts +2 -0
  37. package/dist/cli/main.d.ts.map +1 -0
  38. package/dist/cli/main.js +7 -0
  39. package/dist/cli/main.js.map +1 -0
  40. package/dist/client/state-store.d.ts +80 -0
  41. package/dist/client/state-store.d.ts.map +1 -0
  42. package/dist/client/state-store.js +422 -0
  43. package/dist/client/state-store.js.map +1 -0
  44. package/dist/client/supervisor.d.ts +118 -0
  45. package/dist/client/supervisor.d.ts.map +1 -0
  46. package/dist/client/supervisor.js +627 -0
  47. package/dist/client/supervisor.js.map +1 -0
  48. package/dist/client/transport.d.ts +30 -0
  49. package/dist/client/transport.d.ts.map +1 -0
  50. package/dist/client/transport.js +2 -0
  51. package/dist/client/transport.js.map +1 -0
  52. package/dist/client/types.d.ts +65 -0
  53. package/dist/client/types.d.ts.map +1 -0
  54. package/dist/client/types.js +13 -0
  55. package/dist/client/types.js.map +1 -0
  56. package/dist/client/wire.d.ts +32 -0
  57. package/dist/client/wire.d.ts.map +1 -0
  58. package/dist/client/wire.js +302 -0
  59. package/dist/client/wire.js.map +1 -0
  60. package/dist/client/ws-transport.d.ts +54 -0
  61. package/dist/client/ws-transport.d.ts.map +1 -0
  62. package/dist/client/ws-transport.js +229 -0
  63. package/dist/client/ws-transport.js.map +1 -0
  64. package/dist/config.d.ts +38 -0
  65. package/dist/config.d.ts.map +1 -0
  66. package/dist/config.js +125 -0
  67. package/dist/config.js.map +1 -0
  68. package/dist/control.d.ts +59 -0
  69. package/dist/control.d.ts.map +1 -0
  70. package/dist/control.js +217 -0
  71. package/dist/control.js.map +1 -0
  72. package/dist/credentials.d.ts +44 -0
  73. package/dist/credentials.d.ts.map +1 -0
  74. package/dist/credentials.js +229 -0
  75. package/dist/credentials.js.map +1 -0
  76. package/dist/hub.d.ts +83 -0
  77. package/dist/hub.d.ts.map +1 -0
  78. package/dist/hub.js +412 -0
  79. package/dist/hub.js.map +1 -0
  80. package/dist/index.d.ts +20 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +18 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/logger.d.ts +47 -0
  85. package/dist/logger.d.ts.map +1 -0
  86. package/dist/logger.js +175 -0
  87. package/dist/logger.js.map +1 -0
  88. package/dist/paths.d.ts +29 -0
  89. package/dist/paths.d.ts.map +1 -0
  90. package/dist/paths.js +50 -0
  91. package/dist/paths.js.map +1 -0
  92. package/dist/plugins/git.d.ts +30 -0
  93. package/dist/plugins/git.d.ts.map +1 -0
  94. package/dist/plugins/git.js +80 -0
  95. package/dist/plugins/git.js.map +1 -0
  96. package/dist/plugins/manager.d.ts +41 -0
  97. package/dist/plugins/manager.d.ts.map +1 -0
  98. package/dist/plugins/manager.js +328 -0
  99. package/dist/plugins/manager.js.map +1 -0
  100. package/dist/plugins/manifest.d.ts +9 -0
  101. package/dist/plugins/manifest.d.ts.map +1 -0
  102. package/dist/plugins/manifest.js +63 -0
  103. package/dist/plugins/manifest.js.map +1 -0
  104. package/dist/plugins/types.d.ts +39 -0
  105. package/dist/plugins/types.d.ts.map +1 -0
  106. package/dist/plugins/types.js +2 -0
  107. package/dist/plugins/types.js.map +1 -0
  108. package/dist/runtime/claude.d.ts +30 -0
  109. package/dist/runtime/claude.d.ts.map +1 -0
  110. package/dist/runtime/claude.js +163 -0
  111. package/dist/runtime/claude.js.map +1 -0
  112. package/dist/runtime/codex.d.ts +44 -0
  113. package/dist/runtime/codex.d.ts.map +1 -0
  114. package/dist/runtime/codex.js +192 -0
  115. package/dist/runtime/codex.js.map +1 -0
  116. package/dist/runtime/events.d.ts +7 -0
  117. package/dist/runtime/events.d.ts.map +1 -0
  118. package/dist/runtime/events.js +37 -0
  119. package/dist/runtime/events.js.map +1 -0
  120. package/dist/runtime/index.d.ts +10 -0
  121. package/dist/runtime/index.d.ts.map +1 -0
  122. package/dist/runtime/index.js +10 -0
  123. package/dist/runtime/index.js.map +1 -0
  124. package/dist/runtime/pi.d.ts +34 -0
  125. package/dist/runtime/pi.d.ts.map +1 -0
  126. package/dist/runtime/pi.js +211 -0
  127. package/dist/runtime/pi.js.map +1 -0
  128. package/dist/runtime/registry.d.ts +16 -0
  129. package/dist/runtime/registry.d.ts.map +1 -0
  130. package/dist/runtime/registry.js +22 -0
  131. package/dist/runtime/registry.js.map +1 -0
  132. package/dist/runtime/runner-child.d.ts +2 -0
  133. package/dist/runtime/runner-child.d.ts.map +1 -0
  134. package/dist/runtime/runner-child.js +41 -0
  135. package/dist/runtime/runner-child.js.map +1 -0
  136. package/dist/runtime/runner-manager.d.ts +77 -0
  137. package/dist/runtime/runner-manager.d.ts.map +1 -0
  138. package/dist/runtime/runner-manager.js +295 -0
  139. package/dist/runtime/runner-manager.js.map +1 -0
  140. package/dist/runtime/runner-wire.d.ts +23 -0
  141. package/dist/runtime/runner-wire.d.ts.map +1 -0
  142. package/dist/runtime/runner-wire.js +93 -0
  143. package/dist/runtime/runner-wire.js.map +1 -0
  144. package/dist/runtime/types.d.ts +43 -0
  145. package/dist/runtime/types.d.ts.map +1 -0
  146. package/dist/runtime/types.js +3 -0
  147. package/dist/runtime/types.js.map +1 -0
  148. package/dist/runtime/zcode.d.ts +14 -0
  149. package/dist/runtime/zcode.d.ts.map +1 -0
  150. package/dist/runtime/zcode.js +21 -0
  151. package/dist/runtime/zcode.js.map +1 -0
  152. package/dist/service/launchd.d.ts +34 -0
  153. package/dist/service/launchd.d.ts.map +1 -0
  154. package/dist/service/launchd.js +86 -0
  155. package/dist/service/launchd.js.map +1 -0
  156. package/dist/service/systemd.d.ts +16 -0
  157. package/dist/service/systemd.d.ts.map +1 -0
  158. package/dist/service/systemd.js +89 -0
  159. package/dist/service/systemd.js.map +1 -0
  160. package/dist/wire.d.ts +24 -0
  161. package/dist/wire.d.ts.map +1 -0
  162. package/dist/wire.js +7 -0
  163. package/dist/wire.js.map +1 -0
  164. package/package.json +140 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 df007df
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @allin-ai/agent-client
2
+
3
+ `allinai-agent` is the persistent local client for AllInAI. It keeps its
4
+ configuration, credentials, plugins, run state, control socket, and logs under
5
+ `~/.allinai/agent` by default.
6
+
7
+ It connects to a Hub over the Agent Client protocol, accepts typed platform
8
+ commands, starts one isolated runner per execution, reports ordered events, and
9
+ manages locally installed Git plugins. It has no second local executor, claim
10
+ loop, or Hub-provided shell execution path.
11
+
12
+ ## Install and operate
13
+
14
+ ```bash
15
+ pnpm --filter @allin-ai/agent-client build
16
+ pnpm --filter @allin-ai/agent-client exec allinai-agent init
17
+ pnpm --filter @allin-ai/agent-client exec allinai-agent daemon
18
+ pnpm --filter @allin-ai/agent-client exec allinai-agent status
19
+ ```
20
+
21
+ Use `--config-dir <absolute path>` to put all client-owned state below a
22
+ different root. The Desktop application uses this option for its per-user Agent
23
+ Client home and supervises `allinai-agent daemon` through the local control
24
+ endpoint.
25
+
26
+ ## Protocol surface
27
+
28
+ The public package exports the local configuration/control helpers, the Hub
29
+ test implementation, Client transport/supervisor types, runtime adapters, and
30
+ Git-plugin manager:
31
+
32
+ ```ts
33
+ import {
34
+ createMemoryHub,
35
+ createWsClientTransport,
36
+ createClientSupervisor,
37
+ createPlatformRegistry,
38
+ createPluginManager,
39
+ } from "@allin-ai/agent-client";
40
+ ```
41
+
42
+ `createMemoryHub` is an in-process protocol implementation for integration
43
+ tests and embedding. Production clients use their configured Hub URL and
44
+ credential store; credentials never need to be injected into a second local
45
+ executor.
46
+
47
+ ## Packaging
48
+
49
+ The root build runs `scripts/build-agent-client.mjs`. It cleans the Client
50
+ `dist/`, deploys production dependencies to `out/agent-client/`, and creates
51
+ the executable expected by Desktop at `out/agent-client/allinai-agent`.
52
+ Electron Builder copies that directory to the packaged resource path
53
+ `resources/agent-client/allinai-agent`.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { main } from "../dist/cli/main.js";
3
+
4
+ void main(process.argv.slice(2));
@@ -0,0 +1,16 @@
1
+ import type { CapabilityContextKey } from "./types.js";
2
+ export type LocalContextSource = {
3
+ execution?: Record<string, unknown>;
4
+ workspace?: string | Record<string, unknown>;
5
+ projectConfig?: Record<string, unknown>;
6
+ /** Deliberately ignored: a capability never inherits process environment. */
7
+ environment?: unknown;
8
+ [key: string]: unknown;
9
+ };
10
+ /**
11
+ * Constructs a fresh JSON-only object. It selects named local sources rather
12
+ * than spreading a command or process object, so credentials and ambient
13
+ * environment cannot cross into a plugin process by accident.
14
+ */
15
+ export declare function buildCapabilityContext(keys: readonly CapabilityContextKey[], source: LocalContextSource): Record<string, unknown>;
16
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/capabilities/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAUvD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,6EAA6E;IAC7E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAkFF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,SAAS,oBAAoB,EAAE,EACrC,MAAM,EAAE,kBAAkB,GACzB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB"}
@@ -0,0 +1,98 @@
1
+ import { PLATFORM_IDS } from "../runtime/types.js";
2
+ /**
3
+ * Project configuration is useful only after this recursive boundary. These
4
+ * names deliberately over-match: losing an optional display field is safer
5
+ * than leaking a session, cookie, bearer credential, or access key.
6
+ */
7
+ const SENSITIVE_KEY = /(token|secret|password|credential|authorization|authentication|oauth|auth(token|key|cookie|session)|api[_-]?key|private[_-]?key|access[_-]?(key|token)|bearer|cookie|session|keychain|(^|[_-])env($|[_-]))/i;
8
+ const UNSAFE_OBJECT_KEY = new Set(["__proto__", "constructor", "prototype"]);
9
+ const MAX_CONTEXT_DEPTH = 12;
10
+ function isPlainObject(value) {
11
+ if (!value || typeof value !== "object" || Array.isArray(value))
12
+ return false;
13
+ const prototype = Object.getPrototypeOf(value);
14
+ return prototype === Object.prototype || prototype === null;
15
+ }
16
+ function isRuntime(value) {
17
+ return (typeof value === "string" && PLATFORM_IDS.includes(value));
18
+ }
19
+ function sanitizeJson(value, seen = new WeakSet(), depth = 0) {
20
+ if (value === null || typeof value === "string" || typeof value === "boolean")
21
+ return value;
22
+ if (typeof value === "number")
23
+ return Number.isFinite(value) ? value : undefined;
24
+ if (depth > MAX_CONTEXT_DEPTH || typeof value !== "object")
25
+ return undefined;
26
+ if (seen.has(value))
27
+ return undefined;
28
+ seen.add(value);
29
+ if (Array.isArray(value)) {
30
+ const result = [];
31
+ for (const item of value) {
32
+ const sanitized = sanitizeJson(item, seen, depth + 1);
33
+ if (sanitized !== undefined)
34
+ result.push(sanitized);
35
+ }
36
+ return result;
37
+ }
38
+ if (!isPlainObject(value))
39
+ return undefined;
40
+ const result = {};
41
+ for (const [key, item] of Object.entries(value)) {
42
+ if (SENSITIVE_KEY.test(key) || UNSAFE_OBJECT_KEY.has(key))
43
+ continue;
44
+ const sanitized = sanitizeJson(item, seen, depth + 1);
45
+ if (sanitized !== undefined)
46
+ result[key] = sanitized;
47
+ }
48
+ return result;
49
+ }
50
+ function executionContext(source) {
51
+ if (!source)
52
+ return null;
53
+ const result = {};
54
+ for (const key of ["executionId", "taskId", "commandId"]) {
55
+ if (typeof source[key] === "string" && source[key].trim())
56
+ result[key] = source[key];
57
+ }
58
+ if (Number.isSafeInteger(source.attempt) && source.attempt >= 0) {
59
+ result.attempt = source.attempt;
60
+ }
61
+ if (isRuntime(source.runtime))
62
+ result.runtime = source.runtime;
63
+ return Object.keys(result).length > 0 ? result : null;
64
+ }
65
+ function workspaceContext(source) {
66
+ const candidate = typeof source === "string"
67
+ ? source
68
+ : isPlainObject(source) && typeof source.path === "string"
69
+ ? source.path
70
+ : null;
71
+ return candidate && candidate.trim() ? { path: candidate } : null;
72
+ }
73
+ /**
74
+ * Constructs a fresh JSON-only object. It selects named local sources rather
75
+ * than spreading a command or process object, so credentials and ambient
76
+ * environment cannot cross into a plugin process by accident.
77
+ */
78
+ export function buildCapabilityContext(keys, source) {
79
+ const requested = new Set(keys);
80
+ const context = {};
81
+ if (requested.has("execution")) {
82
+ const execution = executionContext(source.execution);
83
+ if (execution)
84
+ context.execution = execution;
85
+ }
86
+ if (requested.has("workspace")) {
87
+ const workspace = workspaceContext(source.workspace);
88
+ if (workspace)
89
+ context.workspace = workspace;
90
+ }
91
+ if (requested.has("projectConfig")) {
92
+ const projectConfig = sanitizeJson(source.projectConfig);
93
+ if (projectConfig && !Array.isArray(projectConfig))
94
+ context.projectConfig = projectConfig;
95
+ }
96
+ return context;
97
+ }
98
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/capabilities/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,MAAM,qBAAqB,CAAC;AAoBpE;;;;GAIG;AACH,MAAM,aAAa,GACjB,6MAA6M,CAAC;AAChN,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;AAC7E,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9E,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;AAC9D,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAmB,CAAC,CACxE,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,KAAc,EACd,OAAO,IAAI,OAAO,EAAU,EAC5B,KAAK,GAAG,CAAC;IAET,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;QAC3E,OAAO,KAAK,CAAC;IACf,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,IAAI,KAAK,GAAG,i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AAG,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,SAAS;YAAE,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/C,CAAC;IACD,IAAI,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,SAAS;YAAE,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/C,CAAC;IACD,IAAI,SAAS,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;QACnC,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACzD,IAAI,aAAa,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC;YAChD,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;IAC1C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { JsonSchema } from "./types.js";
2
+ /**
3
+ * Validates the manifest's deliberately small JSON Schema subset. Any schema
4
+ * shape or value outside that subset is rejected rather than silently ignored.
5
+ */
6
+ export declare function validateCapabilityInput(schema: JsonSchema, input: unknown): boolean;
7
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/capabilities/input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AA+S7C;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,OAAO,GACb,OAAO,CAET"}
@@ -0,0 +1,224 @@
1
+ const MAX_SCHEMA_DEPTH = 12;
2
+ const MAX_VALUE_DEPTH = 16;
3
+ const MAX_SCHEMA_PROPERTIES = 128;
4
+ const MAX_COLLECTION_ITEMS = 1_024;
5
+ const MAX_DESCRIPTION_LENGTH = 4_096;
6
+ const UNSAFE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
7
+ function isPlainObject(value) {
8
+ if (!value || typeof value !== "object" || Array.isArray(value))
9
+ return false;
10
+ const prototype = Object.getPrototypeOf(value);
11
+ return prototype === Object.prototype || prototype === null;
12
+ }
13
+ function hasOnlyKeys(value, allowed) {
14
+ return Object.keys(value).every((key) => allowed.includes(key));
15
+ }
16
+ function isBoundedInteger(value, maximum = MAX_COLLECTION_ITEMS) {
17
+ return (typeof value === "number" &&
18
+ Number.isSafeInteger(value) &&
19
+ value >= 0 &&
20
+ value <= maximum);
21
+ }
22
+ function optionalBound(schema, key, maximum) {
23
+ const value = schema[key];
24
+ if (value === undefined)
25
+ return undefined;
26
+ return isBoundedInteger(value, maximum) ? value : null;
27
+ }
28
+ function isDescription(schema) {
29
+ return (schema.description === undefined ||
30
+ (typeof schema.description === "string" &&
31
+ schema.description.length <= MAX_DESCRIPTION_LENGTH));
32
+ }
33
+ function isJsonValue(value, depth = 0) {
34
+ if (value === null ||
35
+ typeof value === "string" ||
36
+ typeof value === "boolean" ||
37
+ (typeof value === "number" && Number.isFinite(value))) {
38
+ return true;
39
+ }
40
+ if (depth >= MAX_VALUE_DEPTH || !value || typeof value !== "object") {
41
+ return false;
42
+ }
43
+ if (Array.isArray(value)) {
44
+ return (value.length <= MAX_COLLECTION_ITEMS &&
45
+ value.every((item) => isJsonValue(item, depth + 1)));
46
+ }
47
+ if (!isPlainObject(value) ||
48
+ Object.keys(value).length > MAX_SCHEMA_PROPERTIES) {
49
+ return false;
50
+ }
51
+ return Object.entries(value).every(([key, item]) => !UNSAFE_KEYS.has(key) && isJsonValue(item, depth + 1));
52
+ }
53
+ function validateObject(schema, value, depth) {
54
+ if (!hasOnlyKeys(schema, [
55
+ "type",
56
+ "description",
57
+ "properties",
58
+ "required",
59
+ "additionalProperties",
60
+ "minProperties",
61
+ "maxProperties",
62
+ ]) ||
63
+ !isDescription(schema) ||
64
+ !isPlainObject(value)) {
65
+ return false;
66
+ }
67
+ const minProperties = optionalBound(schema, "minProperties", MAX_SCHEMA_PROPERTIES);
68
+ const maxProperties = optionalBound(schema, "maxProperties", MAX_SCHEMA_PROPERTIES);
69
+ if (minProperties === null ||
70
+ maxProperties === null ||
71
+ (minProperties !== undefined &&
72
+ maxProperties !== undefined &&
73
+ minProperties > maxProperties)) {
74
+ return false;
75
+ }
76
+ const entries = Object.entries(value);
77
+ if (entries.length > MAX_SCHEMA_PROPERTIES ||
78
+ (minProperties !== undefined && entries.length < minProperties) ||
79
+ (maxProperties !== undefined && entries.length > maxProperties) ||
80
+ entries.some(([key]) => UNSAFE_KEYS.has(key))) {
81
+ return false;
82
+ }
83
+ let properties = {};
84
+ if (schema.properties !== undefined) {
85
+ if (!isPlainObject(schema.properties) ||
86
+ Object.keys(schema.properties).length > MAX_SCHEMA_PROPERTIES ||
87
+ Object.entries(schema.properties).some(([key]) => !key || key.length > 128 || UNSAFE_KEYS.has(key))) {
88
+ return false;
89
+ }
90
+ properties = schema.properties;
91
+ }
92
+ let required = [];
93
+ if (schema.required !== undefined) {
94
+ if (!Array.isArray(schema.required) ||
95
+ schema.required.length > MAX_SCHEMA_PROPERTIES ||
96
+ schema.required.some((key) => typeof key !== "string" || !Object.hasOwn(properties, key)) ||
97
+ new Set(schema.required).size !== schema.required.length) {
98
+ return false;
99
+ }
100
+ required = schema.required;
101
+ }
102
+ if (required.some((key) => !Object.hasOwn(value, key)))
103
+ return false;
104
+ if (schema.additionalProperties !== undefined &&
105
+ typeof schema.additionalProperties !== "boolean") {
106
+ return false;
107
+ }
108
+ const allowAdditional = schema.additionalProperties !== false;
109
+ for (const [key, item] of entries) {
110
+ const propertySchema = properties[key];
111
+ if (propertySchema === undefined) {
112
+ if (!allowAdditional || !isJsonValue(item, depth + 1))
113
+ return false;
114
+ continue;
115
+ }
116
+ if (!validateSchema(propertySchema, item, depth + 1))
117
+ return false;
118
+ }
119
+ return true;
120
+ }
121
+ function validateArray(schema, value, depth) {
122
+ if (!hasOnlyKeys(schema, [
123
+ "type",
124
+ "description",
125
+ "items",
126
+ "minItems",
127
+ "maxItems",
128
+ ]) ||
129
+ !isDescription(schema) ||
130
+ !Array.isArray(value) ||
131
+ schema.items === undefined) {
132
+ return false;
133
+ }
134
+ const minItems = optionalBound(schema, "minItems");
135
+ const maxItems = optionalBound(schema, "maxItems");
136
+ if (minItems === null ||
137
+ maxItems === null ||
138
+ (minItems !== undefined && maxItems !== undefined && minItems > maxItems) ||
139
+ value.length > MAX_COLLECTION_ITEMS ||
140
+ (minItems !== undefined && value.length < minItems) ||
141
+ (maxItems !== undefined && value.length > maxItems)) {
142
+ return false;
143
+ }
144
+ return value.every((item) => validateSchema(schema.items, item, depth + 1));
145
+ }
146
+ function validateString(schema, value) {
147
+ if (!hasOnlyKeys(schema, [
148
+ "type",
149
+ "description",
150
+ "minLength",
151
+ "maxLength",
152
+ ]) ||
153
+ !isDescription(schema) ||
154
+ typeof value !== "string") {
155
+ return false;
156
+ }
157
+ const minLength = optionalBound(schema, "minLength");
158
+ const maxLength = optionalBound(schema, "maxLength");
159
+ if (minLength === null ||
160
+ maxLength === null ||
161
+ (minLength !== undefined &&
162
+ maxLength !== undefined &&
163
+ minLength > maxLength) ||
164
+ (minLength !== undefined && value.length < minLength) ||
165
+ (maxLength !== undefined && value.length > maxLength)) {
166
+ return false;
167
+ }
168
+ return true;
169
+ }
170
+ function validateNumber(schema, value) {
171
+ if (!hasOnlyKeys(schema, ["type", "description", "minimum", "maximum"]) ||
172
+ !isDescription(schema) ||
173
+ typeof value !== "number" ||
174
+ !Number.isFinite(value)) {
175
+ return false;
176
+ }
177
+ if (schema.type === "integer" && !Number.isInteger(value))
178
+ return false;
179
+ if ((schema.minimum !== undefined &&
180
+ (typeof schema.minimum !== "number" ||
181
+ !Number.isFinite(schema.minimum))) ||
182
+ (schema.maximum !== undefined &&
183
+ (typeof schema.maximum !== "number" ||
184
+ !Number.isFinite(schema.maximum))) ||
185
+ (typeof schema.minimum === "number" &&
186
+ typeof schema.maximum === "number" &&
187
+ schema.minimum > schema.maximum)) {
188
+ return false;
189
+ }
190
+ return ((schema.minimum === undefined || value >= schema.minimum) &&
191
+ (schema.maximum === undefined || value <= schema.maximum));
192
+ }
193
+ function validateSchema(schema, value, depth) {
194
+ if (depth > MAX_SCHEMA_DEPTH || !isPlainObject(schema))
195
+ return false;
196
+ if (schema.type === "object")
197
+ return validateObject(schema, value, depth);
198
+ if (schema.type === "array")
199
+ return validateArray(schema, value, depth);
200
+ if (schema.type === "string")
201
+ return validateString(schema, value);
202
+ if (schema.type === "number" || schema.type === "integer") {
203
+ return validateNumber(schema, value);
204
+ }
205
+ if (schema.type === "boolean") {
206
+ return (hasOnlyKeys(schema, ["type", "description"]) &&
207
+ isDescription(schema) &&
208
+ typeof value === "boolean");
209
+ }
210
+ if (schema.type === "null") {
211
+ return (hasOnlyKeys(schema, ["type", "description"]) &&
212
+ isDescription(schema) &&
213
+ value === null);
214
+ }
215
+ return false;
216
+ }
217
+ /**
218
+ * Validates the manifest's deliberately small JSON Schema subset. Any schema
219
+ * shape or value outside that subset is rejected rather than silently ignored.
220
+ */
221
+ export function validateCapabilityInput(schema, input) {
222
+ return validateSchema(schema, input, 0);
223
+ }
224
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/capabilities/input.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AACrC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;AAE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AAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1D,OAAO,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,CACL,WAAW,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YAC5C,aAAa,CAAC,MAAM,CAAC;YACrB,OAAO,KAAK,KAAK,SAAS,CAC3B,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,CACL,WAAW,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YAC5C,aAAa,CAAC,MAAM,CAAC;YACrB,KAAK,KAAK,IAAI,CACf,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAkB,EAClB,KAAc;IAEd,OAAO,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type ShellCapability } from "./types.js";
2
+ export declare const MAX_CAPABILITY_TIMEOUT_SECONDS = 900;
3
+ export declare function isValidCapabilityId(value: unknown): value is string;
4
+ export declare function isSafeCapabilityEntry(value: unknown): value is string;
5
+ /**
6
+ * Parse the intentionally small JSON Schema subset accepted for direct shell
7
+ * inputs. A root object is required, so a Hub request is always structured.
8
+ */
9
+ export declare function parseShellCapability(value: unknown): ShellCapability | null;
10
+ /**
11
+ * Installer-time realpath validation closes the remaining symlink escape
12
+ * avenue that syntactic manifest parsing cannot see.
13
+ */
14
+ export declare function validateCapabilityEntries(pluginRoot: string, capabilities: readonly ShellCapability[]): Promise<void>;
15
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/capabilities/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAsPlD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEnE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAmBrE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAsC3E;AAYD;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,SAAS,eAAe,EAAE,GACvC,OAAO,CAAC,IAAI,CAAC,CA+Bf"}