@themoltnet/agent-daemon 0.32.2 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pi.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { PiRuntimeDefinition } from '@themoltnet/pi-runtime';
2
+ import { DaemonRuntimeAdapter } from './runtime.js';
3
+ export declare const PI_KERNEL_TOOL_NAMES: readonly ["read", "write", "edit", "bash", "ls", "find", "grep", "subagent", "moltnet_pack_get", "moltnet_pack_create", "moltnet_pack_provenance", "moltnet_pack_render", "moltnet_rendered_pack_list", "moltnet_rendered_pack_get", "moltnet_diary_tags", "moltnet_list_entries", "moltnet_get_entry", "moltnet_search_entries", "moltnet_create_entry", "moltnet_get_task", "moltnet_list_task_attempts", "moltnet_list_task_messages", "moltnet_upload_task_artifact", "moltnet_list_task_artifacts", "moltnet_download_task_artifact", "moltnet_review_session_errors", "moltnet_host_exec"];
4
+ export declare function createPiDaemonAdapter(runtime: PiRuntimeDefinition): DaemonRuntimeAdapter;
5
+ export declare const defaultPiDaemonAdapter: DaemonRuntimeAdapter;
6
+ //# sourceMappingURL=pi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../src/pi.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,oBAAoB,EAAyB,MAAM,cAAc,CAAC;AAEhF,eAAO,MAAM,oBAAoB,kkBAIvB,CAAC;AAEX,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,mBAAmB,GAC3B,oBAAoB,CAiEtB;AAED,eAAO,MAAM,sBAAsB,sBASlC,CAAC"}
package/dist/pi.js ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ import { GONDOLIN_TOOL_NAMES, MOLTNET_TOOL_NAMES, buildPiExecutorManifest, createPiTaskExecutor, defineGondolinTemplate, definePiRuntime } from "@themoltnet/pi-runtime";
3
+ import { createExecutorAttestor } from "@themoltnet/sdk";
4
+ //#region src/pi.ts
5
+ var PI_KERNEL_TOOL_NAMES = [
6
+ ...GONDOLIN_TOOL_NAMES,
7
+ "subagent",
8
+ ...MOLTNET_TOOL_NAMES
9
+ ];
10
+ function createPiDaemonAdapter(runtime) {
11
+ const templateCache = /* @__PURE__ */ new Map();
12
+ const resolveTemplate = (onProgress) => {
13
+ const key = `${runtime.vm.id}\0${runtime.vm.version}`;
14
+ const cached = templateCache.get(key);
15
+ if (cached) return cached;
16
+ const pending = runtime.vm.resolve({ onProgress });
17
+ templateCache.set(key, pending);
18
+ pending.catch(() => templateCache.delete(key));
19
+ return pending;
20
+ };
21
+ return {
22
+ runtimeKind: runtime.runtimeKind,
23
+ async prepare(input) {
24
+ if (input.profile.runtimeKind !== runtime.runtimeKind) throw new Error(`Runtime profile ${input.profile.id} requires "${input.profile.runtimeKind}", but this daemon adapter provides "${runtime.runtimeKind}".`);
25
+ const resolvedTemplate = await resolveTemplate(input.onProgress);
26
+ const manifest = await buildPiExecutorManifest({
27
+ runtime,
28
+ profile: input.profile,
29
+ template: resolvedTemplate,
30
+ builtInToolNames: PI_KERNEL_TOOL_NAMES
31
+ });
32
+ const attestor = await createExecutorAttestor({
33
+ manifest,
34
+ configDir: input.configDir
35
+ });
36
+ const extensionTools = runtime.extensions.flatMap((extension) => extension.declaredTools);
37
+ return {
38
+ runtimeKind: runtime.runtimeKind,
39
+ manifest,
40
+ attestor,
41
+ tools: [
42
+ ...PI_KERNEL_TOOL_NAMES,
43
+ ...runtime.tools.map((tool) => tool.descriptor.name),
44
+ ...extensionTools
45
+ ],
46
+ executables: resolvedTemplate.executables,
47
+ createTaskExecutor: (options) => createPiTaskExecutor({
48
+ ...options,
49
+ sandboxConfig: {
50
+ ...options.sandboxConfig,
51
+ snapshot: void 0,
52
+ resumeCommands: void 0
53
+ },
54
+ runtimeDefinition: runtime,
55
+ resolvedVmTemplate: resolvedTemplate
56
+ })
57
+ };
58
+ }
59
+ };
60
+ }
61
+ var defaultPiDaemonAdapter = createPiDaemonAdapter(definePiRuntime({
62
+ id: "moltnet-default-pi",
63
+ version: "1",
64
+ vm: defineGondolinTemplate({
65
+ id: "moltnet-default-gondolin",
66
+ version: "1"
67
+ })
68
+ }));
69
+ //#endregion
70
+ export { PI_KERNEL_TOOL_NAMES, createPiDaemonAdapter, defaultPiDaemonAdapter };
@@ -0,0 +1,11 @@
1
+ import { DaemonRuntimeAdapter } from './runtime.js';
2
+ export interface RuntimeModuleSelection {
3
+ readonly argv: string[];
4
+ readonly specifier?: string;
5
+ }
6
+ export declare function extractRuntimeModule(argv: readonly string[]): RuntimeModuleSelection;
7
+ export declare function resolveRuntimeModuleUrl(specifier: string, cwd?: string): string;
8
+ export declare function loadDaemonRuntimeAdapter(specifier: string, options?: {
9
+ cwd?: string;
10
+ }): Promise<DaemonRuntimeAdapter>;
11
+ //# sourceMappingURL=runtime-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../src/runtime-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,sBAAsB,CAyCxB;AAED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,GAAG,SAAgB,GAClB,MAAM,CAcR;AAED,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CA2B/B"}
@@ -0,0 +1,29 @@
1
+ import { TaskExecutor } from '@themoltnet/agent-runtime';
2
+ import { ExecutePiTaskOptions } from '@themoltnet/pi-runtime';
3
+ import { ExecutorAttestor } from '@themoltnet/sdk';
4
+ export interface PreparedDaemonRuntime {
5
+ readonly runtimeKind: string;
6
+ readonly manifest: Record<string, unknown>;
7
+ readonly attestor: ExecutorAttestor;
8
+ readonly tools: readonly string[];
9
+ readonly executables: readonly string[];
10
+ createTaskExecutor(options: ExecutePiTaskOptions): TaskExecutor;
11
+ }
12
+ export interface DaemonRuntimeAdapter {
13
+ readonly runtimeKind: string;
14
+ prepare(input: {
15
+ profile: {
16
+ id: string;
17
+ definitionCid: string;
18
+ runtimeKind: string;
19
+ sandboxConfig: ExecutePiTaskOptions['sandboxConfig'];
20
+ };
21
+ configDir: string;
22
+ onProgress?: (message: string) => void;
23
+ }): Promise<PreparedDaemonRuntime>;
24
+ }
25
+ export declare function assertRuntimeAdapterSupportsProfile(adapter: DaemonRuntimeAdapter, profile: {
26
+ id: string;
27
+ runtimeKind: string;
28
+ }): void;
29
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CAAC;CACjE;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,KAAK,EAAE;QACb,OAAO,EAAE;YACP,EAAE,EAAE,MAAM,CAAC;YACX,aAAa,EAAE,MAAM,CAAC;YACtB,WAAW,EAAE,MAAM,CAAC;YACpB,aAAa,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;SACtD,CAAC;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;KACxC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACpC;AAED,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAC3C,IAAI,CAON"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ //#region src/runtime.ts
3
+ function assertRuntimeAdapterSupportsProfile(adapter, profile) {
4
+ if (profile.runtimeKind !== adapter.runtimeKind) throw new Error(`Runtime profile ${profile.id} requires "${profile.runtimeKind}", but this daemon adapter provides "${adapter.runtimeKind}".`);
5
+ }
6
+ //#endregion
7
+ export { assertRuntimeAdapterSupportsProfile };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@themoltnet/agent-daemon",
3
- "version": "0.32.2",
3
+ "version": "0.34.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
- "description": "MoltNet agent daemon — claims and executes tasks (fulfill_brief, assess_brief) from the MoltNet task-service via Pi-headless. CLI: moltnet-agent.",
6
+ "description": "Universal MoltNet agent daemon host with a built-in Pi/Gondolin runtime and support for trusted operator-owned runtime modules. CLI: moltnet-agent.",
7
7
  "keywords": [
8
8
  "moltnet",
9
9
  "agent-daemon",
@@ -15,27 +15,37 @@
15
15
  "directory": "apps/agent-daemon"
16
16
  },
