appduct 0.10.0 → 0.11.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/README.md +122 -52
- package/dist/artifact-inspect.d.ts +0 -1
- package/dist/bin.d.ts +0 -1
- package/dist/bin.js +1250 -2
- package/dist/cli/command-options.d.ts +8 -1
- package/dist/cli/create-cli.d.ts +0 -1
- package/dist/cli/dispatch.d.ts +10 -1
- package/dist/cli/envelope.d.ts +19 -0
- package/dist/cli/global-flags.d.ts +30 -0
- package/dist/cli/open-target.d.ts +25 -8
- package/dist/cli/result-types.d.ts +31 -5
- package/dist/cli/router.d.ts +78 -0
- package/dist/cli/routes/daemon/index.d.ts +9 -0
- package/dist/cli/routes/daemon/index.js +848 -0
- package/dist/cli/routes/daemon/run.d.ts +3 -0
- package/dist/cli/routes/daemon/run.js +3246 -0
- package/dist/cli/routes/daemon/start.d.ts +3 -0
- package/dist/cli/routes/daemon/start.js +1677 -0
- package/dist/cli/routes/daemon/status.d.ts +4 -0
- package/dist/cli/routes/daemon/status.js +1685 -0
- package/dist/cli/routes/daemon/stop.d.ts +4 -0
- package/dist/cli/routes/daemon/stop.js +1655 -0
- package/dist/cli/routes/doctor.d.ts +3 -0
- package/dist/cli/routes/doctor.js +1075 -0
- package/dist/cli/routes/events.d.ts +3 -0
- package/dist/cli/routes/events.js +1915 -0
- package/dist/cli/routes/init.d.ts +3 -0
- package/dist/cli/routes/init.js +1486 -0
- package/dist/cli/routes/invoke.d.ts +3 -0
- package/dist/cli/routes/invoke.js +1893 -0
- package/dist/cli/routes/keygen.d.ts +3 -0
- package/dist/cli/routes/keygen.js +928 -0
- package/dist/cli/routes/link.d.ts +3 -0
- package/dist/cli/routes/link.js +2714 -0
- package/dist/cli/routes/ls.d.ts +3 -0
- package/dist/cli/routes/ls.js +1668 -0
- package/dist/cli/routes/mcp.d.ts +5 -0
- package/dist/cli/routes/mcp.js +3929 -0
- package/dist/cli/routes/revoke.d.ts +3 -0
- package/dist/cli/routes/revoke.js +1684 -0
- package/dist/cli/routes/tools.d.ts +3 -0
- package/dist/cli/routes/tools.js +1860 -0
- package/dist/cli/runner.d.ts +3 -11
- package/dist/cli/types.d.ts +9 -6
- package/dist/cli/version-guard.d.ts +20 -0
- package/dist/cli.d.ts +0 -1
- package/dist/client/app-client.d.ts +4 -4
- package/dist/client/bootstrap.d.ts +4 -4
- package/dist/client/connect.d.ts +0 -1
- package/dist/client/errors.d.ts +0 -1
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.js +2389 -16
- package/dist/commands/daemon/context.d.ts +14 -0
- package/dist/commands/daemon/run.d.ts +11 -0
- package/dist/commands/daemon/start.d.ts +5 -0
- package/dist/commands/daemon/status.d.ts +5 -0
- package/dist/commands/daemon/stop.d.ts +5 -0
- package/dist/commands/doctor.d.ts +0 -1
- package/dist/commands/events.d.ts +0 -1
- package/dist/commands/init.d.ts +17 -4
- package/dist/commands/invoke.d.ts +0 -1
- package/dist/commands/keygen.d.ts +0 -1
- package/dist/commands/link.d.ts +1 -2
- package/dist/commands/ls.d.ts +0 -1
- package/dist/commands/mcp.d.ts +2 -4
- package/dist/commands/revoke.d.ts +0 -1
- package/dist/commands/tools.d.ts +19 -3
- package/dist/daemon/address.d.ts +0 -1
- package/dist/daemon/audit.d.ts +6 -11
- package/dist/daemon/calls.d.ts +0 -1
- package/dist/daemon/config.d.ts +13 -16
- package/dist/daemon/daemon.d.ts +0 -1
- package/dist/daemon/event-bus.d.ts +0 -1
- package/dist/daemon/links.d.ts +0 -1
- package/dist/daemon/listener.d.ts +0 -1
- package/dist/daemon/log-rotation.d.ts +0 -1
- package/dist/daemon/pidfile.d.ts +14 -8
- package/dist/daemon/policy.d.ts +0 -1
- package/dist/daemon/registry.d.ts +0 -1
- package/dist/daemon/rpc-errors.d.ts +16 -0
- package/dist/daemon/rpc-server.d.ts +0 -11
- package/dist/daemon/sessions.d.ts +0 -1
- package/dist/daemon/socket-probe.d.ts +0 -1
- package/dist/daemon/state-dir.d.ts +0 -1
- package/dist/daemon/timers.d.ts +0 -1
- package/dist/daemon/tls.d.ts +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/host-certificate.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1307 -3
- package/dist/key-material.d.ts +0 -1
- package/dist/link.d.ts +8 -7
- package/dist/mcp/app-tools.d.ts +153 -0
- package/dist/mcp/connect-tool.d.ts +14 -8
- package/dist/mcp/daemon-tools.d.ts +2 -11
- package/dist/mcp/events-tool.d.ts +0 -1
- package/dist/mcp/server.d.ts +33 -14
- package/dist/native-scheme.d.ts +0 -1
- package/dist/output.d.ts +8 -11
- package/dist/package-root.d.ts +11 -0
- package/dist/package-version.d.ts +0 -1
- package/dist/qr-terminal.d.ts +0 -1
- package/dist/rpc/client.d.ts +3 -3
- package/dist/scheme.d.ts +60 -2
- package/dist/spki-pin.d.ts +0 -1
- package/package.json +6 -3
- package/dist/artifact-inspect.d.ts.map +0 -1
- package/dist/artifact-inspect.js +0 -334
- package/dist/bin.d.ts.map +0 -1
- package/dist/cli/command-options.d.ts.map +0 -1
- package/dist/cli/command-options.js +0 -95
- package/dist/cli/create-cli.d.ts.map +0 -1
- package/dist/cli/create-cli.js +0 -56
- package/dist/cli/dispatch.d.ts.map +0 -1
- package/dist/cli/dispatch.js +0 -275
- package/dist/cli/open-target.d.ts.map +0 -1
- package/dist/cli/open-target.js +0 -438
- package/dist/cli/result-types.d.ts.map +0 -1
- package/dist/cli/result-types.js +0 -6
- package/dist/cli/runner.d.ts.map +0 -1
- package/dist/cli/runner.js +0 -111
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/types.js +0 -10
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -2
- package/dist/client/app-client.d.ts.map +0 -1
- package/dist/client/app-client.js +0 -223
- package/dist/client/bootstrap.d.ts.map +0 -1
- package/dist/client/bootstrap.js +0 -108
- package/dist/client/connect.d.ts.map +0 -1
- package/dist/client/connect.js +0 -38
- package/dist/client/errors.d.ts.map +0 -1
- package/dist/client/errors.js +0 -40
- package/dist/client/index.d.ts.map +0 -1
- package/dist/commands/daemon.d.ts +0 -22
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js +0 -128
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -42
- package/dist/commands/events.d.ts.map +0 -1
- package/dist/commands/events.js +0 -76
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -231
- package/dist/commands/invoke.d.ts.map +0 -1
- package/dist/commands/invoke.js +0 -54
- package/dist/commands/keygen.d.ts.map +0 -1
- package/dist/commands/keygen.js +0 -46
- package/dist/commands/link.d.ts.map +0 -1
- package/dist/commands/link.js +0 -43
- package/dist/commands/ls.d.ts.map +0 -1
- package/dist/commands/ls.js +0 -7
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -98
- package/dist/commands/revoke.d.ts.map +0 -1
- package/dist/commands/revoke.js +0 -7
- package/dist/commands/tools.d.ts.map +0 -1
- package/dist/commands/tools.js +0 -52
- package/dist/daemon/address.d.ts.map +0 -1
- package/dist/daemon/address.js +0 -71
- package/dist/daemon/audit.d.ts.map +0 -1
- package/dist/daemon/audit.js +0 -237
- package/dist/daemon/calls.d.ts.map +0 -1
- package/dist/daemon/calls.js +0 -158
- package/dist/daemon/config.d.ts.map +0 -1
- package/dist/daemon/config.js +0 -170
- package/dist/daemon/daemon.d.ts.map +0 -1
- package/dist/daemon/daemon.js +0 -560
- package/dist/daemon/event-bus.d.ts.map +0 -1
- package/dist/daemon/event-bus.js +0 -111
- package/dist/daemon/links.d.ts.map +0 -1
- package/dist/daemon/links.js +0 -118
- package/dist/daemon/listener.d.ts.map +0 -1
- package/dist/daemon/listener.js +0 -132
- package/dist/daemon/log-rotation.d.ts.map +0 -1
- package/dist/daemon/log-rotation.js +0 -136
- package/dist/daemon/pidfile.d.ts.map +0 -1
- package/dist/daemon/pidfile.js +0 -90
- package/dist/daemon/policy.d.ts.map +0 -1
- package/dist/daemon/policy.js +0 -24
- package/dist/daemon/registry.d.ts.map +0 -1
- package/dist/daemon/registry.js +0 -31
- package/dist/daemon/rpc-server.d.ts.map +0 -1
- package/dist/daemon/rpc-server.js +0 -203
- package/dist/daemon/sessions.d.ts.map +0 -1
- package/dist/daemon/sessions.js +0 -429
- package/dist/daemon/socket-probe.d.ts.map +0 -1
- package/dist/daemon/socket-probe.js +0 -28
- package/dist/daemon/state-dir.d.ts.map +0 -1
- package/dist/daemon/state-dir.js +0 -43
- package/dist/daemon/timers.d.ts.map +0 -1
- package/dist/daemon/timers.js +0 -12
- package/dist/daemon/tls.d.ts.map +0 -1
- package/dist/daemon/tls.js +0 -79
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -162
- package/dist/host-certificate.d.ts.map +0 -1
- package/dist/host-certificate.js +0 -111
- package/dist/index.d.ts.map +0 -1
- package/dist/key-material.d.ts.map +0 -1
- package/dist/key-material.js +0 -42
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js +0 -117
- package/dist/mcp/connect-tool.d.ts.map +0 -1
- package/dist/mcp/connect-tool.js +0 -396
- package/dist/mcp/daemon-tools.d.ts.map +0 -1
- package/dist/mcp/daemon-tools.js +0 -29
- package/dist/mcp/events-tool.d.ts.map +0 -1
- package/dist/mcp/events-tool.js +0 -322
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -538
- package/dist/mcp/tool-mapping.d.ts +0 -58
- package/dist/mcp/tool-mapping.d.ts.map +0 -1
- package/dist/mcp/tool-mapping.js +0 -143
- package/dist/mcp/tool-namespace.d.ts +0 -40
- package/dist/mcp/tool-namespace.d.ts.map +0 -1
- package/dist/mcp/tool-namespace.js +0 -65
- package/dist/native-scheme.d.ts.map +0 -1
- package/dist/native-scheme.js +0 -465
- package/dist/output.d.ts.map +0 -1
- package/dist/output.js +0 -342
- package/dist/package-version.d.ts.map +0 -1
- package/dist/package-version.js +0 -47
- package/dist/qr-terminal.d.ts.map +0 -1
- package/dist/qr-terminal.js +0 -45
- package/dist/rpc/client.d.ts.map +0 -1
- package/dist/rpc/client.js +0 -819
- package/dist/scheme.d.ts.map +0 -1
- package/dist/scheme.js +0 -321
- package/dist/spki-pin.d.ts.map +0 -1
- 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>>;
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -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
|
|
6
|
-
* the
|
|
7
|
-
*
|
|
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
|
package/dist/commands/link.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type LinkCommandOptions = {
|
|
|
11
11
|
scheme?: string;
|
|
12
12
|
open?: string;
|
|
13
13
|
device?: string;
|
|
14
|
-
|
|
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
|
package/dist/commands/ls.d.ts
CHANGED
package/dist/commands/mcp.d.ts
CHANGED
|
@@ -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
|
|
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
|
package/dist/commands/tools.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `appduct tools` (ARCHITECTURE.md §10): `tools [selector] [--full]
|
|
3
|
-
*
|
|
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
|
package/dist/daemon/address.d.ts
CHANGED
|
@@ -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
|
package/dist/daemon/audit.d.ts
CHANGED
|
@@ -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
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
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?: "
|
|
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
|
package/dist/daemon/calls.d.ts
CHANGED
|
@@ -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
|
package/dist/daemon/config.d.ts
CHANGED
|
@@ -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
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
|
package/dist/daemon/daemon.d.ts
CHANGED
package/dist/daemon/links.d.ts
CHANGED
package/dist/daemon/pidfile.d.ts
CHANGED
|
@@ -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)`
|
|
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?"
|
|
18
|
-
* it the same way — pidfile takeover, the auto-spawn path's
|
|
19
|
-
* all hinge on it, and a second implementation that
|
|
20
|
-
* them quietly clobbering a live
|
|
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
|
package/dist/daemon/policy.d.ts
CHANGED
|
@@ -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
|
|
@@ -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
|
|
@@ -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
|
package/dist/daemon/timers.d.ts
CHANGED
package/dist/daemon/tls.d.ts
CHANGED
|
@@ -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
|
package/dist/index.d.ts
CHANGED