swellai 1.0.0 → 1.0.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 (65) hide show
  1. package/dist/src/cli/install.d.ts.map +1 -1
  2. package/dist/src/cli/install.js +7 -3
  3. package/dist/src/cli/install.js.map +1 -1
  4. package/package.json +2 -2
  5. package/templates/actions/detect-runtime/action.yml +113 -0
  6. package/templates/actions/fetch-agents/action.yml +34 -0
  7. package/templates/actions/get-issue-details/action.yml +60 -0
  8. package/templates/actions/setup-claude/action.yml +45 -0
  9. package/templates/actions/setup-opencode/action.yml +128 -0
  10. package/templates/scripts/claude-agent-runner.js +9039 -64
  11. package/templates/scripts/linear-agent.js +9103 -68
  12. package/templates/scripts/planning-agent.js +9080 -66
  13. package/templates/workflows/claude-plan.yml +48 -36
  14. package/dist/agents/linear-agent.d.ts +0 -32
  15. package/dist/agents/linear-agent.d.ts.map +0 -1
  16. package/dist/agents/linear-agent.js +0 -263
  17. package/dist/agents/linear-agent.js.map +0 -1
  18. package/dist/agents/planning-agent.d.ts +0 -36
  19. package/dist/agents/planning-agent.d.ts.map +0 -1
  20. package/dist/agents/planning-agent.js +0 -248
  21. package/dist/agents/planning-agent.js.map +0 -1
  22. package/dist/cli/index.d.ts +0 -3
  23. package/dist/cli/index.d.ts.map +0 -1
  24. package/dist/cli/index.js +0 -102
  25. package/dist/cli/index.js.map +0 -1
  26. package/dist/cli/install.d.ts +0 -11
  27. package/dist/cli/install.d.ts.map +0 -1
  28. package/dist/cli/install.js +0 -257
  29. package/dist/cli/install.js.map +0 -1
  30. package/dist/cli/manifest.d.ts +0 -27
  31. package/dist/cli/manifest.d.ts.map +0 -1
  32. package/dist/cli/manifest.js +0 -65
  33. package/dist/cli/manifest.js.map +0 -1
  34. package/dist/index.d.ts +0 -17
  35. package/dist/index.d.ts.map +0 -1
  36. package/dist/index.js +0 -17
  37. package/dist/index.js.map +0 -1
  38. package/dist/lib/claude-agent-sdk.d.ts +0 -73
  39. package/dist/lib/claude-agent-sdk.d.ts.map +0 -1
  40. package/dist/lib/claude-agent-sdk.js +0 -114
  41. package/dist/lib/claude-agent-sdk.js.map +0 -1
  42. package/dist/lib/conversation-logger.d.ts +0 -66
  43. package/dist/lib/conversation-logger.d.ts.map +0 -1
  44. package/dist/lib/conversation-logger.js +0 -159
  45. package/dist/lib/conversation-logger.js.map +0 -1
  46. package/dist/lib/opencode.d.ts +0 -68
  47. package/dist/lib/opencode.d.ts.map +0 -1
  48. package/dist/lib/opencode.js +0 -151
  49. package/dist/lib/opencode.js.map +0 -1
  50. package/dist/lib/turso-schema.d.ts +0 -13
  51. package/dist/lib/turso-schema.d.ts.map +0 -1
  52. package/dist/lib/turso-schema.js +0 -69
  53. package/dist/lib/turso-schema.js.map +0 -1
  54. package/dist/lib/turso.d.ts +0 -56
  55. package/dist/lib/turso.d.ts.map +0 -1
  56. package/dist/lib/turso.js +0 -144
  57. package/dist/lib/turso.js.map +0 -1
  58. package/dist/lib/types.d.ts +0 -31
  59. package/dist/lib/types.d.ts.map +0 -1
  60. package/dist/lib/types.js +0 -20
  61. package/dist/lib/types.js.map +0 -1
  62. package/dist/lib/utils.d.ts +0 -34
  63. package/dist/lib/utils.d.ts.map +0 -1
  64. package/dist/lib/utils.js +0 -72
  65. package/dist/lib/utils.js.map +0 -1
