appduct 0.10.0 → 0.11.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.
Files changed (230) hide show
  1. package/README.md +121 -51
  2. package/dist/artifact-inspect.d.ts +0 -1
  3. package/dist/bin.d.ts +0 -1
  4. package/dist/bin.js +1250 -2
  5. package/dist/cli/command-options.d.ts +8 -1
  6. package/dist/cli/create-cli.d.ts +0 -1
  7. package/dist/cli/dispatch.d.ts +10 -1
  8. package/dist/cli/envelope.d.ts +19 -0
  9. package/dist/cli/global-flags.d.ts +30 -0
  10. package/dist/cli/open-target.d.ts +25 -8
  11. package/dist/cli/result-types.d.ts +30 -5
  12. package/dist/cli/router.d.ts +78 -0
  13. package/dist/cli/routes/daemon/index.d.ts +9 -0
  14. package/dist/cli/routes/daemon/index.js +848 -0
  15. package/dist/cli/routes/daemon/run.d.ts +3 -0
  16. package/dist/cli/routes/daemon/run.js +3246 -0
  17. package/dist/cli/routes/daemon/start.d.ts +3 -0
  18. package/dist/cli/routes/daemon/start.js +1668 -0
  19. package/dist/cli/routes/daemon/status.d.ts +4 -0
  20. package/dist/cli/routes/daemon/status.js +1676 -0
  21. package/dist/cli/routes/daemon/stop.d.ts +4 -0
  22. package/dist/cli/routes/daemon/stop.js +1646 -0
  23. package/dist/cli/routes/doctor.d.ts +3 -0
  24. package/dist/cli/routes/doctor.js +1075 -0
  25. package/dist/cli/routes/events.d.ts +3 -0
  26. package/dist/cli/routes/events.js +1906 -0
  27. package/dist/cli/routes/init.d.ts +3 -0
  28. package/dist/cli/routes/init.js +1486 -0
  29. package/dist/cli/routes/invoke.d.ts +3 -0
  30. package/dist/cli/routes/invoke.js +1884 -0
  31. package/dist/cli/routes/keygen.d.ts +3 -0
  32. package/dist/cli/routes/keygen.js +928 -0
  33. package/dist/cli/routes/link.d.ts +3 -0
  34. package/dist/cli/routes/link.js +2705 -0
  35. package/dist/cli/routes/ls.d.ts +3 -0
  36. package/dist/cli/routes/ls.js +1659 -0
  37. package/dist/cli/routes/mcp.d.ts +5 -0
  38. package/dist/cli/routes/mcp.js +3917 -0
  39. package/dist/cli/routes/revoke.d.ts +3 -0
  40. package/dist/cli/routes/revoke.js +1675 -0
  41. package/dist/cli/routes/tools.d.ts +3 -0
  42. package/dist/cli/routes/tools.js +1851 -0
  43. package/dist/cli/runner.d.ts +3 -11
  44. package/dist/cli/types.d.ts +9 -6
  45. package/dist/cli/version-guard.d.ts +20 -0
  46. package/dist/cli.d.ts +0 -1
  47. package/dist/client/app-client.d.ts +0 -1
  48. package/dist/client/bootstrap.d.ts +4 -4
  49. package/dist/client/connect.d.ts +0 -1
  50. package/dist/client/errors.d.ts +0 -1
  51. package/dist/client/index.d.ts +0 -1
  52. package/dist/client/index.js +2379 -16
  53. package/dist/commands/daemon/context.d.ts +14 -0
  54. package/dist/commands/daemon/run.d.ts +11 -0
  55. package/dist/commands/daemon/start.d.ts +5 -0
  56. package/dist/commands/daemon/status.d.ts +5 -0
  57. package/dist/commands/daemon/stop.d.ts +5 -0
  58. package/dist/commands/doctor.d.ts +0 -1
  59. package/dist/commands/events.d.ts +0 -1
  60. package/dist/commands/init.d.ts +17 -4
  61. package/dist/commands/invoke.d.ts +0 -1
  62. package/dist/commands/keygen.d.ts +0 -1
  63. package/dist/commands/link.d.ts +1 -2
  64. package/dist/commands/ls.d.ts +0 -1
  65. package/dist/commands/mcp.d.ts +2 -4
  66. package/dist/commands/revoke.d.ts +0 -1
  67. package/dist/commands/tools.d.ts +19 -3
  68. package/dist/daemon/address.d.ts +0 -1
  69. package/dist/daemon/audit.d.ts +6 -11
  70. package/dist/daemon/calls.d.ts +0 -1
  71. package/dist/daemon/config.d.ts +13 -16
  72. package/dist/daemon/daemon.d.ts +0 -1
  73. package/dist/daemon/event-bus.d.ts +0 -1
  74. package/dist/daemon/links.d.ts +0 -1
  75. package/dist/daemon/listener.d.ts +0 -1
  76. package/dist/daemon/log-rotation.d.ts +0 -1
  77. package/dist/daemon/pidfile.d.ts +14 -8
  78. package/dist/daemon/policy.d.ts +0 -1
  79. package/dist/daemon/registry.d.ts +0 -1
  80. package/dist/daemon/rpc-errors.d.ts +16 -0
  81. package/dist/daemon/rpc-server.d.ts +0 -11
  82. package/dist/daemon/sessions.d.ts +0 -1
  83. package/dist/daemon/socket-probe.d.ts +0 -1
  84. package/dist/daemon/state-dir.d.ts +0 -1
  85. package/dist/daemon/timers.d.ts +0 -1
  86. package/dist/daemon/tls.d.ts +0 -1
  87. package/dist/errors.d.ts +0 -1
  88. package/dist/host-certificate.d.ts +0 -1
  89. package/dist/index.d.ts +0 -1
  90. package/dist/index.js +1307 -3
  91. package/dist/key-material.d.ts +0 -1
  92. package/dist/link.d.ts +8 -7
  93. package/dist/mcp/app-tools.d.ts +153 -0
  94. package/dist/mcp/connect-tool.d.ts +14 -8
  95. package/dist/mcp/daemon-tools.d.ts +2 -11
  96. package/dist/mcp/events-tool.d.ts +0 -1
  97. package/dist/mcp/server.d.ts +33 -14
  98. package/dist/native-scheme.d.ts +0 -1
  99. package/dist/output.d.ts +8 -11
  100. package/dist/package-root.d.ts +11 -0
  101. package/dist/package-version.d.ts +0 -1
  102. package/dist/qr-terminal.d.ts +0 -1
  103. package/dist/rpc/client.d.ts +0 -1
  104. package/dist/scheme.d.ts +60 -2
  105. package/dist/spki-pin.d.ts +0 -1
  106. package/package.json +4 -3
  107. package/dist/artifact-inspect.d.ts.map +0 -1
  108. package/dist/artifact-inspect.js +0 -334
  109. package/dist/bin.d.ts.map +0 -1
  110. package/dist/cli/command-options.d.ts.map +0 -1
  111. package/dist/cli/command-options.js +0 -95
  112. package/dist/cli/create-cli.d.ts.map +0 -1
  113. package/dist/cli/create-cli.js +0 -56
  114. package/dist/cli/dispatch.d.ts.map +0 -1
  115. package/dist/cli/dispatch.js +0 -275
  116. package/dist/cli/open-target.d.ts.map +0 -1
  117. package/dist/cli/open-target.js +0 -438
  118. package/dist/cli/result-types.d.ts.map +0 -1
  119. package/dist/cli/result-types.js +0 -6
  120. package/dist/cli/runner.d.ts.map +0 -1
  121. package/dist/cli/runner.js +0 -111
  122. package/dist/cli/types.d.ts.map +0 -1
  123. package/dist/cli/types.js +0 -10
  124. package/dist/cli.d.ts.map +0 -1
  125. package/dist/cli.js +0 -2
  126. package/dist/client/app-client.d.ts.map +0 -1
  127. package/dist/client/app-client.js +0 -223
  128. package/dist/client/bootstrap.d.ts.map +0 -1
  129. package/dist/client/bootstrap.js +0 -108
  130. package/dist/client/connect.d.ts.map +0 -1
  131. package/dist/client/connect.js +0 -38
  132. package/dist/client/errors.d.ts.map +0 -1
  133. package/dist/client/errors.js +0 -40
  134. package/dist/client/index.d.ts.map +0 -1
  135. package/dist/commands/daemon.d.ts +0 -22
  136. package/dist/commands/daemon.d.ts.map +0 -1
  137. package/dist/commands/daemon.js +0 -128
  138. package/dist/commands/doctor.d.ts.map +0 -1
  139. package/dist/commands/doctor.js +0 -42
  140. package/dist/commands/events.d.ts.map +0 -1
  141. package/dist/commands/events.js +0 -76
  142. package/dist/commands/init.d.ts.map +0 -1
  143. package/dist/commands/init.js +0 -231
  144. package/dist/commands/invoke.d.ts.map +0 -1
  145. package/dist/commands/invoke.js +0 -54
  146. package/dist/commands/keygen.d.ts.map +0 -1
  147. package/dist/commands/keygen.js +0 -46
  148. package/dist/commands/link.d.ts.map +0 -1
  149. package/dist/commands/link.js +0 -43
  150. package/dist/commands/ls.d.ts.map +0 -1
  151. package/dist/commands/ls.js +0 -7
  152. package/dist/commands/mcp.d.ts.map +0 -1
  153. package/dist/commands/mcp.js +0 -98
  154. package/dist/commands/revoke.d.ts.map +0 -1
  155. package/dist/commands/revoke.js +0 -7
  156. package/dist/commands/tools.d.ts.map +0 -1
  157. package/dist/commands/tools.js +0 -52
  158. package/dist/daemon/address.d.ts.map +0 -1
  159. package/dist/daemon/address.js +0 -71
  160. package/dist/daemon/audit.d.ts.map +0 -1
  161. package/dist/daemon/audit.js +0 -237
  162. package/dist/daemon/calls.d.ts.map +0 -1
  163. package/dist/daemon/calls.js +0 -158
  164. package/dist/daemon/config.d.ts.map +0 -1
  165. package/dist/daemon/config.js +0 -170
  166. package/dist/daemon/daemon.d.ts.map +0 -1
  167. package/dist/daemon/daemon.js +0 -560
  168. package/dist/daemon/event-bus.d.ts.map +0 -1
  169. package/dist/daemon/event-bus.js +0 -111
  170. package/dist/daemon/links.d.ts.map +0 -1
  171. package/dist/daemon/links.js +0 -118
  172. package/dist/daemon/listener.d.ts.map +0 -1
  173. package/dist/daemon/listener.js +0 -132
  174. package/dist/daemon/log-rotation.d.ts.map +0 -1
  175. package/dist/daemon/log-rotation.js +0 -136
  176. package/dist/daemon/pidfile.d.ts.map +0 -1
  177. package/dist/daemon/pidfile.js +0 -90
  178. package/dist/daemon/policy.d.ts.map +0 -1
  179. package/dist/daemon/policy.js +0 -24
  180. package/dist/daemon/registry.d.ts.map +0 -1
  181. package/dist/daemon/registry.js +0 -31
  182. package/dist/daemon/rpc-server.d.ts.map +0 -1
  183. package/dist/daemon/rpc-server.js +0 -203
  184. package/dist/daemon/sessions.d.ts.map +0 -1
  185. package/dist/daemon/sessions.js +0 -429
  186. package/dist/daemon/socket-probe.d.ts.map +0 -1
  187. package/dist/daemon/socket-probe.js +0 -28
  188. package/dist/daemon/state-dir.d.ts.map +0 -1
  189. package/dist/daemon/state-dir.js +0 -43
  190. package/dist/daemon/timers.d.ts.map +0 -1
  191. package/dist/daemon/timers.js +0 -12
  192. package/dist/daemon/tls.d.ts.map +0 -1
  193. package/dist/daemon/tls.js +0 -79
  194. package/dist/errors.d.ts.map +0 -1
  195. package/dist/errors.js +0 -162
  196. package/dist/host-certificate.d.ts.map +0 -1
  197. package/dist/host-certificate.js +0 -111
  198. package/dist/index.d.ts.map +0 -1
  199. package/dist/key-material.d.ts.map +0 -1
  200. package/dist/key-material.js +0 -42
  201. package/dist/link.d.ts.map +0 -1
  202. package/dist/link.js +0 -117
  203. package/dist/mcp/connect-tool.d.ts.map +0 -1
  204. package/dist/mcp/connect-tool.js +0 -396
  205. package/dist/mcp/daemon-tools.d.ts.map +0 -1
  206. package/dist/mcp/daemon-tools.js +0 -29
  207. package/dist/mcp/events-tool.d.ts.map +0 -1
  208. package/dist/mcp/events-tool.js +0 -322
  209. package/dist/mcp/server.d.ts.map +0 -1
  210. package/dist/mcp/server.js +0 -538
  211. package/dist/mcp/tool-mapping.d.ts +0 -58
  212. package/dist/mcp/tool-mapping.d.ts.map +0 -1
  213. package/dist/mcp/tool-mapping.js +0 -143
  214. package/dist/mcp/tool-namespace.d.ts +0 -40
  215. package/dist/mcp/tool-namespace.d.ts.map +0 -1
  216. package/dist/mcp/tool-namespace.js +0 -65
  217. package/dist/native-scheme.d.ts.map +0 -1
  218. package/dist/native-scheme.js +0 -465
  219. package/dist/output.d.ts.map +0 -1
  220. package/dist/output.js +0 -342
  221. package/dist/package-version.d.ts.map +0 -1
  222. package/dist/package-version.js +0 -47
  223. package/dist/qr-terminal.d.ts.map +0 -1
  224. package/dist/qr-terminal.js +0 -45
  225. package/dist/rpc/client.d.ts.map +0 -1
  226. package/dist/rpc/client.js +0 -819
  227. package/dist/scheme.d.ts.map +0 -1
  228. package/dist/scheme.js +0 -321
  229. package/dist/spki-pin.d.ts.map +0 -1
  230. package/dist/spki-pin.js +0 -14
