@stacknet/stacks 0.2.0 → 0.2.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 (63) hide show
  1. package/README.md +136 -0
  2. package/dist/{billing-eQZIWeNW.d.cts → billing-cj0eSVrp.d.cts} +59 -1
  3. package/dist/{billing-eQZIWeNW.d.ts → billing-cj0eSVrp.d.ts} +59 -1
  4. package/dist/clients/index.cjs +4 -4
  5. package/dist/clients/index.d.cts +24 -1
  6. package/dist/clients/index.d.ts +24 -1
  7. package/dist/clients/index.js +4 -4
  8. package/dist/index.cjs +7 -7
  9. package/dist/index.d.cts +3 -3
  10. package/dist/index.d.ts +3 -3
  11. package/dist/index.js +7 -7
  12. package/dist/proxy/index.cjs +2 -2
  13. package/dist/proxy/index.js +2 -2
  14. package/dist/streaming/index.cjs +5 -5
  15. package/dist/streaming/index.js +5 -5
  16. package/dist/types/index.d.cts +1 -1
  17. package/dist/types/index.d.ts +1 -1
  18. package/package.json +15 -13
  19. package/src/clients/agents.ts +0 -250
  20. package/src/clients/billing.ts +0 -197
  21. package/src/clients/coder.ts +0 -655
  22. package/src/clients/files.ts +0 -86
  23. package/src/clients/index.ts +0 -93
  24. package/src/clients/magma.ts +0 -299
  25. package/src/clients/mcp.ts +0 -208
  26. package/src/clients/network.ts +0 -118
  27. package/src/clients/points.ts +0 -403
  28. package/src/clients/skills.ts +0 -236
  29. package/src/clients/social.ts +0 -286
  30. package/src/clients/stack-management.ts +0 -279
  31. package/src/clients/task-network.ts +0 -303
  32. package/src/clients/user.ts +0 -84
  33. package/src/clients/widgets.ts +0 -171
  34. package/src/index.ts +0 -387
  35. package/src/managers/index.ts +0 -10
  36. package/src/managers/task-manager.ts +0 -332
  37. package/src/proxy/forwarder.ts +0 -235
  38. package/src/proxy/index.ts +0 -32
  39. package/src/proxy/route-handlers.ts +0 -1107
  40. package/src/streaming/component-stream.ts +0 -319
  41. package/src/streaming/index.ts +0 -21
  42. package/src/streaming/sse.ts +0 -266
  43. package/src/types/agent.ts +0 -108
  44. package/src/types/billing.ts +0 -121
  45. package/src/types/chat.ts +0 -58
  46. package/src/types/coder.ts +0 -345
  47. package/src/types/credential.ts +0 -111
  48. package/src/types/file.ts +0 -15
  49. package/src/types/imagination.ts +0 -50
  50. package/src/types/index.ts +0 -20
  51. package/src/types/mcp.ts +0 -35
  52. package/src/types/network.ts +0 -97
  53. package/src/types/points.ts +0 -250
  54. package/src/types/skill.ts +0 -107
  55. package/src/types/social.ts +0 -109
  56. package/src/types/stack.ts +0 -269
  57. package/src/types/task.ts +0 -41
  58. package/src/types/user.ts +0 -29
  59. package/src/types/widget.ts +0 -57
  60. package/src/utils/constants.ts +0 -26
  61. package/src/utils/errors.ts +0 -169
  62. package/src/utils/helpers.ts +0 -85
  63. package/src/utils/index.ts +0 -7
