@agenthippo-ai/agenthippo 0.2.3-dataplane → 1.110.11

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 (139) hide show
  1. package/out/agentpack/index.js +3 -1
  2. package/out/agentpack/paths.js +25 -2
  3. package/out/analytics/dashboard/localFleetAdapter.js +82 -2
  4. package/out/analytics/dashboard/provider.js +13 -2
  5. package/out/analytics/dashboard/webview/panel.js +3 -2
  6. package/out/analytics/identity.js +0 -0
  7. package/out/analytics/service.js +29 -25
  8. package/out/analytics/sessionEvents.js +100 -24
  9. package/out/auth/authBaseUrl.js +59 -0
  10. package/out/auth/bootstrapApply.js +9 -10
  11. package/out/auth/brokerClient.js +48 -14
  12. package/out/auth/provider.js +8 -21
  13. package/out/auth/sessionStore.js +3 -40
  14. package/out/auth/signInFlow.js +2 -1
  15. package/out/auth-broker/config.js +50 -5
  16. package/out/auth-broker/server.js +126 -26
  17. package/out/auth-broker/store.js +25 -24
  18. package/out/authority/warrant.js +206 -0
  19. package/out/branding.js +27 -1
  20. package/out/cli/commands/conformance.js +249 -0
  21. package/out/cli/commands/data-plane.js +151 -0
  22. package/out/cli/commands/deploy.js +1 -0
  23. package/out/cli/commands/gateway.js +4 -0
  24. package/out/cli/commands/pack.js +182 -3
  25. package/out/cli/commands/sandbox.js +351 -0
  26. package/out/cli/commands/serve.js +1145 -130
  27. package/out/cli/commands/store.js +12 -4
  28. package/out/cli/credential-context.js +17 -0
  29. package/out/cli/data-plane/gateway.js +28 -5
  30. package/out/cli/data-plane/index.js +18 -2
  31. package/out/cli/data-plane/registry.js +9 -0
  32. package/out/cli/data-plane/remote.js +106 -0
  33. package/out/cli/data-plane/sidecar.js +225 -0
  34. package/out/cli/deploy/layers/identity.js +88 -4
  35. package/out/cli/deploy-init.js +89 -24
  36. package/out/cli/deps.js +106 -2
  37. package/out/cli/idp-init.js +35 -0
  38. package/out/cli/index.js +171 -17
  39. package/out/cli/pack-install-ref.js +15 -0
  40. package/out/cli/pack-loader.js +8 -1
  41. package/out/cli/pack-runtime.js +61 -0
  42. package/out/cli/runtime.js +35 -1
  43. package/out/cli/serve-hardening.js +260 -14
  44. package/out/cli/utils.js +12 -1
  45. package/out/engines/base.js +32 -3
  46. package/out/engines/claude.js +33 -15
  47. package/out/engines/codex.js +111 -27
  48. package/out/engines/custom.js +15 -1
  49. package/out/evidence/sessionShip.js +643 -0
  50. package/out/extension.js +11 -2
  51. package/out/gateway/bridge.js +40 -2
  52. package/out/gateway/client.js +34 -1
  53. package/out/gateway/installSource.js +68 -0
  54. package/out/gateway/lifecycle.js +185 -51
  55. package/out/gateway/outboundPaths.js +4 -1
  56. package/out/gateway/secretsPreflight.js +90 -0
  57. package/out/gateway/service.js +7 -2
  58. package/out/headless/index.js +25 -2
  59. package/out/live-e2e/mcp-demo/server.mjs +32 -0
  60. package/out/mcp.js +30 -0
  61. package/out/pack/caps.js +271 -0
  62. package/out/pack/governor.js +326 -0
  63. package/out/pack/lease-schema.js +273 -0
  64. package/out/pack/lease.js +682 -0
  65. package/out/pack/reconcile.js +217 -0
  66. package/out/pack/signature.js +839 -0
  67. package/out/remote/handleRemoteChat.js +44 -3
  68. package/out/remote/remoteTrust.js +277 -0
  69. package/out/remote/serveClient.js +52 -5
  70. package/out/runner/host.js +141 -0
  71. package/out/runner/protocol.js +128 -0
  72. package/out/runner/remoteEngine.js +166 -0
  73. package/out/runtime/interfaces/edit-tracker.js +2 -0
  74. package/out/runtime/vscode/vscode-edit-tracker.js +2 -0
  75. package/out/sandbox/containerDriver.js +572 -0
  76. package/out/sandbox/processDriver.js +318 -0
  77. package/out/sandbox/sandboxRunner.js +303 -0
  78. package/out/sandbox/support.js +301 -0
  79. package/out/sandbox/types.js +55 -0
  80. package/out/scripts/agentide-litellm.sh +67 -5
  81. package/out/scripts/agentide_litellm_hooks_v1.py +266 -21
  82. package/out/scripts/analytics/agentide-litellm-otel.config.yaml +98 -132
  83. package/out/scripts/analytics/setup-analytics.ps1 +45 -14
  84. package/out/scripts/analytics/setup-analytics.sh +106 -15
  85. package/out/scripts/analytics/start-analytics.sh +86 -14
  86. package/out/scripts/gateway/setup-gateway.sh +72 -32
  87. package/out/shared/models.js +11 -110
  88. package/out/spotlight/install.js +7 -1
  89. package/out/store/index.js +41 -10
  90. package/out/sync.js +3 -1
  91. package/out/test/analytics.test.js +162 -23
  92. package/out/test/auth-baseurl.test.js +132 -0
  93. package/out/test/auth-bootstrapApply.test.js +27 -6
  94. package/out/test/auth-broker-hardening.test.js +227 -0
  95. package/out/test/auth-broker.test.js +59 -9
  96. package/out/test/branding.test.js +13 -0
  97. package/out/test/caps-governor.test.js +460 -0
  98. package/out/test/codex-new-file-survival.test.js +119 -0
  99. package/out/test/configuration-scopes.test.js +131 -0
  100. package/out/test/data-plane-engine-wiring.test.js +32 -0
  101. package/out/test/data-plane.test.js +380 -0
  102. package/out/test/deploy-init.test.js +47 -1
  103. package/out/test/gateway-client.test.js +28 -0
  104. package/out/test/gateway-install-source.test.js +111 -0
  105. package/out/test/gateway-lifecycle.test.js +1 -1
  106. package/out/test/gateway-outbound.test.js +7 -0
  107. package/out/test/gateway-secrets-preflight.test.js +127 -0
  108. package/out/test/gateway-session-routing.test.js +18 -0
  109. package/out/test/governor-hardening.test.js +222 -0
  110. package/out/test/headless-sync.test.js +22 -0
  111. package/out/test/lease-signature.test.js +357 -0
  112. package/out/test/lease-trust-root.test.js +273 -0
  113. package/out/test/lease-validation.test.js +224 -0
  114. package/out/test/lease.test.js +114 -0
  115. package/out/test/localFleetAdapter.test.js +91 -0
  116. package/out/test/mcp.test.js +27 -1
  117. package/out/test/pack-admission.test.js +216 -0
  118. package/out/test/pack-digest-parity.test.js +140 -0
  119. package/out/test/pack-reconcile.test.js +183 -0
  120. package/out/test/pack-signature-artifact.test.js +103 -0
  121. package/out/test/pack-signature.test.js +176 -0
  122. package/out/test/pack-trust-root.test.js +202 -0
  123. package/out/test/remote-trust.test.js +242 -0
  124. package/out/test/runner-protocol.test.js +249 -0
  125. package/out/test/sandbox-driver.test.js +553 -0
  126. package/out/test/sandbox-hardening.test.js +406 -0
  127. package/out/test/sandbox-runner.test.js +343 -0
  128. package/out/test/sandbox-scope.test.js +449 -0
  129. package/out/test/serve-cron-acceptance.test.js +370 -0
  130. package/out/test/serve-gateway-turn.test.js +122 -0
  131. package/out/test/serve-hardening.test.js +227 -15
  132. package/out/test/serveClient.test.js +6 -5
  133. package/out/test/sessionShip.test.js +618 -0
  134. package/out/test/spotlightPublish.test.js +28 -0
  135. package/out/test/store-install-safe.test.js +69 -0
  136. package/out/test/tls-bypass.test.js +90 -0
  137. package/out/test/warrant.test.js +138 -0
  138. package/out/utils.js +46 -9
  139. package/package.json +1 -1
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) AgentHippo.ai. All rights reserved.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.CURRENT_LINK = void 0;
40
+ exports.safeJoin = safeJoin;
41
+ exports.promoteCurrent = promoteCurrent;
42
+ exports.reconcilePinnedPack = reconcilePinnedPack;
43
+ exports.readDirAsFiles = readDirAsFiles;
44
+ /**
45
+ * Converge on the pinned pack version: fetch, VERIFY, then swap.
46
+ *
47
+ * Until now a version pin could only refuse — serve compared the pin to what it already ran and
48
+ * denied sandbox creation on a mismatch. That is a stop, not a rollback, unless someone had
49
+ * already deployed the pinned version out of band. This closes the loop.
50
+ *
51
+ * Three rules, each load-bearing:
52
+ *
53
+ * 1. **Fetching implies verifying, with no way to opt out.** A pack already on disk was put there
54
+ * by an operator, so requiring signatures for it is a policy choice. A pack pulled over the
55
+ * network and executed is precisely the case signatures exist for, so there is no flag here —
56
+ * an unsigned or unverifiable artifact is never promoted, whatever the lease says.
57
+ *
58
+ * 2. **Failure keeps serving the current version.** Same asymmetry as the lease itself: transport
59
+ * failure must not take a fleet down. A pin we cannot satisfy leaves the instance running what
60
+ * it already had and reporting that version, so the console shows "pinned to X, running Y"
61
+ * rather than an outage. Refusing instead would convert a bad tag or a GitHub blip into a
62
+ * fleet-wide stop.
63
+ *
64
+ * 3. **Promotion is a symlink swap, never an in-place edit.** Files are written to a staging
65
+ * directory, verified there, and only then does `current` point at them. A half-downloaded
66
+ * pack is therefore never reachable, and a sandbox that is mid-start keeps the directory it
67
+ * already opened. Version convergence stays sandbox lifecycle — no hot-swap machinery.
68
+ */
69
+ const fs = __importStar(require("node:fs"));
70
+ const path = __importStar(require("node:path"));
71
+ const signature_1 = require("./signature");
72
+ exports.CURRENT_LINK = 'current';
73
+ /**
74
+ * Join a relative artifact path onto a root, refusing anything that escapes it.
75
+ *
76
+ * A downloaded archive is untrusted input: an entry called `../../etc/cron.d/x` would otherwise
77
+ * write outside the staging directory before any signature had been checked. Verification happens
78
+ * AFTER extraction, so extraction itself has to be safe on its own.
79
+ *
80
+ * REJECT, never sanitise. An earlier version stripped a leading `../` and carried on, which is
81
+ * worse than it looks: the entry then lands somewhere it did not claim, and the signature — which
82
+ * is computed over the extracted tree — would happily cover that rewritten layout. An artifact
83
+ * that asks to escape is refused outright rather than quietly relocated.
84
+ */
85
+ function safeJoin(root, rel) {
86
+ if (path.isAbsolute(rel)) {
87
+ return undefined;
88
+ }
89
+ const abs = path.resolve(root, rel);
90
+ const rootWithSep = root.endsWith(path.sep) ? root : root + path.sep;
91
+ return abs.startsWith(rootWithSep) ? abs : undefined;
92
+ }
93
+ /** Point `<packsRoot>/current` at `target`, atomically enough that no reader sees it missing. */
94
+ function promoteCurrent(packsRoot, target) {
95
+ const link = path.join(packsRoot, exports.CURRENT_LINK);
96
+ const tmp = `${link}.swap-${process.pid}-${Date.now()}`;
97
+ fs.symlinkSync(target, tmp);
98
+ // rename over an existing symlink is atomic; unlink-then-link would leave a window with no
99
+ // `current` at all, and a sandbox starting in that window would fail to find its pack.
100
+ fs.renameSync(tmp, link);
101
+ return link;
102
+ }
103
+ async function reconcilePinnedPack(input) {
104
+ const { pack, pinnedVersion, packsRoot, logger } = input;
105
+ const finalDir = path.join(packsRoot, pinnedVersion);
106
+ fs.mkdirSync(packsRoot, { recursive: true });
107
+ // Already materialised and still valid? Re-verify rather than trust the directory name: it is
108
+ // on local disk, which is exactly where something could have edited it since we wrote it.
109
+ if (fs.existsSync(finalDir)) {
110
+ const existing = verifyMaterialised(finalDir, pack, pinnedVersion, input.publicKeysByKid);
111
+ if (existing.ok) {
112
+ promoteCurrent(packsRoot, finalDir);
113
+ return { ok: true, packDir: finalDir, version: pinnedVersion, alreadyPresent: true };
114
+ }
115
+ logger?.warn(`[Pack] cached ${pack}@${pinnedVersion} failed verification (${existing.reason}); re-fetching`);
116
+ fs.rmSync(finalDir, { recursive: true, force: true });
117
+ }
118
+ let files;
119
+ try {
120
+ files = await input.download(pack, pinnedVersion);
121
+ }
122
+ catch (err) {
123
+ return { ok: false, reason: `fetch failed: ${err instanceof Error ? err.message : String(err)}` };
124
+ }
125
+ if (files.length === 0) {
126
+ return { ok: false, reason: `store returned no files for ${pack}@${pinnedVersion}` };
127
+ }
128
+ const staging = path.join(packsRoot, `.staging-${pinnedVersion}-${process.pid}-${Date.now()}`);
129
+ try {
130
+ fs.mkdirSync(staging, { recursive: true });
131
+ for (const file of files) {
132
+ const abs = safeJoin(staging, file.path);
133
+ // Refuse the whole artifact, not just the entry: a tarball trying to escape is not a
134
+ // packaging accident to route around.
135
+ if (!abs) {
136
+ fs.rmSync(staging, { recursive: true, force: true });
137
+ return { ok: false, reason: `refusing artifact: entry escapes the pack root (${file.path})` };
138
+ }
139
+ // A downloaded artifact never legitimately carries a symlink, and materialising one as a
140
+ // regular file would make the tree hash differently from the list that was verified.
141
+ if (file.link) {
142
+ fs.rmSync(staging, { recursive: true, force: true });
143
+ return { ok: false, reason: `refusing artifact: symlink entries are not accepted from the store (${file.path})` };
144
+ }
145
+ fs.mkdirSync(path.dirname(abs), { recursive: true });
146
+ fs.writeFileSync(abs, file.content);
147
+ }
148
+ const verdict = verifyFetchedArtifact(files, pack, pinnedVersion, input.publicKeysByKid);
149
+ if (!verdict.ok) {
150
+ fs.rmSync(staging, { recursive: true, force: true });
151
+ return { ok: false, reason: verdict.reason };
152
+ }
153
+ fs.renameSync(staging, finalDir);
154
+ promoteCurrent(packsRoot, finalDir);
155
+ logger?.info(`[Pack] converged to ${pack}@${pinnedVersion} (signature verified)`);
156
+ return { ok: true, packDir: finalDir, version: pinnedVersion, alreadyPresent: false };
157
+ }
158
+ catch (err) {
159
+ fs.rmSync(staging, { recursive: true, force: true });
160
+ return { ok: false, reason: `staging failed: ${err instanceof Error ? err.message : String(err)}` };
161
+ }
162
+ }
163
+ /**
164
+ * Read a materialised tree back as a file list, exactly as the digest sees it.
165
+ *
166
+ * Must agree with `computePackDigest`'s walk entry for entry, or a pack signed on disk cannot be
167
+ * re-verified from its own directory. Two things make it agree: `isDigestExcluded` (the same
168
+ * predicate, rather than a second list that drifts) and symlinks carried as `link: true` with
169
+ * their target string, instead of being dropped on the floor as they were before — a dropped
170
+ * symlink is a file the signature covers and this path does not, i.e. a digest mismatch on every
171
+ * pack that contains one.
172
+ *
173
+ * Exported so the parity test can drive the real function rather than a copy of it.
174
+ */
175
+ function readDirAsFiles(dir) {
176
+ const files = [];
177
+ const walk = (d, prefix) => {
178
+ for (const name of fs.readdirSync(d)) {
179
+ const rel = prefix ? `${prefix}/${name}` : name;
180
+ // Skipping excluded subtrees here is a performance choice only — the digest would drop
181
+ // them anyway. Not descending into node_modules is the difference between a fast verify
182
+ // and a slow one. `pack.sig` is deliberately NOT skipped: it is excluded from the digest
183
+ // but it is the file this path reads the signature OUT of.
184
+ if (signature_1.DIGEST_EXCLUDED_SEGMENTS.has(name)) {
185
+ continue;
186
+ }
187
+ const abs = path.join(d, name);
188
+ const st = fs.lstatSync(abs);
189
+ if (st.isSymbolicLink()) {
190
+ files.push({ path: rel, content: Buffer.from(fs.readlinkSync(abs)), link: true });
191
+ }
192
+ else if (st.isDirectory()) {
193
+ walk(abs, rel);
194
+ }
195
+ else if (st.isFile()) {
196
+ files.push({ path: rel, content: fs.readFileSync(abs) });
197
+ }
198
+ }
199
+ };
200
+ walk(dir, '');
201
+ return files;
202
+ }
203
+ function verifyFetchedArtifact(files, pack, version, keys) {
204
+ if (Object.keys(keys).length === 0) {
205
+ return { ok: false, reason: 'no trusted signing keys configured' };
206
+ }
207
+ const sigFile = files.find((f) => f.path.replace(/\\/g, '/') === signature_1.PACK_SIGNATURE_FILE);
208
+ if (!sigFile) {
209
+ return { ok: false, reason: `${pack}@${version} is not signed` };
210
+ }
211
+ const token = sigFile.content.toString('utf8').trim();
212
+ const res = (0, signature_1.verifyPackFromFiles)(token, keys, pack, version, files);
213
+ return res.ok ? { ok: true } : { ok: false, reason: res.reason };
214
+ }
215
+ function verifyMaterialised(dir, pack, version, keys) {
216
+ return verifyFetchedArtifact(readDirAsFiles(dir), pack, version, keys);
217
+ }