nuabase 3.0.1 → 3.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.
@@ -1,5 +1,5 @@
1
- import { c as AgentEffort, d as Logger, b as LocalAgentId, a as LocalAgent, e as SessionApproval } from './chunks/local-agent-Bj-QKikS.cjs';
2
- export { f as LOCAL_AGENT_IDS, g as LocalAgentCallOptions, i as isLocalAgentId } from './chunks/local-agent-Bj-QKikS.cjs';
1
+ import { c as LocalAgentCallOptions, d as Logger, b as LocalAgentId, a as LocalAgent, e as SessionApproval } from './chunks/local-agent-CPIXKS41.cjs';
2
+ export { f as AgentEffort, g as LOCAL_AGENT_IDS, i as isLocalAgentId } from './chunks/local-agent-CPIXKS41.cjs';
3
3
 
4
4
  /**
5
5
  * - subscription: removes API-key env vars (ANTHROPIC_API_KEY, OPENAI_API_KEY, ...) from the
@@ -7,13 +7,7 @@ export { f as LOCAL_AGENT_IDS, g as LocalAgentCallOptions, i as isLocalAgentId }
7
7
  * - inherit: passes the environment through unchanged.
8
8
  */
9
9
  type LocalAgentAuthMode = "subscription" | "inherit";
