@ap3x/cli 0.1.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 (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/dist/agent-session.d.ts +163 -0
  4. package/dist/agent-session.d.ts.map +1 -0
  5. package/dist/auth/anthropic-login.d.ts +98 -0
  6. package/dist/auth/anthropic-login.d.ts.map +1 -0
  7. package/dist/auth/codex-login.d.ts +80 -0
  8. package/dist/auth/codex-login.d.ts.map +1 -0
  9. package/dist/auth/copilot-login.d.ts +36 -0
  10. package/dist/auth/copilot-login.d.ts.map +1 -0
  11. package/dist/auth/login-dispatch.d.ts +76 -0
  12. package/dist/auth/login-dispatch.d.ts.map +1 -0
  13. package/dist/bin.d.ts +3 -0
  14. package/dist/bin.d.ts.map +1 -0
  15. package/dist/bin.js +15 -0
  16. package/dist/branding.d.ts +89 -0
  17. package/dist/branding.d.ts.map +1 -0
  18. package/dist/chunk-3WSVGI7R.js +10522 -0
  19. package/dist/cli.d.ts +135 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cron/agent-executor.d.ts +45 -0
  22. package/dist/cron/agent-executor.d.ts.map +1 -0
  23. package/dist/cron/cron-cli.d.ts +27 -0
  24. package/dist/cron/cron-cli.d.ts.map +1 -0
  25. package/dist/cron/schedule-file.d.ts +7 -0
  26. package/dist/cron/schedule-file.d.ts.map +1 -0
  27. package/dist/glob.d.ts +12 -0
  28. package/dist/glob.d.ts.map +1 -0
  29. package/dist/hooks/hooks-cli.d.ts +11 -0
  30. package/dist/hooks/hooks-cli.d.ts.map +1 -0
  31. package/dist/index.d.ts +26 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +462 -0
  34. package/dist/modes/index.d.ts +5 -0
  35. package/dist/modes/index.d.ts.map +1 -0
  36. package/dist/modes/interactive.d.ts +44 -0
  37. package/dist/modes/interactive.d.ts.map +1 -0
  38. package/dist/modes/print.d.ts +24 -0
  39. package/dist/modes/print.d.ts.map +1 -0
  40. package/dist/modes/render.d.ts +29 -0
  41. package/dist/modes/render.d.ts.map +1 -0
  42. package/dist/modes/rpc.d.ts +149 -0
  43. package/dist/modes/rpc.d.ts.map +1 -0
  44. package/dist/sdk.d.ts +95 -0
  45. package/dist/sdk.d.ts.map +1 -0
  46. package/dist/settings.d.ts +109 -0
  47. package/dist/settings.d.ts.map +1 -0
  48. package/dist/skills.d.ts +27 -0
  49. package/dist/skills.d.ts.map +1 -0
  50. package/dist/slash-commands.d.ts +79 -0
  51. package/dist/slash-commands.d.ts.map +1 -0
  52. package/dist/system-prompt.d.ts +21 -0
  53. package/dist/system-prompt.d.ts.map +1 -0
  54. package/dist/tools/a2a.d.ts +11 -0
  55. package/dist/tools/a2a.d.ts.map +1 -0
  56. package/dist/tools/bash.d.ts +4 -0
  57. package/dist/tools/bash.d.ts.map +1 -0
  58. package/dist/tools/context.d.ts +42 -0
  59. package/dist/tools/context.d.ts.map +1 -0
  60. package/dist/tools/edit.d.ts +16 -0
  61. package/dist/tools/edit.d.ts.map +1 -0
  62. package/dist/tools/find.d.ts +9 -0
  63. package/dist/tools/find.d.ts.map +1 -0
  64. package/dist/tools/grep.d.ts +9 -0
  65. package/dist/tools/grep.d.ts.map +1 -0
  66. package/dist/tools/index.d.ts +35 -0
  67. package/dist/tools/index.d.ts.map +1 -0
  68. package/dist/tools/ls.d.ts +5 -0
  69. package/dist/tools/ls.d.ts.map +1 -0
  70. package/dist/tools/read.d.ts +9 -0
  71. package/dist/tools/read.d.ts.map +1 -0
  72. package/dist/tools/swarm.d.ts +42 -0
  73. package/dist/tools/swarm.d.ts.map +1 -0
  74. package/dist/tools/walk.d.ts +48 -0
  75. package/dist/tools/walk.d.ts.map +1 -0
  76. package/dist/tools/write.d.ts +9 -0
  77. package/dist/tools/write.d.ts.map +1 -0
  78. package/dist/trace/trace-cli.d.ts +9 -0
  79. package/dist/trace/trace-cli.d.ts.map +1 -0
  80. package/dist/utils/clipboard.d.ts +23 -0
  81. package/dist/utils/clipboard.d.ts.map +1 -0
  82. package/dist/utils/git.d.ts +13 -0
  83. package/dist/utils/git.d.ts.map +1 -0
  84. package/dist/utils/highlight.d.ts +23 -0
  85. package/dist/utils/highlight.d.ts.map +1 -0
  86. package/dist/utils/index.d.ts +6 -0
  87. package/dist/utils/index.d.ts.map +1 -0
  88. package/dist/utils/resume.d.ts +9 -0
  89. package/dist/utils/resume.d.ts.map +1 -0
  90. package/dist/utils/version-check.d.ts +34 -0
  91. package/dist/utils/version-check.d.ts.map +1 -0
  92. package/package.json +45 -0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,135 @@
1
+ import { type A2aBinding, serveA2a } from "@ap3x/a2a";
2
+ import { type StreamFn } from "@ap3x/agent-core";
3
+ import type { AnthropicLoginResult, LoginAnthropicOptions } from "./auth/anthropic-login";
4
+ import type { LoginResult, LoginWithChatGPTOptions } from "./auth/codex-login";
5
+ import type { CopilotLoginResult, LoginGitHubCopilotOptions } from "./auth/copilot-login";
6
+ import { type CronCliDeps } from "./cron/cron-cli";
7
+ import { type InteractiveInput, type InteractiveRenderer } from "./modes";
8
+ import { type AgentSessionRuntime } from "./sdk";
9
+ import { type PartialSettings, type Settings, SettingsManager } from "./settings";
10
+ /** The run mode dispatched from parsed arguments. F2 implements each runner. */
11
+ export type RunMode = "interactive" | "print" | "rpc" | "help" | "version" | "login" | "logout" | "serve";
12
+ /** Output format for {@link RunMode} "print". */
13
+ export type PrintFormat = "text" | "json";
14
+ /** Fully parsed CLI options. */
15
+ export interface ParsedArgs {
16
+ mode: RunMode;
17
+ /** Initial prompt (positional args joined), if any. */
18
+ prompt?: string;
19
+ /** Model id override (e.g. "claude-sonnet-4-5"). */
20
+ model?: string;
21
+ /** Provider slug override. */
22
+ provider?: string;
23
+ /** Print-mode output format. */
24
+ format: PrintFormat;
25
+ /** Resume an existing session by id. */
26
+ resume?: string;
27
+ /** Continue the most recent session. */
28
+ continueSession: boolean;
29
+ /** Working directory override. */
30
+ cwd?: string;
31
+ /** Explicit active tool set (comma-separated on the CLI). */
32
+ tools?: string[];
33
+ /** Reasoning intensity override. */
34
+ thinking?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
35
+ /** Override the config directory (maps to AP3X_CONFIG_DIR). */
36
+ configDir?: string;
37
+ /** `serve`: port to bind (0 = ephemeral). Default 7423. */
38
+ port?: number;
39
+ /** `serve`: host to bind. Default 127.0.0.1. */
40
+ host?: string;
41
+ /** `serve`: bearer token callers must present (overrides settings). */
42
+ a2aToken?: string;
43
+ /** `serve`: transport bindings to mount. Default ["jsonrpc"]. */
44
+ a2aBindings?: A2aBinding[];
45
+ /** `serve`: cap retained TERMINAL tasks; 0 = unbounded. Default {@link DEFAULT_SERVE_MAX_RETAINED_TASKS}. */
46
+ maxRetainedTasks?: number;
47
+ /** `serve`: cap retained context transcripts (LRU); 0 = unbounded. Default {@link DEFAULT_SERVE_MAX_RETAINED_CONTEXTS}. */
48
+ maxRetainedContexts?: number;
49
+ /** Unknown flags encountered during parsing (reported, not fatal in F1). */
50
+ unknown: string[];
51
+ }
52
+ /** Raised for malformed argument input (e.g. a flag missing its value). */
53
+ export declare class ArgError extends Error {
54
+ constructor(message: string);
55
+ }
56
+ /**
57
+ * Parse the raw CLI argument vector into {@link ParsedArgs}. Supports the full
58
+ * F1 flag surface; the actual run-mode dispatch is F2. Long flags accept either
59
+ * `--flag value` or `--flag=value`. Unknown flags are collected (not fatal) so
60
+ * the caller can decide how strict to be.
61
+ */
62
+ export declare function parseArgs(args: string[]): ParsedArgs;
63
+ /** Translate parsed args into a {@link PartialSettings} flag layer. */
64
+ export declare function argsToSettings(parsed: ParsedArgs): PartialSettings;
65
+ /** The CLI help text. */
66
+ export declare function printHelp(): string;
67
+ /** The version banner. */
68
+ export declare function printVersion(): string;
69
+ /** A sink for CLI output; injectable so tests don't write to real stdio. */
70
+ export interface CliIO {
71
+ out: (text: string) => void;
72
+ err: (text: string) => void;
73
+ }
74
+ export declare function resolveRuntime(parsed: ParsedArgs, overrides?: {
75
+ /**
76
+ * Custom provider stream function threaded into the runtime's backend
77
+ * (tests inject a capturing/canned stream so no provider call happens).
78
+ * Production callers omit it — the wiring is otherwise identical.
79
+ */
80
+ streamFn?: StreamFn;
81
+ /**
82
+ * Replace the base system prompt (the env-aware coding prompt) wholesale.
83
+ * Used by `ap3x cron` payloads that carry their own systemPrompt; skills
84
+ * still compose on top when the read tool is active.
85
+ */
86
+ systemPrompt?: string;
87
+ }): Promise<{
88
+ runtime: AgentSessionRuntime;
89
+ resolved: Settings;
90
+ settings: SettingsManager;
91
+ /**
92
+ * First-run auth signal (R10): true when a model resolved but no usable
93
+ * credential was found (no API key AND no auth headers). `main()` turns this
94
+ * into an actionable message instead of failing deep in a provider call.
95
+ * Optional so injected faux runtimes (tests) opt out by omission (undefined =
96
+ * no gate).
97
+ */
98
+ authMissing?: boolean;
99
+ }>;
100
+ /** Options for {@link main}; every IO/runtime seam is injectable for tests. */
101
+ export interface MainOptions {
102
+ io?: CliIO;
103
+ /** Override runtime/settings construction (tests inject a faux backend). */
104
+ buildRuntime?: (parsed: ParsedArgs) => Promise<{
105
+ runtime: AgentSessionRuntime;
106
+ resolved: Settings;
107
+ settings: SettingsManager;
108
+ authMissing?: boolean;
109
+ }>;
110
+ /** Override the interactive input source (tests script a sequence). */
111
+ interactiveInput?: InteractiveInput;
112
+ /** Override the interactive renderer (tests capture lines). */
113
+ interactiveRenderer?: InteractiveRenderer;
114
+ /** Override the ChatGPT/Codex login flow (tests inject; no real IO). */
115
+ loginCodex?: (options?: LoginWithChatGPTOptions) => Promise<LoginResult>;
116
+ /** Override the Anthropic (Claude Pro/Max) login flow (tests inject). */
117
+ loginAnthropic?: (options?: LoginAnthropicOptions) => Promise<AnthropicLoginResult>;
118
+ /** Override the GitHub Copilot device-code login flow (tests inject). */
119
+ loginCopilot?: (options?: LoginGitHubCopilotOptions) => Promise<CopilotLoginResult>;
120
+ /** `serve` shutdown seam: aborting stops the server (tests; SIGINT otherwise). */
121
+ serveSignal?: AbortSignal;
122
+ /** `serve` override: inspect/replace the A2A publish call (tests spy the options). */
123
+ serveA2a?: typeof serveA2a;
124
+ /** `cron` dependency overrides (tests stub the store dir / executor / signal). */
125
+ cronDeps?: Partial<Omit<CronCliDeps, "io">>;
126
+ }
127
+ /**
128
+ * The CLI entry point. Parses arguments and dispatches to a run mode:
129
+ * help/version print and exit; `print` runs a single-shot task; `rpc` runs the
130
+ * JSONL loop over stdio; otherwise the interactive REPL. Honors `resume` /
131
+ * `continue` by recording the intent on the built runtime. Returns a process
132
+ * exit code (no bare `process.exit` in the testable path).
133
+ */
134
+ export declare function main(args: string[], options?: MainOptions): Promise<number>;
135
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAmB,QAAQ,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAmD,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAWlG,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAa1F,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,mBAAmB,EAKzB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,mBAAmB,EAA6B,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAYlF,gFAAgF;AAChF,MAAM,MAAM,OAAO,GACf,aAAa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CAAC;IAC1C,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IACzE,yEAAyE;IACzE,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACpF,yEAAyE;IACzE,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,yBAAyB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpF,kFAAkF;IAClF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,sFAAsF;IACtF,QAAQ,CAAC,EAAE,OAAO,QAAQ,CAAC;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;CAC7C;AA0MD;;;;;;GAMG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAiHjF"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The AP3X agent-backed {@link Executor} for `ap3x cron`. cadence owns the WHEN
3
+ * (due computation, exactly-once, retries, timeouts); this executor owns the
4
+ * WHAT: it validates the schedule's payload and runs ONE agent turn with the
5
+ * payload's prompt.
6
+ *
7
+ * Every fire is a fresh one-shot run: no conversation carries over between
8
+ * occurrences (each fire builds its own runtime/session, exactly like
9
+ * `ap3x -p "<prompt>"`). The actual prompt run is injected as a
10
+ * {@link CronPromptRunner} so the executor itself stays free of runtime/auth
11
+ * wiring — `main()` supplies the production runner (built on `resolveRuntime`)
12
+ * and tests supply a stub.
13
+ */
14
+ import type { ExecutionContext, ExecutionOutcome, Executor } from "@ap3x/cadence";
15
+ /** What a cron schedule's `payload` must carry to be runnable by the agent. */
16
+ export declare const CronPayloadSchema: import("@sinclair/typebox").TObject<{
17
+ prompt: import("@sinclair/typebox").TString;
18
+ model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
19
+ provider: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
+ systemPrompt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
+ }>;
22
+ /** The validated shape of {@link CronPayloadSchema}. */
23
+ export interface CronPayload {
24
+ prompt: string;
25
+ model?: string;
26
+ provider?: string;
27
+ systemPrompt?: string;
28
+ }
29
+ /** One prompt run handed to the injected runner. */
30
+ export interface CronPromptRun extends CronPayload {
31
+ /** Aborted by the cadence engine on timeout or shutdown. */
32
+ signal: AbortSignal;
33
+ }
34
+ /**
35
+ * Runs one agent turn and resolves with the final assistant text. Must reject
36
+ * (or return promptly) when `signal` aborts.
37
+ */
38
+ export type CronPromptRunner = (run: CronPromptRun) => Promise<string>;
39
+ /** cadence Executor that runs each occurrence as a one-shot agent prompt. */
40
+ export declare class CronAgentExecutor implements Executor {
41
+ #private;
42
+ constructor(runPrompt: CronPromptRunner);
43
+ execute(ctx: ExecutionContext): Promise<ExecutionOutcome>;
44
+ }
45
+ //# sourceMappingURL=agent-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-executor.d.ts","sourceRoot":"","sources":["../../src/cron/agent-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIlF,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB;;;;;EAK5B,CAAC;AAEH,wDAAwD;AACxD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,oDAAoD;AACpD,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,4DAA4D;IAC5D,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEvE,6EAA6E;AAC7E,qBAAa,iBAAkB,YAAW,QAAQ;;gBAGpC,SAAS,EAAE,gBAAgB;IAIjC,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAyBhE"}
@@ -0,0 +1,27 @@
1
+ import { type Clock, type Executor } from "@ap3x/cadence";
2
+ import type { CliIO } from "../cli";
3
+ /** Injectable dependencies for {@link runCronCli}; tests stub every seam. */
4
+ export interface CronCliDeps {
5
+ io: CliIO;
6
+ /**
7
+ * Build the executor `run` fires occurrences through. Receives the
8
+ * `--config-dir` override (if any) so the production agent runner resolves
9
+ * settings/auth from the same config dir the store lives under.
10
+ */
11
+ createExecutor: (configDir?: string) => Executor;
12
+ /** Store directory override (tests use a temp dir). Default: `<configDir>/cron`. */
13
+ storeDir?: string;
14
+ /** Clock override (tests inject a TestClock). Default: the system clock. */
15
+ clock?: Clock;
16
+ /** Id source override (tests pin ids). Default: `crypto.randomUUID`. */
17
+ idFactory?: () => string;
18
+ /** `run` shutdown seam: aborting stops the scheduler (tests; SIGINT otherwise). */
19
+ signal?: AbortSignal;
20
+ /** Engine poll cadence override for `run`. */
21
+ pollIntervalMs?: number;
22
+ }
23
+ /** The `ap3x cron` help text. */
24
+ export declare function printCronHelp(): string;
25
+ /** Run the `ap3x cron` subcommand tree. Never throws; returns an exit code. */
26
+ export declare function runCronCli(args: string[], deps: CronCliDeps): Promise<number>;
27
+ //# sourceMappingURL=cron-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-cli.d.ts","sourceRoot":"","sources":["../../src/cron/cron-cli.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,KAAK,EAEV,KAAK,QAAQ,EAKd,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAOpC,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,KAAK,CAAC;IACV;;;;OAIG;IACH,cAAc,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,QAAQ,CAAC;IACjD,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;IACzB,mFAAmF;IACnF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,iCAAiC;AACjC,wBAAgB,aAAa,IAAI,MAAM,CA0CtC;AAmDD,+EAA+E;AAC/E,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CA8MnF"}
@@ -0,0 +1,7 @@
1
+ import type { NewSchedule } from "@ap3x/cadence";
2
+ export declare class ScheduleFileError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ /** Parses a markdown schedule file: YAML frontmatter = schedule config, body = agent prompt. */
6
+ export declare function parseScheduleFile(content: string, filePath: string): NewSchedule;
7
+ //# sourceMappingURL=schedule-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule-file.d.ts","sourceRoot":"","sources":["../../src/cron/schedule-file.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AA8BD,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAgChF"}
package/dist/glob.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A tiny, dependency-free glob matcher supporting the subset the CLI needs:
3
+ * `*` (any run of non-separator chars), `**` (any run including separators),
4
+ * `?` (a single non-separator char), and literal segments. Paths are matched
5
+ * with `/` separators. This is deliberately small — not a full POSIX glob — and
6
+ * keeps `@ap3x/cli` free of external glob dependencies.
7
+ */
8
+ /** Compile a glob pattern into an anchored regular expression. */
9
+ export declare function globToRegExp(pattern: string): RegExp;
10
+ /** Test whether `path` (using `/` separators) matches `pattern`. */
11
+ export declare function minimatch(path: string, pattern: string): boolean;
12
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAqBpD;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE"}
@@ -0,0 +1,11 @@
1
+ import type { CliIO } from "../cli";
2
+ export interface HooksCliDeps {
3
+ io: CliIO;
4
+ /** `--config-dir`-style override for the user hooks file. */
5
+ configDir?: string;
6
+ /** Project root; default process.cwd(). */
7
+ cwd?: string;
8
+ }
9
+ export declare function printHooksHelp(): string;
10
+ export declare function runHooksCli(args: string[], deps: HooksCliDeps): Promise<number>;
11
+ //# sourceMappingURL=hooks-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-cli.d.ts","sourceRoot":"","sources":["../../src/hooks/hooks-cli.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,KAAK,CAAC;IACV,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,IAAI,MAAM,CAmBvC;AAwDD,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAgFrF"}
@@ -0,0 +1,26 @@
1
+ export declare const PACKAGE = "@ap3x/cli";
2
+ export declare const VERSION = "0.1.0";
3
+ export { APP_NAME, DISPLAY_NAME, CONFIG_DIR_NAME, ENV_PREFIX, ENV_CONFIG_DIR, SETTINGS_FILE_NAME, SESSIONS_DIR_NAME, LOGS_DIR_NAME, SKILLS_DIR_NAME, resolveConfigDir, resolveSettingsPath, resolveSessionsDir, resolveLogsDir, resolveSkillsDir, CRON_DIR_NAME, resolveCronDir, HOOKS_FILE_NAME, resolveHooksPath, TRACES_DIR_NAME, resolveTracesDir, } from "./branding";
4
+ export { CronAgentExecutor, CronPayloadSchema, type CronPayload, type CronPromptRun, type CronPromptRunner, } from "./cron/agent-executor";
5
+ export { type CronCliDeps, printCronHelp, runCronCli } from "./cron/cron-cli";
6
+ export { type HooksCliDeps, printHooksHelp, runHooksCli } from "./hooks/hooks-cli";
7
+ export { type TraceCliDeps, printTraceHelp, runTraceCli } from "./trace/trace-cli";
8
+ export { loadSkillsFromDir, composeSystemPromptWithSkills } from "./skills";
9
+ export { buildCodingAgentSystemPrompt, resolveEnvContext, type EnvContext, } from "./system-prompt";
10
+ export { type Settings, type PartialSettings, type RemoteAgentConfig, DEFAULT_SETTINGS, parsePartialSettings, SettingsManager, settingsFromEnv, mergeSettings, } from "./settings";
11
+ export { type ParsedArgs, type RunMode, type PrintFormat, type CliIO, type MainOptions, ArgError, main, resolveRuntime, parseArgs, argsToSettings, printHelp, printVersion, } from "./cli";
12
+ export { InteractiveMode, welcomeBanner, type InteractiveModeOptions, type InteractiveInput, type InteractiveRenderer, runPrintMode, type PrintModeOptions, runRpcMode, RpcClient, RpcCommandSchema, RPC_COMMANDS, parseRpcLine, frameResponse, nodeRpcInput, nodeRpcOutput, type RpcCommand, type RpcResponse, type RpcError, type RpcSessionState, type RpcInput, type RpcOutput, type RpcModeOptions, renderAgentEvent, renderUsage, assistantText, toPrintJson, type PrintJsonResult, } from "./modes";
13
+ export { BUILTIN_SLASH_COMMANDS, type SlashCommand, type SlashContext, type SlashResult, dispatchSlashCommand, findSlashCommand, isSlashCommand, } from "./slash-commands";
14
+ export { type CallbackParams, DEFAULT_CALLBACK_PORTS, defaultOpenBrowser, type LoginResult, type LoginWithChatGPTOptions, type LoopbackServer, loginWithChatGPT, logoutCodex, type StartLoopbackServer, startRealLoopbackServer, } from "./auth/codex-login";
15
+ export { type CopilotLoginResult, type LoginGitHubCopilotOptions, loginGitHubCopilot, } from "./auth/copilot-login";
16
+ export { type AnthropicCallbackParams, type AnthropicLoginResult, type AnthropicLoopbackServer, DEFAULT_ANTHROPIC_CALLBACK_PORTS, type LoginAnthropicOptions, loginAnthropic, logoutAnthropic, parseAuthorizationInput, refreshAnthropic, type RefreshAnthropicOptions, type StartAnthropicLoopbackServer, startRealAnthropicLoopbackServer, } from "./auth/anthropic-login";
17
+ export { formatResumeCommand, repoRoot, currentBranch, type GitRunner, defaultGitRunner, copyToClipboard, type Clipboard, noopClipboard, type ClipboardRunner, checkForUpdate, type VersionCheckOptions, type VersionCheckResult, type VersionFetcher, highlight, type HighlightTheme, NO_HIGHLIGHT, } from "./utils";
18
+ export { AgentSession, type AgentSessionEvent, type AgentSessionListener, type AgentSessionOptions, type AgentSessionServices, AgentSessionRuntime, type AgentSessionRuntimeConfig, createAgentSession, createAgentSessionFromServices, createAgentSessionServices, createAgentSessionRuntime, createAgentSessionRuntimeFromServices, createSession, } from "./sdk";
19
+ export { type ToolContext, type SwarmBackend, createToolContext, createReadTool, createWriteTool, createEditTool, createBashTool, createLsTool, createGrepTool, createFindTool, createAllTools, createCodingTools, createReadOnlyTools, createRunSwarmTool, createAutoSwarmTool, createBuildAgentTool, createSwarmTools, createCallAgentTool, createA2aTools, selectTools, withFileMutationQueue, ALL_TOOL_NAMES, READ_ONLY_TOOL_NAMES, } from "./tools";
20
+ export { globToRegExp, minimatch } from "./glob";
21
+ export { MODELS, getModel, getModels, getProviders, getSupportedThinkingLevels, clampThinkingLevel, modelsAreEqual, calculateCost, getEnvApiKey, findEnvKeys, type Model, } from "@ap3x/ai";
22
+ export { Session, createSessionId, buildSessionContext, InMemorySessionStorage, JsonlSessionStorage, type SessionStorage, type SessionContext, type SessionMetadata, type SessionEntry, } from "@ap3x/agent-core";
23
+ export { compact, shouldCompact, estimateContextTokens, DEFAULT_COMPACTION_SETTINGS, type CompactionSettings, type CompactionResult, } from "@ap3x/agent-core";
24
+ export { type AgentBackend, type AgentRunResult, type AgentRunOptions, Ap3xRuntimeBackend, createRuntimeBackend, Agent, type AgentMessage, type AnyAgentTool, defineTool, } from "@ap3x/agent-core";
25
+ export { matchBlocklist, isBlockedCommand } from "@ap3x/agent-core";
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,cAAc,CAAC;AACnC,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,WAAW,EA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