@opengsd/gsd-pi 1.9.0-dev.e10b60d4 → 1.10.0-dev.a5e42e99
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.
- package/README.md +10 -9
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/gsd/auto/loop.js +24 -4
- package/dist/resources/extensions/gsd/auto/run-unit.js +19 -1
- package/dist/resources/extensions/gsd/auto-model-selection.js +1 -0
- package/dist/resources/extensions/gsd/auto-start.js +30 -10
- package/dist/resources/extensions/gsd/auto-verification.js +25 -12
- package/dist/resources/extensions/gsd/auto-worktree-sync.js +7 -3
- package/dist/resources/extensions/gsd/auto.js +12 -1
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +4 -3
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +12 -3
- package/dist/resources/extensions/gsd/doctor-engine-checks.js +37 -6
- package/dist/resources/extensions/gsd/flat-phase-migration.js +12 -0
- package/dist/resources/extensions/gsd/gsd-db.js +75 -31
- package/dist/resources/extensions/gsd/model-cost-table.js +6 -3
- package/dist/resources/extensions/gsd/model-router.js +10 -5
- package/dist/resources/extensions/gsd/planning-subagent-registry.js +12 -4
- package/dist/resources/extensions/gsd/preferences-models.js +50 -10
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +41 -6
- package/dist/resources/extensions/gsd/preferences.js +7 -0
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +3 -0
- package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -1
- package/dist/resources/extensions/gsd/verification-evidence.js +5 -3
- package/dist/resources/extensions/gsd/worktree-state-projection.js +20 -18
- package/dist/resources/extensions/ollama/ollama-chat-provider.js +2 -2
- package/dist/resources/extensions/subagent/index.js +1 -1
- package/dist/startup-model-validation.d.ts +1 -1
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +6 -6
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +6 -6
- package/dist/web/standalone/.next/server/chunks/1991.js +2 -2
- package/dist/web/standalone/.next/server/chunks/5124.js +1 -1
- package/dist/web/standalone/.next/server/chunks/8357.js +2 -2
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/node_modules/@gsd/native/package.json +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/integrations/hermes/open_gsd_hermes/gsd_client.py +1 -1
- package/integrations/hermes/pyproject.toml +1 -1
- package/package.json +7 -6
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/dist/rpc.d.ts +1 -1
- package/packages/contracts/dist/rpc.d.ts.map +1 -1
- package/packages/contracts/dist/rpc.js +1 -1
- package/packages/contracts/dist/rpc.js.map +1 -1
- package/packages/contracts/dist/rpc.test.js +1 -1
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/dist/cli/args.js +2 -2
- package/packages/gsd-agent-modes/dist/cli/args.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/thinking-selector.js +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-autocomplete.js +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/gsd-cloud/README.md +21 -5
- package/packages/gsd-cloud/dist/background-cli.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/background-cli.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/background-cli.test.js +325 -0
- package/packages/gsd-cloud/dist/background-cli.test.js.map +1 -0
- package/packages/gsd-cloud/dist/cli.d.ts.map +1 -1
- package/packages/gsd-cloud/dist/cli.js +146 -16
- package/packages/gsd-cloud/dist/cli.js.map +1 -1
- package/packages/gsd-cloud/dist/cloud-config.d.ts +1 -1
- package/packages/gsd-cloud/dist/cloud-config.d.ts.map +1 -1
- package/packages/gsd-cloud/dist/cloud-config.js +7 -1
- package/packages/gsd-cloud/dist/cloud-config.js.map +1 -1
- package/packages/gsd-cloud/dist/cloud-runtime.d.ts +7 -4
- package/packages/gsd-cloud/dist/cloud-runtime.d.ts.map +1 -1
- package/packages/gsd-cloud/dist/cloud-runtime.js +115 -31
- package/packages/gsd-cloud/dist/cloud-runtime.js.map +1 -1
- package/packages/gsd-cloud/dist/cloud-runtime.test.js +224 -59
- package/packages/gsd-cloud/dist/cloud-runtime.test.js.map +1 -1
- package/packages/gsd-cloud/dist/runtime-artifacts.d.ts +3 -0
- package/packages/gsd-cloud/dist/runtime-artifacts.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/runtime-artifacts.js +36 -0
- package/packages/gsd-cloud/dist/runtime-artifacts.js.map +1 -0
- package/packages/gsd-cloud/dist/runtime-process.d.ts +32 -0
- package/packages/gsd-cloud/dist/runtime-process.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/runtime-process.js +640 -0
- package/packages/gsd-cloud/dist/runtime-process.js.map +1 -0
- package/packages/gsd-cloud/dist/runtime-process.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/runtime-process.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/runtime-process.test.js +543 -0
- package/packages/gsd-cloud/dist/runtime-process.test.js.map +1 -0
- package/packages/gsd-cloud/dist/runtime-telemetry.d.ts +117 -0
- package/packages/gsd-cloud/dist/runtime-telemetry.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/runtime-telemetry.js +291 -0
- package/packages/gsd-cloud/dist/runtime-telemetry.js.map +1 -0
- package/packages/gsd-cloud/dist/runtime-telemetry.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/runtime-telemetry.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/runtime-telemetry.test.js +434 -0
- package/packages/gsd-cloud/dist/runtime-telemetry.test.js.map +1 -0
- package/packages/gsd-cloud/package.json +2 -2
- package/packages/mcp-server/dist/cli-runner.d.ts +3 -0
- package/packages/mcp-server/dist/cli-runner.d.ts.map +1 -1
- package/packages/mcp-server/dist/cli-runner.js +119 -33
- package/packages/mcp-server/dist/cli-runner.js.map +1 -1
- package/packages/mcp-server/package.json +4 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/types.d.ts +2 -2
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/types.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/models.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +130 -2
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +101 -9
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/dist/models.js +18 -6
- package/packages/pi-ai/dist/models.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +3 -2
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-vertex.js.map +1 -1
- package/packages/pi-ai/dist/providers/google.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.d.ts +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.d.ts +1 -1
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +9 -1
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +3 -3
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.d.ts +5 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +54 -0
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.d.ts +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.js +1 -0
- package/packages/pi-coding-agent/dist/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/dist/theme/theme.d.ts +1 -1
- package/pkg/dist/theme/theme.d.ts.map +1 -1
- package/pkg/dist/theme/theme.js +1 -0
- package/pkg/dist/theme/theme.js.map +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/gsd/auto/loop.ts +48 -4
- package/src/resources/extensions/gsd/auto/run-unit.ts +20 -1
- package/src/resources/extensions/gsd/auto-model-selection.ts +1 -0
- package/src/resources/extensions/gsd/auto-start.ts +32 -9
- package/src/resources/extensions/gsd/auto-verification.ts +46 -12
- package/src/resources/extensions/gsd/auto-worktree-sync.ts +10 -3
- package/src/resources/extensions/gsd/auto.ts +13 -1
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +4 -3
- package/src/resources/extensions/gsd/docs/preferences-reference.md +12 -3
- package/src/resources/extensions/gsd/doctor-engine-checks.ts +42 -6
- package/src/resources/extensions/gsd/flat-phase-migration.ts +14 -0
- package/src/resources/extensions/gsd/gsd-db.ts +85 -33
- package/src/resources/extensions/gsd/model-cost-table.ts +14 -3
- package/src/resources/extensions/gsd/model-router.ts +10 -5
- package/src/resources/extensions/gsd/planning-subagent-registry.ts +18 -4
- package/src/resources/extensions/gsd/preferences-models.ts +54 -10
- package/src/resources/extensions/gsd/preferences-types.ts +10 -2
- package/src/resources/extensions/gsd/preferences-validation.ts +49 -6
- package/src/resources/extensions/gsd/preferences.ts +13 -0
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +3 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +156 -0
- package/src/resources/extensions/gsd/tests/auto-start-index-lock.test.ts +21 -1
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +74 -1
- package/src/resources/extensions/gsd/tests/doctor-scope-db-unavailable.test.ts +147 -0
- package/src/resources/extensions/gsd/tests/flat-phase-migration.test.ts +8 -9
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +13 -0
- package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +22 -7
- package/src/resources/extensions/gsd/tests/model-isolation.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/model-router.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +24 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +38 -1
- package/src/resources/extensions/gsd/tests/preferences.test.ts +71 -4
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/service-tier.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/thinking-level-resolution.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/verification-evidence.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/workflow-authority-faults.test.ts +238 -0
- package/src/resources/extensions/gsd/tests/workflow-authority-fixture.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/workflow-authority-fixture.ts +141 -0
- package/src/resources/extensions/gsd/tests/workflow-authority-projection-conflict.test.ts +177 -0
- package/src/resources/extensions/gsd/tests/workflow-fault-harness.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/workflow-fault-harness.ts +72 -0
- package/src/resources/extensions/gsd/tests/worktree-state-projection.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +60 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +40 -0
- package/src/resources/extensions/gsd/tools/plan-slice.ts +5 -1
- package/src/resources/extensions/gsd/verification-evidence.ts +5 -2
- package/src/resources/extensions/gsd/worktree-state-projection.ts +21 -24
- package/src/resources/extensions/ollama/ollama-chat-provider.ts +2 -2
- package/src/resources/extensions/ollama/tests/ollama-chat-provider-think.test.ts +4 -0
- package/src/resources/extensions/subagent/index.ts +1 -1
- /package/dist/web/standalone/.next/static/{V9MAVyYVPboQUB9KTTAMi → xwUaOqui04jIIFVsIBLiL}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{V9MAVyYVPboQUB9KTTAMi → xwUaOqui04jIIFVsIBLiL}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
// Project/App: Open GSD
|
|
2
|
+
// File Purpose: Contract tests for the token-free runtime telemetry consumed by desktop monitors.
|
|
3
|
+
import assert from "node:assert/strict";
|
|
4
|
+
import { mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { test } from "node:test";
|
|
8
|
+
import { clearRuntimeTelemetry, readRuntimeTelemetry, RuntimeTelemetryStore } from "./runtime-telemetry.js";
|
|
9
|
+
test("runtime telemetry persists connection state and traffic without credentials", async (t) => {
|
|
10
|
+
const root = makeTempDir(t, "gsd-cloud-telemetry-");
|
|
11
|
+
const configPath = join(root, "daemon.yaml");
|
|
12
|
+
const telemetryPath = join(root, "cloud-runtime-status.json");
|
|
13
|
+
const store = new RuntimeTelemetryStore(configPath, {
|
|
14
|
+
gatewayUrl: "https://cloud.example.com",
|
|
15
|
+
runtimeId: "runtime-1",
|
|
16
|
+
runtimeName: "MacBook",
|
|
17
|
+
});
|
|
18
|
+
store.connecting();
|
|
19
|
+
store.connected();
|
|
20
|
+
store.received('{"type":"tool_call","requestId":"request-1"}');
|
|
21
|
+
store.requestStarted({
|
|
22
|
+
requestId: "request-1",
|
|
23
|
+
projectAlias: "project-one",
|
|
24
|
+
toolName: "gsd_status",
|
|
25
|
+
receivedBytes: 48,
|
|
26
|
+
});
|
|
27
|
+
store.sent('{"type":"tool_result","requestId":"request-1","result":{}}');
|
|
28
|
+
store.requestFinished({
|
|
29
|
+
requestId: "request-1",
|
|
30
|
+
projectAlias: "project-one",
|
|
31
|
+
toolName: "gsd_status",
|
|
32
|
+
durationMs: 25,
|
|
33
|
+
outcome: "success",
|
|
34
|
+
});
|
|
35
|
+
await store.flush();
|
|
36
|
+
const raw = readFileSync(telemetryPath, "utf8");
|
|
37
|
+
const status = JSON.parse(raw);
|
|
38
|
+
assert.equal(status.version, 1);
|
|
39
|
+
assert.equal(status.state, "connected");
|
|
40
|
+
assert.equal(status.gateway_url, "https://cloud.example.com");
|
|
41
|
+
assert.equal(status.runtime_id, "runtime-1");
|
|
42
|
+
assert.equal(status.runtime_name, "MacBook");
|
|
43
|
+
assert.equal(status.connection_attempts, 1);
|
|
44
|
+
assert.equal(status.received_messages, 1);
|
|
45
|
+
assert.equal(status.sent_messages, 1);
|
|
46
|
+
assert.equal(status.received_bytes, Buffer.byteLength('{"type":"tool_call","requestId":"request-1"}'));
|
|
47
|
+
assert.equal(status.sent_bytes, Buffer.byteLength('{"type":"tool_result","requestId":"request-1","result":{}}'));
|
|
48
|
+
assert.equal(status.active_requests, 0);
|
|
49
|
+
assert.equal(raw.includes("device_token"), false);
|
|
50
|
+
assert.equal(statSync(telemetryPath).mode & 0o777, 0o600);
|
|
51
|
+
});
|
|
52
|
+
test("runtime telemetry removes credentials from gateway metadata", async (t) => {
|
|
53
|
+
const root = makeTempDir(t, "gsd-cloud-gateway-metadata-");
|
|
54
|
+
const telemetryPath = join(root, "cloud-runtime-status.json");
|
|
55
|
+
const credentialed = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
56
|
+
gatewayUrl: "https://user:password@cloud.example.com/runtime?access_token=secret#private",
|
|
57
|
+
});
|
|
58
|
+
await credentialed.flush();
|
|
59
|
+
const status = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
60
|
+
assert.equal(status.gateway_url, "https://cloud.example.com/runtime");
|
|
61
|
+
const malformed = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
62
|
+
gatewayUrl: "not a URL?access_token=secret#private",
|
|
63
|
+
});
|
|
64
|
+
await malformed.flush();
|
|
65
|
+
const raw = readFileSync(telemetryPath, "utf8");
|
|
66
|
+
assert.equal(JSON.parse(raw).gateway_url, "invalid gateway");
|
|
67
|
+
assert.equal(raw.includes("secret"), false);
|
|
68
|
+
assert.equal(raw.includes("private"), false);
|
|
69
|
+
const opaque = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
70
|
+
gatewayUrl: "javascript:access_token=opaque-secret",
|
|
71
|
+
});
|
|
72
|
+
await opaque.flush();
|
|
73
|
+
const opaqueRaw = readFileSync(telemetryPath, "utf8");
|
|
74
|
+
assert.equal(JSON.parse(opaqueRaw).gateway_url, "invalid gateway");
|
|
75
|
+
assert.equal(opaqueRaw.includes("opaque-secret"), false);
|
|
76
|
+
});
|
|
77
|
+
test("runtime telemetry publishes idle liveness until the runtime stops", async (t) => {
|
|
78
|
+
const root = makeTempDir(t, "gsd-cloud-idle-liveness-");
|
|
79
|
+
const telemetryPath = join(root, "cloud-runtime-status.json");
|
|
80
|
+
const store = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
81
|
+
gatewayUrl: "https://cloud.example.com",
|
|
82
|
+
});
|
|
83
|
+
t.after(async () => {
|
|
84
|
+
store.stopped();
|
|
85
|
+
await store.flush();
|
|
86
|
+
});
|
|
87
|
+
store.connecting();
|
|
88
|
+
store.connected();
|
|
89
|
+
await store.flush();
|
|
90
|
+
const initial = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
91
|
+
await new Promise((resolve) => setTimeout(resolve, 1_250));
|
|
92
|
+
const idle = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
93
|
+
assert.ok(new Date(idle.updated_at) > new Date(initial.updated_at));
|
|
94
|
+
assert.equal(idle.received_messages, initial.received_messages);
|
|
95
|
+
assert.equal(idle.sent_messages, initial.sent_messages);
|
|
96
|
+
assert.deepEqual(idle.recent_activity, initial.recent_activity);
|
|
97
|
+
store.stopped();
|
|
98
|
+
await store.flush();
|
|
99
|
+
const stopped = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
100
|
+
await new Promise((resolve) => setTimeout(resolve, 1_250));
|
|
101
|
+
const afterStop = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
102
|
+
assert.equal(afterStop.updated_at, stopped.updated_at);
|
|
103
|
+
});
|
|
104
|
+
test("runtime telemetry stops liveness after terminal startup failure", async (t) => {
|
|
105
|
+
const root = makeTempDir(t, "gsd-cloud-failed-liveness-");
|
|
106
|
+
const telemetryPath = join(root, "cloud-runtime-status.json");
|
|
107
|
+
const store = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
108
|
+
gatewayUrl: "invalid gateway",
|
|
109
|
+
});
|
|
110
|
+
t.after(async () => {
|
|
111
|
+
store.stopped();
|
|
112
|
+
await store.flush();
|
|
113
|
+
});
|
|
114
|
+
store.connecting();
|
|
115
|
+
store.socketError("invalid gateway");
|
|
116
|
+
store.failed();
|
|
117
|
+
await store.flush();
|
|
118
|
+
const failed = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
119
|
+
await new Promise((resolve) => setTimeout(resolve, 1_250));
|
|
120
|
+
const afterFailure = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
121
|
+
assert.equal(failed.state, "error");
|
|
122
|
+
assert.equal(failed.last_error, "invalid gateway");
|
|
123
|
+
assert.equal(afterFailure.updated_at, failed.updated_at);
|
|
124
|
+
});
|
|
125
|
+
test("runtime telemetry attributes requests and recent activity to advertised projects", async (t) => {
|
|
126
|
+
const root = makeTempDir(t, "gsd-cloud-project-telemetry-");
|
|
127
|
+
const configPath = join(root, "daemon.yaml");
|
|
128
|
+
const telemetryPath = join(root, "cloud-runtime-status.json");
|
|
129
|
+
const store = new RuntimeTelemetryStore(configPath, {
|
|
130
|
+
gatewayUrl: "https://cloud.example.com",
|
|
131
|
+
runtimeId: "runtime-1",
|
|
132
|
+
});
|
|
133
|
+
store.projectsAdvertised([
|
|
134
|
+
{
|
|
135
|
+
alias: "project-one",
|
|
136
|
+
path: "/work/project-one",
|
|
137
|
+
repoIdentity: "repo-one",
|
|
138
|
+
remoteLabel: "open-gsd/project-one",
|
|
139
|
+
markers: [".gsd"],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
alias: "project-two",
|
|
143
|
+
path: "/work/project-two",
|
|
144
|
+
repoIdentity: "repo-two",
|
|
145
|
+
markers: [".gsd"],
|
|
146
|
+
},
|
|
147
|
+
]);
|
|
148
|
+
store.requestStarted({
|
|
149
|
+
requestId: "request-1",
|
|
150
|
+
projectAlias: "project-one",
|
|
151
|
+
toolName: "gsd_execute",
|
|
152
|
+
receivedBytes: 128,
|
|
153
|
+
});
|
|
154
|
+
store.requestFinished({
|
|
155
|
+
requestId: "request-1",
|
|
156
|
+
projectAlias: "project-one",
|
|
157
|
+
toolName: "gsd_execute",
|
|
158
|
+
durationMs: 42,
|
|
159
|
+
outcome: "success",
|
|
160
|
+
});
|
|
161
|
+
store.sent("x".repeat(512), "/work/project-one");
|
|
162
|
+
store.sent("global");
|
|
163
|
+
await store.flush();
|
|
164
|
+
const status = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
165
|
+
assert.equal(status.projects?.length, 2);
|
|
166
|
+
assert.deepEqual(status.projects?.[0], {
|
|
167
|
+
alias: "project-one",
|
|
168
|
+
path: "/work/project-one",
|
|
169
|
+
repo_identity: "repo-one",
|
|
170
|
+
remote_label: "open-gsd/project-one",
|
|
171
|
+
state: "idle",
|
|
172
|
+
active_requests: 0,
|
|
173
|
+
active_tools: [],
|
|
174
|
+
request_count: 1,
|
|
175
|
+
error_count: 0,
|
|
176
|
+
received_bytes: 128,
|
|
177
|
+
sent_bytes: 512,
|
|
178
|
+
last_tool: "gsd_execute",
|
|
179
|
+
last_activity_at: status.projects?.[0]?.last_activity_at,
|
|
180
|
+
});
|
|
181
|
+
assert.deepEqual(status.projects?.[1], {
|
|
182
|
+
alias: "project-two",
|
|
183
|
+
path: "/work/project-two",
|
|
184
|
+
repo_identity: "repo-two",
|
|
185
|
+
state: "idle",
|
|
186
|
+
active_requests: 0,
|
|
187
|
+
active_tools: [],
|
|
188
|
+
request_count: 0,
|
|
189
|
+
error_count: 0,
|
|
190
|
+
received_bytes: 0,
|
|
191
|
+
sent_bytes: 0,
|
|
192
|
+
last_tool: null,
|
|
193
|
+
last_activity_at: null,
|
|
194
|
+
});
|
|
195
|
+
assert.equal(status.recent_activity?.length, 1);
|
|
196
|
+
assert.equal(status.recent_activity?.[0]?.project_alias, "project-one");
|
|
197
|
+
assert.equal(status.recent_activity?.[0]?.tool_name, "gsd_execute");
|
|
198
|
+
assert.equal(status.recent_activity?.[0]?.outcome, "success");
|
|
199
|
+
assert.equal(status.recent_activity?.[0]?.duration_ms, 42);
|
|
200
|
+
});
|
|
201
|
+
test("runtime telemetry tracks concurrent in-flight tool names", async (t) => {
|
|
202
|
+
const root = makeTempDir(t, "gsd-cloud-active-tools-");
|
|
203
|
+
const telemetryPath = join(root, "cloud-runtime-status.json");
|
|
204
|
+
const store = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
205
|
+
gatewayUrl: "https://cloud.example.com",
|
|
206
|
+
});
|
|
207
|
+
store.projectsAdvertised([{
|
|
208
|
+
alias: "project-one",
|
|
209
|
+
path: "/work/project-one",
|
|
210
|
+
repoIdentity: "repo-one",
|
|
211
|
+
markers: [".gsd"],
|
|
212
|
+
}]);
|
|
213
|
+
store.requestStarted({
|
|
214
|
+
requestId: "request-1",
|
|
215
|
+
projectPath: "/work/project-one",
|
|
216
|
+
toolName: "gsd_execute",
|
|
217
|
+
receivedBytes: 10,
|
|
218
|
+
});
|
|
219
|
+
store.requestStarted({
|
|
220
|
+
requestId: "request-2",
|
|
221
|
+
projectPath: "/work/project-one",
|
|
222
|
+
toolName: "gsd_status",
|
|
223
|
+
receivedBytes: 10,
|
|
224
|
+
});
|
|
225
|
+
await store.flush();
|
|
226
|
+
let status = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
227
|
+
assert.equal(status.projects[0]?.active_requests, 2);
|
|
228
|
+
assert.deepEqual(status.projects[0]?.active_tools, ["gsd_execute", "gsd_status"]);
|
|
229
|
+
store.requestFinished({
|
|
230
|
+
requestId: "request-1",
|
|
231
|
+
projectPath: "/work/project-one",
|
|
232
|
+
toolName: "gsd_execute",
|
|
233
|
+
durationMs: 5,
|
|
234
|
+
outcome: "success",
|
|
235
|
+
});
|
|
236
|
+
await store.flush();
|
|
237
|
+
status = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
238
|
+
assert.deepEqual(status.projects[0]?.active_tools, ["gsd_status"]);
|
|
239
|
+
});
|
|
240
|
+
test("runtime telemetry bounds recent project activity", async (t) => {
|
|
241
|
+
const root = makeTempDir(t, "gsd-cloud-project-telemetry-");
|
|
242
|
+
const configPath = join(root, "daemon.yaml");
|
|
243
|
+
const telemetryPath = join(root, "cloud-runtime-status.json");
|
|
244
|
+
const store = new RuntimeTelemetryStore(configPath, {
|
|
245
|
+
gatewayUrl: "https://cloud.example.com",
|
|
246
|
+
});
|
|
247
|
+
store.projectsAdvertised([{
|
|
248
|
+
alias: "project-one",
|
|
249
|
+
path: "/work/project-one",
|
|
250
|
+
repoIdentity: "repo-one",
|
|
251
|
+
markers: [".gsd"],
|
|
252
|
+
}]);
|
|
253
|
+
for (let index = 0; index < 55; index += 1) {
|
|
254
|
+
const requestId = `request-${index}`;
|
|
255
|
+
store.requestStarted({
|
|
256
|
+
requestId,
|
|
257
|
+
projectAlias: "project-one",
|
|
258
|
+
toolName: "gsd_status",
|
|
259
|
+
receivedBytes: 10,
|
|
260
|
+
});
|
|
261
|
+
store.requestFinished({
|
|
262
|
+
requestId,
|
|
263
|
+
projectAlias: "project-one",
|
|
264
|
+
toolName: "gsd_status",
|
|
265
|
+
durationMs: index,
|
|
266
|
+
outcome: index === 54 ? "error" : "success",
|
|
267
|
+
...(index === 54 ? { error: "fixture failure" } : {}),
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
store.sent("global");
|
|
271
|
+
await store.flush();
|
|
272
|
+
const status = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
273
|
+
assert.equal(status.recent_activity?.length, 50);
|
|
274
|
+
assert.equal(status.recent_activity?.[0]?.request_id, "request-5");
|
|
275
|
+
assert.equal(status.recent_activity?.at(-1)?.request_id, "request-54");
|
|
276
|
+
assert.equal(status.recent_activity?.at(-1)?.error, "fixture failure");
|
|
277
|
+
assert.equal(status.projects?.[0]?.error_count, 1);
|
|
278
|
+
assert.equal(status.projects?.[0]?.sent_bytes, 0);
|
|
279
|
+
});
|
|
280
|
+
test("runtime telemetry records reconnects and the latest failure", async (t) => {
|
|
281
|
+
const root = makeTempDir(t, "gsd-cloud-telemetry-");
|
|
282
|
+
const configPath = join(root, "daemon.yaml");
|
|
283
|
+
const telemetryPath = join(root, "cloud-runtime-status.json");
|
|
284
|
+
const store = new RuntimeTelemetryStore(configPath, {
|
|
285
|
+
gatewayUrl: "https://cloud.example.com",
|
|
286
|
+
runtimeId: "runtime-1",
|
|
287
|
+
});
|
|
288
|
+
store.connecting();
|
|
289
|
+
store.connected();
|
|
290
|
+
store.disconnected("socket closed");
|
|
291
|
+
store.connecting();
|
|
292
|
+
await store.flush();
|
|
293
|
+
const status = JSON.parse(readFileSync(telemetryPath, "utf8"));
|
|
294
|
+
assert.equal(status.state, "reconnecting");
|
|
295
|
+
assert.equal(status.connection_attempts, 2);
|
|
296
|
+
assert.equal(status.reconnects, 1);
|
|
297
|
+
assert.equal(status.last_error, "socket closed");
|
|
298
|
+
});
|
|
299
|
+
test("runtime telemetry distinguishes projects with duplicate aliases by path", async (t) => {
|
|
300
|
+
const root = makeTempDir(t, "gsd-cloud-duplicate-alias-");
|
|
301
|
+
const store = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
302
|
+
gatewayUrl: "https://cloud.example.com",
|
|
303
|
+
});
|
|
304
|
+
store.projectsAdvertised([
|
|
305
|
+
{ alias: "app", path: "/work/one/app", repoIdentity: "repo-one", markers: [".gsd"] },
|
|
306
|
+
{ alias: "app", path: "/work/two/app", repoIdentity: "repo-two", markers: [".gsd"] },
|
|
307
|
+
]);
|
|
308
|
+
store.requestStarted({
|
|
309
|
+
requestId: "request-2",
|
|
310
|
+
projectAlias: "app",
|
|
311
|
+
projectPath: "/work/two/app",
|
|
312
|
+
toolName: "gsd_status",
|
|
313
|
+
receivedBytes: 25,
|
|
314
|
+
});
|
|
315
|
+
store.requestFinished({
|
|
316
|
+
requestId: "request-2",
|
|
317
|
+
projectAlias: "app",
|
|
318
|
+
projectPath: "/work/two/app",
|
|
319
|
+
toolName: "gsd_status",
|
|
320
|
+
durationMs: 10,
|
|
321
|
+
outcome: "success",
|
|
322
|
+
});
|
|
323
|
+
store.sent("result", "/work/two/app");
|
|
324
|
+
await store.flush();
|
|
325
|
+
const status = JSON.parse(readFileSync(join(root, "cloud-runtime-status.json"), "utf8"));
|
|
326
|
+
assert.deepEqual(status.projects.map(({ path, request_count, received_bytes, sent_bytes }) => ({
|
|
327
|
+
path, request_count, received_bytes, sent_bytes,
|
|
328
|
+
})), [
|
|
329
|
+
{ path: "/work/one/app", request_count: 0, received_bytes: 0, sent_bytes: 0 },
|
|
330
|
+
{ path: "/work/two/app", request_count: 1, received_bytes: 25, sent_bytes: 6 },
|
|
331
|
+
]);
|
|
332
|
+
assert.deepEqual(status.recent_activity, [{
|
|
333
|
+
request_id: "request-2",
|
|
334
|
+
project_alias: "app",
|
|
335
|
+
project_path: "/work/two/app",
|
|
336
|
+
tool_name: "gsd_status",
|
|
337
|
+
outcome: "success",
|
|
338
|
+
duration_ms: 10,
|
|
339
|
+
at: status.recent_activity[0]?.at,
|
|
340
|
+
}]);
|
|
341
|
+
});
|
|
342
|
+
test("runtime telemetry keeps same-repository worktrees distinct", async (t) => {
|
|
343
|
+
const root = makeTempDir(t, "gsd-cloud-worktree-telemetry-");
|
|
344
|
+
const store = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
345
|
+
gatewayUrl: "https://cloud.example.com",
|
|
346
|
+
});
|
|
347
|
+
store.projectsAdvertised([
|
|
348
|
+
{ alias: "app", path: "/work/one/app", repoIdentity: "shared-repo", markers: [".gsd"] },
|
|
349
|
+
{ alias: "app-copy", path: "/work/two/app", repoIdentity: "shared-repo", markers: [".gsd"] },
|
|
350
|
+
]);
|
|
351
|
+
store.requestStarted({
|
|
352
|
+
requestId: "request-1",
|
|
353
|
+
projectPath: "/work/one/app",
|
|
354
|
+
toolName: "gsd_status",
|
|
355
|
+
receivedBytes: 10,
|
|
356
|
+
});
|
|
357
|
+
store.requestFinished({
|
|
358
|
+
requestId: "request-1",
|
|
359
|
+
projectPath: "/work/one/app",
|
|
360
|
+
toolName: "gsd_status",
|
|
361
|
+
durationMs: 1,
|
|
362
|
+
outcome: "success",
|
|
363
|
+
});
|
|
364
|
+
store.projectsAdvertised([
|
|
365
|
+
{ alias: "app", path: "/work/one/app", repoIdentity: "shared-repo", markers: [".gsd"] },
|
|
366
|
+
{ alias: "app-copy", path: "/work/two/app", repoIdentity: "shared-repo", markers: [".gsd"] },
|
|
367
|
+
]);
|
|
368
|
+
await store.flush();
|
|
369
|
+
const status = JSON.parse(readFileSync(join(root, "cloud-runtime-status.json"), "utf8"));
|
|
370
|
+
assert.deepEqual(status.projects.map(({ path, request_count }) => ({ path, request_count })), [
|
|
371
|
+
{ path: "/work/one/app", request_count: 1 },
|
|
372
|
+
{ path: "/work/two/app", request_count: 0 },
|
|
373
|
+
]);
|
|
374
|
+
});
|
|
375
|
+
test("runtime telemetry removes credentials from remote labels", async (t) => {
|
|
376
|
+
const root = makeTempDir(t, "gsd-cloud-remote-label-");
|
|
377
|
+
const store = new RuntimeTelemetryStore(join(root, "daemon.yaml"), {
|
|
378
|
+
gatewayUrl: "https://cloud.example.com",
|
|
379
|
+
});
|
|
380
|
+
store.projectsAdvertised([
|
|
381
|
+
{
|
|
382
|
+
alias: "project-one",
|
|
383
|
+
path: "/work/project-one",
|
|
384
|
+
repoIdentity: "repo-one",
|
|
385
|
+
remoteLabel: "https://token:secret@github.com/open-gsd/project-one.git?access_token=query-secret#fragment-secret",
|
|
386
|
+
markers: [".gsd"],
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
alias: "project-two",
|
|
390
|
+
path: "/work/project-two",
|
|
391
|
+
repoIdentity: "repo-two",
|
|
392
|
+
remoteLabel: "git@github.com:open-gsd/project-two.git?token=scp-secret#scp-fragment",
|
|
393
|
+
markers: [".gsd"],
|
|
394
|
+
},
|
|
395
|
+
]);
|
|
396
|
+
await store.flush();
|
|
397
|
+
const raw = readFileSync(join(root, "cloud-runtime-status.json"), "utf8");
|
|
398
|
+
const status = JSON.parse(raw);
|
|
399
|
+
assert.equal(status.projects[0]?.remote_label, "https://github.com/open-gsd/project-one.git");
|
|
400
|
+
assert.equal(status.projects[1]?.remote_label, "github.com:open-gsd/project-two.git");
|
|
401
|
+
assert.equal(raw.includes("token"), false);
|
|
402
|
+
assert.equal(raw.includes("secret"), false);
|
|
403
|
+
assert.equal(raw.includes("fragment"), false);
|
|
404
|
+
});
|
|
405
|
+
test("runtime telemetry isolates persistence failures", async (t) => {
|
|
406
|
+
const root = makeTempDir(t, "gsd-cloud-persistence-failure-");
|
|
407
|
+
const blocker = join(root, "not-a-directory");
|
|
408
|
+
writeFileSync(blocker, "fixture");
|
|
409
|
+
const store = new RuntimeTelemetryStore(join(blocker, "daemon.yaml"), {
|
|
410
|
+
gatewayUrl: "https://cloud.example.com",
|
|
411
|
+
});
|
|
412
|
+
store.connected();
|
|
413
|
+
await store.flush();
|
|
414
|
+
});
|
|
415
|
+
test("clearRuntimeTelemetry removes the persisted snapshot for the config namespace", async (t) => {
|
|
416
|
+
const root = makeTempDir(t, "gsd-cloud-clear-telemetry-");
|
|
417
|
+
const configPath = join(root, "daemon.yaml");
|
|
418
|
+
const store = new RuntimeTelemetryStore(configPath, {
|
|
419
|
+
gatewayUrl: "https://cloud.example.com",
|
|
420
|
+
runtimeId: "runtime-1",
|
|
421
|
+
});
|
|
422
|
+
store.connected();
|
|
423
|
+
await store.flush();
|
|
424
|
+
assert.notEqual(readRuntimeTelemetry(configPath), null);
|
|
425
|
+
clearRuntimeTelemetry(configPath);
|
|
426
|
+
assert.equal(readRuntimeTelemetry(configPath), null);
|
|
427
|
+
clearRuntimeTelemetry(configPath);
|
|
428
|
+
});
|
|
429
|
+
function makeTempDir(t, prefix) {
|
|
430
|
+
const root = mkdtempSync(join(tmpdir(), prefix));
|
|
431
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
432
|
+
return root;
|
|
433
|
+
}
|
|
434
|
+
//# sourceMappingURL=runtime-telemetry.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-telemetry.test.js","sourceRoot":"","sources":["../src/runtime-telemetry.test.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,kGAAkG;AAClG,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAoB,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE5G,IAAI,CAAC,6EAA6E,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC9F,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;I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EAAE,CAAC;IAClB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;IACpB,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;IAExD,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAElC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;IACrD,qBAAqB,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC,CAAC,CAAC;AAEH,SAAS,WAAW,CAAC,CAAc,EAAE,MAAc;IACjD,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// Project/App: Open GSD\n// File Purpose: Contract tests for the token-free runtime telemetry consumed by desktop monitors.\nimport assert from \"node:assert/strict\";\nimport { mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { test, type TestContext } from \"node:test\";\nimport { clearRuntimeTelemetry, readRuntimeTelemetry, RuntimeTelemetryStore } from \"./runtime-telemetry.js\";\n\ntest(\"runtime telemetry persists connection state and traffic without credentials\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-telemetry-\");\n const configPath = join(root, \"daemon.yaml\");\n const telemetryPath = join(root, \"cloud-runtime-status.json\");\n const store = new RuntimeTelemetryStore(configPath, {\n gatewayUrl: \"https://cloud.example.com\",\n runtimeId: \"runtime-1\",\n runtimeName: \"MacBook\",\n });\n\n store.connecting();\n store.connected();\n store.received('{\"type\":\"tool_call\",\"requestId\":\"request-1\"}');\n store.requestStarted({\n requestId: \"request-1\",\n projectAlias: \"project-one\",\n toolName: \"gsd_status\",\n receivedBytes: 48,\n });\n store.sent('{\"type\":\"tool_result\",\"requestId\":\"request-1\",\"result\":{}}');\n store.requestFinished({\n requestId: \"request-1\",\n projectAlias: \"project-one\",\n toolName: \"gsd_status\",\n durationMs: 25,\n outcome: \"success\",\n });\n await store.flush();\n\n const raw = readFileSync(telemetryPath, \"utf8\");\n const status = JSON.parse(raw) as Record<string, unknown>;\n assert.equal(status.version, 1);\n assert.equal(status.state, \"connected\");\n assert.equal(status.gateway_url, \"https://cloud.example.com\");\n assert.equal(status.runtime_id, \"runtime-1\");\n assert.equal(status.runtime_name, \"MacBook\");\n assert.equal(status.connection_attempts, 1);\n assert.equal(status.received_messages, 1);\n assert.equal(status.sent_messages, 1);\n assert.equal(status.received_bytes, Buffer.byteLength('{\"type\":\"tool_call\",\"requestId\":\"request-1\"}'));\n assert.equal(status.sent_bytes, Buffer.byteLength('{\"type\":\"tool_result\",\"requestId\":\"request-1\",\"result\":{}}'));\n assert.equal(status.active_requests, 0);\n assert.equal(raw.includes(\"device_token\"), false);\n assert.equal(statSync(telemetryPath).mode & 0o777, 0o600);\n});\n\ntest(\"runtime telemetry removes credentials from gateway metadata\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-gateway-metadata-\");\n const telemetryPath = join(root, \"cloud-runtime-status.json\");\n\n const credentialed = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"https://user:password@cloud.example.com/runtime?access_token=secret#private\",\n });\n await credentialed.flush();\n const status = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as { gateway_url: string };\n assert.equal(status.gateway_url, \"https://cloud.example.com/runtime\");\n\n const malformed = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"not a URL?access_token=secret#private\",\n });\n await malformed.flush();\n const raw = readFileSync(telemetryPath, \"utf8\");\n assert.equal((JSON.parse(raw) as { gateway_url: string }).gateway_url, \"invalid gateway\");\n assert.equal(raw.includes(\"secret\"), false);\n assert.equal(raw.includes(\"private\"), false);\n\n const opaque = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"javascript:access_token=opaque-secret\",\n });\n await opaque.flush();\n const opaqueRaw = readFileSync(telemetryPath, \"utf8\");\n assert.equal((JSON.parse(opaqueRaw) as { gateway_url: string }).gateway_url, \"invalid gateway\");\n assert.equal(opaqueRaw.includes(\"opaque-secret\"), false);\n});\n\ntest(\"runtime telemetry publishes idle liveness until the runtime stops\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-idle-liveness-\");\n const telemetryPath = join(root, \"cloud-runtime-status.json\");\n const store = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"https://cloud.example.com\",\n });\n t.after(async () => {\n store.stopped();\n await store.flush();\n });\n\n store.connecting();\n store.connected();\n await store.flush();\n const initial = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as {\n updated_at: string;\n received_messages: number;\n sent_messages: number;\n recent_activity: unknown[];\n };\n\n await new Promise((resolve) => setTimeout(resolve, 1_250));\n const idle = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as typeof initial;\n assert.ok(new Date(idle.updated_at) > new Date(initial.updated_at));\n assert.equal(idle.received_messages, initial.received_messages);\n assert.equal(idle.sent_messages, initial.sent_messages);\n assert.deepEqual(idle.recent_activity, initial.recent_activity);\n\n store.stopped();\n await store.flush();\n const stopped = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as typeof initial;\n await new Promise((resolve) => setTimeout(resolve, 1_250));\n const afterStop = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as typeof initial;\n assert.equal(afterStop.updated_at, stopped.updated_at);\n});\n\ntest(\"runtime telemetry stops liveness after terminal startup failure\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-failed-liveness-\");\n const telemetryPath = join(root, \"cloud-runtime-status.json\");\n const store = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"invalid gateway\",\n });\n t.after(async () => {\n store.stopped();\n await store.flush();\n });\n\n store.connecting();\n store.socketError(\"invalid gateway\");\n store.failed();\n await store.flush();\n const failed = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as {\n state: string;\n updated_at: string;\n last_error: string;\n };\n await new Promise((resolve) => setTimeout(resolve, 1_250));\n const afterFailure = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as typeof failed;\n\n assert.equal(failed.state, \"error\");\n assert.equal(failed.last_error, \"invalid gateway\");\n assert.equal(afterFailure.updated_at, failed.updated_at);\n});\n\ntest(\"runtime telemetry attributes requests and recent activity to advertised projects\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-project-telemetry-\");\n const configPath = join(root, \"daemon.yaml\");\n const telemetryPath = join(root, \"cloud-runtime-status.json\");\n const store = new RuntimeTelemetryStore(configPath, {\n gatewayUrl: \"https://cloud.example.com\",\n runtimeId: \"runtime-1\",\n });\n\n store.projectsAdvertised([\n {\n alias: \"project-one\",\n path: \"/work/project-one\",\n repoIdentity: \"repo-one\",\n remoteLabel: \"open-gsd/project-one\",\n markers: [\".gsd\"],\n },\n {\n alias: \"project-two\",\n path: \"/work/project-two\",\n repoIdentity: \"repo-two\",\n markers: [\".gsd\"],\n },\n ]);\n store.requestStarted({\n requestId: \"request-1\",\n projectAlias: \"project-one\",\n toolName: \"gsd_execute\",\n receivedBytes: 128,\n });\n store.requestFinished({\n requestId: \"request-1\",\n projectAlias: \"project-one\",\n toolName: \"gsd_execute\",\n durationMs: 42,\n outcome: \"success\",\n });\n store.sent(\"x\".repeat(512), \"/work/project-one\");\n store.sent(\"global\");\n await store.flush();\n\n const status = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as {\n projects?: Array<Record<string, unknown>>;\n recent_activity?: Array<Record<string, unknown>>;\n };\n assert.equal(status.projects?.length, 2);\n assert.deepEqual(status.projects?.[0], {\n alias: \"project-one\",\n path: \"/work/project-one\",\n repo_identity: \"repo-one\",\n remote_label: \"open-gsd/project-one\",\n state: \"idle\",\n active_requests: 0,\n active_tools: [],\n request_count: 1,\n error_count: 0,\n received_bytes: 128,\n sent_bytes: 512,\n last_tool: \"gsd_execute\",\n last_activity_at: status.projects?.[0]?.last_activity_at,\n });\n assert.deepEqual(status.projects?.[1], {\n alias: \"project-two\",\n path: \"/work/project-two\",\n repo_identity: \"repo-two\",\n state: \"idle\",\n active_requests: 0,\n active_tools: [],\n request_count: 0,\n error_count: 0,\n received_bytes: 0,\n sent_bytes: 0,\n last_tool: null,\n last_activity_at: null,\n });\n assert.equal(status.recent_activity?.length, 1);\n assert.equal(status.recent_activity?.[0]?.project_alias, \"project-one\");\n assert.equal(status.recent_activity?.[0]?.tool_name, \"gsd_execute\");\n assert.equal(status.recent_activity?.[0]?.outcome, \"success\");\n assert.equal(status.recent_activity?.[0]?.duration_ms, 42);\n});\n\ntest(\"runtime telemetry tracks concurrent in-flight tool names\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-active-tools-\");\n const telemetryPath = join(root, \"cloud-runtime-status.json\");\n const store = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"https://cloud.example.com\",\n });\n store.projectsAdvertised([{\n alias: \"project-one\",\n path: \"/work/project-one\",\n repoIdentity: \"repo-one\",\n markers: [\".gsd\"],\n }]);\n\n store.requestStarted({\n requestId: \"request-1\",\n projectPath: \"/work/project-one\",\n toolName: \"gsd_execute\",\n receivedBytes: 10,\n });\n store.requestStarted({\n requestId: \"request-2\",\n projectPath: \"/work/project-one\",\n toolName: \"gsd_status\",\n receivedBytes: 10,\n });\n await store.flush();\n\n let status = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as {\n projects: Array<{ active_requests: number; active_tools: string[] }>;\n };\n assert.equal(status.projects[0]?.active_requests, 2);\n assert.deepEqual(status.projects[0]?.active_tools, [\"gsd_execute\", \"gsd_status\"]);\n\n store.requestFinished({\n requestId: \"request-1\",\n projectPath: \"/work/project-one\",\n toolName: \"gsd_execute\",\n durationMs: 5,\n outcome: \"success\",\n });\n await store.flush();\n status = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as typeof status;\n assert.deepEqual(status.projects[0]?.active_tools, [\"gsd_status\"]);\n});\n\ntest(\"runtime telemetry bounds recent project activity\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-project-telemetry-\");\n const configPath = join(root, \"daemon.yaml\");\n const telemetryPath = join(root, \"cloud-runtime-status.json\");\n const store = new RuntimeTelemetryStore(configPath, {\n gatewayUrl: \"https://cloud.example.com\",\n });\n\n store.projectsAdvertised([{\n alias: \"project-one\",\n path: \"/work/project-one\",\n repoIdentity: \"repo-one\",\n markers: [\".gsd\"],\n }]);\n for (let index = 0; index < 55; index += 1) {\n const requestId = `request-${index}`;\n store.requestStarted({\n requestId,\n projectAlias: \"project-one\",\n toolName: \"gsd_status\",\n receivedBytes: 10,\n });\n store.requestFinished({\n requestId,\n projectAlias: \"project-one\",\n toolName: \"gsd_status\",\n durationMs: index,\n outcome: index === 54 ? \"error\" : \"success\",\n ...(index === 54 ? { error: \"fixture failure\" } : {}),\n });\n }\n store.sent(\"global\");\n await store.flush();\n\n const status = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as {\n projects?: Array<{ error_count?: number; sent_bytes?: number }>;\n recent_activity?: Array<{ request_id?: string; error?: string }>;\n };\n assert.equal(status.recent_activity?.length, 50);\n assert.equal(status.recent_activity?.[0]?.request_id, \"request-5\");\n assert.equal(status.recent_activity?.at(-1)?.request_id, \"request-54\");\n assert.equal(status.recent_activity?.at(-1)?.error, \"fixture failure\");\n assert.equal(status.projects?.[0]?.error_count, 1);\n assert.equal(status.projects?.[0]?.sent_bytes, 0);\n});\n\ntest(\"runtime telemetry records reconnects and the latest failure\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-telemetry-\");\n const configPath = join(root, \"daemon.yaml\");\n const telemetryPath = join(root, \"cloud-runtime-status.json\");\n const store = new RuntimeTelemetryStore(configPath, {\n gatewayUrl: \"https://cloud.example.com\",\n runtimeId: \"runtime-1\",\n });\n\n store.connecting();\n store.connected();\n store.disconnected(\"socket closed\");\n store.connecting();\n await store.flush();\n\n const status = JSON.parse(readFileSync(telemetryPath, \"utf8\")) as Record<string, unknown>;\n assert.equal(status.state, \"reconnecting\");\n assert.equal(status.connection_attempts, 2);\n assert.equal(status.reconnects, 1);\n assert.equal(status.last_error, \"socket closed\");\n});\n\ntest(\"runtime telemetry distinguishes projects with duplicate aliases by path\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-duplicate-alias-\");\n const store = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"https://cloud.example.com\",\n });\n\n store.projectsAdvertised([\n { alias: \"app\", path: \"/work/one/app\", repoIdentity: \"repo-one\", markers: [\".gsd\"] },\n { alias: \"app\", path: \"/work/two/app\", repoIdentity: \"repo-two\", markers: [\".gsd\"] },\n ]);\n store.requestStarted({\n requestId: \"request-2\",\n projectAlias: \"app\",\n projectPath: \"/work/two/app\",\n toolName: \"gsd_status\",\n receivedBytes: 25,\n });\n store.requestFinished({\n requestId: \"request-2\",\n projectAlias: \"app\",\n projectPath: \"/work/two/app\",\n toolName: \"gsd_status\",\n durationMs: 10,\n outcome: \"success\",\n });\n store.sent(\"result\", \"/work/two/app\");\n await store.flush();\n\n const status = JSON.parse(readFileSync(join(root, \"cloud-runtime-status.json\"), \"utf8\")) as {\n projects: Array<{ path: string; request_count: number; received_bytes: number; sent_bytes: number }>;\n recent_activity: Array<Record<string, unknown>>;\n };\n assert.deepEqual(status.projects.map(({ path, request_count, received_bytes, sent_bytes }) => ({\n path, request_count, received_bytes, sent_bytes,\n })), [\n { path: \"/work/one/app\", request_count: 0, received_bytes: 0, sent_bytes: 0 },\n { path: \"/work/two/app\", request_count: 1, received_bytes: 25, sent_bytes: 6 },\n ]);\n assert.deepEqual(status.recent_activity, [{\n request_id: \"request-2\",\n project_alias: \"app\",\n project_path: \"/work/two/app\",\n tool_name: \"gsd_status\",\n outcome: \"success\",\n duration_ms: 10,\n at: status.recent_activity[0]?.at,\n }]);\n});\n\ntest(\"runtime telemetry keeps same-repository worktrees distinct\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-worktree-telemetry-\");\n const store = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"https://cloud.example.com\",\n });\n\n store.projectsAdvertised([\n { alias: \"app\", path: \"/work/one/app\", repoIdentity: \"shared-repo\", markers: [\".gsd\"] },\n { alias: \"app-copy\", path: \"/work/two/app\", repoIdentity: \"shared-repo\", markers: [\".gsd\"] },\n ]);\n store.requestStarted({\n requestId: \"request-1\",\n projectPath: \"/work/one/app\",\n toolName: \"gsd_status\",\n receivedBytes: 10,\n });\n store.requestFinished({\n requestId: \"request-1\",\n projectPath: \"/work/one/app\",\n toolName: \"gsd_status\",\n durationMs: 1,\n outcome: \"success\",\n });\n store.projectsAdvertised([\n { alias: \"app\", path: \"/work/one/app\", repoIdentity: \"shared-repo\", markers: [\".gsd\"] },\n { alias: \"app-copy\", path: \"/work/two/app\", repoIdentity: \"shared-repo\", markers: [\".gsd\"] },\n ]);\n await store.flush();\n\n const status = JSON.parse(readFileSync(join(root, \"cloud-runtime-status.json\"), \"utf8\")) as {\n projects: Array<{ path: string; request_count: number }>;\n };\n assert.deepEqual(\n status.projects.map(({ path, request_count }) => ({ path, request_count })),\n [\n { path: \"/work/one/app\", request_count: 1 },\n { path: \"/work/two/app\", request_count: 0 },\n ],\n );\n});\n\ntest(\"runtime telemetry removes credentials from remote labels\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-remote-label-\");\n const store = new RuntimeTelemetryStore(join(root, \"daemon.yaml\"), {\n gatewayUrl: \"https://cloud.example.com\",\n });\n\n store.projectsAdvertised([\n {\n alias: \"project-one\",\n path: \"/work/project-one\",\n repoIdentity: \"repo-one\",\n remoteLabel: \"https://token:secret@github.com/open-gsd/project-one.git?access_token=query-secret#fragment-secret\",\n markers: [\".gsd\"],\n },\n {\n alias: \"project-two\",\n path: \"/work/project-two\",\n repoIdentity: \"repo-two\",\n remoteLabel: \"git@github.com:open-gsd/project-two.git?token=scp-secret#scp-fragment\",\n markers: [\".gsd\"],\n },\n ]);\n await store.flush();\n\n const raw = readFileSync(join(root, \"cloud-runtime-status.json\"), \"utf8\");\n const status = JSON.parse(raw) as { projects: Array<{ remote_label?: string }> };\n assert.equal(status.projects[0]?.remote_label, \"https://github.com/open-gsd/project-one.git\");\n assert.equal(status.projects[1]?.remote_label, \"github.com:open-gsd/project-two.git\");\n assert.equal(raw.includes(\"token\"), false);\n assert.equal(raw.includes(\"secret\"), false);\n assert.equal(raw.includes(\"fragment\"), false);\n});\n\ntest(\"runtime telemetry isolates persistence failures\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-persistence-failure-\");\n const blocker = join(root, \"not-a-directory\");\n writeFileSync(blocker, \"fixture\");\n const store = new RuntimeTelemetryStore(join(blocker, \"daemon.yaml\"), {\n gatewayUrl: \"https://cloud.example.com\",\n });\n\n store.connected();\n await store.flush();\n});\n\ntest(\"clearRuntimeTelemetry removes the persisted snapshot for the config namespace\", async (t) => {\n const root = makeTempDir(t, \"gsd-cloud-clear-telemetry-\");\n const configPath = join(root, \"daemon.yaml\");\n const store = new RuntimeTelemetryStore(configPath, {\n gatewayUrl: \"https://cloud.example.com\",\n runtimeId: \"runtime-1\",\n });\n store.connected();\n await store.flush();\n assert.notEqual(readRuntimeTelemetry(configPath), null);\n\n clearRuntimeTelemetry(configPath);\n\n assert.equal(readRuntimeTelemetry(configPath), null);\n clearRuntimeTelemetry(configPath);\n});\n\nfunction makeTempDir(t: TestContext, prefix: string): string {\n const root = mkdtempSync(join(tmpdir(), prefix));\n t.after(() => rmSync(root, { recursive: true, force: true }));\n return root;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengsd/gsd-cloud",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0-dev.a5e42e99",
|
|
4
4
|
"description": "Standalone CLI agent that connects a local GSD runtime to GSD Cloud (cloud.opengsd.net)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "node ../../scripts/clean-package-dist.cjs && tsc -p tsconfig.json --incremental false",
|
|
20
|
-
"test": "pnpm run build && node --test dist/inject-gateway.test.js dist/cloud-gateway-lookup.test.js dist/cloud-config.test.js dist/device-flow.test.js dist/cloud-runtime.test.js dist/executors/mcp-stdio-client.test.js dist/executors/gsd-pi-executor.test.js"
|
|
20
|
+
"test": "pnpm run build && node --test dist/inject-gateway.test.js dist/cloud-gateway-lookup.test.js dist/cloud-config.test.js dist/device-flow.test.js dist/cloud-runtime.test.js dist/runtime-telemetry.test.js dist/runtime-process.test.js dist/background-cli.test.js dist/executors/mcp-stdio-client.test.js dist/executors/gsd-pi-executor.test.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"ws": "^8.21.0",
|
|
@@ -34,6 +34,9 @@ export interface RunMcpServerCliOptions {
|
|
|
34
34
|
clearInterval?: typeof clearInterval;
|
|
35
35
|
isOrphaned?: () => boolean;
|
|
36
36
|
cleanupStepTimeoutMs?: number;
|
|
37
|
+
stdinIdleTimeoutMs?: number;
|
|
38
|
+
stdinIdleCheckIntervalMs?: number;
|
|
39
|
+
orphanParentLossCheckIntervalMs?: number;
|
|
37
40
|
}
|
|
38
41
|
export declare function runMcpServerCli(options?: RunMcpServerCliOptions): Promise<void>;
|
|
39
42
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-runner.d.ts","sourceRoot":"","sources":["../src/cli-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"cli-runner.d.ts","sourceRoot":"","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