@@ -0,0 +1,14 @@
1
+ /** The context shared by the `appduct daemon <action>` handlers (`run.ts`, `start.ts`, `stop.ts`,
2
+ * `status.ts`). One file per action so the CLI's lazy router (`cli/router.ts`) can load `status`
3
+ * without evaluating `run`'s daemon implementation (ARCHITECTURE.md §10 "Startup cost"). */
4
+ import type { Clock } from "../../cli/types.js";
5
+ import type { SpawnFn } from "../../rpc/client.js";
6
+ export type DaemonCommandContext = {
7
+ stateDir: string;
8
+ clock?: Clock;
9
+ spawn?: SpawnFn;
10
+ warn?: (message: string) => void;
11
+ /** Test seam: the version `daemon status` compares the daemon against; defaults to this
12
+ * package's own version. */
13
+ clientVersion?: string;
14
+ };
@@ -0,0 +1,11 @@
1
+ /** `appduct daemon run` (ARCHITECTURE.md §4): host the daemon in this process. The only daemon
2
+ * action that loads the daemon implementation itself (`daemon/daemon.ts`, and with it `ws` and the
3
+ * certificate stack), which is why it lives in its own module. */
4
+ import type { CliResult, DaemonRunCommandData } from "../../cli/result-types.js";
5
+ import type { DaemonCommandContext } from "./context.js";
6
+ export type DaemonRunHostedResult = {
7
+ result: CliResult<DaemonRunCommandData>;
8
+ completion: Promise<void>;
9
+ stop: () => void;
10
+ };
11
+ export declare const handleDaemonRunCommand: (context: DaemonCommandContext) => Promise<DaemonRunHostedResult>;
@@ -0,0 +1,5 @@
1
+ /** `appduct daemon start` (ARCHITECTURE.md §4): a `daemon.status` call with auto-spawn on, so a
2
+ * daemon that isn't running gets started as a detached process — never in-process. */
3
+ import type { CliResult, DaemonStartCommandData } from "../../cli/result-types.js";
4
+ import type { DaemonCommandContext } from "./context.js";
5
+ export declare const handleDaemonStartCommand: (context: DaemonCommandContext) => Promise<CliResult<DaemonStartCommandData>>;
@@ -0,0 +1,5 @@
1
+ /** `appduct daemon status` (ARCHITECTURE.md §4): `daemon.status` passthrough plus the version-drift
2
+ * diagnosis. Warns instead of restarting, unlike the guarded commands (`cli/dispatch.ts`). */
3
+ import type { CliResult, DaemonStatusCommandData } from "../../cli/result-types.js";
4
+ import type { DaemonCommandContext } from "./context.js";
5
+ export declare const handleDaemonStatusCommand: (context: DaemonCommandContext) => Promise<CliResult<DaemonStatusCommandData>>;
@@ -0,0 +1,5 @@
1
+ /** `appduct daemon stop` (ARCHITECTURE.md §4): `daemon.shutdown` over RPC, falling back to a
2
+ * SIGTERM at the pidfile's process when the socket is not answering. */
3
+ import type { CliResult, DaemonStopCommandData } from "../../cli/result-types.js";
4
+ import type { DaemonCommandContext } from "./context.js";
5
+ export declare const handleDaemonStopCommand: (context: DaemonCommandContext) => Promise<CliResult<DaemonStopCommandData>>;
@@ -20,4 +20,3 @@ export type DoctorCommandContext = {
20
20
  exec?: ExecBufferFn;
21
21
  };
