@hypercli.com/cli 0.0.0-stage → 0.9.2

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 (98) hide show
  1. package/README.md +25 -2
  2. package/dist/commands/acp.d.ts +5 -0
  3. package/dist/commands/acp.js +51 -0
  4. package/dist/commands/acp.js.map +1 -0
  5. package/dist/commands/agent-login.d.ts +97 -0
  6. package/dist/commands/agent-login.js +547 -0
  7. package/dist/commands/agent-login.js.map +1 -0
  8. package/dist/commands/agents.d.ts +48 -0
  9. package/dist/commands/agents.js +2026 -0
  10. package/dist/commands/agents.js.map +1 -0
  11. package/dist/commands/configure.d.ts +11 -0
  12. package/dist/commands/configure.js +59 -0
  13. package/dist/commands/configure.js.map +1 -0
  14. package/dist/commands/files.d.ts +15 -0
  15. package/dist/commands/files.js +176 -0
  16. package/dist/commands/files.js.map +1 -0
  17. package/dist/commands/flow.d.ts +20 -0
  18. package/dist/commands/flow.js +360 -0
  19. package/dist/commands/flow.js.map +1 -0
  20. package/dist/commands/integrations.d.ts +32 -0
  21. package/dist/commands/integrations.js +460 -0
  22. package/dist/commands/integrations.js.map +1 -0
  23. package/dist/commands/jobs.d.ts +5 -0
  24. package/dist/commands/jobs.js +496 -0
  25. package/dist/commands/jobs.js.map +1 -0
  26. package/dist/commands/me.d.ts +23 -0
  27. package/dist/commands/me.js +258 -0
  28. package/dist/commands/me.js.map +1 -0
  29. package/dist/commands/memory.d.ts +5 -0
  30. package/dist/commands/memory.js +110 -0
  31. package/dist/commands/memory.js.map +1 -0
  32. package/dist/commands/routines.d.ts +27 -0
  33. package/dist/commands/routines.js +493 -0
  34. package/dist/commands/routines.js.map +1 -0
  35. package/dist/commands/skills.d.ts +36 -0
  36. package/dist/commands/skills.js +369 -0
  37. package/dist/commands/skills.js.map +1 -0
  38. package/dist/commands/voice.d.ts +15 -0
  39. package/dist/commands/voice.js +378 -0
  40. package/dist/commands/voice.js.map +1 -0
  41. package/dist/commands/websearch-core.d.ts +10 -0
  42. package/dist/commands/websearch-core.js +56 -0
  43. package/dist/commands/websearch-core.js.map +1 -0
  44. package/dist/commands/websearch.d.ts +13 -0
  45. package/dist/commands/websearch.js +20 -0
  46. package/dist/commands/websearch.js.map +1 -0
  47. package/dist/core/argv.d.ts +51 -0
  48. package/dist/core/argv.js +81 -0
  49. package/dist/core/argv.js.map +1 -0
  50. package/dist/core/captured-logs.d.ts +9 -0
  51. package/dist/core/captured-logs.js +52 -0
  52. package/dist/core/captured-logs.js.map +1 -0
  53. package/dist/core/client.d.ts +18 -0
  54. package/dist/core/client.js +31 -0
  55. package/dist/core/client.js.map +1 -0
  56. package/dist/core/config-file.d.ts +13 -0
  57. package/dist/core/config-file.js +79 -0
  58. package/dist/core/config-file.js.map +1 -0
  59. package/dist/core/errors.d.ts +22 -0
  60. package/dist/core/errors.js +37 -0
  61. package/dist/core/errors.js.map +1 -0
  62. package/dist/core/help.d.ts +13 -0
  63. package/dist/core/help.js +55 -0
  64. package/dist/core/help.js.map +1 -0
  65. package/dist/core/integrations-mcp.d.ts +2 -0
  66. package/dist/core/integrations-mcp.js +115 -0
  67. package/dist/core/integrations-mcp.js.map +1 -0
  68. package/dist/core/output.d.ts +29 -0
  69. package/dist/core/output.js +34 -0
  70. package/dist/core/output.js.map +1 -0
  71. package/dist/core/skills-runtime.d.ts +37 -0
  72. package/dist/core/skills-runtime.js +101 -0
  73. package/dist/core/skills-runtime.js.map +1 -0
  74. package/dist/core/table.d.ts +17 -0
  75. package/dist/core/table.js +34 -0
  76. package/dist/core/table.js.map +1 -0
  77. package/dist/core/types.d.ts +65 -0
  78. package/dist/core/types.js +40 -0
  79. package/dist/core/types.js.map +1 -0
  80. package/dist/index.d.ts +11 -0
  81. package/dist/index.js +73 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/registry.d.ts +10 -0
  84. package/dist/registry.js +39 -0
  85. package/dist/registry.js.map +1 -0
  86. package/dist/version.d.ts +1 -0
  87. package/dist/version.js +3 -0
  88. package/dist/version.js.map +1 -0
  89. package/package.json +33 -4
  90. package/skills/hypercli-account.json +17 -0
  91. package/skills/hypercli-agents.json +23 -0
  92. package/skills/hypercli-auth.json +11 -0
  93. package/skills/hypercli-compute.json +20 -0
  94. package/skills/hypercli-flows.json +11 -0
  95. package/skills/hypercli-knowledge.json +13 -0
  96. package/skills/hypercli-voice.json +10 -0
  97. package/skills/hypercli.json +23 -0
  98. package/skills/index.json +124 -0
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # Agent chat setup
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ```sh
4
+ hyper agents chat <agent> 'Use the MCP tools' --cwd /workspace/project --mcp-servers servers.json
5
+ hyper agents chat <agent> 'Continue' --session <session-id> --cwd /workspace/project --mcp-servers servers.json
6
+ cat servers.json | hyper agents chat <agent> 'Use the MCP tools' --mcp-servers -
7
+ ```
8
+
9
+ `--cwd` is the working directory on the agent, passed unchanged to ACP session
10
+ setup. `--mcp-servers` reads a local UTF-8 JSON file (or `-` for stdin). Both
11
+ options apply to new sessions and `--session` resume. Omitted options use the
12
+ SDK defaults. Supply the desired MCP setup again when resuming.
13
+
14
+ The file is a vanilla ACP v1 MCP server array, for example:
15
+
16
+ ```json
17
+ [
18
+ {"name":"local-tools","command":"/opt/tools/mcp-server","args":[],"env":[]},
19
+ {"type":"http","name":"http-tools","url":"https://tools.example/mcp","headers":[]},
20
+ {"type":"sse","name":"sse-tools","url":"https://tools.example/sse","headers":[]}
21
+ ]
22
+ ```
23
+
24
+ Stdio entries have no `type` field. Environment entries and headers use
25
+ `{"name":"KEY","value":"VALUE"}` pairs. An empty array is valid. The CLI checks
26
+ JSON shape; the peer decides which transports and setup it supports.
@@ -0,0 +1,5 @@
1
+ import type { CommandContext } from '../core/types.js';
2
+ export declare const name = "acp";
3
+ export declare const summary = "Publish files through the local Hyper-ACP host";
4
+ export declare const usage: string[];
5
+ export declare function run(ctx: CommandContext, args: string[]): Promise<number | void>;
@@ -0,0 +1,51 @@
1
+ import { resolve } from 'node:path';
2
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
3
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
4
+ import { parseCommandArgs } from '../core/argv.js';
5
+ import { CliError, UsageError } from '../core/errors.js';
6
+ import { APP_VERSION } from '../version.js';
7
+ export const name = 'acp';
8
+ export const summary = 'Publish files through the local Hyper-ACP host';
9
+ export const usage = ['hyper acp attach --file PATH [--session-id UUID]'];
10
+ export async function run(ctx, args) {
11
+ const parsed = parseCommandArgs(args, { file: { type: 'string' }, 'session-id': { type: 'string' } });
12
+ if (parsed.help) {
13
+ ctx.output.result(usage, usage.join('\n'));
14
+ return;
15
+ }
16
+ if (parsed.positionals.length !== 1 || parsed.positionals[0] !== 'attach')
17
+ throw new UsageError(usage[0]);
18
+ const file = parsed.values.file;
19
+ const sessionId = parsed.values['session-id'] ?? process.env.HYPER_SESSION_ID;
20
+ if (typeof file !== 'string' || !file)
21
+ throw new UsageError('--file is required');
22
+ if (typeof sessionId !== 'string' || !sessionId)
23
+ throw new UsageError('HYPER_SESSION_ID or --session-id is required');
24
+ const bearer = process.env.HYPER_AGENTS_API_KEY;
25
+ if (!bearer)
26
+ throw new CliError('HYPER_AGENTS_API_KEY is required for the local host');
27
+ const port = process.env.HYPER_ACP_MCP_PORT ?? '18521';
28
+ if (!/^\d+$/.test(port) || Number(port) < 1 || Number(port) > 65535)
29
+ throw new UsageError('Invalid HYPER_ACP_MCP_PORT');
30
+ const endpoint = `http://127.0.0.1:${Number(port)}/mcp`;
31
+ if (process.env.HYPER_ACP_MCP_SERVER && process.env.HYPER_ACP_MCP_SERVER !== endpoint)
32
+ throw new UsageError('HYPER_ACP_MCP_SERVER must match the loopback listener');
33
+ const client = new Client({ name: 'hyper-cli', version: APP_VERSION });
34
+ const transport = new StreamableHTTPClientTransport(new URL(endpoint), {
35
+ requestInit: { headers: { Authorization: `Bearer ${bearer}` } },
36
+ });
37
+ try {
38
+ await client.connect(transport);
39
+ const result = await client.callTool({ name: 'attach_file', arguments: { path: resolve(file), sessionId } }, undefined, { timeout: 90000 });
40
+ ctx.output.result(result, JSON.stringify(result, null, 2));
41
+ return result.isError ? 1 : 0;
42
+ }
43
+ catch {
44
+ throw new CliError('Local attachment request failed; delivery may be uncertain. Do not automatically retry.');
45
+ }
46
+ finally {
47
+ await client.close().catch(() => { });
48
+ await transport.close().catch(() => { });
49
+ }
50
+ }
51
+ //# sourceMappingURL=acp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acp.js","sourceRoot":"","sources":["../../src/commands/acp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,OAAO,GAAG,gDAAgD,CAAC;AACxE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,kDAAkD,CAAC,CAAC;AAE1E,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,GAAmB,EAAE,IAAc;IAC3D,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IACtG,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAAC,GAAG,CAAC,MAAM,CAAC,MA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inery; no TTY needed.
4
+ *
5
+ * Flow registry (LOGIN_FLOWS) is keyed by runtime so new runtimes (opencode,
6
+ * openclaw_acp, ...) slot in by adding an entry — each flow is an async fn over
7
+ * the shared exec/poll primitives.
8
+ *
9
+ * Choreographies (verified live in pods):
10
+ * codex device-auth — detached `codex login --device-auth` writes a URL +
11
+ * one-time code to /tmp/devauth.log; user completes it in a browser; the
12
+ * log then reports success. Codes expire in 15 min.
13
+ * claude-code paste-back — `claude auth login` reads stdin from a fifo held
14
+ * open by a detached sleep; the OAuth URL lands in /tmp/clin.log; the
15
+ * user pastes back the `code#state` string, which is piped into the fifo.
16
+ * OAuth codes are single-use and bound to that login process's state, so
17
+ * the URL is always re-extracted fresh from the log.
18
+ * claude-code host-creds — copies local ~/.claude/.credentials.json into the
19
+ * pod. Only ever via the explicit --from-host-creds flag.
20
+ *
21
+ * Detached-process discipline: exec calls are kept short; pod-side setsid
22
+ * processes survive client-side exec timeouts ('operation timed out'), so
23
+ * every launch tolerates the timeout and the poll loop discovers state.
24
+ */
25
+ import { type Deployments } from '@hypercli.com/sdk';
26
+ import type { CommandContext } from '../core/types.js';
27
+ /** Strip ANSI escapes from pod log output before any regex extraction. */
28
+ export declare function stripAnsi(input: string): string;
29
+ /** Pull the device-auth URL + one-time code out of codex's log. */
30
+ export declare function extractCodexDeviceAuth(log: string): {
31
+ url?: string;
32
+ code?: string;
33
+ };
34
+ export declare function codexDeviceAuthOutcome(log: string): 'success' | 'failed' | undefined;
35
+ /** Pull the OAuth authorize URL out of `claude auth login` output. */
36
+ export declare function extractClaudeOAuthUrl(log: string): string | undefined;
37
+ export declare function claudePasteOutcome(log: string): 'success' | 'failed' | undefined;
38
+ /** `claude auth status` prints JSON; tolerate it embedded in noisier output. */
39
+ export declare function claudeStatusLoggedIn(text: string): boolean;
40
+ /** POSIX single-quote an argv fragment (the pasted code rides through sh). */
41
+ export declare function shQuote(value: string): string;
42
+ export interface PollLogOptions<T> {
43
+ /** Return the current log text, or null when not yet readable. */
44
+ read: () => Promise<string | null>;
45
+ /** Extract the awaited value from (ANSI-stripped) text; undefined = keep polling. */
46
+ extract: (text: string) => T | undefined;
47
+ /** Terminal-abort check on the text; returning a message throws CliError. */
48
+ fail?: (text: string) => string | undefined;
49
+ deadlineAtMs: number;
50
+ waitingFor: string;
51
+ minIntervalMs?: number;
52
+ maxIntervalMs?: number;
53
+ /** Test seams: deterministic time/sleep/jitter. */
54
+ sleep?: (ms: number) => Promise<void>;
55
+ now?: () => number;
56
+ random?: () => number;
57
+ }
58
+ export declare function pollLog<T>(opts: PollLogOptions<T>): Promise<T>;
59
+ interface LoginIO {
60
+ /** Machine mode: JSON lines on stdout, code read from stdin. */
61
+ readonly machine: boolean;
62
+ info(message: string): void;
63
+ announce(url: string, code?: string): void;
64
+ readInput(prompt: string): Promise<string>;
65
+ finish(outcome: LoginOutcome, provider?: string): void;
66
+ }
67
+ export interface LoginOutcome {
68
+ loggedIn: boolean;
69
+ flow: string;
70
+ runtime: string;
71
+ agentId: string;
72
+ detail?: string;
73
+ }
74
+ export interface LoginFlowContext {
75
+ d: Deployments;
76
+ agentId: string;
77
+ deadlineAtMs: number;
78
+ io: LoginIO;
79
+ provider?: string;
80
+ }
81
+ export interface LoginFlow {
82
+ readonly name: string;
83
+ readonly runtime: string;
84
+ /** Does an external wallet/user step have to feed input back into the CLI? */
85
+ readonly requiresWalletUserInput: {
86
+ readonly type: 'code-paste' | 'none';
87
+ };
88
+ readonly summary: string;
89
+ run(fx: LoginFlowContext): Promise<LoginOutcome>;
90
+ }
91
+ export declare const LOGIN_FLOWS: ReadonlyMap<string, readonly LoginFlow[]>;
92
+ /** Exported for `hyper agents login` wiring in agents.ts. */
93
+ export declare function cmdAgentsLogin(ctx: CommandContext, args: string[], hooks?: {
94
+ readInput?: (prompt: string) => Promise<string>;
95
+ now?: () => number;
96
+ }): Promise<void>;
97
+ export {};