@flowy-agent-store/sdk 0.1.0-beta.2 → 0.1.0-beta.4

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 CHANGED
@@ -8,13 +8,57 @@ import { launchClient } from "@flowy-agent-store/sdk";
8
8
  const session = await launchClient({
9
9
  client: { name: "my-app", version: "0.1.0" },
10
10
  });
11
- const store = await session.client.listStore();
11
+
12
+ // 获取:浏览 / 搜索目录(含每个条目的安装状态)
13
+ const items = await session.client.store.search("software");
14
+
15
+ // 安装:导入 + 注册,并等到组件真的可用(默认 waitForReady: true)
16
+ const outcome = await session.client.store.install(items[0]);
17
+ if (outcome.readyIssue === "authorization_required") {
18
+ await session.client.connectors.authStart(outcome.readyComponentId!);
19
+ }
20
+
21
+ // 禁用 / 启用:连接器改 mcp_servers.enabled,专家/专家团改 Preset.enabled
22
+ await session.client.store.setEnabled(items[0], false);
23
+
24
+ // 卸载:真的释放运行时产物(技能目录 / Preset / MCP server 行),再清记录
25
+ const released = await session.client.store.uninstall(items[0]);
26
+ if (!released.ok) console.warn(released.components.filter((c) => !c.ok));
27
+
12
28
  await session.close();
13
29
  ```
14
30
 
31
+ 五个动词都在 SDK 里可用,但**都不在 `@flowy-agent-store/sdk` 这个包里**:本包只负责进程与传输,方法来自 `@flowy-agent-store/client`,其中 `store` 子客户端把 `install` / `uninstall` / `setEnabled` 编排成一条状态机(`search → install → … → uninstall`)。这样分层是刻意的——见 `docs/agent-store/12-sdk-packaging.md` §2 的职责划分。
32
+
33
+ 几条使用上的事实(都是实测结论,不是约定):
34
+
35
+ - `store.install` 默认**等到可用**才 resolve。技能拷完即可用,连接器不然:它注册出来是 **disabled** 的(安装器的既定默认),所以就绪检查会先把它 enable,再跑一次探针——只轮询状态永远到不了 `connected`,因为状态派生自上一次探针。
36
+ - 就绪超时**不会丢掉安装结果**:返回成功的安装 + `ready: false` / `readyIssue: "ready_timeout"`。需要 OAuth 的连接器立刻返回 `authorization_required`,不把超时预算烧光。
37
+ - 没有「更新」动词。`store.checkUpdates()` 只报告哪些条目有新版,`store.updateHint(item)` 告诉你该怎么做——当前是 `"uninstall_reinstall"`:卸载后重装,安装路径会按版本漂移重新导入,取到市场当前版本。
38
+ - 卸载是**可重入**的:产物已不在算成功。部分失败时那些组件保持已安装、`ok: false` 且点名到组件,重试有意义。
39
+ - `store.setEnabled(item, false)` 对技能只翻一个目录层标记,返回 `code: "skill_disable_flag_only"`——技能语料没有启用状态,要让技能离开运行时只能 `uninstall`。这个 code 会原样透出,不会被吞。
40
+
15
41
  规则(P0 实测结论):
16
42
 
17
43
  - 子进程固定 `--host 127.0.0.1 --no-open`;非回环一律拒绝(`isLoopbackUrl`)。
44
+ - 工具面不用改宿主自己的 `~/.agent-store/config.toml`:`env.AGENT_STORE_TOOLS` 直接指定,值是 JSON(形状同 `[tools]` 表),**整份替换**文件里的策略,`{}` = 全开。它只在 Store 宿主生效(桌面 / Web 宿主不采纳 `[tools]`),且子进程启动时读一次。
45
+
46
+ ```ts
47
+ const session = await launchClient({
48
+ client: { name: "my-app", version: "0.1.0" },
49
+ env: {
50
+ // 只要基础能力:关掉桌面控制/浏览器与几个域
51
+ AGENT_STORE_TOOLS: JSON.stringify({
52
+ web: true,
53
+ computer: false,
54
+ browser: false,
55
+ domains: { cron: false, knowledge: false, media: false },
56
+ }),
57
+ },
58
+ });
59
+ ```
18
60
  - 默认自带临时 `--data-dir` 并在 `close()` 删除;传自己的目录即表示独占——后端单实例锁会 fail-fast。
19
- - 二进制定位:`bin` 参数 → `AGENT_STORE_BIN` → `PATH`;找不到直接报错(不下载,见 P2)。
20
- - 就绪行 `protocol_version` 与 SDK 不一致时杀掉子进程并报错(含两端版本)。
61
+ - 二进制定位:`bin` 参数 → `AGENT_STORE_BIN` → 平台 runtime 包的 `vendor/` → `PATH`;找不到直接报错(**不下载**,见 P2)。
62
+ - 就绪行 `protocol_version` 与 SDK 不一致时杀掉子进程并报错(含两端版本)。该值是**契约指纹**,不是版本号:任何 wire 变更都会 bump。
63
+
64
+ 不在本包范围内(`07-typescript-sdk.md` §非目标):`config/*` 与 `skill/*` 写面。它们的**类型**在 `@flowy-agent-store/protocol`(wire 上存在的方法就有形状),但**没有** typed 方法——因为这些面跟着宿主自己的设置文件与技能目录走,是最易变的部分。这是可发现性边界,不是权限边界:`client.transport` 是公开的,服务端按磁盘归属判定可写性。要用就直连 `transport.request`,并自担变动。
package/dist/index.cjs CHANGED
@@ -10,7 +10,7 @@ let node_readline = require("node:readline");
10
10
  let _flowy_agent_store_protocol = require("@flowy-agent-store/protocol");
11
11
  //#region src/bin.ts
12
12
  /**
13
- * Locate the `agent-store` runtime binary.
13
+ * Locate the `flowy-agent-store` runtime binary.
14
14
  *
15
15
  * Order (docs/agent-store/12 §6):
16
16
  * 1. explicit `bin` argument (skips every other lookup)
@@ -18,13 +18,13 @@ let _flowy_agent_store_protocol = require("@flowy-agent-store/protocol");
18
18
  * 3. platform runtime package (`@flowy-agent-store/runtime-<platform>-<arch>`,
19
19
  * an optionalDependency of `@flowy-agent-store/sdk`) resolved via
20
20
  * `createRequire(import.meta.url).resolve` — the binary ships inside the
21
- * package (`vendor/agent-store[.exe]`)
22
- * 4. `agent-store[.exe]` on `PATH`
21
+ * package (`vendor/flowy-agent-store[.exe]`)
22
+ * 4. `flowy-agent-store[.exe]` on `PATH`
23
23
  *
24
24
  * Anything else is a hard error — the SDK never downloads or guesses.
25
25
  */
