@slock-ai/daemon 0.56.0 → 0.56.1-play.20260603140721

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/core.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {
2
+ DAEMON_API_KEY_ENV,
2
3
  DAEMON_CLI_USAGE,
3
4
  DaemonCore,
4
5
  deleteWorkspaceDirectory,
@@ -8,12 +9,14 @@ import {
8
9
  resolveChatBridgePath,
9
10
  resolveSlockCliPath,
10
11
  resolveWorkspaceDirectoryPath,
11
- scanWorkspaceDirectories
12
- } from "./chunk-4H5XFLYA.js";
12
+ scanWorkspaceDirectories,
13
+ scrubDaemonAuthEnv
14
+ } from "./chunk-5EVWI6BL.js";
13
15
  import {
14
16
  subscribeDaemonLogs
15
17
  } from "./chunk-M2KQBJR3.js";
16
18
  export {
19
+ DAEMON_API_KEY_ENV,
17
20
  DAEMON_CLI_USAGE,
18
21
  DaemonCore,
19
22
  deleteWorkspaceDirectory,
@@ -24,5 +27,6 @@ export {
24
27
  resolveSlockCliPath,
25
28
  resolveWorkspaceDirectoryPath,
26
29
  scanWorkspaceDirectories,
30
+ scrubDaemonAuthEnv,
27
31
  subscribeDaemonLogs
28
32
  };
@@ -0,0 +1,96 @@
1
+ // src/drivers/piSdkRunner.ts
2
+ import { readFile } from "fs/promises";
3
+ import path from "path";
4
+ import {
5
+ AuthStorage,
6
+ createAgentSessionFromServices,
7
+ createAgentSessionServices,
8
+ SessionManager
9
+ } from "@earendil-works/pi-coding-agent";
10
+ function writeJson(value) {
11
+ process.stdout.write(`${JSON.stringify(value)}
12
+ `);
13
+ }
14
+ function parseArgs(argv) {
15
+ const index = argv.indexOf("--config");
16
+ const configPath = index >= 0 ? argv[index + 1] : void 0;
17
+ if (!configPath) throw new Error("Missing --config <path>");
18
+ return { configPath };
19
+ }
20
+ function resolveConfiguredModel(modelId, modelRegistry) {
21
+ if (!modelId) return void 0;
22
+ const [provider, ...rest] = modelId.split("/");
23
+ const providerScopedId = rest.join("/");
24
+ if (provider && providerScopedId) {
25
+ const exact = modelRegistry.find(provider, providerScopedId);
26
+ if (exact) return exact;
27
+ }
28
+ return modelRegistry.getAll().find(
29
+ (model) => model.id === modelId || `${model.provider}/${model.id}` === modelId || (providerScopedId ? model.id === providerScopedId : false)
30
+ );
31
+ }
32
+ async function createSessionManager(config) {
33
+ if (!config.sessionId) return SessionManager.create(config.cwd, config.sessionDir);
34
+ const localSessions = await SessionManager.list(config.cwd, config.sessionDir);
35
+ const match = localSessions.find((session) => session.id.startsWith(config.sessionId));
36
+ if (match) return SessionManager.open(match.path, config.sessionDir);
37
+ return SessionManager.create(config.cwd, config.sessionDir);
38
+ }
39
+ async function run() {
40
+ const { configPath } = parseArgs(process.argv.slice(2));
41
+ const config = JSON.parse(await readFile(configPath, "utf8"));
42
+ const authStorage = AuthStorage.create(path.join(config.agentDir, "auth.json"));
43
+ const services = await createAgentSessionServices({
44
+ cwd: config.cwd,
45
+ agentDir: config.agentDir,
46
+ authStorage,
47
+ resourceLoaderOptions: {
48
+ appendSystemPrompt: [config.standingPrompt],
49
+ noContextFiles: true,
50
+ noExtensions: true,
51
+ noPromptTemplates: true,
52
+ noSkills: true,
53
+ noThemes: true
54
+ }
55
+ });
56
+ for (const diagnostic of services.diagnostics) {
57
+ const line = `[Pi SDK] ${diagnostic.type}: ${diagnostic.message}`;
58
+ if (diagnostic.type === "error") throw new Error(line);
59
+ process.stderr.write(`${line}
60
+ `);
61
+ }
62
+ const sessionManager = await createSessionManager(config);
63
+ const model = resolveConfiguredModel(config.model, services.modelRegistry);
64
+ if (config.model && !model) {
65
+ throw new Error(`Configured Pi model '${config.model}' was not found in Pi model registry.`);
66
+ }
67
+ const { session } = await createAgentSessionFromServices({
68
+ services,
69
+ sessionManager,
70
+ model
71
+ });
72
+ const header = session.sessionManager.getHeader();
73
+ if (header) writeJson(header);
74
+ const unsubscribe = session.subscribe((event) => writeJson(event));
75
+ try {
76
+ await session.prompt(config.prompt);
77
+ } finally {
78
+ unsubscribe();
79
+ session.dispose();
80
+ await services.settingsManager.flush();
81
+ }
82
+ }
83
+ run().catch((error) => {
84
+ const message = error instanceof Error ? error.message : String(error);
85
+ writeJson({
86
+ type: "message_end",
87
+ message: {
88
+ role: "assistant",
89
+ content: [],
90
+ stopReason: "error",
91
+ errorMessage: message
92
+ }
93
+ });
94
+ writeJson({ type: "turn_end" });
95
+ process.exitCode = 1;
96
+ });
package/dist/index.js CHANGED
@@ -2,12 +2,14 @@
2
2
  import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
- parseDaemonCliArgs
6
- } from "./chunk-4H5XFLYA.js";
5
+ parseDaemonCliArgs,
6
+ scrubDaemonAuthEnv
7
+ } from "./chunk-5EVWI6BL.js";
7
8
  import "./chunk-M2KQBJR3.js";
8
9
 
9
10
  // src/index.ts
10
- var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
11
+ var parsedArgs = parseDaemonCliArgs(process.argv.slice(2), process.env);
12
+ scrubDaemonAuthEnv(process.env);
11
13
  if (!parsedArgs) {
12
14
  console.error(DAEMON_CLI_USAGE);
13
15
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slock-ai/daemon",
3
- "version": "0.56.0",
3
+ "version": "0.56.1-play.20260603140721",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "slock-daemon": "dist/index.js"