@agenthippo-ai/agenthippo 0.2.3-dataplane → 1.110.9

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 (130) hide show
  1. package/out/analytics/dashboard/provider.js +13 -2
  2. package/out/analytics/dashboard/webview/panel.js +3 -2
  3. package/out/analytics/identity.js +0 -0
  4. package/out/analytics/service.js +23 -25
  5. package/out/analytics/sessionEvents.js +98 -23
  6. package/out/auth/authBaseUrl.js +59 -0
  7. package/out/auth/bootstrapApply.js +9 -10
  8. package/out/auth/brokerClient.js +48 -14
  9. package/out/auth/provider.js +8 -21
  10. package/out/auth/sessionStore.js +3 -40
  11. package/out/auth/signInFlow.js +2 -1
  12. package/out/auth-broker/config.js +50 -5
  13. package/out/auth-broker/server.js +122 -26
  14. package/out/auth-broker/store.js +25 -24
  15. package/out/authority/warrant.js +206 -0
  16. package/out/branding.js +27 -1
  17. package/out/cli/commands/conformance.js +249 -0
  18. package/out/cli/commands/data-plane.js +67 -0
  19. package/out/cli/commands/deploy.js +1 -0
  20. package/out/cli/commands/gateway.js +4 -0
  21. package/out/cli/commands/pack.js +182 -3
  22. package/out/cli/commands/sandbox.js +332 -0
  23. package/out/cli/commands/serve.js +875 -52
  24. package/out/cli/commands/store.js +12 -4
  25. package/out/cli/data-plane/gateway.js +28 -5
  26. package/out/cli/data-plane/index.js +17 -2
  27. package/out/cli/data-plane/registry.js +9 -0
  28. package/out/cli/data-plane/remote.js +106 -0
  29. package/out/cli/data-plane/sidecar.js +161 -0
  30. package/out/cli/deploy/layers/identity.js +85 -4
  31. package/out/cli/deploy-init.js +89 -24
  32. package/out/cli/deps.js +106 -2
  33. package/out/cli/idp-init.js +35 -0
  34. package/out/cli/index.js +155 -16
  35. package/out/cli/pack-install-ref.js +15 -0
  36. package/out/cli/pack-loader.js +8 -1
  37. package/out/cli/pack-runtime.js +61 -0
  38. package/out/cli/runtime.js +35 -1
  39. package/out/cli/serve-hardening.js +80 -3
  40. package/out/cli/utils.js +12 -1
  41. package/out/engines/base.js +32 -3
  42. package/out/engines/claude.js +33 -15
  43. package/out/engines/codex.js +110 -26
  44. package/out/engines/custom.js +8 -0
  45. package/out/evidence/sessionShip.js +610 -0
  46. package/out/extension.js +11 -2
  47. package/out/gateway/bridge.js +40 -2
  48. package/out/gateway/client.js +34 -1
  49. package/out/gateway/installSource.js +68 -0
  50. package/out/gateway/lifecycle.js +185 -51
  51. package/out/gateway/outboundPaths.js +4 -1
  52. package/out/gateway/secretsPreflight.js +90 -0
  53. package/out/gateway/service.js +7 -2
  54. package/out/headless/index.js +17 -1
  55. package/out/live-e2e/mcp-demo/server.mjs +32 -0
  56. package/out/mcp.js +30 -0
  57. package/out/pack/caps.js +271 -0
  58. package/out/pack/governor.js +309 -0
  59. package/out/pack/lease-schema.js +270 -0
  60. package/out/pack/lease.js +640 -0
  61. package/out/pack/reconcile.js +217 -0
  62. package/out/pack/signature.js +839 -0
  63. package/out/remote/handleRemoteChat.js +44 -3
  64. package/out/remote/remoteTrust.js +277 -0
  65. package/out/remote/serveClient.js +52 -5
  66. package/out/runner/host.js +131 -0
  67. package/out/runner/protocol.js +108 -0
  68. package/out/runner/remoteEngine.js +130 -0
  69. package/out/runtime/interfaces/edit-tracker.js +2 -0
  70. package/out/runtime/vscode/vscode-edit-tracker.js +2 -0
  71. package/out/sandbox/containerDriver.js +570 -0
  72. package/out/sandbox/processDriver.js +315 -0
  73. package/out/sandbox/sandboxRunner.js +191 -0
  74. package/out/sandbox/support.js +301 -0
  75. package/out/sandbox/types.js +55 -0
  76. package/out/scripts/agentide-litellm.sh +67 -5
  77. package/out/scripts/agentide_litellm_hooks_v1.py +182 -21
  78. package/out/scripts/analytics/agentide-litellm-otel.config.yaml +94 -132
  79. package/out/scripts/analytics/setup-analytics.ps1 +37 -13
  80. package/out/scripts/analytics/setup-analytics.sh +93 -13
  81. package/out/scripts/analytics/start-analytics.sh +86 -14
  82. package/out/scripts/gateway/setup-gateway.sh +72 -32
  83. package/out/shared/models.js +11 -110
  84. package/out/spotlight/install.js +7 -1
  85. package/out/store/index.js +41 -10
  86. package/out/sync.js +3 -1
  87. package/out/test/analytics.test.js +162 -23
  88. package/out/test/auth-baseurl.test.js +132 -0
  89. package/out/test/auth-bootstrapApply.test.js +27 -6
  90. package/out/test/auth-broker-hardening.test.js +227 -0
  91. package/out/test/auth-broker.test.js +59 -9
  92. package/out/test/branding.test.js +13 -0
  93. package/out/test/caps-governor.test.js +455 -0
  94. package/out/test/codex-new-file-survival.test.js +119 -0
  95. package/out/test/configuration-scopes.test.js +131 -0
  96. package/out/test/data-plane.test.js +67 -0
  97. package/out/test/deploy-init.test.js +40 -0
  98. package/out/test/gateway-client.test.js +28 -0
  99. package/out/test/gateway-install-source.test.js +111 -0
  100. package/out/test/gateway-lifecycle.test.js +1 -1
  101. package/out/test/gateway-outbound.test.js +7 -0
  102. package/out/test/gateway-secrets-preflight.test.js +127 -0
  103. package/out/test/gateway-session-routing.test.js +18 -0
  104. package/out/test/governor-hardening.test.js +217 -0
  105. package/out/test/headless-sync.test.js +22 -0
  106. package/out/test/lease-signature.test.js +357 -0
  107. package/out/test/lease-trust-root.test.js +273 -0
  108. package/out/test/lease-validation.test.js +169 -0
  109. package/out/test/lease.test.js +114 -0
  110. package/out/test/mcp.test.js +27 -1
  111. package/out/test/pack-admission.test.js +216 -0
  112. package/out/test/pack-digest-parity.test.js +140 -0
  113. package/out/test/pack-reconcile.test.js +183 -0
  114. package/out/test/pack-signature-artifact.test.js +103 -0
  115. package/out/test/pack-signature.test.js +176 -0
  116. package/out/test/pack-trust-root.test.js +202 -0
  117. package/out/test/remote-trust.test.js +242 -0
  118. package/out/test/runner-protocol.test.js +249 -0
  119. package/out/test/sandbox-driver.test.js +553 -0
  120. package/out/test/sandbox-hardening.test.js +395 -0
  121. package/out/test/sandbox-runner.test.js +343 -0
  122. package/out/test/serve-hardening.test.js +45 -6
  123. package/out/test/serveClient.test.js +6 -5
  124. package/out/test/sessionShip.test.js +560 -0
  125. package/out/test/spotlightPublish.test.js +28 -0
  126. package/out/test/store-install-safe.test.js +69 -0
  127. package/out/test/tls-bypass.test.js +90 -0
  128. package/out/test/warrant.test.js +138 -0
  129. package/out/utils.js +46 -9
  130. package/package.json +1 -1
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) AgentHippo.ai. All rights reserved.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isTerminalFrame = isTerminalFrame;
7
+ exports.encodeRunnerFrame = encodeRunnerFrame;
8
+ exports.encodeClientFrame = encodeClientFrame;
9
+ exports.parseRunnerFrame = parseRunnerFrame;
10
+ exports.parseClientFrame = parseClientFrame;
11
+ exports.splitFrames = splitFrames;
12
+ exports.toWireOptions = toWireOptions;
13
+ function isTerminalFrame(frame) {
14
+ return frame.type === 'result' || frame.type === 'failed';
15
+ }
16
+ function encodeRunnerFrame(frame) {
17
+ return `${JSON.stringify(frame)}\n`;
18
+ }
19
+ function encodeClientFrame(frame) {
20
+ return `${JSON.stringify(frame)}\n`;
21
+ }
22
+ /** Parse one runner→serve line. Returns undefined for anything malformed (never throws). */
23
+ function parseRunnerFrame(line) {
24
+ const parsed = parseObject(line);
25
+ if (!parsed) {
26
+ return undefined;
27
+ }
28
+ const type = parsed.type;
29
+ if (type === 'ready') {
30
+ return { type: 'ready' };
31
+ }
32
+ if (type === 'result' && typeof parsed.id === 'string') {
33
+ return {
34
+ type: 'result',
35
+ id: parsed.id,
36
+ ...(typeof parsed.nativeSessionId === 'string' ? { nativeSessionId: parsed.nativeSessionId } : {}),
37
+ };
38
+ }
39
+ if (type === 'failed' && typeof parsed.id === 'string') {
40
+ return {
41
+ type: 'failed',
42
+ id: parsed.id,
43
+ message: typeof parsed.message === 'string' ? parsed.message : 'Sandbox turn failed',
44
+ };
45
+ }
46
+ if (type === 'question' && parsed.payload && typeof parsed.payload === 'object') {
47
+ return { type: 'question', payload: parsed.payload };
48
+ }
49
+ // Streamed engine events keep the existing union — validated by shape, not re-listed here.
50
+ if (typeof type === 'string' && RUNNER_EVENT_TYPES.has(type)) {
51
+ return parsed;
52
+ }
53
+ return undefined;
54
+ }
55
+ /** Parse one serve→runner line. Returns undefined for anything malformed (never throws). */
56
+ function parseClientFrame(line) {
57
+ const parsed = parseObject(line);
58
+ if (!parsed) {
59
+ return undefined;
60
+ }
61
+ if (parsed.type === 'run' && typeof parsed.id === 'string' && typeof parsed.message === 'string') {
62
+ const options = parsed.options && typeof parsed.options === 'object' ? parsed.options : {};
63
+ return { type: 'run', id: parsed.id, message: parsed.message, options: options };
64
+ }
65
+ if (parsed.type === 'abort' && typeof parsed.id === 'string') {
66
+ return { type: 'abort', id: parsed.id };
67
+ }
68
+ return undefined;
69
+ }
70
+ const RUNNER_EVENT_TYPES = new Set([
71
+ 'text', 'thinking', 'toolStart', 'toolEnd', 'progress', 'error', 'done', 'nativeSessionId', 'probe',
72
+ ]);
73
+ function parseObject(line) {
74
+ let parsed;
75
+ try {
76
+ parsed = JSON.parse(line);
77
+ }
78
+ catch {
79
+ return undefined;
80
+ }
81
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
82
+ return undefined;
83
+ }
84
+ return parsed;
85
+ }
86
+ /**
87
+ * Split a byte stream into newline-delimited frames. Returns the parsed lines plus whatever
88
+ * partial text is left over, which the caller carries into the next chunk.
89
+ */
90
+ function splitFrames(buffer) {
91
+ const parts = buffer.split('\n');
92
+ const rest = parts.pop() ?? '';
93
+ return { lines: parts.filter((l) => l.trim().length > 0), rest };
94
+ }
95
+ /**
96
+ * The credential scrub, applied where serve builds a `run` frame. The four secrets that must
97
+ * never cross: `AgentRequestOptions.apiKey` plus `EngineConfig`'s `litellmApiKey` /
98
+ * `openaiApiKey` / `anthropicApiKey` (the latter three live in engine config, which the runner
99
+ * builds in-sandbox from `baseUrl` + `modelToken` — they are never sent).
100
+ */
101
+ function toWireOptions(options, model) {
102
+ const { apiKey: _dropped, ...rest } = options;
103
+ return {
104
+ ...rest,
105
+ ...(model.baseUrl ? { baseUrl: model.baseUrl } : {}),
106
+ ...(model.modelToken ? { modelToken: model.modelToken } : {}),
107
+ };
108
+ }
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) AgentHippo.ai. All rights reserved.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RemoteEngine = void 0;
7
+ /**
8
+ * `RemoteEngine` (PLAN/serve-v4-clean.md §3): satisfies `AgentEngine` by forwarding the turn to
9
+ * a runner inside a sandbox. serve's turn loop, streaming, rate limiting and session handling do
10
+ * not change — this is the same move `RemoteDataPlane` (`cli/data-plane/remote.ts`) already
11
+ * makes against the in-process `DataPlane`, one layer up.
12
+ */
13
+ const customEngineIpc_1 = require("../engines/customEngineIpc");
14
+ const protocol_1 = require("./protocol");
15
+ class RemoteEngine {
16
+ id;
17
+ displayName;
18
+ channel;
19
+ model;
20
+ logger;
21
+ /** Per-run sinks, keyed by run id — the protocol multiplexes turns on one channel. */
22
+ pending = new Map();
23
+ buffer = '';
24
+ seq = 0;
25
+ wired = false;
26
+ constructor(opts) {
27
+ this.id = opts.id;
28
+ this.displayName = opts.displayName;
29
+ this.channel = opts.channel;
30
+ this.model = opts.model ?? {};
31
+ this.logger = opts.logger;
32
+ }
33
+ async stream(message, options, emitter, _runtime, signal) {
34
+ this.wire();
35
+ const id = `r${++this.seq}`;
36
+ const settled = new Promise((resolve, reject) => {
37
+ this.pending.set(id, { emitter, resolve, reject });
38
+ });
39
+ const onAbort = () => { this.send({ type: 'abort', id }); };
40
+ if (signal) {
41
+ if (signal.aborted) {
42
+ onAbort();
43
+ }
44
+ else {
45
+ signal.addEventListener('abort', onAbort, { once: true });
46
+ }
47
+ }
48
+ try {
49
+ // A fresh warrant for this turn when the caller can mint one; the create-time token is
50
+ // the fallback for paths that mint nothing (tier 0, tests).
51
+ const modelToken = this.model.mintToken
52
+ ? (await this.model.mintToken()) ?? this.model.modelToken
53
+ : this.model.modelToken;
54
+ this.send({
55
+ type: 'run',
56
+ id,
57
+ message,
58
+ options: (0, protocol_1.toWireOptions)(options, { ...this.model, modelToken }),
59
+ });
60
+ // Resolves on the TERMINAL frame (result/failed) — never on the streamed `done`,
61
+ // which engines emit mid-run.
62
+ await settled;
63
+ }
64
+ finally {
65
+ this.pending.delete(id);
66
+ signal?.removeEventListener('abort', onAbort);
67
+ }
68
+ }
69
+ /** No-op by design: the runner drives its own maintenance timer in-sandbox (see runner/host.ts). */
70
+ onMaintenance() { }
71
+ /** Sandbox teardown is the driver's job (`destroy(handle)` at session end), not the engine's. */
72
+ dispose() { }
73
+ wire() {
74
+ if (this.wired) {
75
+ return;
76
+ }
77
+ this.wired = true;
78
+ this.channel.input.on('data', (chunk) => {
79
+ this.buffer += typeof chunk === 'string' ? chunk : chunk.toString('utf8');
80
+ const { lines, rest } = (0, protocol_1.splitFrames)(this.buffer);
81
+ this.buffer = rest;
82
+ for (const line of lines) {
83
+ const frame = (0, protocol_1.parseRunnerFrame)(line);
84
+ if (!frame) {
85
+ this.logger?.warn('[RemoteEngine] dropped malformed runner frame');
86
+ continue;
87
+ }
88
+ void this.dispatch(frame);
89
+ }
90
+ });
91
+ void this.channel.closed?.then(() => this.failAll(new Error('sandbox channel closed')), (err) => this.failAll(err instanceof Error ? err : new Error(String(err))));
92
+ }
93
+ async dispatch(frame) {
94
+ if (frame.type === 'ready') {
95
+ return;
96
+ }
97
+ if (frame.type === 'result') {
98
+ this.pending.get(frame.id)?.resolve(frame.nativeSessionId);
99
+ return;
100
+ }
101
+ if (frame.type === 'failed') {
102
+ this.pending.get(frame.id)?.reject(new Error(frame.message));
103
+ return;
104
+ }
105
+ // Streamed events fan out to every in-flight emitter. In the sandbox model a runner hosts
106
+ // exactly one session, so in practice there is one — but the run id is not carried on
107
+ // streamed events (matching the existing worker protocol), so this stays a broadcast.
108
+ for (const entry of this.pending.values()) {
109
+ if (frame.type === 'question') {
110
+ // One-way notification; the runner already answered it `declined` locally.
111
+ await entry.emitter.question(frame.payload).catch(() => undefined);
112
+ continue;
113
+ }
114
+ await (0, customEngineIpc_1.applyParsedRunnerEvent)(entry.emitter, frame).catch((err) => {
115
+ this.logger?.warn(`[RemoteEngine] emitter error: ${err instanceof Error ? err.message : String(err)}`);
116
+ return undefined;
117
+ });
118
+ }
119
+ }
120
+ failAll(err) {
121
+ for (const [id, entry] of this.pending) {
122
+ entry.reject(err);
123
+ this.pending.delete(id);
124
+ }
125
+ }
126
+ send(frame) {
127
+ this.channel.output.write((0, protocol_1.encodeClientFrame)(frame));
128
+ }
129
+ }
130
+ exports.RemoteEngine = RemoteEngine;
@@ -9,6 +9,8 @@ exports.NoOpEditTracker = void 0;
9
9
  * Suitable for eval mode, CLI, and production where edit tracking is not needed.
10
10
  */
11
11
  class NoOpEditTracker {
12
+ /** Nothing is written back here — callers must not delete a file expecting this to restore it. */
13
+ appliesEdits = false;
12
14
  async startTracking(_sessionId, _files) {
13
15
  return undefined;
14
16
  }
@@ -44,6 +44,8 @@ const vscode = __importStar(require("vscode"));
44
44
  */
45
45
  class VSCodeEditTracker {
46
46
  logger;
47
+ /** `applyEdit` writes through the IDE's workspace edit, so a pre-delete is recoverable. */
48
+ appliesEdits = true;
47
49
  constructor(logger) {
48
50
  this.logger = logger;
49
51
  }