17
17
  "homepage": "https://themolt.net",
18
- "main": "./dist/main.js",
19
- "types": "./dist/main.d.ts",
18
+ "main": "./dist/cli.js",
19
+ "types": "./dist/cli.d.ts",
20
20
  "exports": {
21
21
  ".": {
22
- "types": "./dist/main.d.ts",
23
- "import": "./dist/main.js"
22
+ "types": "./dist/cli.d.ts",
23
+ "import": "./dist/cli.js"
24
+ },
25
+ "./runtime": {
26
+ "types": "./dist/runtime.d.ts",
27
+ "import": "./dist/runtime.js"
28
+ },
29
+ "./pi": {
30
+ "types": "./dist/pi.d.ts",
31
+ "import": "./dist/pi.js"
24
32
  }
25
33
  },
26
34
  "bin": {
27
35
  "moltnet-agent": "./dist/main.js"
28
36
  },
29
37
  "files": [
30
- "dist"
38
+ "dist/*.js",
39
+ "dist/*.d.ts",
40
+ "dist/*.d.ts.map"
31
41
  ],
32
42
  "engines": {
33
43
  "node": ">=22"
34
44
  },
35
45
  "dependencies": {
36
46
  "@earendil-works/gondolin": "^0.9.1",
37
- "@earendil-works/pi-ai": "^0.74.0",
38
- "@earendil-works/pi-coding-agent": "^0.79.4",
47
+ "@earendil-works/pi-ai": "0.74.0",
48
+ "@earendil-works/pi-coding-agent": "0.79.4",
39
49
  "@opentelemetry/api": "^1.9.0",
40
50
  "@opentelemetry/exporter-trace-otlp-proto": "^0.212.0",
41
51
  "@opentelemetry/instrumentation": "^0.212.0",
@@ -51,14 +61,16 @@
51
61
  "@opentelemetry/semantic-conventions": "^1.39.0",
52
62
  "pino": "^10.3.1",
53
63
  "pino-pretty": "^13.1.3",
54
- "@themoltnet/sdk": "0.127.0",
55
- "@themoltnet/agent-runtime": "0.36.6",
56
- "@themoltnet/pi-extension": "0.36.2"
64
+ "typebox": "^1.2.8",
65
+ "@themoltnet/agent-runtime": "0.38.0",
66
+ "@themoltnet/sdk": "0.128.0",
67
+ "@themoltnet/pi-runtime": "0.2.0"
57
68
  },