10
- type LocalAgentOptions = {
11
- /** The agent's own model name (e.g. "haiku" for Claude Code) for calls that name no model. Defaults to the agent's default. */
12
- model?: string;
13
- /** How hard the model thinks, as the CLI's own reasoning or effort setting. Defaults to the CLI's default. */
14
- effort?: AgentEffort;
15
- /** Per-call limit in milliseconds. Defaults to 180000. */
16
- timeoutMs?: number;
10
+ type LocalAgentOptions = LocalAgentCallOptions & {
17
11
  /** Maximum agent processes running at once. Defaults to 2. */
18
12
  concurrency?: number;
19
13
  /** Defaults to "subscription". */
@@ -57,6 +51,40 @@ type LocalAgentStatus = {
57
51
  */
58
52
  declare function detectLocalAgents(binaryPaths?: Partial<Record<LocalAgentId, string>>): Promise<LocalAgentStatus[]>;
59
53
 
54
+ /** How to install one supported coding-agent CLI and sign in to it. */
55
+ type LocalAgentSetup = {
56
+ agent: LocalAgentId;
57
+ /** The agent's product name: "Claude Code". */
58
+ name: string;
59
+ /** The accounts it works with, short enough for a table cell. */
60
+ worksWith: string;
61
+ /** A shell command that installs the CLI. */
62
+ install: string;
63
+ /** How to sign in once, after installing, in a few words. Commands are in backticks. */
64
+ signIn: string;
65
+ docsUrl: string;
66
+ };
67
+ /**
68
+ * What an app tells a user who has no coding agent set up: that one is
69
+ * missing, how to install each supported one, and a prompt that has a
70
+ * desktop or browser agent do it for them. Plain text, ready to show as it is.
71
+ */
72
+ type LocalAgentSetupGuide = {
73
+ /** One line saying no supported agent is set up. */
74
+ missing: string;
75
+ /** Why a desktop or browser app isn't enough: Nuabase runs the CLI. */
76
+ cliOnly: string;
77
+ /** In preference order, as findLocalAgent() tries them. */
78
+ agents: LocalAgentSetup[];
79
+ /**
80
+ * For the user to paste into a desktop or browser agent, such as the Claude
81
+ * or ChatGPT app, which can install a CLI though it can't be run as one.
82
+ */
83
+ setupPrompt: string;
84
+ };
85
+ /** Pure: how to set up a supported coding agent, for people who have none. */
86
+ declare function localAgentSetupGuide(): LocalAgentSetupGuide;
87
+
60
88
  /**
61
89
  * How a session can be started on this platform:
62
90
  * - terminal: in a new terminal window.
@@ -85,6 +113,17 @@ type AgentSessionConfig = {
85
113
  name?: string;
86
114
  /** Defaults to process.platform. */
87
115
  platform?: NodeJS.Platform;
116
+ /**
117
+ * The environment `open` runs in on macOS. A terminal app it launches keeps
118
+ * it for every window, so leave out what other sessions shouldn't see.
119
+ * Defaults to process.env.
120
+ */
121
+ env?: NodeJS.ProcessEnv;
122
+ /**
123
+ * Variables the launcher unsets before starting the agent, for a terminal
124
+ * that already holds them. Each must be a shell variable name.
125
+ */
126
+ unsetEnv?: readonly string[];
88
127
  };
89
128
  type AgentSessionFiles = {
90
129
  promptPath: string;
@@ -132,8 +171,8 @@ declare function agentSessionMode(platform?: NodeJS.Platform): AgentSessionMode;
132
171
  /**
133
172
  * Writes the prompt and a launcher that starts the agent on it, and where the
134
173
  * platform can, opens a terminal window running it. Expected failures come
135
- * back as the result; it throws only for an unknown agent or a `name` already
136
- * used. Node.js only.
174
+ * back as the result; it throws only for an unknown agent, an `unsetEnv` entry that
175
+ * isn't a variable name or a `name` already used. Node.js only.
137
176
  */
138
177
  declare function startAgentSession(config: AgentSessionConfig): Promise<AgentSessionStart>;
139
178
  type SessionLauncherTarget = {
@@ -142,9 +181,11 @@ type SessionLauncherTarget = {
142
181
  /** The agent's own options, which go before the prompt. */
143
182
  agentArgs: readonly string[];
144
183
  promptPath: string;
184
+ /** Variable names, unset before the agent starts. */
185
+ unsetEnv?: readonly string[];
145
186
  };
146
187
  /** Pure: the shell script that starts the agent on the prompt in `promptPath`. */
147
- declare function sessionLauncher({ cwd, binaryPath, agentArgs, promptPath }: SessionLauncherTarget): string;
188
+ declare function sessionLauncher({ cwd, binaryPath, agentArgs, promptPath, unsetEnv, }: SessionLauncherTarget): string;
148
189
 
149
- export { AgentEffort, LocalAgent, LocalAgentId, Logger, SessionApproval, agentSessionMode, detectLocalAgents, findLocalAgent, localAgent, sessionLauncher, startAgentSession };
150
- export type { AgentSessionConfig, AgentSessionFiles, AgentSessionMode, AgentSessionRefusal, AgentSessionStart, LocalAgentAuthMode, LocalAgentConfig, LocalAgentOptions, LocalAgentStatus, SessionLauncherTarget };
190
+ export { LocalAgent, LocalAgentCallOptions, LocalAgentId, Logger, SessionApproval, agentSessionMode, detectLocalAgents, findLocalAgent, localAgent, localAgentSetupGuide, sessionLauncher, startAgentSession };
191
+ export type { AgentSessionConfig, AgentSessionFiles, AgentSessionMode, AgentSessionRefusal, AgentSessionStart, LocalAgentAuthMode, LocalAgentConfig, LocalAgentOptions, LocalAgentSetup, LocalAgentSetupGuide, LocalAgentStatus, SessionLauncherTarget };
@@ -1,5 +1,5 @@
1
- import { c as AgentEffort, d as Logger, b as LocalAgentId, a as LocalAgent, e as SessionApproval } from './chunks/local-agent-Bj-QKikS.mjs';
2
- export { f as LOCAL_AGENT_IDS, g as LocalAgentCallOptions, i as isLocalAgentId } from './chunks/local-agent-Bj-QKikS.mjs';
1
+ import { c as LocalAgentCallOptions, d as Logger, b as LocalAgentId, a as LocalAgent, e as SessionApproval } from './chunks/local-agent-CPIXKS41.mjs';
2
+ export { f as AgentEffort, g as LOCAL_AGENT_IDS, i as isLocalAgentId } from './chunks/local-agent-CPIXKS41.mjs';
3
3
 
4
4
  /**
5
5
  * - subscription: removes API-key env vars (ANTHROPIC_API_KEY, OPENAI_API_KEY, ...) from the
@@ -7,13 +7,7 @@ export { f as LOCAL_AGENT_IDS, g as LocalAgentCallOptions, i as isLocalAgentId }
7
7
  * - inherit: passes the environment through unchanged.
8
8
  */
9
9
  type LocalAgentAuthMode = "subscription" | "inherit";
10
- type LocalAgentOptions = {
11
- /** The agent's own model name (e.g. "haiku" for Claude Code) for calls that name no model. Defaults to the agent's default. */
12
- model?: string;
13
- /** How hard the model thinks, as the CLI's own reasoning or effort setting. Defaults to the CLI's default. */
14
- effort?: AgentEffort;
15
- /** Per-call limit in milliseconds. Defaults to 180000. */
16
- timeoutMs?: number;
10
+ type LocalAgentOptions = LocalAgentCallOptions & {
17
11
  /** Maximum agent processes running at once. Defaults to 2. */
18
12
  concurrency?: number;
19
13
  /** Defaults to "subscription". */
@@ -57,6 +51,40 @@ type LocalAgentStatus = {
57
51
  */
58
52
  declare function detectLocalAgents(binaryPaths?: Partial<Record<LocalAgentId, string>>): Promise<LocalAgentStatus[]>;
59
53
 
54
+ /** How to install one supported coding-agent CLI and sign in to it. */
55
+ type LocalAgentSetup = {
56
+ agent: LocalAgentId;
57
+ /** The agent's product name: "Claude Code". */
58
+ name: string;
59
+ /** The accounts it works with, short enough for a table cell. */
60
+ worksWith: string;
61
+ /** A shell command that installs the CLI. */
62
+ install: string;
63
+ /** How to sign in once, after installing, in a few words. Commands are in backticks. */
64
+ signIn: string;
65
+ docsUrl: string;
66
+ };
67
+ /**
68
+ * What an app tells a user who has no coding agent set up: that one is
69
+ * missing, how to install each supported one, and a prompt that has a
70
+ * desktop or browser agent do it for them. Plain text, ready to show as it is.
71
+ */
72
+ type LocalAgentSetupGuide = {
73
+ /** One line saying no supported agent is set up. */
74
+ missing: string;
75
+ /** Why a desktop or browser app isn't enough: Nuabase runs the CLI. */
76
+ cliOnly: string;
77
+ /** In preference order, as findLocalAgent() tries them. */
78
+ agents: LocalAgentSetup[];
79
+ /**
80
+ * For the user to paste into a desktop or browser agent, such as the Claude
81
+ * or ChatGPT app, which can install a CLI though it can't be run as one.
82
+ */
83
+ setupPrompt: string;
84
+ };
85
+ /** Pure: how to set up a supported coding agent, for people who have none. */
86
+ declare function localAgentSetupGuide(): LocalAgentSetupGuide;
87
+
60
88
  /**
61
89
  * How a session can be started on this platform:
62
90
  * - terminal: in a new terminal window.
@@ -85,6 +113,17 @@ type AgentSessionConfig = {
85
113
  name?: string;
86
114
  /** Defaults to process.platform. */
87
115
  platform?: NodeJS.Platform;
116
+ /**
117
+ * The environment `open` runs in on macOS. A terminal app it launches keeps
118
+ * it for every window, so leave out what other sessions shouldn't see.
119
+ * Defaults to process.env.
120
+ */
121
+ env?: NodeJS.ProcessEnv;
122
+ /**
123
+ * Variables the launcher unsets before starting the agent, for a terminal
124
+ * that already holds them. Each must be a shell variable name.
125
+ */
126
+ unsetEnv?: readonly string[];
88
127
  };
89
128
  type AgentSessionFiles = {
90
129
  promptPath: string;
@@ -132,8 +171,8 @@ declare function agentSessionMode(platform?: NodeJS.Platform): AgentSessionMode;
132
171
  /**
133
172
  * Writes the prompt and a launcher that starts the agent on it, and where the
134
173
  * platform can, opens a terminal window running it. Expected failures come
135
- * back as the result; it throws only for an unknown agent or a `name` already
136
- * used. Node.js only.
174
+ * back as the result; it throws only for an unknown agent, an `unsetEnv` entry that
175
+ * isn't a variable name or a `name` already used. Node.js only.
137
176
  */
138
177
  declare function startAgentSession(config: AgentSessionConfig): Promise<AgentSessionStart>;
139
178
  type SessionLauncherTarget = {
@@ -142,9 +181,11 @@ type SessionLauncherTarget = {
142
181
  /** The agent's own options, which go before the prompt. */
143
182
  agentArgs: readonly string[];
144
183
  promptPath: string;
184
+ /** Variable names, unset before the agent starts. */
185
+ unsetEnv?: readonly string[];
145
186
  };
146
187
  /** Pure: the shell script that starts the agent on the prompt in `promptPath`. */
147
- declare function sessionLauncher({ cwd, binaryPath, agentArgs, promptPath }: SessionLauncherTarget): string;
188
+ declare function sessionLauncher({ cwd, binaryPath, agentArgs, promptPath, unsetEnv, }: SessionLauncherTarget): string;
148
189
 
149
- export { AgentEffort, LocalAgent, LocalAgentId, Logger, SessionApproval, agentSessionMode, detectLocalAgents, findLocalAgent, localAgent, sessionLauncher, startAgentSession };
150
- export type { AgentSessionConfig, AgentSessionFiles, AgentSessionMode, AgentSessionRefusal, AgentSessionStart, LocalAgentAuthMode, LocalAgentConfig, LocalAgentOptions, LocalAgentStatus, SessionLauncherTarget };
190
+ export { LocalAgent, LocalAgentCallOptions, LocalAgentId, Logger, SessionApproval, agentSessionMode, detectLocalAgents, findLocalAgent, localAgent, localAgentSetupGuide, sessionLauncher, startAgentSession };
191
+ export type { AgentSessionConfig, AgentSessionFiles, AgentSessionMode, AgentSessionRefusal, AgentSessionStart, LocalAgentAuthMode, LocalAgentConfig, LocalAgentOptions, LocalAgentSetup, LocalAgentSetupGuide, LocalAgentStatus, SessionLauncherTarget };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuabase",
3
3
  "description": "Nuabase TypeScript client to create typed functions from LLM prompts",
4
- "version": "3.0.1",
4
+ "version": "3.1.0",
5
5
  "type": "module",
6
6
  "author": "Jasim A Basheer <jasim@nuabase.com>",
7
7
  "engines": {