@arnilo/prism-hosts 0.0.0-stage → 0.13.1
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/CHANGELOG.md +394 -0
- package/LICENSE +21 -0
- package/README.md +34 -2
- package/acp/README.md +87 -0
- package/acp/src/capabilities.ts +184 -0
- package/acp/src/errors.ts +24 -0
- package/acp/src/host.ts +36 -0
- package/acp/src/index.ts +25 -0
- package/acp/src/limits.ts +49 -0
- package/acp/src/mapper.ts +419 -0
- package/acp/src/permission.ts +37 -0
- package/acp/src/projection.ts +39 -0
- package/acp/src/prompt.ts +170 -0
- package/acp/src/serve.ts +345 -0
- package/acp/src/session-map.ts +49 -0
- package/ag-ui/README.md +56 -0
- package/ag-ui/src/a2ui.ts +570 -0
- package/ag-ui/src/ag-ui-mapper.ts +507 -0
- package/ag-ui/src/encrypted-value.ts +40 -0
- package/ag-ui/src/errors.ts +29 -0
- package/ag-ui/src/handler.ts +642 -0
- package/ag-ui/src/index.ts +177 -0
- package/ag-ui/src/input.ts +190 -0
- package/ag-ui/src/limits.ts +279 -0
- package/ag-ui/src/mcp-apps.ts +256 -0
- package/ag-ui/src/mcp.ts +94 -0
- package/ag-ui/src/projection.ts +201 -0
- package/ag-ui/src/projectors.ts +272 -0
- package/ag-ui/src/renderer/bind.ts +152 -0
- package/ag-ui/src/renderer/core.ts +270 -0
- package/ag-ui/src/renderer/index.ts +165 -0
- package/ag-ui/src/replay.ts +189 -0
- package/ag-ui/src/types.ts +66 -0
- package/channels/README.md +139 -0
- package/channels/src/admission.ts +8 -0
- package/channels/src/approvals.ts +262 -0
- package/channels/src/checkpoint-contract.ts +97 -0
- package/channels/src/delivery.ts +116 -0
- package/channels/src/host-ui.ts +356 -0
- package/channels/src/identity.ts +46 -0
- package/channels/src/index.ts +82 -0
- package/channels/src/limits.ts +49 -0
- package/channels/src/memory-stores.ts +112 -0
- package/channels/src/pairing.ts +178 -0
- package/channels/src/runtime-admit.ts +389 -0
- package/channels/src/runtime-core.ts +621 -0
- package/channels/src/runtime-reconcile.ts +299 -0
- package/channels/src/runtime-turn.ts +664 -0
- package/channels/src/runtime-types.ts +95 -0
- package/channels/src/runtime.ts +86 -0
- package/channels/src/secret-ref.ts +42 -0
- package/channels/src/signal.ts +790 -0
- package/channels/src/state.ts +355 -0
- package/channels/src/telegram.ts +1317 -0
- package/channels/src/types.ts +442 -0
- package/devtools/README.md +92 -0
- package/devtools/bin/prism-devtools.ts +63 -0
- package/devtools/src/args.ts +71 -0
- package/devtools/src/bun.d.ts +27 -0
- package/devtools/src/compare.ts +190 -0
- package/devtools/src/errors.ts +15 -0
- package/devtools/src/index.ts +25 -0
- package/devtools/src/replay.ts +36 -0
- package/devtools/src/security.ts +80 -0
- package/devtools/src/serve.ts +259 -0
- package/devtools/src/ui/assets.ts +108 -0
- package/devtools/src/ui/inspector.ts +182 -0
- package/driver-process/README.md +197 -0
- package/driver-process/src/abort.ts +74 -0
- package/driver-process/src/adapter.ts +211 -0
- package/driver-process/src/driver.ts +303 -0
- package/driver-process/src/errors.ts +17 -0
- package/driver-process/src/extend.ts +72 -0
- package/driver-process/src/index.ts +5 -0
- package/driver-process/src/inspect.ts +33 -0
- package/driver-process/src/session.ts +72 -0
- package/driver-process/src/testing.ts +394 -0
- package/driver-process/src/transports/json-rpc.ts +147 -0
- package/driver-process/src/transports/jsonl-stream.ts +12 -0
- package/driver-process/src/transports/types.ts +11 -0
- package/driver-process/src/turn.ts +106 -0
- package/evals/README.md +843 -0
- package/evals/src/calibration.ts +179 -0
- package/evals/src/citation-integrity.ts +98 -0
- package/evals/src/citations.ts +45 -0
- package/evals/src/compare-experiments.ts +153 -0
- package/evals/src/comparison.ts +230 -0
- package/evals/src/curate.ts +257 -0
- package/evals/src/dataset.ts +81 -0
- package/evals/src/erp-invariants.ts +163 -0
- package/evals/src/errors.ts +23 -0
- package/evals/src/experiment.ts +537 -0
- package/evals/src/failure-injection.ts +77 -0
- package/evals/src/feedback.ts +53 -0
- package/evals/src/index.ts +198 -0
- package/evals/src/injection.ts +247 -0
- package/evals/src/judge-panel.ts +109 -0
- package/evals/src/judge.ts +89 -0
- package/evals/src/limits.ts +50 -0
- package/evals/src/report-record.ts +47 -0
- package/evals/src/rubric-judge.ts +334 -0
- package/evals/src/scenario-runner.ts +317 -0
- package/evals/src/scenarios.ts +81 -0
- package/evals/src/score.ts +328 -0
- package/evals/src/scorer.ts +21 -0
- package/evals/src/state-match.ts +130 -0
- package/evals/src/stats.ts +635 -0
- package/evals/src/threshold.ts +117 -0
- package/evals/src/timeline.ts +38 -0
- package/evals/src/toolless-session.ts +33 -0
- package/evals/src/trace.ts +80 -0
- package/evals/src/trajectory.ts +623 -0
- package/evals/src/types.ts +672 -0
- package/evals/src/user-simulator.ts +101 -0
- package/evals/src/util.ts +207 -0
- package/headless/README.md +172 -0
- package/headless/src/answers.ts +91 -0
- package/headless/src/authority.ts +32 -0
- package/headless/src/errors.ts +36 -0
- package/headless/src/index.ts +17 -0
- package/headless/src/limits.ts +11 -0
- package/headless/src/pending.ts +16 -0
- package/headless/src/policy.ts +36 -0
- package/headless/src/resume.ts +103 -0
- package/headless/src/route.ts +153 -0
- package/headless/src/scheduler/clock.ts +22 -0
- package/headless/src/scheduler/cron.ts +19 -0
- package/headless/src/scheduler/firing.ts +58 -0
- package/headless/src/scheduler/index.ts +399 -0
- package/headless/src/scheduler/lease.ts +38 -0
- package/headless/src/scheduler/missed.ts +12 -0
- package/headless/src/scheduler/state.ts +132 -0
- package/host-builder/README.md +251 -0
- package/host-builder/bin/prism-host-builder.ts +169 -0
- package/host-builder/data/api.json +6197 -0
- package/host-builder/data/errors.json +558 -0
- package/host-builder/data/examples/acp.ts +63 -0
- package/host-builder/data/examples/adapters/conformance.ts +34 -0
- package/host-builder/data/examples/adapters/fixtures/rpc-server.json +26 -0
- package/host-builder/data/examples/adapters/fixtures/stream-cli.json +27 -0
- package/host-builder/data/examples/adapters/fixtures/workspace-config.json +28 -0
- package/host-builder/data/examples/adapters/rpc-server.dialect.ts +218 -0
- package/host-builder/data/examples/adapters/rpc-server.ts +309 -0
- package/host-builder/data/examples/adapters/stream-cli.dialect.ts +165 -0
- package/host-builder/data/examples/adapters/stream-cli.ts +256 -0
- package/host-builder/data/examples/adapters/workspace-config.dialect.ts +172 -0
- package/host-builder/data/examples/adapters/workspace-config.ts +251 -0
- package/host-builder/data/examples/advisor.ts +94 -0
- package/host-builder/data/examples/ag-ui-a2ui.ts +80 -0
- package/host-builder/data/examples/ag-ui-mcp-apps.ts +44 -0
- package/host-builder/data/examples/ag-ui-server.ts +118 -0
- package/host-builder/data/examples/agent-durable-approval.ts +43 -0
- package/host-builder/data/examples/api-key-auth.ts +23 -0
- package/host-builder/data/examples/approval.ts +92 -0
- package/host-builder/data/examples/attention-compiler.ts +81 -0
- package/host-builder/data/examples/autonomous-coding-loop.ts +343 -0
- package/host-builder/data/examples/behavior-evaluation.ts +303 -0
- package/host-builder/data/examples/build-workflow.ts +334 -0
- package/host-builder/data/examples/cache-aware-prompt-assembly.ts +139 -0
- package/host-builder/data/examples/caveman-ponytail.ts +197 -0
- package/host-builder/data/examples/cli.ts +31 -0
- package/host-builder/data/examples/coding-approval.ts +115 -0
- package/host-builder/data/examples/coding-browser-evaluation.ts +208 -0
- package/host-builder/data/examples/coding-compaction.ts +30 -0
- package/host-builder/data/examples/coding-goal-verify.ts +121 -0
- package/host-builder/data/examples/coding-tools-capability-gaps.ts +75 -0
- package/host-builder/data/examples/compaction.ts +36 -0
- package/host-builder/data/examples/connected-slack-mcp.ts +67 -0
- package/host-builder/data/examples/context.ts +29 -0
- package/host-builder/data/examples/custom-adapter.ts +256 -0
- package/host-builder/data/examples/custom-builders.ts +66 -0
- package/host-builder/data/examples/custom-loop.ts +89 -0
- package/host-builder/data/examples/custom-provider.ts +70 -0
- package/host-builder/data/examples/custom-session-store.ts +72 -0
- package/host-builder/data/examples/custom-tools-skills-context.ts +97 -0
- package/host-builder/data/examples/decision-models.ts +98 -0
- package/host-builder/data/examples/define-package.ts +188 -0
- package/host-builder/data/examples/delegate.ts +200 -0
- package/host-builder/data/examples/discover-skills.ts +65 -0
- package/host-builder/data/examples/drive-rag-sync.ts +44 -0
- package/host-builder/data/examples/durable-approval.ts +139 -0
- package/host-builder/data/examples/durable-investigation.ts +93 -0
- package/host-builder/data/examples/durable-loops-and-approvals.ts +94 -0
- package/host-builder/data/examples/enterprise-identity.ts +21 -0
- package/host-builder/data/examples/enterprise-policy-audit.ts +50 -0
- package/host-builder/data/examples/enterprise-work-connectors.ts +103 -0
- package/host-builder/data/examples/eval-injection.ts +73 -0
- package/host-builder/data/examples/eval-judges.ts +145 -0
- package/host-builder/data/examples/evals.ts +86 -0
- package/host-builder/data/examples/evaluation-gate.ts +40 -0
- package/host-builder/data/examples/execution-timeline.ts +173 -0
- package/host-builder/data/examples/external-agent.ts +541 -0
- package/host-builder/data/examples/external-app-db-backed.ts +344 -0
- package/host-builder/data/examples/governance-deny.ts +122 -0
- package/host-builder/data/examples/guardrail-packs.ts +240 -0
- package/host-builder/data/examples/headless-host.ts +245 -0
- package/host-builder/data/examples/hooks-audit-command.mjs +31 -0
- package/host-builder/data/examples/hooks-json.ts +87 -0
- package/host-builder/data/examples/host-builder-agent.ts +150 -0
- package/host-builder/data/examples/host-hooks.ts +71 -0
- package/host-builder/data/examples/host-step-loop-timeline.ts +212 -0
- package/host-builder/data/examples/hosted-sandbox.ts +48 -0
- package/host-builder/data/examples/instruction-injection.ts +127 -0
- package/host-builder/data/examples/jsonl-stores-branching.ts +49 -0
- package/host-builder/data/examples/long-term-memory.ts +158 -0
- package/host-builder/data/examples/manifest.ts +112 -0
- package/host-builder/data/examples/mcp-server.ts +48 -0
- package/host-builder/data/examples/mcp-trust.ts +173 -0
- package/host-builder/data/examples/memory-and-wiki.ts +315 -0
- package/host-builder/data/examples/memory-lifecycle.ts +302 -0
- package/host-builder/data/examples/memory-system.ts +255 -0
- package/host-builder/data/examples/messaging-agent.ts +70 -0
- package/host-builder/data/examples/minimal-host-app.ts +41 -0
- package/host-builder/data/examples/model-router-aggregate-budgets.ts +364 -0
- package/host-builder/data/examples/model-router.ts +106 -0
- package/host-builder/data/examples/obscura.ts +48 -0
- package/host-builder/data/examples/observability.ts +116 -0
- package/host-builder/data/examples/open-connector-sidecar.ts +105 -0
- package/host-builder/data/examples/openai-compatible.ts +70 -0
- package/host-builder/data/examples/package-skills.ts +85 -0
- package/host-builder/data/examples/phase9-coding-intelligence.ts +221 -0
- package/host-builder/data/examples/provider-registration.ts +29 -0
- package/host-builder/data/examples/provider-resolver.ts +39 -0
- package/host-builder/data/examples/rag.ts +40 -0
- package/host-builder/data/examples/remote-agent-server.ts +45 -0
- package/host-builder/data/examples/remote-agent.ts +124 -0
- package/host-builder/data/examples/research-ledger.ts +79 -0
- package/host-builder/data/examples/revocation-propagation.ts +287 -0
- package/host-builder/data/examples/run-feedback.ts +93 -0
- package/host-builder/data/examples/scanned-document-rag.ts +48 -0
- package/host-builder/data/examples/sdk-basics.ts +21 -0
- package/host-builder/data/examples/secure-agent.ts +55 -0
- package/host-builder/data/examples/semantic-memory.ts +52 -0
- package/host-builder/data/examples/serve-tools.ts +495 -0
- package/host-builder/data/examples/session-memory.ts +318 -0
- package/host-builder/data/examples/session-search.ts +131 -0
- package/host-builder/data/examples/session.ts +52 -0
- package/host-builder/data/examples/side-call.ts +68 -0
- package/host-builder/data/examples/signal-agent.ts +9 -0
- package/host-builder/data/examples/skills-progressive-disclosure.ts +88 -0
- package/host-builder/data/examples/skills.ts +19 -0
- package/host-builder/data/examples/sqlite-resume.ts +147 -0
- package/host-builder/data/examples/system-project-prompts.ts +74 -0
- package/host-builder/data/examples/system-prompts.ts +19 -0
- package/host-builder/data/examples/telegram-agent.ts +30 -0
- package/host-builder/data/examples/tool-narrowing-planes.ts +99 -0
- package/host-builder/data/examples/tools.ts +29 -0
- package/host-builder/data/examples/validator.ts +67 -0
- package/host-builder/data/examples/web-no-key.ts +85 -0
- package/host-builder/data/examples/web-research.ts +35 -0
- package/host-builder/data/examples/workflow-event-sink.ts +114 -0
- package/host-builder/data/examples/workflow-loop.ts +93 -0
- package/host-builder/data/examples/workflow-multimodal-document.ts +94 -0
- package/host-builder/data/examples/workflow-parallel-research.ts +111 -0
- package/host-builder/data/examples/workflow-postgres-resume.ts +75 -0
- package/host-builder/data/examples/workflow-research-and-review.ts +98 -0
- package/host-builder/data/examples/workflow-sqlite-resume.ts +163 -0
- package/host-builder/data/examples.json +130 -0
- package/host-builder/skills/prism-host-builder/SKILL.md +85 -0
- package/host-builder/skills/prism-host-builder/references/choosing.md +101 -0
- package/host-builder/skills/prism-host-builder/references/layout.md +52 -0
- package/host-builder/skills/prism-host-builder/references/pitfalls.md +50 -0
- package/host-builder/skills/prism-host-builder/references/recipes.md +129 -0
- package/host-builder/skills/prism-host-builder/references/security.md +52 -0
- package/host-builder/skills/prism-host-builder/references/upgrading.md +67 -0
- package/host-builder/skills/prism-host-builder/references/verification.md +108 -0
- package/host-builder/src/check/child.ts +108 -0
- package/host-builder/src/check/conformance.ts +13 -0
- package/host-builder/src/check/inspect.ts +20 -0
- package/host-builder/src/check/manifest.ts +23 -0
- package/host-builder/src/check/runner.ts +181 -0
- package/host-builder/src/check/targets.ts +65 -0
- package/host-builder/src/errors.ts +35 -0
- package/host-builder/src/index.ts +25 -0
- package/host-builder/src/indexes.ts +145 -0
- package/host-builder/src/install/install.ts +400 -0
- package/host-builder/src/install/targets.ts +50 -0
- package/host-builder/src/lookup/api.ts +127 -0
- package/host-builder/src/lookup/bound.ts +38 -0
- package/host-builder/src/lookup/docs.ts +238 -0
- package/host-builder/src/lookup/errors.ts +92 -0
- package/host-builder/src/lookup/examples.ts +117 -0
- package/host-builder/src/lookup/text.ts +60 -0
- package/host-builder/src/server.ts +300 -0
- package/host-builder/src/version.ts +38 -0
- package/mcp-server/README.md +219 -0
- package/mcp-server/src/bounds.ts +23 -0
- package/mcp-server/src/host.ts +31 -0
- package/mcp-server/src/index.ts +27 -0
- package/mcp-server/src/serve-tools.ts +408 -0
- package/mcp-server/src/serve.ts +329 -0
- package/mcp-server/src/server.ts +331 -0
- package/mcp-server/src/session-map.ts +47 -0
- package/mcp-server/src/skill-resources.ts +85 -0
- package/mcp-server/src/types.ts +215 -0
- package/package.json +130 -4
- package/remote/README.md +244 -0
- package/remote/src/attribution.ts +22 -0
- package/remote/src/auth.ts +30 -0
- package/remote/src/bun-module.d.ts +34 -0
- package/remote/src/channel.ts +86 -0
- package/remote/src/connect.ts +212 -0
- package/remote/src/dispatcher.ts +282 -0
- package/remote/src/errors.ts +59 -0
- package/remote/src/host-ui.ts +152 -0
- package/remote/src/http-gate.ts +43 -0
- package/remote/src/index.ts +53 -0
- package/remote/src/jsonl.ts +69 -0
- package/remote/src/limits.ts +43 -0
- package/remote/src/mirror.ts +90 -0
- package/remote/src/pending.ts +22 -0
- package/remote/src/protocol.ts +107 -0
- package/remote/src/serve.ts +560 -0
- package/remote/src/session-proxy.ts +219 -0
- package/remote/src/sse.ts +38 -0
- package/remote/src/stdio-client.ts +41 -0
- package/remote/src/testing-fixtures/serve-stdio.ts +32 -0
- package/remote/src/testing.ts +230 -0
- package/remote/src/transport.ts +139 -0
- package/remote/src/transports/client.ts +126 -0
- package/remote/src/transports/network.ts +268 -0
- package/remote/src/wire.ts +244 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import {
|
|
5
|
+
createAgent,
|
|
6
|
+
createMemorySessionStore,
|
|
7
|
+
definePackage,
|
|
8
|
+
providerDone,
|
|
9
|
+
providerTextDelta,
|
|
10
|
+
providerToolCall,
|
|
11
|
+
toolCallContent,
|
|
12
|
+
} from "@arnilo/prism";
|
|
13
|
+
import { mockProvider } from "@arnilo/prism/testing";
|
|
14
|
+
import { createHashEmbedder, type Embedder } from "@arnilo/prism-memory-system/core";
|
|
15
|
+
import { createMarkdownMemoryStores } from "@arnilo/prism-memory-system/core/fabric";
|
|
16
|
+
import memorySystem, { createMemory, createLongTermMemory } from "@arnilo/prism-memory-system";
|
|
17
|
+
|
|
18
|
+
// Network-free: session one consolidates an explicit statement into a typed project note through
|
|
19
|
+
// `memory:consolidate` and archives the turn itself through `memory:archive`; a second process (a
|
|
20
|
+
// fresh agent over the same markdown store) recalls both the fact and the verbatim exchange.
|
|
21
|
+
// The store is canonical note files under `<root>/notes` with a derived SQLite index. A third agent
|
|
22
|
+
// roots a different project at the same store: it sees the shared user preference but not the first
|
|
23
|
+
// project's fact.
|
|
24
|
+
const FACT = "Prefer the smallest retry budget.";
|
|
25
|
+
const root = await mkdtemp(join(tmpdir(), "prism-long-term-memory-"));
|
|
26
|
+
|
|
27
|
+
const embeddings = definePackage({
|
|
28
|
+
name: "@example/embeddings",
|
|
29
|
+
version: "0.0.0",
|
|
30
|
+
requires: { api: 1 },
|
|
31
|
+
setup(prism) {
|
|
32
|
+
prism.services.provide<Embedder>("embeddings", createHashEmbedder({ dimensions: 32, id: "demo-embeddings" }));
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
// A preference in the shared `user` scope, written before either project opens the store.
|
|
38
|
+
const seeded = await createMarkdownMemoryStores({ root: join(root, "notes") });
|
|
39
|
+
const userMemory = createMemory({
|
|
40
|
+
tenantId: "prism",
|
|
41
|
+
resourceId: "user",
|
|
42
|
+
threadId: "default",
|
|
43
|
+
vectorStore: seeded.vectorStore,
|
|
44
|
+
});
|
|
45
|
+
await createLongTermMemory({ memory: userMemory, consolidate: false }).remember({
|
|
46
|
+
kind: "preference",
|
|
47
|
+
content: "Prefer terse changelog entries",
|
|
48
|
+
scope: "user",
|
|
49
|
+
});
|
|
50
|
+
await seeded.close();
|
|
51
|
+
|
|
52
|
+
const first = await createAgent({
|
|
53
|
+
model: { provider: "mock", model: "demo" },
|
|
54
|
+
packages: [
|
|
55
|
+
mockProvider([
|
|
56
|
+
[providerTextDelta("noted"), providerDone()],
|
|
57
|
+
[
|
|
58
|
+
providerToolCall(
|
|
59
|
+
toolCallContent("n1", "record_notes", {
|
|
60
|
+
notes: [
|
|
61
|
+
{
|
|
62
|
+
text: FACT,
|
|
63
|
+
kind: "fact",
|
|
64
|
+
scope: "project",
|
|
65
|
+
keywords: ["retry", "budget"],
|
|
66
|
+
aliases: [],
|
|
67
|
+
evidence: ["c1"],
|
|
68
|
+
explicit: true,
|
|
69
|
+
correction: false,
|
|
70
|
+
generality: 1,
|
|
71
|
+
ephemerality: 0,
|
|
72
|
+
derivable: false,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
}),
|
|
76
|
+
),
|
|
77
|
+
providerDone(),
|
|
78
|
+
],
|
|
79
|
+
]),
|
|
80
|
+
embeddings(),
|
|
81
|
+
// One extractor call per pass; the command runs regardless of minTurnsBetween.
|
|
82
|
+
memorySystem({ ltm: { tools: { root }, promote: { minTurnsBetween: 8 }, exchanges: {} } }),
|
|
83
|
+
],
|
|
84
|
+
slots: { store: createMemorySessionStore() },
|
|
85
|
+
});
|
|
86
|
+
const firstSession = await first.session({ id: "session-one", create: true });
|
|
87
|
+
await firstSession.run("Always keep the retry budget small.");
|
|
88
|
+
const consolidated = (await first.commands.run("memory:consolidate", {}, { session: firstSession })) as { written: number };
|
|
89
|
+
console.log(`session one: memory:consolidate wrote ${consolidated.written} project note(s)`);
|
|
90
|
+
const archived = (await first.commands.run("memory:archive", {}, { session: firstSession })) as { totalArchived: number };
|
|
91
|
+
console.log(`session one: exchange archive holds ${archived.totalArchived} turn(s) for this session`);
|
|
92
|
+
await first.dispose();
|
|
93
|
+
|
|
94
|
+
const results: string[] = [];
|
|
95
|
+
const second = await createAgent({
|
|
96
|
+
model: { provider: "mock", model: "demo" },
|
|
97
|
+
packages: [
|
|
98
|
+
mockProvider(
|
|
99
|
+
[
|
|
100
|
+
[providerToolCall(toolCallContent("c1", "memory.recall", { query: "retry budget", kinds: ["fact"] })), providerDone()],
|
|
101
|
+
[providerTextDelta("recalled"), providerDone()],
|
|
102
|
+
[providerToolCall(toolCallContent("c2", "memory.recall", { query: "retry budget", kinds: ["exchange"] })), providerDone()],
|
|
103
|
+
[providerTextDelta("recalled"), providerDone()],
|
|
104
|
+
],
|
|
105
|
+
{
|
|
106
|
+
onRequest: (request) => {
|
|
107
|
+
const last = request.messages.at(-1);
|
|
108
|
+
if (last?.role === "tool") results.push(JSON.stringify(last.content));
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
),
|
|
112
|
+
embeddings(),
|
|
113
|
+
memorySystem({ ltm: { tools: { root } } }),
|
|
114
|
+
],
|
|
115
|
+
});
|
|
116
|
+
const secondSession = await second.session({ id: "session-two", create: true });
|
|
117
|
+
await secondSession.run("What do you know about retries?");
|
|
118
|
+
await secondSession.run("What exactly did we say about the retry budget?");
|
|
119
|
+
const recalled = results.join("\n");
|
|
120
|
+
console.log(
|
|
121
|
+
"session two:",
|
|
122
|
+
`${recalled.includes("smallest retry budget") ? "recalled the fact" : "no fact"} and ${recalled.includes("Always keep the retry budget small.") ? "the verbatim exchange" : "no exchange"} from the markdown store`,
|
|
123
|
+
);
|
|
124
|
+
await second.dispose();
|
|
125
|
+
|
|
126
|
+
const other: string[] = [];
|
|
127
|
+
const third = await createAgent({
|
|
128
|
+
model: { provider: "mock", model: "demo" },
|
|
129
|
+
packages: [
|
|
130
|
+
mockProvider(
|
|
131
|
+
[
|
|
132
|
+
[providerToolCall(toolCallContent("c1", "memory.recall", { query: "retry budget" })), providerDone()],
|
|
133
|
+
[providerTextDelta("nothing"), providerDone()],
|
|
134
|
+
[providerToolCall(toolCallContent("c2", "memory.recall", { query: "changelog preference" })), providerDone()],
|
|
135
|
+
[providerTextDelta("recalled"), providerDone()],
|
|
136
|
+
],
|
|
137
|
+
{
|
|
138
|
+
onRequest: (request) => {
|
|
139
|
+
const last = request.messages.at(-1);
|
|
140
|
+
if (last?.role === "tool") other.push(JSON.stringify(last.content));
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
),
|
|
144
|
+
embeddings(),
|
|
145
|
+
memorySystem({ ltm: { tools: { root }, scopes: { project: { id: "other--00000001" } } } }),
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
const thirdSession = await third.session({ id: "session-three", create: true });
|
|
149
|
+
await thirdSession.run("What do you know about retries?");
|
|
150
|
+
const factCrossed = other.join("\n").includes("smallest retry budget");
|
|
151
|
+
await thirdSession.run("What do I prefer for changelogs?");
|
|
152
|
+
const preferenceShared = other.join("\n").includes("terse changelog entries");
|
|
153
|
+
if (factCrossed || !preferenceShared) throw new Error("cross-project isolation failed");
|
|
154
|
+
console.log("session three:", "shared preference recalled; project fact stayed in project one");
|
|
155
|
+
await third.dispose();
|
|
156
|
+
} finally {
|
|
157
|
+
await rm(root, { recursive: true, force: true });
|
|
158
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { createAgent, providerDone, providerTextDelta, toolCallContent } from "@arnilo/prism";
|
|
6
|
+
import { mockProvider } from "@arnilo/prism/testing";
|
|
7
|
+
import { configure, install, installedPackageDir, loadManifest, ManifestError, scopeDirs, setEnabled } from "@arnilo/prism/manifest";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The manifest cycle (roadmap Phase 4): install a local package, load it into an agent, disable it,
|
|
11
|
+
* reload, then show the three fail-closed paths. Real `bun add` of a `file:` spec into a temp root.
|
|
12
|
+
*
|
|
13
|
+
* 1. `install` records the package with its version, integrity hash and declared capabilities.
|
|
14
|
+
* 2. `loadManifest` hands the agent the package; one turn uses its tool.
|
|
15
|
+
* 3. `setEnabled(false)` and a reload: the tool is gone.
|
|
16
|
+
* 4. An untrusted project manifest is skipped (no `trustProject`, no import).
|
|
17
|
+
* 5. `configure` refuses a literal in a secret field and writes nothing.
|
|
18
|
+
* 6. One installed byte changes: the load fails as `integrity_mismatch` before any import.
|
|
19
|
+
*
|
|
20
|
+
* Run: npm run build:core && bun examples/manifest.ts
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const FIXTURE = fileURLToPath(new URL("./fixtures/hello-package", import.meta.url));
|
|
24
|
+
const MODEL = { provider: "mock", model: "demo" } as const;
|
|
25
|
+
|
|
26
|
+
async function codeOf(run: () => Promise<unknown>): Promise<string> {
|
|
27
|
+
try {
|
|
28
|
+
await run();
|
|
29
|
+
} catch (error) {
|
|
30
|
+
if (error instanceof ManifestError) return error.code;
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
return "none";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export async function demo(): Promise<Record<string, unknown>> {
|
|
37
|
+
const started = Date.now();
|
|
38
|
+
const root = await mkdtemp(join(tmpdir(), "prism-manifest-"));
|
|
39
|
+
const home = await mkdtemp(join(tmpdir(), "prism-manifest-home-"));
|
|
40
|
+
try {
|
|
41
|
+
// 1. Install into the project scope.
|
|
42
|
+
const entry = await install(`file:${FIXTURE}`, { scope: "project", root, home });
|
|
43
|
+
|
|
44
|
+
// 2. Load and run one turn that calls the package's tool.
|
|
45
|
+
const advertised: string[][] = [];
|
|
46
|
+
let greeted: unknown;
|
|
47
|
+
// Turn 1 calls the package's tool; turn 2 answers. `onRequest` records what each turn advertised.
|
|
48
|
+
const provider = mockProvider(
|
|
49
|
+
[
|
|
50
|
+
[{ type: "tool_call" as const, call: toolCallContent("c1", "hello_greet", { name: "prism" }) }, providerDone()],
|
|
51
|
+
[providerTextDelta("done"), providerDone()],
|
|
52
|
+
],
|
|
53
|
+
{
|
|
54
|
+
onRequest(request) {
|
|
55
|
+
advertised.push((request.tools ?? []).map((tool) => tool.name));
|
|
56
|
+
const result = request.messages.flatMap((message) => message.content).find((block) => block.type === "tool_result");
|
|
57
|
+
if (result?.type === "tool_result") greeted = result.result;
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
const trusted = { root, home, trustProject: () => true };
|
|
62
|
+
const run = async (): Promise<string> => {
|
|
63
|
+
const agent = await createAgent({ id: "manifest-demo", model: MODEL, packages: [...(await loadManifest(trusted)), provider] });
|
|
64
|
+
try {
|
|
65
|
+
return (await (await agent.session()).run("greet prism")).status;
|
|
66
|
+
} finally {
|
|
67
|
+
await agent.dispose();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const status = await run();
|
|
71
|
+
|
|
72
|
+
// 3. Disable and reload: the tool is no longer advertised.
|
|
73
|
+
await setEnabled(entry.name, false, { scope: "project", root, home });
|
|
74
|
+
advertised.length = 0;
|
|
75
|
+
await run();
|
|
76
|
+
const toolAfterDisable = advertised.some((tools) => tools.includes("hello_greet"));
|
|
77
|
+
await setEnabled(entry.name, true, { scope: "project", root, home });
|
|
78
|
+
|
|
79
|
+
// 4. An untrusted project manifest is skipped: nothing loads and nothing is imported.
|
|
80
|
+
const untrusted = await loadManifest({ root, home });
|
|
81
|
+
|
|
82
|
+
// 5. A literal in a secret field is refused; the file is unchanged.
|
|
83
|
+
const manifestPath = scopeDirs({ scope: "project", root, home }).manifestPath;
|
|
84
|
+
const before = await readFile(manifestPath, "utf8");
|
|
85
|
+
const literal = await codeOf(() => configure(entry.name, { apiKey: "a-literal-key-0123" }, { scope: "project", root, home }));
|
|
86
|
+
const unchanged = (await readFile(manifestPath, "utf8")) === before;
|
|
87
|
+
await configure(entry.name, { apiKey: "env:DEMO_HELLO_KEY" }, { scope: "project", root, home });
|
|
88
|
+
|
|
89
|
+
// 6. Tamper with one installed file: the load fails closed.
|
|
90
|
+
const file = join(installedPackageDir(scopeDirs({ scope: "project", root, home }).packagesDir, entry.name), "index.js");
|
|
91
|
+
await writeFile(file, `${await readFile(file, "utf8")}// edited\n`);
|
|
92
|
+
const tampered = await codeOf(() => loadManifest(trusted));
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
installed: `${entry.name}@${entry.version}`,
|
|
96
|
+
capabilities: entry.capabilities,
|
|
97
|
+
status,
|
|
98
|
+
greeted,
|
|
99
|
+
toolAfterDisable,
|
|
100
|
+
untrustedLoaded: untrusted.length,
|
|
101
|
+
literal,
|
|
102
|
+
unchanged,
|
|
103
|
+
tampered,
|
|
104
|
+
withinBudget: Date.now() - started < 5000,
|
|
105
|
+
};
|
|
106
|
+
} finally {
|
|
107
|
+
await rm(root, { recursive: true, force: true });
|
|
108
|
+
await rm(home, { recursive: true, force: true });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (import.meta.url === `file://${process.argv[1]}`) console.log(JSON.stringify(await demo()));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createAgent, providerDone, providerTextDelta } from "@arnilo/prism";
|
|
2
|
+
import { mockProvider } from "@arnilo/prism/testing";
|
|
3
|
+
import { mcpHost, serveMcp } from "@arnilo/prism-hosts/mcp-server";
|
|
4
|
+
|
|
5
|
+
// One agent, one tool: `serveMcp` exposes the agent as a single `prompt` tool and
|
|
6
|
+
// lists its commands as MCP prompts. `mcpHost()` wires approvals: a suspended run
|
|
7
|
+
// answers `input_required` and resumes on the client's elicitation response.
|
|
8
|
+
const agent = await createAgent({
|
|
9
|
+
id: "mcp-server-demo",
|
|
10
|
+
model: { provider: "mock", model: "offline" },
|
|
11
|
+
host: mcpHost(),
|
|
12
|
+
packages: [mockProvider([[providerTextDelta("hello from the Prism agent"), providerDone()]])],
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (process.argv.includes("--stdio")) {
|
|
16
|
+
serveMcp(agent, { stdio: true });
|
|
17
|
+
// Protocol-only stdout: logs go to stderr.
|
|
18
|
+
console.error("demo MCP server listening on stdio");
|
|
19
|
+
} else {
|
|
20
|
+
// In-process demo over both transports without opening a port.
|
|
21
|
+
const { Client, InMemoryTransport } = await import("@modelcontextprotocol/client");
|
|
22
|
+
const client = new Client({ name: "demo-client", version: "0.0.1" }, { capabilities: {} });
|
|
23
|
+
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
24
|
+
const handle = serveMcp(agent, { transport: serverTransport });
|
|
25
|
+
await client.connect(clientTransport);
|
|
26
|
+
|
|
27
|
+
const result = await client.callTool({ name: "prompt", arguments: { prompt: "hello" } });
|
|
28
|
+
console.log(JSON.stringify(result));
|
|
29
|
+
|
|
30
|
+
await client.close();
|
|
31
|
+
await handle.close();
|
|
32
|
+
|
|
33
|
+
// Dual-era HTTP serving looks like this:
|
|
34
|
+
//
|
|
35
|
+
// import { createServer as createHttpServer } from "node:http";
|
|
36
|
+
// const { handler } = serveMcp(agent, {
|
|
37
|
+
// http: { allowedOrigins: ["https://example.test"] }, // exact origin allowlist
|
|
38
|
+
// });
|
|
39
|
+
// createHttpServer(async (req, res) => {
|
|
40
|
+
// const request = toWebRequest(req); // from @modelcontextprotocol/node
|
|
41
|
+
// const response = await handler(request);
|
|
42
|
+
// res.writeHead(response.status, Object.fromEntries(response.headers));
|
|
43
|
+
// res.end(response.body);
|
|
44
|
+
// });
|
|
45
|
+
//
|
|
46
|
+
// Modern serving is one fresh McpServer per request with no sticky sessions;
|
|
47
|
+
// pass `sessionIdGenerator` + `resolveIdentity` to bind stateful 2025 sessions.
|
|
48
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { existsSync, unlinkSync } from "node:fs";
|
|
3
|
+
import { createServer } from "node:http";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { type AgentEvent, createAgent, definePackage } from "@arnilo/prism";
|
|
7
|
+
import { bindManifestInstance, createScriptedHostUi, mockProvider, providerDone, providerTextDelta } from "@arnilo/prism/testing";
|
|
8
|
+
import mcpPackageDefinition, { type McpPackageConfig } from "@arnilo/prism-extensions/mcp";
|
|
9
|
+
import { createMcpHandler, McpServer } from "@modelcontextprotocol/server";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Demonstrates:
|
|
13
|
+
* 1. An untrusted project stdio server never spawns when host.ui confirmation is denied.
|
|
14
|
+
* 2. A trusted URL server receives its `Authorization` header from an `env:` ref, while a
|
|
15
|
+
* second, unreachable trusted server proves the token is redacted from a connect error.
|
|
16
|
+
* 3. The token appears in no event, inspect() output, status note, command result, or error.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const node = process.execPath;
|
|
20
|
+
const SECRET_TOKEN = "secret-token-prism-mcp-demo-98765";
|
|
21
|
+
|
|
22
|
+
async function startFixture(): Promise<{ origin: string; received: string[]; close(): Promise<void> }> {
|
|
23
|
+
const received: string[] = [];
|
|
24
|
+
const handler = createMcpHandler(() => {
|
|
25
|
+
const server = new McpServer({ name: "docs-fixture", version: "1.0.0" }, { capabilities: { tools: {} } });
|
|
26
|
+
server.registerTool("docs_lookup", { inputSchema: {} }, async () => ({
|
|
27
|
+
content: [{ type: "text" as const, text: "ok" }],
|
|
28
|
+
}));
|
|
29
|
+
return server;
|
|
30
|
+
}, {});
|
|
31
|
+
const http = createServer(async (request, response) => {
|
|
32
|
+
const chunks: Buffer[] = [];
|
|
33
|
+
for await (const chunk of request) chunks.push(chunk as Buffer);
|
|
34
|
+
const body = Buffer.concat(chunks);
|
|
35
|
+
const authorization = request.headers.authorization;
|
|
36
|
+
if (typeof authorization === "string") received.push(authorization);
|
|
37
|
+
const webRequest = new Request(new URL(request.url ?? "/", "http://127.0.0.1"), {
|
|
38
|
+
method: request.method,
|
|
39
|
+
headers: request.headers as HeadersInit,
|
|
40
|
+
body: request.method === "GET" || request.method === "DELETE" ? undefined : body,
|
|
41
|
+
});
|
|
42
|
+
const webResponse = await handler.fetch(webRequest);
|
|
43
|
+
response.writeHead(webResponse.status, Object.fromEntries(webResponse.headers));
|
|
44
|
+
for await (const chunk of webResponse.body ?? new Uint8Array()) response.write(chunk);
|
|
45
|
+
response.end();
|
|
46
|
+
});
|
|
47
|
+
await new Promise<void>((resolve, reject) => {
|
|
48
|
+
http.once("error", reject);
|
|
49
|
+
http.listen(0, "127.0.0.1", () => resolve());
|
|
50
|
+
});
|
|
51
|
+
const origin = `http://127.0.0.1:${(http.address() as { port: number }).port}`;
|
|
52
|
+
return {
|
|
53
|
+
origin,
|
|
54
|
+
received,
|
|
55
|
+
close: async () => {
|
|
56
|
+
await handler.close();
|
|
57
|
+
http.closeAllConnections();
|
|
58
|
+
await new Promise<void>((resolve) => http.close(() => resolve()));
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function demo(): Promise<Record<string, unknown>> {
|
|
64
|
+
process.env.DOCS_MCP_TOKEN = SECRET_TOKEN;
|
|
65
|
+
|
|
66
|
+
const sentinel = join(tmpdir(), `prism-mcp-trust-example-${Date.now()}-${Math.random().toString(36).slice(2)}`);
|
|
67
|
+
if (existsSync(sentinel)) unlinkSync(sentinel);
|
|
68
|
+
|
|
69
|
+
const fixture = await startFixture();
|
|
70
|
+
const events: AgentEvent[] = [];
|
|
71
|
+
const eventCollector = definePackage({
|
|
72
|
+
name: "mcp-trust-event-collector",
|
|
73
|
+
version: "1.0.0",
|
|
74
|
+
requires: { api: 1 },
|
|
75
|
+
setup(prism) {
|
|
76
|
+
prism.hooks.on("package.event", (event) => void events.push(event));
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Approve the two URL servers, deny the stdio server.
|
|
81
|
+
const scriptedUi = createScriptedHostUi((request) => {
|
|
82
|
+
if (request.kind !== "confirm") return { status: "unavailable" };
|
|
83
|
+
const title = request.title ?? "";
|
|
84
|
+
return { status: "answered", value: title.includes("docs-url") || title.includes("broken-url") };
|
|
85
|
+
}).ui;
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const projectMcpConfig: McpPackageConfig = {
|
|
89
|
+
servers: [
|
|
90
|
+
{
|
|
91
|
+
id: "untrusted-stdio",
|
|
92
|
+
transport: "stdio",
|
|
93
|
+
command: node,
|
|
94
|
+
args: ["-e", `require("fs").writeFileSync(${JSON.stringify(sentinel)}, "ran")`],
|
|
95
|
+
allow: "stdio",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "docs-url",
|
|
99
|
+
transport: "http",
|
|
100
|
+
url: `${fixture.origin}/mcp`,
|
|
101
|
+
allow: fixture.origin,
|
|
102
|
+
headers: { Authorization: { ref: "env:DOCS_MCP_TOKEN", prefix: "Bearer " } },
|
|
103
|
+
connectTimeoutMs: 5000,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "broken-url",
|
|
107
|
+
transport: "http",
|
|
108
|
+
url: "https://127.0.0.1:59996/mcp",
|
|
109
|
+
allow: "https://127.0.0.1:59996",
|
|
110
|
+
headers: { Authorization: { ref: "env:DOCS_MCP_TOKEN", prefix: "Bearer " } },
|
|
111
|
+
connectTimeoutMs: 50,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const projectMcpInstance = bindManifestInstance(mcpPackageDefinition, projectMcpConfig as unknown as Record<string, unknown>, {
|
|
117
|
+
optional: false,
|
|
118
|
+
source: { kind: "manifest", scope: "project", scopes: { servers: "project" } },
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const agent = await createAgent({
|
|
122
|
+
id: "mcp-trust-demo",
|
|
123
|
+
model: { provider: "mock", model: "test" },
|
|
124
|
+
packages: [mockProvider([[providerTextDelta("ok"), providerDone()]]), eventCollector, projectMcpInstance],
|
|
125
|
+
host: { ui: scriptedUi },
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const statusResult = (await agent.commands.run("mcp:status")) as {
|
|
129
|
+
servers: Array<{ id: string; state: string; toolCount: number; error?: string; reason?: string }>;
|
|
130
|
+
};
|
|
131
|
+
const byId = (id: string) => statusResult.servers.find((server) => server.id === id);
|
|
132
|
+
const inspectResult = agent.inspect();
|
|
133
|
+
|
|
134
|
+
const sentinelCreated = existsSync(sentinel);
|
|
135
|
+
assert.equal(sentinelCreated, false, "the untrusted stdio server spawned and created a sentinel file");
|
|
136
|
+
assert.equal(byId("untrusted-stdio")?.state, "disabled", "the untrusted server is disabled");
|
|
137
|
+
assert.equal(byId("untrusted-stdio")?.reason, "untrusted", "the untrusted server names the reason");
|
|
138
|
+
assert.equal(byId("docs-url")?.state, "connected", `the trusted fixture server connected: ${byId("docs-url")?.error ?? ""}`);
|
|
139
|
+
assert.ok(
|
|
140
|
+
fixture.received.some((header) => header === `Bearer ${SECRET_TOKEN}`),
|
|
141
|
+
"the fixture never received the Authorization header",
|
|
142
|
+
);
|
|
143
|
+
assert.equal(byId("broken-url")?.state, "failed", "the unreachable trusted server failed");
|
|
144
|
+
|
|
145
|
+
const dump = JSON.stringify({ events, statusResult, inspectResult, notes: inspectResult.statusNotes });
|
|
146
|
+
const secretLeaked = dump.includes(SECRET_TOKEN);
|
|
147
|
+
assert.equal(secretLeaked, false, "the secret token leaked into events, status, inspect, or notes");
|
|
148
|
+
|
|
149
|
+
await agent.dispose();
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
sentinelCreated,
|
|
153
|
+
headerReceived: fixture.received.some((header) => header === `Bearer ${SECRET_TOKEN}`),
|
|
154
|
+
secretLeaked,
|
|
155
|
+
untrustedState: byId("untrusted-stdio")?.state,
|
|
156
|
+
untrustedReason: byId("untrusted-stdio")?.reason,
|
|
157
|
+
docsState: byId("docs-url")?.state,
|
|
158
|
+
brokenState: byId("broken-url")?.state,
|
|
159
|
+
};
|
|
160
|
+
} finally {
|
|
161
|
+
await fixture.close();
|
|
162
|
+
if (existsSync(sentinel)) unlinkSync(sentinel);
|
|
163
|
+
delete process.env.DOCS_MCP_TOKEN;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export async function main() {
|
|
168
|
+
console.log(JSON.stringify(await demo(), null, 2));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
172
|
+
await main();
|
|
173
|
+
}
|