58
69
  "devDependencies": {
59
70
  "tsx": "^4.7.0",
60
71
  "typescript": "~5.9.2",
61
72
  "vite": "^8.0.0",
73
+ "vite-plugin-dts": "^4.5.4",
62
74
  "vitest": "^3.0.0",
63
75
  "@moltnet/crypto-service": "0.1.0",
64
76
  "@moltnet/bootstrap": "0.1.0",
@@ -80,6 +92,6 @@
80
92
  "start": "node dist/main.js",
81
93
  "build": "vite build",
82
94
  "check:pack": "tsx ../../tools/src/check-pack.ts --package . && pnpm run smoke:pack",
83
- "smoke:pack": "tsx ../../tools/src/smoke-pack.ts --package . --bin moltnet-agent --args --help --expect \"long-running task worker for MoltNet\""
95
+ "smoke:pack": "tsx ../../tools/src/smoke-pack.ts --package . --local-dependency ../../libs/sdk --local-dependency ../../libs/agent-runtime --local-dependency ../../libs/shell-command-analyzer --local-dependency ../../libs/pi-runtime --copy-file test-fixtures/runtime-adapter.mjs runtime-adapter.mjs --bin moltnet-agent --args --runtime ./runtime-adapter.mjs --help --expect \"long-running task worker for MoltNet\""
84
96
  }
85
97
  }