26
26
  const VENDOR_DIR = "vendor";
27
- const BIN_NAMES = ["agent-store", "agent-store.exe"];
27
+ const BIN_NAMES = ["flowy-agent-store", "flowy-agent-store.exe"];
28
28
  function resolveAppServerBin(explicit) {
29
29
  if (explicit && (0, node_fs.existsSync)(explicit)) return explicit;
30
30
  const candidates = [];
@@ -38,7 +38,7 @@ function resolveAppServerBin(explicit) {
38
38
  if (found) candidates.push(found);
39
39
  }
40
40
  const hit = candidates.find((candidate) => (0, node_fs.existsSync)(candidate));
41
- if (!hit) throw new Error(`cannot find the agent-store runtime binary: pass \`bin\`, set AGENT_STORE_BIN, install @flowy-agent-store/runtime-${process.platform}-${process.arch} alongside @flowy-agent-store/sdk, or put agent-store[.exe] on PATH`);
41
+ if (!hit) throw new Error(`cannot find the flowy-agent-store runtime binary: pass \`bin\`, set AGENT_STORE_BIN, install @flowy-agent-store/runtime-${process.platform}-${process.arch} alongside @flowy-agent-store/sdk, or put flowy-agent-store[.exe] on PATH`);
42
42
  return hit;
43
43
  }
44
44
  /** Probe the platform runtime package for a vendored binary (optional dep). */
@@ -112,7 +112,7 @@ async function spawnAppServer(options = {}) {
112
112
  const ownedDir = options.dataDir === void 0;
113
113
  const dataDir = ownedDir ? await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "agent-store-sdk-")) : options.dataDir;