@@ -1,151 +0,0 @@
1
- /**
2
- * OpenCode SDK helpers for server setup and event monitoring.
3
- */
4
- import { createOpencode } from "@opencode-ai/sdk";
5
- /**
6
- * Create and configure an OpenCode server instance
7
- *
8
- * @param options - Configuration options for the OpenCode server
9
- * @returns OpenCode client and server instances
10
- */
11
- export async function createOpencodeServer(options) {
12
- const { provider, apiKey, model, agentName, agentDescription, agentPrompt, agentTools = {}, agentPermissions = {}, maxSteps = 30, linearApiKey, } = options;
13
- // Build OpenCode configuration
14
- const opcodeConfig = {
15
- provider: {
16
- [provider]: {
17
- options: {
18
- apiKey,
19
- timeout: false, // Disable timeout
20
- },
21
- },
22
- },
23
- ...(linearApiKey && {
24
- mcp: {
25
- linear: {
26
- type: "remote",
27
- url: "https://mcp.linear.app/mcp",
28
- headers: {
29
- Authorization: `Bearer ${linearApiKey}`,
30
- },
31
- },
32
- },
33
- }),
34
- agent: {
35
- [agentName]: {
36
- description: agentDescription,
37
- mode: "subagent",
38
- model,
39
- prompt: agentPrompt,
40
- tools: agentTools,
41
- maxSteps,
42
- permission: agentPermissions,
43
- },
44
- },
45
- };
46
- console.error("Starting OpenCode server...");
47
- const { client, server } = await createOpencode({
48
- hostname: "127.0.0.1",
49
- port: 0, // Auto-assign port
50
- config: opcodeConfig,
51
- });
52
- console.error(`✓ OpenCode server started at ${server.url}`);
53
- return { client: client, server };
54
- }
55
- /**
56
- * Setup event monitoring for an OpenCode session
57
- *
58
- * @param client - OpenCode client instance
59
- * @param logger - Optional conversation logger for storing tool executions
60
- */
61
- export function setupEventMonitoring(client, logger) {
62
- console.error("Setting up event monitoring...");
63
- (async () => {
64
- try {
65
- const events = await client.event.subscribe();
66
- for await (const event of events.stream) {
67
- // Monitor tool execution
68
- if (event.type === "message.part.updated") {
69
- const part = event.properties.part;
70
- if (part.type === "tool") {
71
- const status = part.state.status;
72
- const toolName = part.tool;
73
- if (status === "running") {
74
- const input = JSON.stringify(part.state.input || {}, null, 2);
75
- console.error(`\n[TOOL] ${toolName} - RUNNING`);
76
- console.error(` Input: ${input}`);
77
- // Log to database if logger is available
78
- if (logger) {
79
- logger.logToolExecution({
80
- toolName,
81
- status: "running",
82
- input: part.state.input,
83
- startedAt: new Date(),
84
- });
85
- }
86
- }
87
- else if (status === "completed") {
88
- const output = part.state.output?.slice(0, 200) || "(no output)";
89
- const duration = part.state.time?.end && part.state.time?.start
90
- ? `${((part.state.time.end - part.state.time.start) / 1000).toFixed(2)}s`
91
- : "unknown";
92
- console.error(`\n[TOOL] ${toolName} - COMPLETED (${duration})`);
93
- console.error(` Output preview: ${output}${part.state.output && part.state.output.length > 200 ? "..." : ""}`);
94
- // Log to database if logger is available
95
- if (logger) {
96
- logger.logToolExecution({
97
- toolName,
98
- status: "completed",
99
- input: part.state.input,
100
- output: part.state.output,
101
- startedAt: part.state.time?.start ? new Date(part.state.time.start) : undefined,
102
- endedAt: part.state.time?.end ? new Date(part.state.time.end) : undefined,
103
- });
104
- }
105
- }
106
- else if (status === "error") {
107
- console.error(`\n[TOOL] ${toolName} - ERROR`);
108
- console.error(` Error: ${part.state.error}`);
109
- // Log to database if logger is available
110
- if (logger) {
111
- logger.logToolExecution({
112
- toolName,
113
- status: "error",
114
- input: part.state.input,
115
- error: part.state.error,
116
- });
117
- }
118
- }
119
- }
120
- }
121
- // Monitor session status
122
- if (event.type === "session.status") {
123
- const status = event.properties.status;
124
- if (String(status) === "idle") {
125
- console.error(`\n[STATUS] Session idle`);
126
- }
127
- else if (String(status) === "busy") {
128
- console.error(`\n[STATUS] Session busy (processing)`);
129
- }
130
- else if (typeof status === "object" && "attempt" in status) {
131
- // Retry status
132
- console.error(`\n[STATUS] Session retrying (attempt ${status.attempt})`);
133
- if ("message" in status)
134
- console.error(` Reason: ${status.message}`);
135
- if ("next" in status)
136
- console.error(` Next retry in: ${status.next}ms`);
137
- }
138
- }
139
- // Monitor session errors
140
- if (event.type === "session.error") {
141
- const error = event.properties.error;
142
- console.error(`\n[ERROR] Session error:`, error);
143
- }
144
- }
145
- }
146
- catch (err) {
147
- console.error("Event monitoring subscription error:", err);
148
- }
149
- })();
150
- }
151
- //# sourceMappingURL=opencode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opencode.js","sourceRoot":"","sources":["../../src/lib/opencode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiDlD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAA8B;IAE9B,MAAM,EACJ,QAAQ,EACR,MAAM,EACN,KAAK,EACL,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,UA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AC,IAAI,KAAK,eAAe,EAAE,CAAC;oBACnC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC;oBACrC,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Turso database schema definitions and migration logic.
3
- *
4
- * This module defines the database schema for conversation logging
5
- * and provides idempotent migration functions.
6
- */
7
- export declare const SCHEMA_VERSION = 1;
8
- /**
9
- * SQL statements for creating the conversation logging schema.
10
- * All statements use IF NOT EXISTS for idempotent execution.
11
- */
12
- export declare const SCHEMA_STATEMENTS: string[];
13
- //# sourceMappingURL=turso-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turso-schema.d.ts","sourceRoot":"","sources":["../../src/lib/turso-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,UA4D7B,CAAC"}
@@ -1,69 +0,0 @@
1
- /**
2
- * Turso database schema definitions and migration logic.
3
- *
4
- * This module defines the database schema for conversation logging
5
- * and provides idempotent migration functions.
6
- */
7
- export const SCHEMA_VERSION = 1;
8
- /**
9
- * SQL statements for creating the conversation logging schema.
10
- * All statements use IF NOT EXISTS for idempotent execution.
11
- */
12
- export const SCHEMA_STATEMENTS = [
13
- // Schema version tracking
14
- `CREATE TABLE IF NOT EXISTS schema_version (
15
- version INTEGER PRIMARY KEY,
16
- applied_at TEXT NOT NULL DEFAULT (datetime('now'))
17
- )`,
18
- // Sessions table - tracks agent execution sessions
19
- `CREATE TABLE IF NOT EXISTS sessions (
20
- id TEXT PRIMARY KEY,
21
- agent_type TEXT NOT NULL,
22
- model TEXT NOT NULL,
23
- provider TEXT,
24
- started_at TEXT NOT NULL DEFAULT (datetime('now')),
25
- ended_at TEXT,
26
- status TEXT NOT NULL DEFAULT 'running',
27
- error_message TEXT,
28
- metadata TEXT
29
- )`,
30
- // Messages table - stores conversation messages
31
- `CREATE TABLE IF NOT EXISTS messages (
32
- id TEXT PRIMARY KEY,
33
- session_id TEXT NOT NULL,
34
- sequence INTEGER NOT NULL,
35
- role TEXT NOT NULL,
36
- content TEXT,
37
- tool_name TEXT,
38
- tool_input TEXT,
39
- tool_output TEXT,
40
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
41
- token_count INTEGER,
42
- FOREIGN KEY (session_id) REFERENCES sessions(id)
43
- )`,
44
- // Tool executions table - tracks individual tool calls
45
- `CREATE TABLE IF NOT EXISTS tool_executions (
46
- id TEXT PRIMARY KEY,
47
- session_id TEXT NOT NULL,
48
- message_id TEXT,
49
- tool_name TEXT NOT NULL,
50
- status TEXT NOT NULL,
51
- input TEXT,
52
- output TEXT,
53
- error TEXT,
54
- started_at TEXT NOT NULL DEFAULT (datetime('now')),
55
- ended_at TEXT,
56
- duration_ms INTEGER,
57
- FOREIGN KEY (session_id) REFERENCES sessions(id),
58
- FOREIGN KEY (message_id) REFERENCES messages(id)
59
- )`,
60
- // Indexes for query performance
61
- "CREATE INDEX IF NOT EXISTS idx_messages_session ON messages(session_id)",
62
- "CREATE INDEX IF NOT EXISTS idx_messages_created ON messages(created_at)",
63
- "CREATE INDEX IF NOT EXISTS idx_tool_executions_session ON tool_executions(session_id)",
64
- "CREATE INDEX IF NOT EXISTS idx_tool_executions_started ON tool_executions(started_at)",
65
- "CREATE INDEX IF NOT EXISTS idx_sessions_agent_type ON sessions(agent_type)",
66
- "CREATE INDEX IF NOT EXISTS idx_sessions_status ON sessions(status)",
67
- "CREATE INDEX IF NOT EXISTS idx_sessions_started ON sessions(started_at)",
68
- ];
69
- //# sourceMappingURL=turso-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turso-schema.js","sourceRoot":"","sources":["../../src/lib/turso-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,0BAA0B;IAC1B;;;IAGE;IAEF,mDAAmD;IACnD;;;;;;;;;;IAUE;IAEF,gDAAgD;IAChD;;;;;;;;;;;;IAYE;IAEF,uDAAuD;IACvD;;;;;;;;;;;;;;IAcE;IAEF,gCAAgC;IAChC,yEAAyE;IACzE,yEAAyE;IACzE,uFAAuF;IACvF,uFAAuF;IACvF,4EAA4E;IAC5E,oEAAoE;IACpE,yEAAyE;CAC1E,CAAC"}
@@ -1,56 +0,0 @@
1
- /**
2
- * Turso/libSQL client configuration and connection management.
3
- *
4
- * This module provides utilities for connecting to a Turso database
5
- * for conversation logging. Logging is optional - when credentials
6
- * are not configured, functions return null gracefully.
7
- *
8
- * In CI/CD environments (GitHub Actions), uses ephemeral embedded replicas
9
- * that sync to cloud at the end of each session.
10
- */
11
- import { type Client } from "@libsql/client";
12
- export interface TursoConfig {
13
- url: string;
14
- authToken: string;
15
- }
16
- /**
17
- * Get Turso configuration from environment variables.
18
- * Returns null if credentials are not configured (logging disabled).
19
- */
20
- export declare function getTursoConfig(): TursoConfig | null;
21
- /**
22
- * Create a new Turso client with the provided configuration.
23
- * Uses embedded replica (local SQLite + sync) for better performance.
24
- */
25
- export declare function createTursoClient(config: TursoConfig): Client;
26
- /**
27
- * Get the shared Turso client instance.
28
- * Returns null if Turso is not configured.
29
- * Creates the client on first call (lazy initialization).
30
- */
31
- export declare function getTursoClient(): Promise<Client | null>;
32
- /**
33
- * Sync the local embedded replica with Turso cloud.
34
- * This pushes all local data to the cloud database.
35
- * Returns true if sync was successful, false otherwise.
36
- */
37
- export declare function syncToCloud(): Promise<boolean>;
38
- /**
39
- * Close the Turso client connection.
40
- * Safe to call even if client was never created.
41
- * Does NOT sync before closing - call syncToCloud() explicitly if needed.
42
- */
43
- export declare function closeTursoClient(): void;
44
- /**
45
- * Initialize the database schema.
46
- * This function is idempotent and can be called multiple times safely.
47
- * Returns true if initialization was successful or already done.
48
- * Returns false if Turso is not configured.
49
- */
50
- export declare function initializeSchema(): Promise<boolean>;
51
- /**
52
- * Reset schema initialization state.
53
- * Useful for testing or when reconnecting.
54
- */
55
- export declare function resetSchemaState(): void;
56
- //# sourceMappingURL=turso.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turso.d.ts","sourceRoot":"","sources":["../../src/lib/turso.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,gBAAgB,CAAC;AAG3D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,WAAW,GAAG,IAAI,CASnD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAW7D;AAKD;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAU7D;AAED;;;;GAIG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAapD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC;AAKD;;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CA8CzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
package/dist/lib/turso.js DELETED
@@ -1,144 +0,0 @@
1
- /**
2
- * Turso/libSQL client configuration and connection management.
3
- *
4
- * This module provides utilities for connecting to a Turso database
5
- * for conversation logging. Logging is optional - when credentials
6
- * are not configured, functions return null gracefully.
7
- *
8
- * In CI/CD environments (GitHub Actions), uses ephemeral embedded replicas
9
- * that sync to cloud at the end of each session.
10
- */
11
- import { tmpdir } from "node:os";
12
- import { join } from "node:path";
13
- import { createClient } from "@libsql/client";
14
- import { SCHEMA_STATEMENTS, SCHEMA_VERSION } from "./turso-schema.js";
15
- /**
16
- * Get Turso configuration from environment variables.
17
- * Returns null if credentials are not configured (logging disabled).
18
- */
19
- export function getTursoConfig() {
20
- const url = process.env.TURSO_DATABASE_URL;
21
- const authToken = process.env.TURSO_AUTH_TOKEN;
22
- if (!url || !authToken) {
23
- return null;
24
- }
25
- return { url, authToken };
26
- }
27
- /**
28
- * Create a new Turso client with the provided configuration.
29
- * Uses embedded replica (local SQLite + sync) for better performance.
30
- */
31
- export function createTursoClient(config) {
32
- // Generate unique local database path for this session
33
- const sessionId = crypto.randomUUID();
34
- const localDbPath = join(tmpdir(), `turso-session-${sessionId}.db`);
35
- return createClient({
36
- url: `file:${localDbPath}`, // Local SQLite file
37
- syncUrl: config.url, // Sync to Turso cloud
38
- authToken: config.authToken,
39
- syncInterval: 0, // Disable automatic sync - we'll sync manually
40
- });
41
- }
42
- // Singleton client instance
43
- let _client = null;
44
- /**
45
- * Get the shared Turso client instance.
46
- * Returns null if Turso is not configured.
47
- * Creates the client on first call (lazy initialization).
48
- */
49
- export async function getTursoClient() {
50
- const config = getTursoConfig();
51
- if (!config) {
52
- return null;
53
- }
54
- if (!_client) {
55
- _client = createTursoClient(config);
56
- }
57
- return _client;
58
- }
59
- /**
60
- * Sync the local embedded replica with Turso cloud.
61
- * This pushes all local data to the cloud database.
62
- * Returns true if sync was successful, false otherwise.
63
- */
64
- export async function syncToCloud() {
65
- if (!_client) {
66
- return false;
67
- }
68
- try {
69
- await _client.sync();
70
- console.error("[Turso] Successfully synced local data to cloud");
71
- return true;
72
- }
73
- catch (error) {
74
- console.error("[Turso] Failed to sync to cloud:", error);
75
- return false;
76
- }
77
- }
78
- /**
79
- * Close the Turso client connection.
80
- * Safe to call even if client was never created.
81
- * Does NOT sync before closing - call syncToCloud() explicitly if needed.
82
- */
83
- export function closeTursoClient() {
84
- if (_client) {
85
- _client.close();
86
- _client = null;
87
- }
88
- }
89
- // Schema initialization state
90
- let _schemaInitialized = false;
91
- /**
92
- * Initialize the database schema.
93
- * This function is idempotent and can be called multiple times safely.
94
- * Returns true if initialization was successful or already done.
95
- * Returns false if Turso is not configured.
96
- */
97
- export async function initializeSchema() {
98
- if (_schemaInitialized) {
99
- return true;
100
- }
101
- const client = await getTursoClient();
102
- if (!client) {
103
- return false;
104
- }
105
- try {
106
- // Check current schema version
107
- const versionResult = await client
108
- .execute("SELECT version FROM schema_version ORDER BY version DESC LIMIT 1")
109
- .catch(() => ({ rows: [] }));
110
- const currentVersion = versionResult.rows.length > 0 && versionResult.rows[0]?.version
111
- ? Number(versionResult.rows[0].version)
112
- : 0;
113
- if (currentVersion >= SCHEMA_VERSION) {
114
- _schemaInitialized = true;
115
- return true;
116
- }
117
- // Run all schema statements (idempotent due to IF NOT EXISTS)
118
- for (const statement of SCHEMA_STATEMENTS) {
119
- await client.execute(statement);
120
- }
121
- // Record schema version if not already present
122
- if (currentVersion < SCHEMA_VERSION) {
123
- await client.execute({
124
- sql: "INSERT OR REPLACE INTO schema_version (version) VALUES (?)",
125
- args: [SCHEMA_VERSION],
126
- });
127
- }
128
- _schemaInitialized = true;
129
- console.error(`[Turso] Schema initialized to version ${SCHEMA_VERSION}`);
130
- return true;
131
- }
132
- catch (error) {
133
- console.error("[Turso] Failed to initialize schema:", error);
134
- return false;
135
- }
136
- }
137
- /**
138
- * Reset schema initialization state.
139
- * Useful for testing or when reconnecting.
140
- */
141
- export function resetSchemaState() {
142
- _schemaInitialized = false;
143
- }
144
- //# sourceMappingURL=turso.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turso.js","sourceRoot":"","sources":["../../src/lib/turso.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,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AC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YACvC,CAAC,CAAC,CAAC,CAAC;QAER,IAAI,cAAc,IAAI,cAAc,EAAE,CAAC;YACrC,kBAAkB,GAAG,IAAI,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,8DAA8D;QAC9D,KAAK,MAAM,SAAS,IAAI,iBAAiB,EAAE,CAAC;YAC1C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC;QAED,+CAA+C;QAC/C,IAAI,cAAc,GAAG,cAAc,EAAE,CAAC;YACpC,MAAM,MAAM,CAAC,OAAO,CAAC;gBACnB,GAAG,EAAE,4DAA4D;gBACjE,IAAI,EAAE,CAAC,cAAc,CAAC;aACvB,CAAC,CAAC;QACL,CAAC;QAED,kBAAkB,GAAG,IAAI,CAAC;QAC1B,OAAO,CAAC,KAAK,CAAC,yCAAyC,cAAc,EAAE,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,kBAAkB,GAAG,KAAK,CAAC;AAC7B,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Shared TypeScript interfaces and types for the multi-provider plan generation system.
3
- */
4
- /**
5
- * Message part from OpenCode SDK responses
6
- */
7
- export interface Part {
8
- type: string;
9
- text?: string;
10
- [key: string]: unknown;
11
- }
12
- /**
13
- * Provider configuration options
14
- */
15
- export interface ProviderConfig {
16
- apiKey: string;
17
- timeout?: boolean;
18
- }
19
- /**
20
- * Supported AI providers
21
- */
22
- export type Provider = "anthropic" | "openai" | "google";
23
- /**
24
- * Provider-specific default models
25
- */
26
- export declare const DEFAULT_MODELS: Record<Provider, string>;
27
- /**
28
- * Environment variable names for API keys by provider
29
- */
30
- export declare const API_KEY_ENV_VARS: Record<Provider, string[]>;
31
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAInD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAIvD,CAAC"}
package/dist/lib/types.js DELETED
@@ -1,20 +0,0 @@
1
- /**
2
- * Shared TypeScript interfaces and types for the multi-provider plan generation system.
3
- */
4
- /**
5
- * Provider-specific default models
6
- */
7
- export const DEFAULT_MODELS = {
8
- anthropic: "claude-opus-4-5",
9
- openai: "gpt-5.2-pro",
10
- google: "gemini-2.5-flash",
11
- };
12
- /**
13
- * Environment variable names for API keys by provider
14
- */
15
- export const API_KEY_ENV_VARS = {
16
- anthropic: ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"],
17
- openai: ["OPENAI_API_KEY"],
18
- google: ["GOOGLE_GENERATIVE_AI_API_KEY"],
19
- };
20
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAwBH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAA6B;IACtD,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,kBAAkB;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,SAAS,EAAE,CAAC,mBAAmB,EAAE,yBAAyB,CAAC;IAC3D,MAAM,EAAE,CAAC,gBAAgB,CAAC;IAC1B,MAAM,EAAE,CAAC,8BAA8B,CAAC;CACzC,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Shared utility functions for the multi-provider plan generation system.
3
- */
4
- import { type Part, type Provider } from "./types.js";
5
- /**
6
- * Extract text from message parts
7
- *
8
- * @param parts - Array of message parts from OpenCode SDK
9
- * @returns Concatenated text from all text-type parts
10
- */
11
- export declare function extractTextFromParts(parts: Part[]): string;
12
- /**
13
- * Validate that all required environment variables are set
14
- *
15
- * @param requiredVars - Array of environment variable names to check
16
- * @throws Error if any required variables are missing
17
- */
18
- export declare function validateEnvVars(requiredVars: string[]): void;
19
- /**
20
- * Get API key from environment variables for a specific provider
21
- *
22
- * @param provider - The AI provider (anthropic, openai, google)
23
- * @returns The API key for the provider
24
- * @throws Error if no API key is found for the provider
25
- */
26
- export declare function getApiKey(provider: Provider): string;
27
- /**
28
- * Validate that a provider is supported
29
- *
30
- * @param provider - The provider name to validate
31
- * @throws Error if the provider is not supported
32
- */
33
- export declare function validateProvider(provider: string): asserts provider is Provider;
34
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAoB,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAO1D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,IAAI,CAa5D;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAiBpD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAS/E"}
package/dist/lib/utils.js DELETED
@@ -1,72 +0,0 @@
1
- /**
2
- * Shared utility functions for the multi-provider plan generation system.
3
- */
4
- import { API_KEY_ENV_VARS } from "./types.js";
5
- /**
6
- * Extract text from message parts
7
- *
8
- * @param parts - Array of message parts from OpenCode SDK
9
- * @returns Concatenated text from all text-type parts
10
- */
11
- export function extractTextFromParts(parts) {
12
- if (!Array.isArray(parts))
13
- return "";
14
- return parts
15
- .filter((part) => part.type === "text")
16
- .map((part) => part.text || "")
17
- .join("\n");
18
- }
19
- /**
20
- * Validate that all required environment variables are set
21
- *
22
- * @param requiredVars - Array of environment variable names to check
23
- * @throws Error if any required variables are missing
24
- */
25
- export function validateEnvVars(requiredVars) {
26
- const missingVars = requiredVars.filter((varName) => !process.env[varName]);
27
- if (missingVars.length > 0) {
28
- const errorMsg = [
29
- "Error: Missing required environment variables:",
30
- ...missingVars.map((varName) => ` - ${varName}`),
31
- "",
32
- "Please set all required environment variables and try again.",
33
- ].join("\n");
34
- throw new Error(errorMsg);
35
- }
36
- }
37
- /**
38
- * Get API key from environment variables for a specific provider
39
- *
40
- * @param provider - The AI provider (anthropic, openai, google)
41
- * @returns The API key for the provider
42
- * @throws Error if no API key is found for the provider
43
- */
44
- export function getApiKey(provider) {
45
- const envVars = API_KEY_ENV_VARS[provider];
46
- for (const envVar of envVars) {
47
- const apiKey = process.env[envVar];
48
- if (apiKey) {
49
- return apiKey;
50
- }
51
- }
52
- const errorMsg = [
53
- `Error: No API key found for provider "${provider}"`,
54
- `Required environment variables (at least one):`,
55
- ...envVars.map((envVar) => ` - ${envVar}`),
56
- ].join("\n");
57
- throw new Error(errorMsg);
58
- }
59
- /**
60
- * Validate that a provider is supported
61
- *
62
- * @param provider - The provider name to validate
63
- * @throws Error if the provider is not supported
64
- */
65
- export function validateProvider(provider) {
66
- const validProviders = ["anthropic", "openai", "google"];
67
- if (!validProviders.includes(provider)) {
68
- throw new Error(`Error: Unsupported provider "${provider}". ` +
69
- `Supported providers: ${validProviders.join(", ")}`);
70
- }
71
- }
72
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAA4B,MAAM,YAAY,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,OAAO,KAAK;SACT,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;SACtC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;SAC9B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,YAAsB;IACpD,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5E,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG;YACf,gDAAgD;YAChD,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC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