appduct 0.11.1 → 0.13.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 (74) hide show
  1. package/README.md +43 -38
  2. package/dist/bin.js +50 -36
  3. package/dist/cli/command-options.d.ts +7 -17
  4. package/dist/cli/result-types.d.ts +11 -8
  5. package/dist/cli/routes/daemon/index.js +12 -16
  6. package/dist/cli/routes/daemon/run.js +216 -46
  7. package/dist/cli/routes/daemon/start.js +18 -16
  8. package/dist/cli/routes/daemon/status.js +18 -16
  9. package/dist/cli/routes/daemon/stop.js +18 -16
  10. package/dist/cli/routes/doctor.js +12 -16
  11. package/dist/cli/routes/events/index.d.ts +9 -0
  12. package/dist/cli/routes/events/index.js +842 -0
  13. package/dist/cli/routes/events/shared-options.d.ts +12 -0
  14. package/dist/cli/routes/events/shared-options.js +102 -0
  15. package/dist/cli/routes/events/since.d.ts +6 -0
  16. package/dist/cli/routes/events/since.js +1977 -0
  17. package/dist/cli/routes/events/tail.d.ts +6 -0
  18. package/dist/cli/routes/{events.js → events/tail.js} +184 -162
  19. package/dist/cli/routes/init.js +14 -18
  20. package/dist/cli/routes/keygen.js +13 -16
  21. package/dist/cli/routes/mcp.js +193 -175
  22. package/dist/cli/routes/sessions/index.d.ts +7 -0
  23. package/dist/cli/routes/sessions/index.js +843 -0
  24. package/dist/cli/routes/sessions/link.d.ts +4 -0
  25. package/dist/cli/routes/{link.js → sessions/link.js} +19 -17
  26. package/dist/cli/routes/sessions/ls.d.ts +4 -0
  27. package/dist/cli/routes/{ls.js → sessions/ls.js} +19 -17
  28. package/dist/cli/routes/sessions/revoke.d.ts +4 -0
  29. package/dist/cli/routes/{revoke.js → sessions/revoke.js} +20 -18
  30. package/dist/cli/routes/tools/call.d.ts +4 -0
  31. package/dist/cli/routes/{invoke.js → tools/call.js} +21 -19
  32. package/dist/cli/routes/tools/describe.d.ts +6 -0
  33. package/dist/cli/routes/tools/describe.js +1837 -0
  34. package/dist/cli/routes/tools/index.d.ts +6 -0
  35. package/dist/cli/routes/tools/index.js +843 -0
  36. package/dist/cli/routes/tools/ls.d.ts +4 -0
  37. package/dist/cli/routes/{tools.js → tools/ls.js} +46 -73
  38. package/dist/cli/routes/tools/shared-options.d.ts +16 -0
  39. package/dist/cli/routes/tools/shared-options.js +122 -0
  40. package/dist/client/app-client.d.ts +96 -37
  41. package/dist/client/index.d.ts +3 -2
  42. package/dist/client/index.js +183 -139
  43. package/dist/commands/events.d.ts +31 -13
  44. package/dist/commands/invoke.d.ts +1 -1
  45. package/dist/commands/link.d.ts +1 -1
  46. package/dist/commands/ls.d.ts +1 -1
  47. package/dist/commands/revoke.d.ts +1 -1
  48. package/dist/commands/tools.d.ts +12 -13
  49. package/dist/daemon/config.d.ts +5 -2
  50. package/dist/daemon/daemon.d.ts +3 -0
  51. package/dist/daemon/event-bus.d.ts +36 -4
  52. package/dist/daemon/events-log.d.ts +31 -0
  53. package/dist/daemon/memory-append-only-file.d.ts +17 -0
  54. package/dist/daemon/node-append-only-file.d.ts +9 -0
  55. package/dist/daemon/rpc-errors.d.ts +1 -1
  56. package/dist/daemon/state-dir.d.ts +2 -0
  57. package/dist/errors.d.ts +1 -1
  58. package/dist/events/index.d.ts +60 -0
  59. package/dist/index.js +62 -39
  60. package/dist/link.d.ts +1 -1
  61. package/dist/mcp/app-tools.d.ts +3 -2
  62. package/dist/mcp/connect-tool.d.ts +1 -1
  63. package/dist/mcp/events-tool.d.ts +28 -34
  64. package/dist/native-scheme.d.ts +1 -1
  65. package/dist/output.d.ts +29 -6
  66. package/dist/rpc/client.d.ts +1 -1
  67. package/dist/scheme.d.ts +4 -4
  68. package/package.json +2 -2
  69. package/dist/cli/routes/events.d.ts +0 -3
  70. package/dist/cli/routes/invoke.d.ts +0 -3
  71. package/dist/cli/routes/link.d.ts +0 -3
  72. package/dist/cli/routes/ls.d.ts +0 -3
  73. package/dist/cli/routes/revoke.d.ts +0 -3
  74. package/dist/cli/routes/tools.d.ts +0 -3
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The `--name`/`--payload-max-bytes` flags shared by `events tail` and `events since` (issue
3
+ * #115): both pass them straight through to `events.subscribe`/`events.since` with no default —
4
+ * see `commands/events.ts`. Kept out of `index.ts` — nothing outside this directory imports it —
5
+ * since a route module, not the noun's router, is the caller.
6
+ */
7
+ import type { RouteContext } from "../../router.js";
8
+ export type EventsFilterFlags = {
9
+ name?: string;
10
+ payloadMaxBytes?: number;
11
+ };
12
+ export declare const parseEventsFilterFlags: (context: RouteContext) => EventsFilterFlags;
@@ -0,0 +1,102 @@
1
+ // src/rpc/client.ts
2
+ import { join as join2 } from "node:path";
3
+ import { RPC_METHODS } from "@appduct/shared";
4
+
5
+ // src/daemon/config.ts
6
+ var DEFAULT_DAEMON_LOG_MAX_BYTES = 10 * 1024 * 1024;
7
+
8
+ // src/package-root.ts
9
+ import { existsSync, readFileSync } from "node:fs";
10
+ import { dirname, join } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+ var PACKAGE_NAME = "appduct";
13
+ var cached;
14
+ var getPackageRoot = () => {
15
+ if (cached !== void 0) {
16
+ return cached;
17
+ }
18
+ let dir = dirname(fileURLToPath(import.meta.url));
19
+ for (; ; ) {
20
+ const candidate = join(dir, "package.json");
21
+ if (existsSync(candidate)) {
22
+ let name;
23
+ try {
24
+ name = JSON.parse(readFileSync(candidate, "utf8")).name;
25
+ } catch {
26
+ }
27
+ if (name === PACKAGE_NAME) {
28
+ cached = dir;
29
+ return dir;
30
+ }
31
+ }
32
+ const parent = dirname(dir);
33
+ if (parent === dir) {
34
+ throw new Error(`Could not locate the "${PACKAGE_NAME}" package root above ${import.meta.url}.`);
35
+ }
36
+ dir = parent;
37
+ }
38
+ };
39
+
40
+ // src/rpc/client.ts
41
+ var defaultBinPath = join2(getPackageRoot(), "bin.js");
42
+
43
+ // src/errors.ts
44
+ var AppductCliError = class extends Error {
45
+ type;
46
+ details;
47
+ constructor(type, message, details) {
48
+ super(message);
49
+ this.name = "AppductCliError";
50
+ this.type = type;
51
+ this.details = details;
52
+ }
53
+ };
54
+ var usageError = (message, details) => {
55
+ return new AppductCliError("usage_error", message, details);
56
+ };
57
+
58
+ // src/cli/command-options.ts
59
+ var parsePositiveIntegerOption = (value, flagName) => {
60
+ if (value === void 0) {
61
+ return void 0;
62
+ }
63
+ const parsed = typeof value === "number" ? value : typeof value === "string" ? Number(value) : Number.NaN;
64
+ if (!Number.isFinite(parsed) || !Number.isInteger(parsed) || parsed <= 0) {
65
+ throw usageError(`"${flagName}" must be a positive integer.`);
66
+ }
67
+ return parsed;
68
+ };
69
+ var readTextOption = (argv, value, flagName) => {
70
+ if (value === void 0) {
71
+ return void 0;
72
+ }
73
+ if (typeof value === "boolean") {
74
+ throw usageError(`"${flagName}" requires a value.`);
75
+ }
76
+ let raw;
77
+ for (let index = 0; index < argv.length; index += 1) {
78
+ const token = argv[index];
79
+ if (token === "--") {
80
+ break;
81
+ }
82
+ if (token === flagName && index + 1 < argv.length) {
83
+ raw = argv[index + 1];
84
+ index += 1;
85
+ } else if (token.startsWith(`${flagName}=`)) {
86
+ raw = token.slice(flagName.length + 1);
87
+ }
88
+ }
89
+ return raw ?? String(Array.isArray(value) ? value.at(-1) : value);
90
+ };
91
+
92
+ // src/cli/routes/events/shared-options.ts
93
+ var parseEventsFilterFlags = (context) => {
94
+ const { options } = context;
95
+ return {
96
+ name: readTextOption(context.argv, options.name, "--name"),
97
+ payloadMaxBytes: parsePositiveIntegerOption(options.payloadMaxBytes, "--payload-max-bytes")
98
+ };
99
+ };
100
+ export {
101
+ parseEventsFilterFlags
102
+ };
@@ -0,0 +1,6 @@
1
+ /** Route for `appduct events since` — loaded by `routes/events/index.ts`'s router only when it
2
+ * runs (issue #96; replaces the removed `appduct events --since <cursor>` one-shot form). The
3
+ * cursor is now a required positional rather than a flag, split out via
4
+ * `splitSelectorAndRequiredTarget` exactly like `tools describe`/`tools call`. */
5
+ import type { Route } from "../../router.js";
6
+ export declare const route: Route;