114
114
  const port = options.port ?? 0;
115
- const child = (0, node_child_process.spawn)(bin, [
115
+ const { child, exited } = spawnRuntimeChild(bin, [
116
116
  "--host",
117
117
  "127.0.0.1",
118
118
  "--port",
@@ -121,14 +121,7 @@ async function spawnAppServer(options = {}) {
121
121
  dataDir,
122
122
  "--no-open",
123
123
  ...options.extraArgs ?? []
124
- ], {
125
- stdio: [
126
- "ignore",
127
- "pipe",
128
- "pipe"
129
- ],
130
- windowsHide: true
131
- });
124
+ ], options);
132
125
  const stderrTail = [];
133
126
  child.stderr?.on("data", (chunk) => {
134
127
  for (const line of String(chunk).split(/\r?\n/)) {
@@ -168,6 +161,7 @@ async function spawnAppServer(options = {}) {
168
161
  return {
169
162
  readiness,
170
163
  dataDir,
164
+ exited,
171
165
  close: async () => {
172
166
  if (closed) return;
173
167
  closed = true;
@@ -187,31 +181,77 @@ async function spawnAppServer(options = {}) {
187
181
  throw error;
188
182
  }
189
183
  }
184
+ /**
185
+ * Spawn the runtime process and start tracking its exit.
186
+ *
187
+ * Internal (not part of the package entry): exported so the lifecycle and
188
+ * `env` / `cwd` passthrough contract can be exercised with a synthetic child,
189
+ * which is what the managed CLI args normally make impossible to inject.
190
+ */
191
+ function spawnRuntimeChild(bin, args, options = {}) {
192
+ const child = (0, node_child_process.spawn)(bin, args, {
193
+ stdio: [
194
+ "ignore",
195
+ "pipe",
196
+ "pipe"
197
+ ],
198
+ windowsHide: true,
199
+ ...options.env ? { env: {
200
+ ...process.env,
201
+ ...options.env
202
+ } } : {},
203
+ ...options.cwd ? { cwd: options.cwd } : {}
204
+ });
205
+ return {
206
+ child,
207
+ exited: new Promise((resolve) => {
208
+ child.once("exit", (code, signal) => {
209
+ const info = {
210
+ code,
211
+ signal
212
+ };
213
+ resolve(info);
214
+ try {
215
+ options.onExit?.(info);
216
+ } catch {}
217
+ });
218
+ })
219
+ };
220
+ }
221
+ /** Internal: exported for the stdout-backpressure regression test only. */
190
222
  function waitForReadiness(child, timeoutMs) {
191
223
  return new Promise((resolve, reject) => {
192
224
  if (!child.stdout) {
193
225
  reject(/* @__PURE__ */ new Error("spawned runtime has no stdout pipe"));
194
226
  return;
195
227
  }
196
- const lines = (0, node_readline.createInterface)({ input: child.stdout });
197
- const timer = setTimeout(() => {
228
+ const stdout = child.stdout;
229
+ const lines = (0, node_readline.createInterface)({ input: stdout });
230
+ let settled = false;
231
+ const fail = (error) => {
232
+ if (settled) return;
233
+ settled = true;
198
234
  lines.close();
199
- reject(/* @__PURE__ */ new Error(`timed out after ${timeoutMs}ms waiting for the runtime readiness line`));
200
- }, timeoutMs);
201
- const done = (fn) => {
202
- clearTimeout(timer);
203
- lines.close();
204
- fn();
235
+ reject(error);
205
236
  };
237
+ const timer = setTimeout(() => {
238
+ fail(/* @__PURE__ */ new Error(`timed out after ${timeoutMs}ms waiting for the runtime readiness line`));
239
+ }, timeoutMs);
206
240
  lines.on("line", (line) => {
241
+ if (settled) return;
207
242
  const readiness = parseReadinessLine(line);
208
- if (readiness) done(() => resolve(readiness));
243
+ if (!readiness) return;
244
+ settled = true;
245
+ clearTimeout(timer);
246
+ lines.close();
247
+ stdout.resume();
248
+ resolve(readiness);
209
249
  });
210
250
  child.once("error", (error) => {
211
- done(() => reject(/* @__PURE__ */ new Error(`failed to spawn the runtime: ${error.message}`)));
251
+ fail(/* @__PURE__ */ new Error(`failed to spawn the runtime: ${error.message}`));
212
252
  });
213
253
  child.once("exit", (code) => {
214
- done(() => reject(/* @__PURE__ */ new Error(`runtime exited before reporting readiness (code ${code})`)));
254
+ fail(/* @__PURE__ */ new Error(`runtime exited before reporting readiness (code ${code})`));
215
255
  });
216
256
  });
217
257
  }
@@ -262,6 +302,7 @@ async function launchClient(options) {
262
302
  }
263
303
  }
264
304
  //#endregion
305
+ exports.assertProtocolCompatible = assertProtocolCompatible;
265
306
  exports.launchClient = launchClient;
266
307
  exports.parseReadinessLine = parseReadinessLine;
267
308
  exports.resolveAppServerBin = resolveAppServerBin;
package/dist/index.d.cts CHANGED
@@ -23,6 +23,8 @@ interface ReadinessInfo {
23
23
  export declare function parseReadinessLine(line: string): ReadinessInfo | null;
24
24
  //#endregion
25
25
  //#region src/spawn.d.ts
26
+ /** Fail when the runtime speaks a different wire protocol (§7 acceptance). */
27
+ export declare function assertProtocolCompatible(runtimeVersion: string): void;
26
28
  interface SpawnOptions {
27
29
  /** Explicit binary path (overrides `AGENT_STORE_BIN` / `PATH`). */
28
30
  bin?: string;
@@ -34,10 +36,29 @@ interface SpawnOptions {
34
36
  extraArgs?: string[];
35
37
  /** How long to wait for the readiness line. Defaults to 120s (cold DB init). */
36
38
  readyTimeoutMs?: number;
39
+ /** Extra environment variables, merged over the parent's `process.env`. */
40
+ env?: Record<string, string | undefined>;
41
+ /** Working directory for the child. Defaults to the parent's cwd. */
42
+ cwd?: string;
43
+ /** Called once when the child exits, for any reason (crash included). */
44
+ onExit?: (info: SpawnExitInfo) => void;
45
+ }
46
+ /** How a spawned runtime process ended. */
47
+ interface SpawnExitInfo {
48
+ /** Exit code, or `null` when the process was terminated by a signal. */
49
+ code: number | null;
50
+ /** Terminating signal, or `null` on a normal exit. */
51
+ signal: string | null;
37
52
  }
38
53
  interface SpawnedServer {
39
54
  readonly readiness: ReadinessInfo;
40
55
  readonly dataDir: string;
56
+ /**
57
+ * Settles when the runtime process exits — including an unexpected crash,
58
+ * which is otherwise indistinguishable from "still starting up". Never
59
+ * rejects: inspect `code` / `signal`.
60
+ */
61
+ readonly exited: Promise<SpawnExitInfo>;
41
62
  /** Terminate the child and remove the data dir when it was auto-created. */
42
63
  close(): Promise<void>;
43
64
  }
@@ -64,4 +85,4 @@ export interface LaunchedClient {
64
85
  */
65
86
  export declare function launchClient(options: LaunchOptions): Promise<LaunchedClient>;
66
87
  //#endregion
67
- export type { ReadinessInfo, SpawnOptions, SpawnedServer };
88
+ export type { ReadinessInfo, SpawnExitInfo, SpawnOptions, SpawnedServer };
package/dist/index.d.mts CHANGED
@@ -23,6 +23,8 @@ interface ReadinessInfo {
23
23
  export declare function parseReadinessLine(line: string): ReadinessInfo | null;
24
24
  //#endregion
25
25
  //#region src/spawn.d.ts
26
+ /** Fail when the runtime speaks a different wire protocol (§7 acceptance). */
27
+ export declare function assertProtocolCompatible(runtimeVersion: string): void;
26
28
  interface SpawnOptions {
27
29
  /** Explicit binary path (overrides `AGENT_STORE_BIN` / `PATH`). */
28
30
  bin?: string;
@@ -34,10 +36,29 @@ interface SpawnOptions {
34
36
  extraArgs?: string[];
35
37
  /** How long to wait for the readiness line. Defaults to 120s (cold DB init). */
36
38
  readyTimeoutMs?: number;
39
+ /** Extra environment variables, merged over the parent's `process.env`. */
40
+ env?: Record<string, string | undefined>;
41
+ /** Working directory for the child. Defaults to the parent's cwd. */
42
+ cwd?: string;
43
+ /** Called once when the child exits, for any reason (crash included). */
44
+ onExit?: (info: SpawnExitInfo) => void;
45
+ }
46
+ /** How a spawned runtime process ended. */
47
+ interface SpawnExitInfo {
48
+ /** Exit code, or `null` when the process was terminated by a signal. */
49
+ code: number | null;
50
+ /** Terminating signal, or `null` on a normal exit. */
51
+ signal: string | null;
37
52
  }
38
53
  interface SpawnedServer {
39
54
  readonly readiness: ReadinessInfo;
40
55
  readonly dataDir: string;
56
+ /**
57
+ * Settles when the runtime process exits — including an unexpected crash,
58
+ * which is otherwise indistinguishable from "still starting up". Never
59
+ * rejects: inspect `code` / `signal`.
60
+ */
61
+ readonly exited: Promise<SpawnExitInfo>;
41
62
  /** Terminate the child and remove the data dir when it was auto-created. */
42
63
  close(): Promise<void>;
43
64
  }
@@ -64,4 +85,4 @@ export interface LaunchedClient {
64
85
  */
65
86
  export declare function launchClient(options: LaunchOptions): Promise<LaunchedClient>;
66
87
  //#endregion
67
- export type { ReadinessInfo, SpawnOptions, SpawnedServer };
88
+ export type { ReadinessInfo, SpawnExitInfo, SpawnOptions, SpawnedServer };
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import { createInterface } from "node:readline";
9
9
  import { APP_SERVER_PROTOCOL_VERSION } from "@flowy-agent-store/protocol";
10
10
  //#region src/bin.ts
11
11
  /**
12
- * Locate the `agent-store` runtime binary.
12
+ * Locate the `flowy-agent-store` runtime binary.
13
13
  *
14
14
  * Order (docs/agent-store/12 §6):
15
15
  * 1. explicit `bin` argument (skips every other lookup)
@@ -17,13 +17,13 @@ import { APP_SERVER_PROTOCOL_VERSION } from "@flowy-agent-store/protocol";
17
17
  * 3. platform runtime package (`@flowy-agent-store/runtime-<platform>-<arch>`,
18
18
  * an optionalDependency of `@flowy-agent-store/sdk`) resolved via
19
19
  * `createRequire(import.meta.url).resolve` — the binary ships inside the
20
- * package (`vendor/agent-store[.exe]`)
21
- * 4. `agent-store[.exe]` on `PATH`
20
+ * package (`vendor/flowy-agent-store[.exe]`)
21
+ * 4. `flowy-agent-store[.exe]` on `PATH`
22
22
  *
23
23
  * Anything else is a hard error — the SDK never downloads or guesses.
24
24
  */
25
25
  const VENDOR_DIR = "vendor";
26
- const BIN_NAMES = ["agent-store", "agent-store.exe"];
26
+ const BIN_NAMES = ["flowy-agent-store", "flowy-agent-store.exe"];
27
27
  function resolveAppServerBin(explicit) {
28
28
  if (explicit && existsSync(explicit)) return explicit;
29
29
  const candidates = [];
@@ -37,7 +37,7 @@ function resolveAppServerBin(explicit) {
37
37
  if (found) candidates.push(found);
38
38
  }
39
39
  const hit = candidates.find((candidate) => existsSync(candidate));
40
- if (!hit) throw new Error(`cannot find the agent-store runtime binary: pass \`bin\`, set AGENT_STORE_BIN, install @flowy-agent-store/runtime-${process.platform}-${process.arch} alongside @flowy-agent-store/sdk, or put agent-store[.exe] on PATH`);
40
+ if (!hit) throw new Error(`cannot find the flowy-agent-store runtime binary: pass \`bin\`, set AGENT_STORE_BIN, install @flowy-agent-store/runtime-${process.platform}-${process.arch} alongside @flowy-agent-store/sdk, or put flowy-agent-store[.exe] on PATH`);
41
41
  return hit;
42
42
  }
43
43
  /** Probe the platform runtime package for a vendored binary (optional dep). */
@@ -111,7 +111,7 @@ async function spawnAppServer(options = {}) {
111
111
  const ownedDir = options.dataDir === void 0;
112
112
  const dataDir = ownedDir ? await mkdtemp(join(tmpdir(), "agent-store-sdk-")) : options.dataDir;
113
113
  const port = options.port ?? 0;
114
- const child = spawn(bin, [
114
+ const { child, exited } = spawnRuntimeChild(bin, [
115
115
  "--host",
116
116
  "127.0.0.1",
117
117
  "--port",
@@ -120,14 +120,7 @@ async function spawnAppServer(options = {}) {
120
120
  dataDir,
121
121
  "--no-open",
122
122
  ...options.extraArgs ?? []
123
- ], {
124
- stdio: [
125
- "ignore",
126
- "pipe",
127
- "pipe"
128
- ],
129
- windowsHide: true
130
- });
123
+ ], options);
131
124
  const stderrTail = [];
132
125
  child.stderr?.on("data", (chunk) => {
133
126
  for (const line of String(chunk).split(/\r?\n/)) {
@@ -167,6 +160,7 @@ async function spawnAppServer(options = {}) {
167
160
  return {
168
161
  readiness,
169
162
  dataDir,
163
+ exited,
170
164
  close: async () => {
171
165
  if (closed) return;
172
166
  closed = true;
@@ -186,31 +180,77 @@ async function spawnAppServer(options = {}) {
186
180
  throw error;
187
181
  }
188
182
  }
183
+ /**
184
+ * Spawn the runtime process and start tracking its exit.
185
+ *
186
+ * Internal (not part of the package entry): exported so the lifecycle and
187
+ * `env` / `cwd` passthrough contract can be exercised with a synthetic child,
188
+ * which is what the managed CLI args normally make impossible to inject.
189
+ */
190
+ function spawnRuntimeChild(bin, args, options = {}) {
191
+ const child = spawn(bin, args, {
192
+ stdio: [
193
+ "ignore",
194
+ "pipe",
195
+ "pipe"
196
+ ],
197
+ windowsHide: true,
198
+ ...options.env ? { env: {
199
+ ...process.env,
200
+ ...options.env
201
+ } } : {},
202
+ ...options.cwd ? { cwd: options.cwd } : {}
203
+ });
204
+ return {
205
+ child,
206
+ exited: new Promise((resolve) => {
207
+ child.once("exit", (code, signal) => {
208
+ const info = {
209
+ code,
210
+ signal
211
+ };
212
+ resolve(info);
213
+ try {
214
+ options.onExit?.(info);
215
+ } catch {}
216
+ });
217
+ })
218
+ };
219
+ }
220
+ /** Internal: exported for the stdout-backpressure regression test only. */
189
221
  function waitForReadiness(child, timeoutMs) {
190
222
  return new Promise((resolve, reject) => {
191
223
  if (!child.stdout) {
192
224
  reject(/* @__PURE__ */ new Error("spawned runtime has no stdout pipe"));
193
225
  return;
194
226
  }
195
- const lines = createInterface({ input: child.stdout });
196
- const timer = setTimeout(() => {
227
+ const stdout = child.stdout;
228
+ const lines = createInterface({ input: stdout });
229
+ let settled = false;
230
+ const fail = (error) => {
231
+ if (settled) return;
232
+ settled = true;
197
233
  lines.close();
198
- reject(/* @__PURE__ */ new Error(`timed out after ${timeoutMs}ms waiting for the runtime readiness line`));
199
- }, timeoutMs);
200
- const done = (fn) => {
201
- clearTimeout(timer);
202
- lines.close();
203
- fn();
234
+ reject(error);
204
235
  };
236
+ const timer = setTimeout(() => {
237
+ fail(/* @__PURE__ */ new Error(`timed out after ${timeoutMs}ms waiting for the runtime readiness line`));
238
+ }, timeoutMs);
205
239
  lines.on("line", (line) => {
240
+ if (settled) return;
206
241
  const readiness = parseReadinessLine(line);
207
- if (readiness) done(() => resolve(readiness));
242
+ if (!readiness) return;
243
+ settled = true;
244
+ clearTimeout(timer);
245
+ lines.close();
246
+ stdout.resume();
247
+ resolve(readiness);
208
248
  });
209
249
  child.once("error", (error) => {
210
- done(() => reject(/* @__PURE__ */ new Error(`failed to spawn the runtime: ${error.message}`)));
250
+ fail(/* @__PURE__ */ new Error(`failed to spawn the runtime: ${error.message}`));
211
251
  });
212
252
  child.once("exit", (code) => {
213
- done(() => reject(/* @__PURE__ */ new Error(`runtime exited before reporting readiness (code ${code})`)));
253
+ fail(/* @__PURE__ */ new Error(`runtime exited before reporting readiness (code ${code})`));
214
254
  });
215
255
  });
216
256
  }
@@ -261,4 +301,4 @@ async function launchClient(options) {
261
301
  }
262
302
  }
263
303
  //#endregion
264
- export { launchClient, parseReadinessLine, resolveAppServerBin, spawnAppServer };
304
+ export { assertProtocolCompatible, launchClient, parseReadinessLine, resolveAppServerBin, spawnAppServer };
package/package.json CHANGED
@@ -1,40 +1,49 @@
1
- {
2
- "name": "@flowy-agent-store/sdk",
3
- "version": "0.1.0-beta.2",
4
- "description": "Node.js host for the Agent Store App Server: spawn the runtime binary and connect over loopback (docs/agent-store/12 P1-3)",
5
- "type": "module",
6
- "license": "Apache-2.0",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.mts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
12
- },
13
- "./package.json": "./package.json"
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "dependencies": {
19
- "@flowy-agent-store/client": "0.1.0-beta.2",
20
- "@flowy-agent-store/protocol": "0.1.0-beta.2"
21
- },
22
- "scripts": {
23
- "build": "tsdown",
24
- "prepack": "tsdown"
25
- },
26
- "publishConfig": {
27
- "access": "public",
28
- "registry": "https://registry.npmjs.org/"
29
- },
30
- "main": "./dist/index.cjs",
31
- "module": "./dist/index.mjs",
32
- "types": "./dist/index.d.mts",
33
- "optionalDependencies": {
34
- "@flowy-agent-store/runtime-win32-x64": "0.1.0-beta.2",
35
- "@flowy-agent-store/runtime-linux-x64": "0.1.0-beta.2",
36
- "@flowy-agent-store/runtime-linux-arm64": "0.1.0-beta.2",
37
- "@flowy-agent-store/runtime-darwin-x64": "0.1.0-beta.2",
38
- "@flowy-agent-store/runtime-darwin-arm64": "0.1.0-beta.2"
39
- }
40
- }
1
+ {
2
+ "name": "@flowy-agent-store/sdk",
3
+ "version": "0.1.0-beta.4",
4
+ "description": "Node.js host for the Agent Store App Server: spawn the runtime binary and connect over loopback (docs/agent-store/12 P1-3)",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/Michael-Lfx/allo.git",
13
+ "directory": "web/packages/sdk"
14
+ },
15
+ "sideEffects": false,
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.mts",
19
+ "import": "./dist/index.mjs",
20
+ "require": "./dist/index.cjs"
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "dependencies": {
28
+ "@flowy-agent-store/client": "0.1.0-beta.4",
29
+ "@flowy-agent-store/protocol": "0.1.0-beta.4"
30
+ },
31
+ "scripts": {
32
+ "build": "tsdown",
33
+ "prepack": "tsdown"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public",
37
+ "registry": "https://registry.npmjs.org/"
38
+ },
39
+ "main": "./dist/index.cjs",
40
+ "module": "./dist/index.mjs",
41
+ "types": "./dist/index.d.mts",
42
+ "optionalDependencies": {
43
+ "@flowy-agent-store/runtime-win32-x64": "0.1.0-beta.4",
44
+ "@flowy-agent-store/runtime-linux-x64": "0.1.0-beta.4",
45
+ "@flowy-agent-store/runtime-linux-arm64": "0.1.0-beta.4",
46
+ "@flowy-agent-store/runtime-darwin-x64": "0.1.0-beta.4",
47
+ "@flowy-agent-store/runtime-darwin-arm64": "0.1.0-beta.4"
48
+ }
49
+ }