@@ -1,121 +0,0 @@
1
- /**
2
- * Billing and metered usage type definitions
3
- */
4
-
5
- export type BillingTier = 'free' | 'starter' | 'pro' | 'enterprise';
6
-
7
- export interface BillingPlan {
8
- id: string;
9
- name: string;
10
- tier: BillingTier;
11
- price_monthly: number;
12
- price_yearly: number;
13
- included_units: number;
14
- overage_price: number;
15
- features: string[];
16
- }
17
-
18
- export interface MeteredUsage {
19
- stack_identity_id: string;
20
- stack_id: string;
21
- period_start: number;
22
- period_end: number;
23
- usage_type: string;
24
- quantity: number;
25
- unit_price: number;
26
- total_amount: number;
27
- }
28
-
29
- export interface BillingState {
30
- stack_identity_id: string;
31
- stripe_customer_id?: string;
32
- current_tier: BillingTier;
33
- subscription_id?: string;
34
- subscription_status?: 'active' | 'past_due' | 'canceled' | 'trialing';
35
- current_period_start?: number;
36
- current_period_end?: number;
37
- usage_this_period: MeteredUsage[];
38
- total_usage_units: number;
39
- total_amount_due: number;
40
- has_card_on_file: boolean;
41
- updated_at: number;
42
- }
43
-
44
- export interface BillingPlansResponse {
45
- plans: BillingPlan[];
46
- }
47
-
48
- export interface CreateCheckoutSessionResponse {
49
- checkout_url: string;
50
- session_id: string;
51
- }
52
-
53
- export interface BillingPortalResponse {
54
- portal_url: string;
55
- }
56
-
57
- export interface UsageRecord {
58
- id: string;
59
- task_id: string;
60
- model: string | null;
61
- executor_node_id: string;
62
- inbound: { text_tokens: number; image_megapixels: number; video_megabytes: number; audio_megabytes: number };
63
- outbound: { text_tokens: number; image_megapixels: number; video_megabytes: number; audio_megabytes: number };
64
- execution_time_ms: number;
65
- recorded_at: number;
66
- cost: {
67
- input_token_value: string;
68
- output_token_value: string;
69
- image_value: string;
70
- video_value: string;
71
- audio_value: string;
72
- total_value: string;
73
- };
74
- }
75
-
76
- export interface PaginationMeta {
77
- page: number;
78
- limit: number;
79
- total: number;
80
- total_pages: number;
81
- has_more: boolean;
82
- }
83
-
84
- export interface BillingClientConfig {
85
- baseUrl?: string;
86
- authToken?: string;
87
- }
88
-
89
- // SOL payment types (additive — Stripe types above remain unchanged)
90
-
91
- export type PaymentMethod = 'stripe' | 'solana';
92
-
93
- export interface SolSubscriptionResult {
94
- subscription: {
95
- id: string;
96
- planId: string;
97
- planName: string;
98
- status: string;
99
- tokensGranted: number;
100
- periodEnd: number;
101
- paymentMethod: 'solana';
102
- txSignature: string;
103
- };
104
- }
105
-
106
- export interface SolPrepaidResult {
107
- alreadyCredited: boolean;
108
- tokensCredited?: number;
109
- amountCents?: number;
110
- paymentRef?: string;
111
- paymentMethod: 'solana';
112
- }
113
-
114
- export interface TopupResult {
115
- success: boolean;
116
- tokensCredited: number;
117
- amountCents: number;
118
- paymentMethod: PaymentMethod;
119
- paymentRef: string;
120
- tokenBalance: number;
121
- }
package/src/types/chat.ts DELETED
@@ -1,58 +0,0 @@
1
- /**
2
- * Chat and message type definitions
3
- */
4
-
5
- export interface Message {
6
- role: 'system' | 'user' | 'assistant';
7
- content: string;
8
- }
9
-
10
- export interface ChatCompletionRequest {
11
- model: string;
12
- messages: Message[];
13
- stream?: boolean;
14
- temperature?: number;
15
- max_tokens?: number;
16
- sessionId?: string;
17
- search?: boolean; // Enable/disable web search tools (default: true)
18
- }
19
-
20
- export interface ChatCompletionChunk {
21
- id: string;
22
- object: 'chat.completion.chunk';
23
- created: number;
24
- model: string;
25
- choices: Array<{
26
- index: number;
27
- delta: {
28
- role?: 'assistant';
29
- content?: string;
30
- };
31
- finish_reason: string | null;
32
- }>;
33
- usage?: {
34
- prompt_tokens: number;
35
- completion_tokens: number;
36
- total_tokens: number;
37
- };
38
- }
39
-
40
- export interface ChatCompletionResponse {
41
- id: string;
42
- object: 'chat.completion';
43
- created: number;
44
- model: string;
45
- choices: Array<{
46
- index: number;
47
- message: {
48
- role: 'assistant';
49
- content: string;
50
- };
51
- finish_reason: string;
52
- }>;
53
- usage: {
54
- prompt_tokens: number;
55
- completion_tokens: number;
56
- total_tokens: number;
57
- };
58
- }
@@ -1,345 +0,0 @@
1
- /**
2
- * Coder type definitions
3
- * Types for the GeoffCoder AI coding agent
4
- */
5
-
6
- // ============================================================================
7
- // Session Types
8
- // ============================================================================
9
-
10
- export type CoderSessionStatus = 'active' | 'completed' | 'aborted' | 'error';
11
-
12
- export interface CoderSession {
13
- id: string;
14
- workingDirectory: string;
15
- status: CoderSessionStatus;
16
- createdAt: string;
17
- updatedAt?: string;
18
- metrics: CoderMetrics;
19
- sandboxId?: string;
20
- }
21
-
22
- export interface CoderMetrics {
23
- tokensUsed: number;
24
- promptTokens: number;
25
- completionTokens: number;
26
- contextSize: number;
27
- filesCreated: number;
28
- filesModified: number;
29
- linesAdded: number;
30
- linesRemoved: number;
31
- commandsExecuted: number;
32
- toolCallsTotal: number;
33
- apiCalls: number;
34
- startTime: number;
35
- endTime?: number;
36
- modifiedFiles: string[];
37
- createdFiles: string[];
38
- }
39
-
40
- // ============================================================================
41
- // Execution Types
42
- // ============================================================================
43
-
44
- export interface CoderExecuteRequest {
45
- /** The prompt/task for the coder agent */
46
- prompt: string;
47
- /** Working directory for file operations */
48
- workingDirectory?: string;
49
- /** Maximum iterations for the agent loop */
50
- maxIterations?: number;
51
- /** Model to use for completions */
52
- model?: string;
53
- /** Maximum tokens per response */
54
- maxTokens?: number;
55
- /** Temperature for generation */
56
- temperature?: number;
57
- /** Whether to stream the response */
58
- stream?: boolean;
59
- /** Existing session ID to continue */
60
- sessionId?: string;
61
- /** Existing sandbox ID to use (from frontend) */
62
- sandboxId?: string;
63
- /** E2B sandbox configuration */
64
- sandbox?: CoderSandboxConfig;
65
- // New: API configuration for self-hosted models (e.g., devstral:24b)
66
- /** Chat ID for session tracking and approval responses */
67
- chatId?: string;
68
- /** API base URL for self-hosted inference endpoint */
69
- apiBase?: string;
70
- /** API key for authentication */
71
- apiKey?: string;
72
- /** Auto-approve tool execution (default: true for backward compatibility) */
73
- autoApprove?: boolean;
74
- /** Tool permission overrides */
75
- toolPermissions?: Record<string, {
76
- permission: 'always' | 'ask' | 'never';
77
- allowlist?: string[];
78
- denylist?: string[];
79
- }>;
80
- }
81
-
82
- export interface CoderSandboxConfig {
83
- /** Enable sandbox execution */
84
- enabled: boolean;
85
- /** Sandbox template (e.g., 'node', 'python', 'nextjs') */
86
- template?: string;
87
- /** Session timeout in seconds */
88
- timeout?: number;
89
- /** Environment variables */
90
- env?: Record<string, string>;
91
- /** Packages to pre-install */
92
- packages?: string[];
93
- }
94
-
95
- export interface CoderExecuteResponse {
96
- sessionId: string;
97
- status: CoderSessionStatus;
98
- result?: string;
99
- error?: string;
100
- metrics: CoderMetrics;
101
- }
102
-
103
- // ============================================================================
104
- // Streaming Types
105
- // ============================================================================
106
-
107
- export type CoderStreamEventType =
108
- | 'session_start'
109
- | 'thinking'
110
- | 'tool_call'
111
- | 'tool_result'
112
- | 'assistant_message'
113
- | 'progress'
114
- | 'metrics_update'
115
- | 'session_complete'
116
- | 'complete' // Alias for session_complete
117
- | 'file_written' // File creation event
118
- | 'file_modified' // File modification event
119
- | 'sandbox_info' // Sandbox info event
120
- | 'session_files' // Session files event (at completion)
121
- | 'text' // Text content event
122
- | 'done' // Done event
123
- | 'error'
124
- // Tool approval events (for Mistral integration)
125
- | 'approval_required' // Tool needs user approval
126
- | 'approval_response' // User responded to approval
127
- | 'tool_blocked' // Tool was blocked by permission
128
- // Phase 1 & 2 events
129
- | 'context_compacted' // Context window was compacted
130
- | 'background_process_started' // Background bash process started
131
- | 'background_process_completed' // Background bash process completed
132
- | 'session_saved' // Session snapshot saved
133
- | 'session_resumed' // Session resumed from snapshot
134
- | 'file_checkpoint' // File checkpoint created
135
- | 'memory_loaded' // Hierarchical memory loaded
136
- | 'question_asked' // Agent asked user a question
137
- | 'question_answered' // User answered agent's question
138
- | 'blueprint_generated' // Blueprint/plan generated
139
- | 'plan_progress' // Plan execution progress
140
- | 'token_usage' // Token usage metrics
141
- | 'task_created' // Task was created
142
- | 'task_update'; // Task was updated
143
-
144
- export interface CoderStreamEvent {
145
- type: CoderStreamEventType;
146
- data: unknown;
147
- timestamp: number;
148
- }
149
-
150
- export interface CoderThinkingEvent {
151
- type: 'thinking';
152
- data: {
153
- content: string;
154
- iteration: number;
155
- };
156
- }
157
-
158
- export interface CoderToolCallEvent {
159
- type: 'tool_call';
160
- data: {
161
- toolName: string;
162
- arguments: Record<string, unknown>;
163
- toolCallId: string;
164
- };
165
- }
166
-
167
- export interface CoderToolResultEvent {
168
- type: 'tool_result';
169
- data: {
170
- toolCallId: string;
171
- toolName: string;
172
- success: boolean;
173
- output: string;
174
- error?: string;
175
- };
176
- }
177
-
178
- export interface CoderProgressEvent {
179
- type: 'progress';
180
- data: {
181
- iteration: number;
182
- maxIterations: number;
183
- currentAction: string;
184
- };
185
- }
186
-
187
- // ============================================================================
188
- // Tool Types
189
- // ============================================================================
190
-
191
- export interface CoderTool {
192
- name: string;
193
- description: string;
194
- parameters: {
195
- type: 'object';
196
- properties: Record<string, CoderToolParameter>;
197
- required?: string[];
198
- };
199
- }
200
-
201
- export interface CoderToolParameter {
202
- type: string;
203
- description: string;
204
- enum?: string[];
205
- }
206
-
207
- export interface CoderToolResult {
208
- success: boolean;
209
- output: string;
210
- error?: string;
211
- }
212
-
213
- // ============================================================================
214
- // File System Types
215
- // ============================================================================
216
-
217
- export interface CoderFileInfo {
218
- name: string;
219
- path: string;
220
- size: number;
221
- isDirectory: boolean;
222
- modified?: string;
223
- children?: CoderFileInfo[];
224
- }
225
-
226
- export interface CoderFileContent {
227
- path: string;
228
- content: string;
229
- encoding?: 'utf8' | 'base64';
230
- size: number;
231
- }
232
-
233
- export interface CoderFileWriteInput {
234
- path: string;
235
- content: string;
236
- encoding?: 'utf8' | 'base64';
237
- createDirectories?: boolean;
238
- }
239
-
240
- export interface CoderSearchResult {
241
- file: string;
242
- line: number;
243
- content: string;
244
- contextBefore?: string[];
245
- contextAfter?: string[];
246
- }
247
-
248
- export interface CoderDiffInput {
249
- path: string;
250
- original: string;
251
- replacement: string;
252
- replaceAll?: boolean;
253
- }
254
-
255
- // ============================================================================
256
- // Command Execution Types
257
- // ============================================================================
258
-
259
- export interface CoderCommandResult {
260
- stdout: string;
261
- stderr: string;
262
- exitCode: number;
263
- executionTimeMs: number;
264
- }
265
-
266
- export interface CoderCommandInput {
267
- command: string;
268
- timeout?: number;
269
- cwd?: string;
270
- }
271
-
272
- // ============================================================================
273
- // Sandbox Types
274
- // ============================================================================
275
-
276
- export interface CoderSandbox {
277
- id: string;
278
- status: 'creating' | 'ready' | 'busy' | 'stopped' | 'error';
279
- template: string;
280
- workingDirectory: string;
281
- createdAt: string;
282
- expiresAt?: string;
283
- }
284
-
285
- export interface CoderSandboxCreateInput {
286
- template?: string;
287
- timeout?: number;
288
- env?: Record<string, string>;
289
- packages?: string[];
290
- }
291
-
292
- export interface CoderSandboxExecInput {
293
- command: string;
294
- timeout?: number;
295
- stream?: boolean;
296
- }
297
-
298
- export interface CoderSandboxExecResult {
299
- stdout: string;
300
- stderr: string;
301
- exitCode: number;
302
- executionTimeMs: number;
303
- }
304
-
305
- // ============================================================================
306
- // API Response Types
307
- // ============================================================================
308
-
309
- export interface CoderSessionResponse {
310
- session: CoderSession;
311
- }
312
-
313
- export interface CoderSessionsListResponse {
314
- sessions: CoderSession[];
315
- }
316
-
317
- export interface CoderToolsResponse {
318
- tools: CoderTool[];
319
- }
320
-
321
- export interface CoderFilesResponse {
322
- files: CoderFileInfo[];
323
- path: string;
324
- }
325
-
326
- export interface CoderSandboxResponse {
327
- sandbox: CoderSandbox;
328
- }
329
-
330
- // ============================================================================
331
- // Client Config
332
- // ============================================================================
333
-
334
- export interface CoderClientConfig {
335
- /** Base URL for the task network API */
336
- baseUrl?: string;
337
- /** API key for authentication */
338
- apiKey?: string;
339
- /** Request timeout in milliseconds */
340
- timeout?: number;
341
- /** Default model for coder sessions */
342
- defaultModel?: string;
343
- /** Default max iterations */
344
- defaultMaxIterations?: number;
345
- }
@@ -1,111 +0,0 @@
1
- /**
2
- * Credential and identity type definitions
3
- */
4
-
5
- export type AuthMethod =
6
- | 'email'
7
- | 'web3_evm'
8
- | 'web3_solana'
9
- | 'web3_bitcoin'
10
- | 'web3_cosmos'
11
- | 'oauth_google'
12
- | 'oauth_github'
13
- | 'oauth_discord'
14
- | 'oauth_twitter';
15
-
16
- export type Web3Chain = 'ethereum' | 'solana' | 'bitcoin' | 'cosmos' | 'polygon' | 'arbitrum' | 'base';
17
-
18
- export type CredentialType = 'email' | 'web3_wallet' | 'oauth_social' | 'billing_stripe' | 'stripe_connect';
19
-
20
- export interface StackCredential {
21
- id: string;
22
- stack_identity_id: string;
23
- credential_type: CredentialType;
24
- credential_data: EmailCredentialData | Web3CredentialData | OAuthCredentialData | BillingCredentialData | StripeConnectCredentialData;
25
- is_primary: boolean;
26
- linked_at: number;
27
- }
28
-
29
- export interface EmailCredentialData {
30
- email_hash: string;
31
- verified: boolean;
32
- verified_at?: number;
33
- }
34
-
35
- export interface Web3CredentialData {
36
- chain: Web3Chain;
37
- address: string;
38
- address_type: 'p2wpkh' | 'p2tr' | 'ed25519' | 'secp256k1';
39
- verification_signature: string;
40
- verified_at: number;
41
- }
42
-
43
- export interface OAuthCredentialData {
44
- provider: 'google' | 'github' | 'discord' | 'twitter';
45
- provider_user_id: string;
46
- handle?: string;
47
- verified_at: number;
48
- }
49
-
50
- export interface BillingCredentialData {
51
- provider: 'stripe';
52
- customer_id: string;
53
- has_payment_method: boolean;
54
- default_payment_method_id?: string;
55
- card_last_four?: string;
56
- card_brand?: string;
57
- billing_email?: string;
58
- verified_at: number;
59
- }
60
-
61
- export interface StripeConnectCredentialData {
62
- provider: 'stripe_connect';
63
- account_id: string;
64
- details_submitted: boolean;
65
- charges_enabled: boolean;
66
- payouts_enabled: boolean;
67
- email?: string;
68
- verified_at: number;
69
- }
70
-
71
- export interface CredentialLinkProof {
72
- chain?: Web3Chain;
73
- message?: string;
74
- signature?: string;
75
- public_key?: string;
76
- provider?: string;
77
- code?: string;
78
- email?: string;
79
- }
80
-
81
- export interface GlobalIdentity {
82
- id: string;
83
- identity_commitment: string;
84
- root_public_key: string;
85
- recovery_commitments: string[];
86
- created_at: number;
87
- updated_at: number;
88
- }
89
-
90
- export interface StackIdentity {
91
- id: string;
92
- global_identity_id: string;
93
- stack_id: string;
94
- stack_public_key: string;
95
- created_at: number;
96
- last_login: number;
97
- }
98
-
99
- export interface Session {
100
- id: string;
101
- app_identity_id: string;
102
- global_identity_commitment: string;
103
- app_id: string;
104
- credentials: string[];
105
- app_pubkey: string;
106
- jwt: string;
107
- issued_at: number;
108
- expires_at: number;
109
- issuer: string;
110
- signed_by: string[];
111
- }
package/src/types/file.ts DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * File type definitions
3
- */
4
-
5
- export interface FileUploadResponse {
6
- cid: string;
7
- url: string;
8
- filePath?: string;
9
- size?: number;
10
- mimeType?: string;
11
- }
12
-
13
- export interface FilesClientConfig {
14
- baseUrl?: string;
15
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * Imagination and file type definitions
3
- */
4
-
5
- export interface MagmaFile {
6
- cid: string;
7
- name: string;
8
- size: number;
9
- type: string;
10
- url: string;
11
- }
12
-
13
- export interface WorkflowData {
14
- name: string;
15
- coverImage?: string;
16
- description: string;
17
- examples: Array<{
18
- id: string;
19
- data: string;
20
- }>;
21
- workflowJson: string;
22
- }
23
-
24
- export interface ImaginationSource {
25
- cid: string;
26
- type: 'document' | 'link' | 'voice' | 'image' | 'music' | 'text';
27
- name: string;
28
- size?: number;
29
- content?: string;
30
- }
31
-
32
- export interface ImaginationCharacter {
33
- name: string;
34
- gender: string;
35
- age: string;
36
- weight: string;
37
- personality: string;
38
- }
39
-
40
- export interface ImaginationMetadata {
41
- id: string;
42
- title: string;
43
- createdAt: string;
44
- createdBy: string;
45
- sources: ImaginationSource[];
46
- summary?: string;
47
- character?: ImaginationCharacter;
48
- workflow?: WorkflowData;
49
- is_public?: boolean;
50
- }