22
22
  export declare const handleDoctorCommand: (options: DoctorCommandOptions, context?: DoctorCommandContext) => Promise<CliResult<DoctorCommandData>>;
23
- //# sourceMappingURL=doctor.d.ts.map
@@ -34,4 +34,3 @@ export type EventsHostedResult = {
34
34
  stop: () => void;
35
35
  };
36
36
  export declare const handleEventsCommand: (options: EventsCommandOptions, context: EventsCommandContext) => Promise<EventsHostedResult>;
37
- //# sourceMappingURL=events.d.ts.map
@@ -2,9 +2,17 @@
2
2
  * `appduct init` (issue #29): the one command that takes an app root from "package installed"
3
3
  * to "an agent can connect".
4
4
  *
5
- * It writes a *project-level* `.appduct/config.json` holding the deep-link scheme, and returns
6
- * the two things that are not discoverable from the filesystem: the MCP server entry to paste into
7
- * an agent's config, and the `import "@appduct/react-native/auto"` reminder the app needs.
5
+ * It writes a *project-level* `.appduct/config.json` holding the deep-link scheme and, since issue
6
+ * #63, the installed app's id per platform (`appId.ios`/`appId.android` — needed to deliver a
7
+ * link with `--open ios-device`/`--open android` without an "Open with" chooser silently eating
8
+ * it), and returns the two things that are not discoverable from the filesystem: the MCP server
9
+ * entry to paste into an agent's config, and the `import "@appduct/react-native/auto"` reminder
10
+ * the app needs.
11
+ *
12
+ * Unlike `scheme`, an app id has no discovery tier: `--ios-app-id`/`--android-app-id` (or an
13
+ * already-recorded value) is the whole story, and the two are independent flags rather than one
14
+ * `--app-id` — the platforms' ids usually match but not always, and `init` never guesses one from
15
+ * the other (see `discoverNativeScheme`'s own refusal to guess when two probes disagree).
8
16
  *
9
17
  * What it deliberately does **not** do:
10
18
  *
@@ -38,6 +46,12 @@ import type { CliResult, InitCommandData } from "../cli/result-types.js";
38
46
  export type InitCommandOptions = {
39
47
  scheme?: string;
40
48
  force?: boolean;
49
+ /** Writes `appId.ios`. Optional and independent of `androidAppId` — the two ids usually match
50
+ * but not always, so `init` never guesses one from the other (issue #63; see
51
+ * `discoverNativeScheme`'s own refusal-to-guess for the same reasoning applied to a scheme). */
52
+ iosAppId?: string;
53
+ /** Writes `appId.android`. See {@link iosAppId}. */
54
+ androidAppId?: string;
41
55
  };
42
56
  export type InitCommandContext = {
43
57
  /** The app root to initialize. Defaults to `process.cwd()`. */
@@ -48,4 +62,3 @@ export type InitCommandContext = {
48
62
  homeDir?: string;
49
63
  };
50
64
  export declare const handleInitCommand: (options: InitCommandOptions, context?: InitCommandContext) => Promise<CliResult<InitCommandData>>;
51
- //# sourceMappingURL=init.d.ts.map
@@ -19,4 +19,3 @@ export declare const handleInvokeCommand: (options: InvokeCommandOptions, contex
19
19
  /** Aborted on SIGINT (issue #9): closes the RPC connection that issued `tools.call`, which the
20
20
  * daemon treats as a mid-flight cancel and forwards to the app as `tool_cancel`. */
21
21
  signal?: AbortSignal) => Promise<CliResult<InvokeCommandData>>;
22
- //# sourceMappingURL=invoke.d.ts.map
@@ -20,4 +20,3 @@ export type KeygenCommandContext = {
20
20
  stateDir: string;
21
21
  };
22
22
  export declare const handleKeygenCommand: (options: KeygenCommandOptions, context: KeygenCommandContext) => Promise<CliResult<KeygenCommandData>>;
23
- //# sourceMappingURL=keygen.d.ts.map
@@ -11,7 +11,7 @@ export type LinkCommandOptions = {
11
11
  scheme?: string;
12
12
  open?: string;
13
13
  device?: string;
14
- bundleId?: string;
14
+ appId?: string;
15
15
  relaunch?: boolean;
16
16
  };
17
17
  export type LinkCommandContext = {
@@ -27,4 +27,3 @@ export type LinkCommandContext = {
27
27
  schemeEnv?: NodeJS.ProcessEnv;
28
28
  };
29
29
  export declare const handleLinkCommand: (options: LinkCommandOptions, context: LinkCommandContext) => Promise<CliResult<LinkCommandData>>;
30
- //# sourceMappingURL=link.d.ts.map
@@ -6,4 +6,3 @@ export type LsCommandContext = {
6
6
  spawn?: SpawnFn;
7
7
  };
8
8
  export declare const handleLsCommand: (context: LsCommandContext) => Promise<CliResult<LsCommandData>>;
9
- //# sourceMappingURL=ls.d.ts.map
@@ -22,10 +22,9 @@ export type McpCommandContext = {
22
22
  checkVersion?: VersionCheckOptions;
23
23
  /** `--scheme`, the highest-precedence source in `scheme.ts`'s order. */
24
24
  scheme?: string;
25
- /** Where scheme discovery starts; defaults to `process.cwd()`. */
25
+ /** Where scheme discovery starts, and where `appduct_connect` resolves an `appId` from on each
26
+ * call (`ConnectToolDeps.cwd`); defaults to `process.cwd()`. */
26
27
  cwd?: string;
27
- /** Overrides `config.json`'s `iosBundleId`; test seam, same shape as `scheme`. */
28
- iosBundleId?: string;
29
28
  exec?: ExecFn;
30
29
  /** Environment for `adb`/`simctl`, not for `APPDUCT_SCHEME` (see `schemeEnv`). */
31
30
  env?: NodeJS.ProcessEnv;
@@ -46,4 +45,3 @@ export type McpHostedResult = {
46
45
  handle: McpServerHandle;
47
46
  };
48
47
  export declare const handleMcpCommand: (context: McpCommandContext) => Promise<McpHostedResult>;
49
- //# sourceMappingURL=mcp.d.ts.map
@@ -9,4 +9,3 @@ export type RevokeCommandContext = {
9
9
  spawn?: SpawnFn;
10
10
  };
11
11
  export declare const handleRevokeCommand: (options: RevokeCommandOptions, context: RevokeCommandContext) => Promise<CliResult<RevokeCommandData>>;
12
- //# sourceMappingURL=revoke.d.ts.map
@@ -1,6 +1,8 @@
1
1
  /**
2
- * `appduct tools` (ARCHITECTURE.md §10): `tools [selector] [--full]` lists tools for a session;
3
- * `tools [selector] <name>` shows one tool's full schema/annotations.
2
+ * `appduct tools` (ARCHITECTURE.md §10): `tools [selector] [--full] [--group <name>] [--filter
3
+ * <text>] [--limit <n>] [--offset <n>]` lists tools for a session; `tools [selector] --groups`
4
+ * lists only the session's groups with their tool counts; `tools [selector] <name>` shows one
5
+ * tool's full schema/annotations.
4
6
  *
5
7
  * The command table gives both forms a leading optional `[selector]`, which makes a single
6
8
  * positional argument inherently ambiguous (is it the selector, or the tool name in `tools <name>`
@@ -8,16 +10,30 @@
8
10
  * first try the arg as a tool name in the implicit-selector session's registry; if no such tool
9
11
  * exists there (or the implicit selector doesn't resolve, e.g. `ambiguous_session`), fall back to
10
12
  * treating it as a selector and list that session's tools instead.
13
+ *
14
+ * `--group`/`--filter`/`--limit`/`--offset` only ever reach the daemon on a *listing* request: the detail
15
+ * path (an explicit `<name>`, or the ambiguous single-arg probe above) always asks for the whole,
16
+ * unpaged registry, so a name lookup can never miss a tool that paging would have left off a page.
11
17
  */
12
18
  import type { CliResult, ToolsCommandData } from "../cli/result-types.js";
13
19
  import { type SpawnFn } from "../rpc/client.js";
14
20
  export type ToolsCommandOptions = {
15
21
  selector?: string;
16
22
  name?: string;
23
+ /** Only tools in this group (`checkout` includes `checkout/*`). Listing only. */
24
+ group?: string;
25
+ /** List the session's groups with tool counts instead of its tools. Listing only, and
26
+ * exclusive with every other listing flag. */
27
+ groups?: boolean;
28
+ /** Case-insensitive substring match against name and description. Listing only. */
29
+ filter?: string;
30
+ /** Page size. Listing only. */
31
+ limit?: number;
32
+ /** Zero-based start index into the sorted, filtered list. Listing only. */
33
+ offset?: number;
17
34
  };
18
35
  export type ToolsCommandContext = {
19
36
  stateDir: string;
20
37
  spawn?: SpawnFn;
21
38
  };
22
39
  export declare const handleToolsCommand: (options: ToolsCommandOptions, context: ToolsCommandContext) => Promise<CliResult<ToolsCommandData>>;
23
- //# sourceMappingURL=tools.d.ts.map
@@ -27,4 +27,3 @@ export type DetectAdvertisedAddressOptions = {
27
27
  * IPv6 address, finally falling back to loopback if nothing else is available.
28
28
  */
29
29
  export declare const detectAdvertisedAddress: (options?: DetectAdvertisedAddressOptions) => AdvertisedAddress;
30
- //# sourceMappingURL=address.d.ts.map
@@ -43,17 +43,13 @@ export type AuditRecord = {
43
43
  /**
44
44
  * Set only when a `"prompt"`-policy call actually proceeded because the MCP server confirmed a
45
45
  * consent gate (ARCHITECTURE.md §12). Deliberately distinct from a plain `"ok"`: the daemon
46
- * never observed either channel's client-side behavior itself, only that the call arrived
47
- * carrying this marker. The value distinguishes which gate fired:
48
- * - `"client"` (issue #14): the flag-based gate — the weaker of the two, evidence only that
49
- * `_meta["anthropic/requiresUserInteraction"]` was emitted and the client is one known to
50
- * enforce it, not that a human actually answered a prompt.
51
- * - `"elicitation"` (issue #10): the client replied `action: "accept"` to a live
52
- * `elicitation/create` request sent for this call — an observed decision, not merely an armed
53
- * flag, though still not independently verifiable by the daemon (see the field-level trust
54
- * caveat on `ToolsCallParams.consent` in `@appduct/shared`).
46
+ * never observed the client-side prompt itself, only that the call arrived carrying this marker.
47
+ * The only value is `"elicitation"` (issue #10): the client replied `action: "accept"` to a live
48
+ * `elicitation/create` request sent for this call — not independently verifiable by the daemon
49
+ * (see the field-level trust caveat on `ToolsCallParams.consent` in `@appduct/shared`). Audit
50
+ * files written before the flag-based channel was removed may still contain `"client"`.
55
51
  */
56
- consent?: "client" | "elicitation";
52
+ consent?: "elicitation";
57
53
  };
58
54
  /**
59
55
  * Audit directory footprint, surfaced by `daemon.status` so the growth is visible (issue #32).
@@ -104,4 +100,3 @@ export type AuditLoggerOptions = {
104
100
  export declare const canonicalArgsJson: (args: Record<string, unknown>) => string;
105
101
  export declare const argsSha256: (args: Record<string, unknown>) => string;
106
102
  export declare const createAuditLogger: (options: AuditLoggerOptions) => AuditLogger;
107
- //# sourceMappingURL=audit.d.ts.map
@@ -81,4 +81,3 @@ export declare const clampTimeout: (timeoutMs: number | undefined) => number;
81
81
  * 32-bit timer range (~24.8 days), which silently fires the timer immediately. */
82
82
  export declare const deriveCallTransportTimeoutMs: (timeoutMs: number | undefined) => number;
83
83
  export declare const createCallsManager: (options: CallsManagerOptions) => CallsManager;
84
- //# sourceMappingURL=calls.d.ts.map
@@ -9,13 +9,10 @@ export type PolicyDecision = "allow" | "deny" | "prompt";
9
9
  * `config.json`'s `policy` shape (ARCHITECTURE.md §12): `default` applies to tools whose
10
10
  * descriptor has no `annotations.destructiveHint`; `destructive` applies when it is `true`;
11
11
  * `tools["<alias>/<name>"]` overrides both for one specific tool on one specific session alias.
12
- * `"prompt"` means "a human gate is required; if one cannot be guaranteed, deny" — today there are
13
- * two such gates, both MCP-only (ARCHITECTURE.md §9/§12): an MCP client that declares the
14
- * `elicitation` capability at `initialize` (issue #10, preferred whenever available) and an MCP
15
- * client that honors `_meta["anthropic/requiresUserInteraction"]` (issue #14, Claude Code ≥
16
- * v2.1.199, used only as a fallback for a client that doesn't declare elicitation). Every other
17
- * caller (CLI, an MCP client on neither channel) gets `policy_denied` with reason
18
- * `no_consent_channel`.
12
+ * `"prompt"` means "a human gate is required; if one cannot be guaranteed, deny" — today the only
13
+ * such gate is an MCP client that declares the `elicitation` capability at `initialize`
14
+ * (ARCHITECTURE.md §9/§12, issue #10). Every other caller (CLI, an MCP client without
15
+ * elicitation) gets `policy_denied` with reason `no_consent_channel`.
19
16
  */
20
17
  export type AppductPolicyConfig = {
21
18
  default: PolicyDecision;
@@ -23,6 +20,15 @@ export type AppductPolicyConfig = {
23
20
  tools?: Record<string, PolicyDecision>;
24
21
  };
25
22
  export type AppductConfig = {
23
+ /**
24
+ * TCP port for the pinned-wss listener (ARCHITECTURE.md §3). `0` is special and means
25
+ * "let the OS assign a free ephemeral port": the listener binds `0`, and everything that
26
+ * reports or advertises the port afterwards (`daemon.status`'s `wssPort`, a minted link's
27
+ * `endpoint.port`) reports the *bound* port instead. That is the only way several daemons can
28
+ * coexist on one machine without the operator hand-picking ports for each — which is exactly
29
+ * what the test suite needs when several vitest processes run concurrently. Every other value
30
+ * must be a positive integer.
31
+ */
26
32
  wssPort: number;
27
33
  keyPath: string;
28
34
  graceSeconds: number;
@@ -55,14 +61,6 @@ export type AppductConfig = {
55
61
  * CLI-side setting an operator wants to set once rather than pass with every `link` invocation.
56
62
  */
57
63
  scheme?: string;
58
- /**
59
- * The app's iOS bundle id, used only by the experimental `--open ios-device` /
60
- * `appduct_connect` `target: "ios-device"` delivery path (issue #31): `xcrun devicectl device
61
- * process launch` needs to be told which installed app to hand the URL to, and there is nothing
62
- * in the deep link itself that says so. Overridable per invocation by `--bundle-id` (CLI) or
63
- * `bundleId` (MCP). CLI-side like `scheme`, not a daemon setting.
64
- */
65
- iosBundleId?: string;
66
64
  };
67
65
  export declare const DEFAULT_AUDIT_RETENTION_DAYS = 30;
68
66
  export declare const DEFAULT_DAEMON_LOG_MAX_BYTES: number;
@@ -76,4 +74,3 @@ export type ConfigWarnFn = (message: string) => void;
76
74
  export declare const loadConfig: (paths: StateDirPaths, options?: {
77
75
  warn?: ConfigWarnFn;
78
76
  }) => Promise<AppductConfig>;
79
- //# sourceMappingURL=config.d.ts.map
@@ -40,4 +40,3 @@ export type RunningDaemon = {
40
40
  shutdown: () => Promise<void>;
41
41
  };
42
42
  export declare const startDaemon: (options: DaemonOptions) => Promise<RunningDaemon>;
43
- //# sourceMappingURL=daemon.d.ts.map
@@ -46,4 +46,3 @@ export type CreateEventBusOptions = {
46
46
  bufferSize?: number;
47
47
  };
48
48
  export declare const createEventBus: (options?: CreateEventBusOptions) => EventBus;
49
- //# sourceMappingURL=event-bus.d.ts.map
@@ -51,4 +51,3 @@ export type PendingLinkRegistry = {
51
51
  disposeAll: () => void;
52
52
  };
53
53
  export declare const createPendingLinkRegistry: (options: PendingLinkRegistryOptions) => PendingLinkRegistry;
54
- //# sourceMappingURL=links.d.ts.map
@@ -31,4 +31,3 @@ export type DaemonListener = {
31
31
  close: () => Promise<void>;
32
32
  };
33
33
  export declare const startListener: (options: ListenerOptions) => Promise<DaemonListener>;
34
- //# sourceMappingURL=listener.d.ts.map
@@ -79,4 +79,3 @@ export declare const ensureDaemonLogMode: (logFilePath: string, warn?: (message:
79
79
  * with it the spawn) with a duplicate error.
80
80
  */
81
81
  export declare const resolveDaemonLogMaxBytes: (stateDir: string) => Promise<number>;
82
- //# sourceMappingURL=log-rotation.d.ts.map
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Pidfile single-instancing (ARCHITECTURE.md §4). Acquired with `O_EXCL`; on conflict, liveness
3
- * is checked with `process.kill(pid, 0)` and the pidfile is only taken over if the owning
4
- * process is dead.
3
+ * is checked with `process.kill(pid, 0)` — plus, on Linux, a `/proc/<pid>/status` read that treats
4
+ * a zombie as dead — and the pidfile is only taken over if the owning process is dead.
5
5
  */
6
6
  export declare class DaemonAlreadyRunningError extends Error {
7
7
  readonly pid: number;
@@ -12,14 +12,21 @@ export type PidfileHandle = {
12
12
  /** Idempotent: safe to call more than once. */
13
13
  release: () => Promise<void>;
14
14
  };
15
+ /**
16
+ * Reads `/proc/<pid>/status`. Injectable purely so the zombie branch below can be tested without
17
+ * arranging a real unreaped child, which needs a process that outlives its parent *and* an init
18
+ * that does not reap — neither of which a test can rely on across platforms.
19
+ */
20
+ export type ProcStatusReader = (pid: number) => string | undefined;
15
21
  /**
16
22
  * Liveness probe for a pid this process does not own (ARCHITECTURE.md §4's `process.kill(pid, 0)`
17
- * check). Exported because every "is a daemon still there?" decision in the codebase must answer
18
- * it the same way — pidfile takeover, the auto-spawn path's stale-socket unlink, and log rotation
19
- * all hinge on it, and a second implementation that disagreed about `EPERM` would mean one of
20
- * them quietly clobbering a live daemon's state.
23
+ * check, refined by the zombie check above). Exported because every "is a daemon still there?"
24
+ * decision in the codebase must answer it the same way — pidfile takeover, the auto-spawn path's
25
+ * stale-socket unlink, and log rotation all hinge on it, and a second implementation that
26
+ * disagreed about `EPERM` (or about zombies) would mean one of them quietly clobbering a live
27
+ * daemon's state.
21
28
  */
22
- export declare const isProcessAlive: (pid: number) => boolean;
29
+ export declare const isProcessAlive: (pid: number, readStatus?: ProcStatusReader) => boolean;
23
30
  export declare const readPidFromFile: (pidFilePath: string) => Promise<number | undefined>;
24
31
  export type AcquirePidfileOptions = {
25
32
  pid?: number;
@@ -35,4 +42,3 @@ export type AcquirePidfileOptions = {
35
42
  * unparseable) but throwing {@link DaemonAlreadyRunningError} when a live daemon holds it.
36
43
  */
37
44
  export declare const acquirePidfile: (pidFilePath: string, options?: AcquirePidfileOptions) => Promise<PidfileHandle>;
38
- //# sourceMappingURL=pidfile.d.ts.map
@@ -19,4 +19,3 @@ export type PolicySession = {
19
19
  };
20
20
  export declare const policyOverrideKey: (alias: string, toolName: string) => string;
21
21
  export declare const evaluate: (descriptor: ToolDescriptor, session: PolicySession, policy: AppductPolicyConfig) => PolicyDecision;
22
- //# sourceMappingURL=policy.d.ts.map
@@ -16,4 +16,3 @@ export type ToolRegistry = {
16
16
  };
17
17
  /** `onChange` fires after every mutation (snapshot/upsert/remove) — used to emit `tools_changed`. */
18
18
  export declare const createToolRegistry: (onChange?: () => void) => ToolRegistry;
19
- //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The error the daemon's RPC handlers throw to answer a request with a typed wire error
3
+ * (ARCHITECTURE.md §5). It lives apart from `rpc-server.ts` so the modules that *raise* it — the
4
+ * session engine, the call engine — don't drag the socket server itself into every bundle that
5
+ * needs, say, a call-timeout constant from `calls.ts` (the CLI's `invoke` route does).
6
+ */
7
+ import type { ErrorType } from "@appduct/shared";
8
+ export declare class RpcApplicationError extends Error {
9
+ readonly type: ErrorType;
10
+ /** JSON-RPC error code; defaults to the shared "server error" range. */
11
+ readonly code: number;
12
+ readonly details?: unknown | undefined;
13
+ constructor(type: ErrorType, message: string,
14
+ /** JSON-RPC error code; defaults to the shared "server error" range. */
15
+ code?: number, details?: unknown | undefined);
16
+ }
@@ -4,21 +4,11 @@
4
4
  * {@link notify} on a targeted connection — this module only exposes the primitive.
5
5
  */
6
6
  import { type Server, type Socket } from "node:net";
7
- import type { ErrorType } from "@appduct/shared";
8
7
  /** 1 MiB — lines beyond this are dropped by destroying the connection (ARCHITECTURE.md task notes). */
9
8
  export declare const MAX_LINE_BYTES: number;
10
9
  /** 4 MiB — a subscriber connection (`events.subscribe`) whose outbound buffer grows past this
11
10
  * (slow/dead reader) is dropped outright rather than left to back up the daemon indefinitely. */
12
11
  export declare const MAX_NOTIFY_BUFFERED_BYTES: number;
13
- export declare class RpcApplicationError extends Error {
14
- readonly type: ErrorType;
15
- /** JSON-RPC error code; defaults to the shared "server error" range. */
16
- readonly code: number;
17
- readonly details?: unknown | undefined;
18
- constructor(type: ErrorType, message: string,
19
- /** JSON-RPC error code; defaults to the shared "server error" range. */
20
- code?: number, details?: unknown | undefined);
21
- }
22
12
  export type RpcConnection = {
23
13
  readonly id: number;
24
14
  readonly socket: Socket;
@@ -51,4 +41,3 @@ export type RpcServer = {
51
41
  close: () => Promise<void>;
52
42
  };
53
43
  export declare const startRpcServer: (options: RpcServerOptions) => Promise<RpcServer>;
54
- //# sourceMappingURL=rpc-server.d.ts.map
@@ -83,4 +83,3 @@ export type SessionManager = {
83
83
  disposeAll: (code: number, reason: string) => void;
84
84
  };
85
85
  export declare const createSessionManager: (options: SessionManagerOptions) => SessionManager;
86
- //# sourceMappingURL=sessions.d.ts.map
@@ -13,4 +13,3 @@
13
13
  * moment later.
14
14
  */
15
15
  export declare const isSocketConnectable: (socketPath: string) => Promise<boolean>;
16
- //# sourceMappingURL=socket-probe.d.ts.map
@@ -28,4 +28,3 @@ export declare const getStateDirPaths: (stateDir: string) => StateDirPaths;
28
28
  export declare const getSocketPath: (paths: StateDirPaths) => string;
29
29
  /** Creates the state dir (and `audit/`) with mode `0700` if missing; tightens the mode if it exists. */
30
30
  export declare const ensureStateDir: (stateDir: string) => Promise<StateDirPaths>;
31
- //# sourceMappingURL=state-dir.d.ts.map
@@ -13,4 +13,3 @@ export type TimerFns = {
13
13
  clearInterval: (handle: IntervalHandle) => void;
14
14
  };
15
15
  export declare const systemTimers: TimerFns;
16
- //# sourceMappingURL=timers.d.ts.map
@@ -55,4 +55,3 @@ export type CreateTlsManagerOptions = {
55
55
  };
56
56
  export declare const createTlsManager: (options: CreateTlsManagerOptions) => Promise<TlsManager>;
57
57
  export declare const toAgentEndpoint: (address: AdvertisedAddress, port: number) => AgentEndpoint;
58
- //# sourceMappingURL=tls.d.ts.map
package/dist/errors.d.ts CHANGED
@@ -25,4 +25,3 @@ export declare const toCliError: (error: unknown) => CliError;
25
25
  /** Computes the process exit code for the *original* thrown error (not the rendered `CliError`) so
26
26
  * that the sysexits classification never depends on — or leaks into — the rendered `type` field. */
27
27
  export declare const getExitCodeForError: (error: unknown) => number;
28
- //# sourceMappingURL=errors.d.ts.map
@@ -5,4 +5,3 @@ type GeneratedHostCertificate = {
5
5
  };
6
6
  export declare const generateHostCertificate: (keyPem: string, advertisedIp: string) => Promise<GeneratedHostCertificate>;
7
7
  export {};
8
- //# sourceMappingURL=host-certificate.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "./cli.js";
2
2
  export * from "./errors.js";
3
3
  export * from "./output.js";
4
- //# sourceMappingURL=index.d.ts.map