@intella/sdk 0.0.7 → 0.0.9

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 (163) hide show
  1. package/README.md +70 -6
  2. package/dist/agent-manager.d.ts +4 -4
  3. package/dist/agent-manager.d.ts.map +1 -1
  4. package/dist/agent-manager.js +12 -7
  5. package/dist/agent-manager.js.map +1 -1
  6. package/dist/agents/base-agent.d.ts +35 -2
  7. package/dist/agents/base-agent.d.ts.map +1 -1
  8. package/dist/agents/base-agent.js +280 -24
  9. package/dist/agents/base-agent.js.map +1 -1
  10. package/dist/agents/claude-agent.d.ts +1 -1
  11. package/dist/agents/claude-agent.d.ts.map +1 -1
  12. package/dist/agents/claude-agent.js +2 -1
  13. package/dist/agents/claude-agent.js.map +1 -1
  14. package/dist/agents/codex-agent.d.ts +1 -1
  15. package/dist/agents/codex-agent.d.ts.map +1 -1
  16. package/dist/agents/codex-agent.js +2 -1
  17. package/dist/agents/codex-agent.js.map +1 -1
  18. package/dist/agents/intella-lite-agent.d.ts +1 -1
  19. package/dist/agents/intella-lite-agent.d.ts.map +1 -1
  20. package/dist/agents/intella-lite-agent.js +2 -1
  21. package/dist/agents/intella-lite-agent.js.map +1 -1
  22. package/dist/agents/opencode-agent.d.ts +1 -1
  23. package/dist/agents/opencode-agent.d.ts.map +1 -1
  24. package/dist/agents/opencode-agent.js +2 -3
  25. package/dist/agents/opencode-agent.js.map +1 -1
  26. package/dist/index.d.ts +22 -12
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +31 -11
  29. package/dist/index.js.map +1 -1
  30. package/dist/sandbox/{agent-installers.d.ts → agents/agent-installers.d.ts} +1 -1
  31. package/dist/sandbox/agents/agent-installers.d.ts.map +1 -0
  32. package/dist/sandbox/{agent-installers.js → agents/agent-installers.js} +5 -4
  33. package/dist/sandbox/agents/agent-installers.js.map +1 -0
  34. package/dist/sandbox/{agent-setup.d.ts → agents/agent-setup.d.ts} +1 -1
  35. package/dist/sandbox/agents/agent-setup.d.ts.map +1 -0
  36. package/dist/sandbox/{agent-setup.js → agents/agent-setup.js} +3 -2
  37. package/dist/sandbox/agents/agent-setup.js.map +1 -0
  38. package/dist/sandbox/agents/agents.d.ts +49 -0
  39. package/dist/sandbox/agents/agents.d.ts.map +1 -0
  40. package/dist/sandbox/agents/agents.js +71 -0
  41. package/dist/sandbox/agents/agents.js.map +1 -0
  42. package/dist/sandbox/config.d.ts +1 -1
  43. package/dist/sandbox/config.d.ts.map +1 -1
  44. package/dist/sandbox/config.js +26 -18
  45. package/dist/sandbox/config.js.map +1 -1
  46. package/dist/sandbox/file-utils.d.ts +20 -0
  47. package/dist/sandbox/file-utils.d.ts.map +1 -0
  48. package/dist/sandbox/file-utils.js +101 -0
  49. package/dist/sandbox/file-utils.js.map +1 -0
  50. package/dist/sandbox/operations/code-operations.d.ts +68 -0
  51. package/dist/sandbox/operations/code-operations.d.ts.map +1 -0
  52. package/dist/sandbox/operations/code-operations.js +208 -0
  53. package/dist/sandbox/operations/code-operations.js.map +1 -0
  54. package/dist/sandbox/operations/git-operations.d.ts +27 -0
  55. package/dist/sandbox/operations/git-operations.d.ts.map +1 -0
  56. package/dist/sandbox/operations/git-operations.js +235 -0
  57. package/dist/sandbox/operations/git-operations.js.map +1 -0
  58. package/dist/sandbox/providers/base-provider.d.ts +283 -0
  59. package/dist/sandbox/providers/base-provider.d.ts.map +1 -0
  60. package/dist/sandbox/providers/base-provider.js +816 -0
  61. package/dist/sandbox/providers/base-provider.js.map +1 -0
  62. package/dist/sandbox/{daytona-provider.d.ts → providers/daytona-provider.d.ts} +19 -16
  63. package/dist/sandbox/providers/daytona-provider.d.ts.map +1 -0
  64. package/dist/sandbox/{daytona-provider.js → providers/daytona-provider.js} +96 -27
  65. package/dist/sandbox/providers/daytona-provider.js.map +1 -0
  66. package/dist/sandbox/{e2b-provider.d.ts → providers/e2b-provider.d.ts} +16 -10
  67. package/dist/sandbox/providers/e2b-provider.d.ts.map +1 -0
  68. package/dist/sandbox/{e2b-provider.js → providers/e2b-provider.js} +51 -29
  69. package/dist/sandbox/providers/e2b-provider.js.map +1 -0
  70. package/dist/sandbox/{local-provider.d.ts → providers/local-provider.d.ts} +12 -6
  71. package/dist/sandbox/providers/local-provider.d.ts.map +1 -0
  72. package/dist/sandbox/{local-provider.js → providers/local-provider.js} +24 -21
  73. package/dist/sandbox/providers/local-provider.js.map +1 -0
  74. package/dist/sandbox/{modal-provider.d.ts → providers/modal-provider.d.ts} +18 -12
  75. package/dist/sandbox/providers/modal-provider.d.ts.map +1 -0
  76. package/dist/sandbox/{modal-provider.js → providers/modal-provider.js} +49 -29
  77. package/dist/sandbox/providers/modal-provider.js.map +1 -0
  78. package/dist/sandbox/{vercel-provider.d.ts → providers/vercel-provider.d.ts} +19 -14
  79. package/dist/sandbox/providers/vercel-provider.d.ts.map +1 -0
  80. package/dist/sandbox/{vercel-provider.js → providers/vercel-provider.js} +41 -42
  81. package/dist/sandbox/providers/vercel-provider.js.map +1 -0
  82. package/dist/sandbox/utils/detector.d.ts +28 -0
  83. package/dist/sandbox/utils/detector.d.ts.map +1 -0
  84. package/dist/sandbox/utils/detector.js +243 -0
  85. package/dist/sandbox/utils/detector.js.map +1 -0
  86. package/dist/sandbox-manager.js +5 -5
  87. package/dist/sandbox-manager.js.map +1 -1
  88. package/dist/sdk.d.ts +4 -3
  89. package/dist/sdk.d.ts.map +1 -1
  90. package/dist/sdk.js +7 -3
  91. package/dist/sdk.js.map +1 -1
  92. package/dist/session/execution-store.d.ts +71 -0
  93. package/dist/session/execution-store.d.ts.map +1 -0
  94. package/dist/session/execution-store.js +156 -0
  95. package/dist/session/execution-store.js.map +1 -0
  96. package/dist/session/index.d.ts +14 -0
  97. package/dist/session/index.d.ts.map +1 -0
  98. package/dist/session/index.js +20 -0
  99. package/dist/session/index.js.map +1 -0
  100. package/dist/session/manager.d.ts +164 -0
  101. package/dist/session/manager.d.ts.map +1 -0
  102. package/dist/session/manager.js +493 -0
  103. package/dist/session/manager.js.map +1 -0
  104. package/dist/session/store.d.ts +20 -0
  105. package/dist/session/store.d.ts.map +1 -0
  106. package/dist/session/store.js +69 -0
  107. package/dist/session/store.js.map +1 -0
  108. package/dist/session/types.d.ts +57 -0
  109. package/dist/session/types.d.ts.map +1 -0
  110. package/dist/session/types.js +2 -0
  111. package/dist/session/types.js.map +1 -0
  112. package/dist/types.d.ts +622 -19
  113. package/dist/types.d.ts.map +1 -1
  114. package/dist/types.js +35 -0
  115. package/dist/types.js.map +1 -1
  116. package/dist/utils/cli-daemon.d.ts.map +1 -1
  117. package/dist/utils/cli-daemon.js +1 -3
  118. package/dist/utils/cli-daemon.js.map +1 -1
  119. package/dist/utils/machine-id.d.ts +8 -0
  120. package/dist/utils/machine-id.d.ts.map +1 -0
  121. package/dist/utils/machine-id.js +19 -0
  122. package/dist/utils/machine-id.js.map +1 -0
  123. package/dist/utils/redis/client.d.ts +18 -0
  124. package/dist/utils/redis/client.d.ts.map +1 -0
  125. package/dist/utils/redis/client.js +52 -0
  126. package/dist/utils/redis/client.js.map +1 -0
  127. package/dist/utils/redis/index.d.ts +2 -0
  128. package/dist/utils/redis/index.d.ts.map +1 -0
  129. package/dist/utils/redis/index.js +2 -0
  130. package/dist/utils/redis/index.js.map +1 -0
  131. package/dist/utils/{redis-stream.d.ts → redis/stream.d.ts} +41 -74
  132. package/dist/utils/redis/stream.d.ts.map +1 -0
  133. package/dist/utils/{redis-stream.js → redis/stream.js} +133 -69
  134. package/dist/utils/redis/stream.js.map +1 -0
  135. package/dist/utils/repo-context.d.ts +16 -0
  136. package/dist/utils/repo-context.d.ts.map +1 -0
  137. package/dist/utils/repo-context.js +65 -0
  138. package/dist/utils/repo-context.js.map +1 -0
  139. package/dist/utils/tool-response.d.ts +20 -0
  140. package/dist/utils/tool-response.d.ts.map +1 -0
  141. package/dist/utils/tool-response.js +68 -0
  142. package/dist/utils/tool-response.js.map +1 -0
  143. package/package.json +23 -8
  144. package/dist/sandbox/agent-installers.d.ts.map +0 -1
  145. package/dist/sandbox/agent-installers.js.map +0 -1
  146. package/dist/sandbox/agent-setup.d.ts.map +0 -1
  147. package/dist/sandbox/agent-setup.js.map +0 -1
  148. package/dist/sandbox/base-provider.d.ts +0 -106
  149. package/dist/sandbox/base-provider.d.ts.map +0 -1
  150. package/dist/sandbox/base-provider.js +0 -74
  151. package/dist/sandbox/base-provider.js.map +0 -1
  152. package/dist/sandbox/daytona-provider.d.ts.map +0 -1
  153. package/dist/sandbox/daytona-provider.js.map +0 -1
  154. package/dist/sandbox/e2b-provider.d.ts.map +0 -1
  155. package/dist/sandbox/e2b-provider.js.map +0 -1
  156. package/dist/sandbox/local-provider.d.ts.map +0 -1
  157. package/dist/sandbox/local-provider.js.map +0 -1
  158. package/dist/sandbox/modal-provider.d.ts.map +0 -1
  159. package/dist/sandbox/modal-provider.js.map +0 -1
  160. package/dist/sandbox/vercel-provider.d.ts.map +0 -1
  161. package/dist/sandbox/vercel-provider.js.map +0 -1
  162. package/dist/utils/redis-stream.d.ts.map +0 -1
  163. package/dist/utils/redis-stream.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,8 +1,17 @@
1
- import type { LanguageModel, TextStreamPart } from 'ai';
1
+ import type { LanguageModel, TextStreamPart, ModelMessage as BaseModelMessage, FilePart as BaseFilePart, ImagePart as BaseImagePart } from 'ai';
2
2
  /**
3
3
  * Supported agent types
4
4
  */
5
- export type AgentType = 'intella-lite' | 'claude' | 'codex' | 'opencode';
5
+ export declare enum AgentType {
6
+ INTELLA_LITE = "intella-lite",
7
+ CLAUDE = "claude",
8
+ CODEX = "codex",
9
+ OPENCODE = "opencode"
10
+ }
11
+ /**
12
+ * Parse a string to AgentType. Returns CLAUDE for invalid/undefined input.
13
+ */
14
+ export declare function parseAgentType(value: string | AgentType | undefined | null): AgentType;
6
15
  /**
7
16
  * Agent configuration interface
8
17
  */
@@ -39,16 +48,35 @@ export interface TextPart {
39
48
  /**
40
49
  * File part for message content (attachments)
41
50
  */
42
- export interface FilePart {
51
+ export interface FilePart extends BaseFilePart {
43
52
  type: 'file';
44
- data: string | Uint8Array | ArrayBuffer | Buffer | URL;
45
- filename?: string;
46
- mediaType: string;
53
+ size?: number;
54
+ }
55
+ export interface ImagePart extends BaseImagePart {
56
+ type: 'image';
57
+ size?: number;
58
+ }
59
+ export interface DataAnnotationPart {
60
+ type: 'data-annotation';
61
+ annotation: {
62
+ type: string;
63
+ provider?: string;
64
+ data: any;
65
+ };
47
66
  }
48
67
  /**
49
- * Message content can be a string or array of parts (text and/or files)
68
+ * Message content can be a string or array of parts (text, files, and/or data annotations)
69
+ */
70
+ export type MessageContent = string | BaseModelMessage['content'] | Array<TextPart | FilePart | ImagePart | DataAnnotationPart | BaseModelMessage['content']>;
71
+ export type ModelMessage = BaseModelMessage | {
72
+ role: 'user' | 'assistant' | 'system' | 'tool';
73
+ content: MessageContent;
74
+ providerOptions?: Record<string, any>;
75
+ };
76
+ /**
77
+ * Data annotation part for message content (forward declaration for MessageContent)
78
+ * Full interface is defined in the Data Annotation Types section below
50
79
  */
51
- export type MessageContent = string | Array<TextPart | FilePart>;
52
80
  /**
53
81
  * Task execution request
54
82
  */
@@ -57,17 +85,18 @@ export interface TaskRequest {
57
85
  prompt: string;
58
86
  /** System prompt (optional) */
59
87
  systemPrompt?: string;
60
- /** Additional messages for context */
61
- messages?: Array<{
62
- role: 'user' | 'assistant' | 'system';
63
- content: MessageContent;
64
- }>;
88
+ /** Additional messages for context (user (attachments), assistant, system, tool) */
89
+ messages?: Array<ModelMessage>;
65
90
  agentType?: AgentType;
66
91
  model?: string;
92
+ agentConfig?: Partial<AgentConfig>;
67
93
  /** Generation parameters */
68
94
  temperature?: number;
69
95
  maxTokens?: number;
70
96
  mode?: 'default' | 'plan';
97
+ skills?: string[];
98
+ /** Session ID (used by SDK to format paths for attachments, tool_responses, etc.) */
99
+ sessionId?: string;
71
100
  /** Additional options */
72
101
  [key: string]: unknown;
73
102
  }
@@ -154,6 +183,8 @@ export interface OrchestrationResponse {
154
183
  * Base agent interface
155
184
  */
156
185
  export interface IAgent {
186
+ /** Build messages */
187
+ buildMessages(request: TaskRequest): Promise<ModelMessage[]>;
157
188
  /** Agent type */
158
189
  readonly type: AgentType;
159
190
  /** Execute a task and return the response */
@@ -329,6 +360,18 @@ export interface SandboxConfig {
329
360
  installDependencies?: boolean;
330
361
  /** API keys for agent authentication */
331
362
  apiKeys?: Record<string, string>;
363
+ /** Commands to run on sandbox initialization */
364
+ runCmd?: RunCmdEntry[];
365
+ /** NPM packages to install on sandbox initialization */
366
+ npmInstall?: NpmInstallEntry[];
367
+ /** Bun packages to install on sandbox initialization (ensures bun is installed first) */
368
+ bunInstall?: BunInstallEntry[];
369
+ /** APT packages to install on sandbox initialization */
370
+ aptInstall?: AptInstallEntry[];
371
+ /** Pip packages to install on sandbox initialization */
372
+ pipInstall?: PipInstallEntry[];
373
+ /** Git repositories to clone on sandbox initialization */
374
+ gitClone?: GitCloneEntry[];
332
375
  /** Additional provider-specific options */
333
376
  [key: string]: unknown;
334
377
  }
@@ -419,10 +462,255 @@ export interface SandboxInfo {
419
462
  /** Sandbox raw info from the provider*/
420
463
  info?: any;
421
464
  }
465
+ /**
466
+ * Content types supported for sandbox writeFile
467
+ */
468
+ export type WriteFileContent = string | ArrayBuffer | Blob | ReadableStream<Uint8Array> | Uint8Array | Buffer;
469
+ /**
470
+ * Return format for sandbox readFile
471
+ */
472
+ export type ReadFileFormat = 'text' | 'bytes' | 'blob' | 'stream';
473
+ /**
474
+ * Options for sandbox readFile
475
+ */
476
+ export interface ReadFileOptions {
477
+ /** Return format: text (default), bytes, blob, or stream */
478
+ format?: ReadFileFormat;
479
+ }
480
+ /**
481
+ * Entry for batch writeFile
482
+ */
483
+ export interface WriteFileEntry {
484
+ path: string;
485
+ content: WriteFileContent;
486
+ }
487
+ /**
488
+ * Entry for batch uploadFile (source = local path or http(s)/file URL)
489
+ */
490
+ export interface UploadFileEntry {
491
+ source: string;
492
+ remotePath: string;
493
+ }
494
+ /**
495
+ * Git file status (minimal; staging/worktree optional for CLI-based impl)
496
+ */
497
+ export interface GitFileStatus {
498
+ name: string;
499
+ staging?: string;
500
+ worktree?: string;
501
+ extra?: string;
502
+ }
503
+ /**
504
+ * Git repository status
505
+ */
506
+ export interface GitStatus {
507
+ currentBranch: string;
508
+ ahead?: number;
509
+ behind?: number;
510
+ branchPublished?: boolean;
511
+ fileStatus: GitFileStatus[];
512
+ }
513
+ /**
514
+ * Git branches list response
515
+ */
516
+ export interface GitBranchesResponse {
517
+ branches: string[];
518
+ }
519
+ /**
520
+ * Git commit result
521
+ */
522
+ export interface GitCommitResult {
523
+ sha: string;
524
+ }
525
+ /**
526
+ * Options for git clone
527
+ */
528
+ export interface GitCloneOptions {
529
+ branch?: string;
530
+ commitId?: string;
531
+ username?: string;
532
+ password?: string;
533
+ pullOnExists?: boolean;
534
+ role?: string;
535
+ [key: string]: any;
536
+ }
537
+ /**
538
+ * When to run a config setup step
539
+ * - 'creation': Run only when creating a new sandbox
540
+ * - 'resume': Run only when reconnecting to an existing sandbox
541
+ * - 'default': Run on both creation and resume (default behavior)
542
+ */
543
+ export type RunWhen = 'creation' | 'resume' | 'default';
544
+ /**
545
+ * Common execution options for all setup config entries
546
+ */
547
+ export interface SetupExecutionOptions {
548
+ /** When to run this step */
549
+ run?: RunWhen;
550
+ /** Run in background without waiting for completion (fire-and-forget) */
551
+ background?: boolean;
552
+ /** Timeout in milliseconds (only applies when not running in background) */
553
+ timeout?: number;
554
+ /** Working directory to execute the command in */
555
+ path?: string;
556
+ /** Run detached using nohup, output piped to {command_name}.log file */
557
+ detach?: boolean;
558
+ }
559
+ /**
560
+ * Options for runCmd config entry
561
+ */
562
+ export interface RunCmdOptions extends SetupExecutionOptions {
563
+ /** Run command as root using sudo */
564
+ user?: 'root';
565
+ }
566
+ /**
567
+ * Config entry for running commands on sandbox init
568
+ */
569
+ export interface RunCmdEntry {
570
+ /** Command to run (string or array of args) */
571
+ command: string | string[];
572
+ /** Command options */
573
+ options?: RunCmdOptions;
574
+ }
575
+ /**
576
+ * Options for npm install config entry
577
+ */
578
+ export interface NpmInstallOptions extends SetupExecutionOptions {
579
+ /** Install globally (-g flag) */
580
+ g?: boolean;
581
+ /** Install as dev dependency (--save-dev flag) */
582
+ dev?: boolean;
583
+ }
584
+ /**
585
+ * Config entry for npm package installation
586
+ */
587
+ export interface NpmInstallEntry {
588
+ /** Package(s) to install */
589
+ packages: string | string[];
590
+ /** Install options */
591
+ options?: NpmInstallOptions;
592
+ }
593
+ /**
594
+ * Options for bun install config entry
595
+ */
596
+ export interface BunInstallOptions extends SetupExecutionOptions {
597
+ /** Install globally (-g flag) */
598
+ g?: boolean;
599
+ /** Install as dev dependency (--dev flag) */
600
+ dev?: boolean;
601
+ }
602
+ /**
603
+ * Config entry for bun package installation
604
+ */
605
+ export interface BunInstallEntry {
606
+ /** Package(s) to install */
607
+ packages: string | string[];
608
+ /** Install options */
609
+ options?: BunInstallOptions;
610
+ }
611
+ /**
612
+ * Options for apt install config entry
613
+ */
614
+ export interface AptInstallOptions extends SetupExecutionOptions {
615
+ /** Skip recommended packages (--no-install-recommends flag) */
616
+ noInstallRecommends?: boolean;
617
+ }
618
+ /**
619
+ * Config entry for apt package installation
620
+ */
621
+ export interface AptInstallEntry {
622
+ /** Package(s) to install */
623
+ packages: string | string[];
624
+ /** Install options */
625
+ options?: AptInstallOptions;
626
+ }
627
+ /**
628
+ * Options for pip install config entry
629
+ */
630
+ export interface PipInstallOptions extends SetupExecutionOptions {
631
+ /** Install globally (system-wide, no --user flag) */
632
+ g?: boolean;
633
+ /** Use virtual environment (.venv). Creates one if not exists and updates .gitignore */
634
+ venv?: boolean;
635
+ }
636
+ /**
637
+ * Config entry for pip package installation
638
+ */
639
+ export interface PipInstallEntry {
640
+ /** Package(s) to install. If empty array/string, uses -r requirements.txt */
641
+ packages: string | string[];
642
+ /** Install options */
643
+ options?: PipInstallOptions;
644
+ }
645
+ /**
646
+ * Options for git clone config entry (extends GitCloneOptions with execution options)
647
+ */
648
+ export interface GitCloneConfigOptions extends GitCloneOptions, SetupExecutionOptions {
649
+ /** Auto-detect and install dependencies after clone (detects package.json, requirements.txt, lockfiles) */
650
+ autoInstall?: boolean;
651
+ /** Use venv for Python projects during autoInstall */
652
+ useVenv?: boolean;
653
+ }
654
+ /**
655
+ * Post-clone success actions
656
+ */
657
+ export interface GitCloneOnSuccess {
658
+ /** Commands to run after successful clone */
659
+ runCmd?: RunCmdEntry[];
660
+ /** NPM packages to install after clone */
661
+ npmInstall?: NpmInstallEntry[];
662
+ /** Bun packages to install after clone */
663
+ bunInstall?: BunInstallEntry[];
664
+ /** Pip packages to install after clone */
665
+ pipInstall?: PipInstallEntry[];
666
+ }
667
+ /**
668
+ * Config entry for git clone
669
+ * Note: Use options.path from SetupExecutionOptions for target directory
670
+ */
671
+ export interface GitCloneEntry {
672
+ /** Repository URL */
673
+ url: string;
674
+ /** Clone options (use options.path for target directory) */
675
+ options?: GitCloneConfigOptions;
676
+ /** Actions to execute after successful clone */
677
+ onSuccess?: GitCloneOnSuccess;
678
+ }
679
+ /**
680
+ * Git operations interface (unified across sandbox providers)
681
+ */
682
+ export interface IGitOperations {
683
+ clone(url: string, path: string, options?: GitCloneOptions): Promise<void>;
684
+ status(path: string): Promise<GitStatus>;
685
+ branches(path: string): Promise<GitBranchesResponse>;
686
+ createBranch(path: string, name: string): Promise<void>;
687
+ checkoutBranch(path: string, branch: string): Promise<void>;
688
+ deleteBranch(path: string, name: string): Promise<void>;
689
+ add(path: string, files: string[]): Promise<void>;
690
+ commit(path: string, message: string, author: string, email: string, allowEmpty?: boolean): Promise<GitCommitResult>;
691
+ push(path: string, username?: string, password?: string): Promise<void>;
692
+ pull(path: string, username?: string, password?: string): Promise<void>;
693
+ }
694
+ /**
695
+ * Chunk yielded by sandbox.executeAgent (matches SessionStreamChunk from redis-stream)
696
+ */
697
+ export interface SandboxAgentStreamChunk {
698
+ chunkId?: string;
699
+ chunk?: string;
700
+ segmentId?: string | null;
701
+ parentSegmentId?: string | null;
702
+ isDone?: boolean;
703
+ type?: string;
704
+ senderType?: string;
705
+ timestamp?: number;
706
+ data?: unknown;
707
+ }
422
708
  /**
423
709
  * Sandbox provider interface
424
710
  */
425
711
  export interface ISandboxProvider {
712
+ /** Git operations (unified API; Daytona uses native, others use executeCommand + raw git) */
713
+ readonly git: IGitOperations;
426
714
  /** Provider type */
427
715
  readonly type: SandboxProviderType;
428
716
  /** Get the client */
@@ -442,6 +730,8 @@ export interface ISandboxProvider {
442
730
  cwd?: string;
443
731
  env?: Record<string, string>;
444
732
  timeout?: number;
733
+ /** Run detached using nohup, output piped to {command_name}.log file */
734
+ detach?: boolean;
445
735
  }): Promise<CommandResult>;
446
736
  /** Run code (e.g., Python, JavaScript) in the sandbox */
447
737
  runCode(code: string, options?: {
@@ -451,20 +741,28 @@ export interface ISandboxProvider {
451
741
  onStdout?: (data: string) => void;
452
742
  onStderr?: (data: string) => void;
453
743
  }): Promise<CodeExecutionResult>;
454
- /** Upload a file to the sandbox */
455
- uploadFile(localPath: string, remotePath: string): Promise<void>;
744
+ /** Upload file(s) to the sandbox (source = local path or http(s)/file URL) */
745
+ uploadFile(source: string, remotePath: string): Promise<void>;
746
+ uploadFile(entries: UploadFileEntry[]): Promise<void>;
456
747
  /** Download a file from the sandbox */
457
748
  downloadFile(remotePath: string, localPath: string): Promise<void>;
458
- /** Read a file from the sandbox */
459
- readFile(path: string): Promise<string>;
460
- /** Write a file to the sandbox */
461
- writeFile(path: string, content: string): Promise<void>;
749
+ /** Read a file from the sandbox (default format: text) */
750
+ readFile(path: string, options?: ReadFileOptions): Promise<string | Uint8Array | Blob | ReadableStream<Uint8Array>>;
751
+ /** Write file(s) to the sandbox */
752
+ writeFile(path: string, content: WriteFileContent): Promise<void>;
753
+ writeFile(entries: WriteFileEntry[]): Promise<void>;
754
+ /** Create a directory (recursive by default) */
755
+ createDirectory(path: string, options?: {
756
+ recursive?: boolean;
757
+ }): Promise<void>;
462
758
  /** List files in a directory */
463
759
  listFiles(path: string): Promise<string[]>;
464
760
  /** Check if a file exists */
465
761
  fileExists(path: string): Promise<boolean>;
466
762
  /** Delete a file */
467
763
  deleteFile(path: string): Promise<void>;
764
+ /** Get host URL for a port (e.g., localhost:3000 for local, or public URL for cloud providers) */
765
+ getHost(port: number, timeout?: number): Promise<string>;
468
766
  /** Get sandbox status */
469
767
  getStatus(): Promise<{
470
768
  isRunning: boolean;
@@ -473,5 +771,310 @@ export interface ISandboxProvider {
473
771
  }>;
474
772
  /** Get detailed sandbox information */
475
773
  getInfo(sandboxId?: string): Promise<SandboxInfo>;
774
+ /** Run a command (or batch of commands) */
775
+ runCmd(entryOrEntries: RunCmdEntry | RunCmdEntry[]): Promise<CommandResult | CommandResult[]>;
776
+ /** Install npm package(s) */
777
+ npmInstall(entryOrEntries: NpmInstallEntry | NpmInstallEntry[]): Promise<CommandResult | CommandResult[]>;
778
+ /** Install bun package(s) - ensures bun is installed first */
779
+ bunInstall(entryOrEntries: BunInstallEntry | BunInstallEntry[]): Promise<CommandResult | CommandResult[]>;
780
+ /** Install apt package(s) */
781
+ aptInstall(entryOrEntries: AptInstallEntry | AptInstallEntry[]): Promise<CommandResult | CommandResult[]>;
782
+ /** Install pip package(s) */
783
+ pipInstall(entryOrEntries: PipInstallEntry | PipInstallEntry[]): Promise<CommandResult | CommandResult[]>;
784
+ /** Clone git repository(ies) */
785
+ gitCloneRepo(entryOrEntries: GitCloneEntry | GitCloneEntry[]): Promise<void>;
786
+ /** Check if CLI daemon is running in the sandbox */
787
+ checkDaemonStatus(): Promise<boolean>;
788
+ /** Ensure CLI daemon is running (starts if not running) */
789
+ ensureDaemonRunning(options?: {
790
+ startTimeout?: number;
791
+ setSandboxId?: boolean;
792
+ }): Promise<void>;
793
+ /** Publish a command to the sandbox's stream (uses this sandbox instance's ID) */
794
+ publishCommand(command: SandboxCommand, redisUrl?: string): Promise<string>;
795
+ /** Stream events from Session or Sandbox Redis stream (Sandbox uses this instance's ID) */
796
+ streamEvents(eventType: StreamEventType, options?: StreamEventsOptions): AsyncIterable<SandboxAgentStreamChunk | SandboxCommandResult>;
797
+ /** Create a session in the sandbox by running intella CLI */
798
+ createSession(options: {
799
+ sessionId?: string;
800
+ agentType: AgentType;
801
+ model?: string;
802
+ metadata?: Record<string, unknown>;
803
+ setup?: SessionInitSetup;
804
+ }): Promise<SessionMetadataCallable>;
805
+ /** Run setup steps for a session (git clone, npm install, etc.) */
806
+ runSessionSetup(sessionId: string, setup: SessionInitSetup): Promise<void>;
807
+ /** End a session in the sandbox */
808
+ endSession(sessionId: string): Promise<SessionMetadata | null>;
809
+ /** Get a session from the sandbox */
810
+ getSession(sessionId: string): Promise<SessionMetadata | null>;
811
+ /** Publish agent:execute command and stream response from session (requires taskRequest.sessionId) */
812
+ executeAgent(taskRequest: TaskRequest, agentType?: AgentType, options?: {
813
+ redisUrl?: string;
814
+ apiKeys?: Record<string, string>;
815
+ }): AsyncIterable<SandboxAgentStreamChunk>;
816
+ }
817
+ /**
818
+ * Session metadata
819
+ */
820
+ export interface SessionMetadata {
821
+ /** Unique session identifier */
822
+ id: string;
823
+ /** Sandbox ID if session is running in a sandbox */
824
+ sandboxId?: string;
825
+ /** Sandbox provider type */
826
+ sandboxProvider?: SandboxProviderType | 'local';
827
+ /** Agent type for this session */
828
+ agentType?: AgentType;
829
+ /** Model used for this session */
830
+ model?: string;
831
+ /** Session status */
832
+ status: 'active' | 'ended' | 'pending';
833
+ /** Session start timestamp */
834
+ startedAt: number;
835
+ /** Session end timestamp */
836
+ endedAt?: number;
837
+ /** Additional metadata */
838
+ metadata?: Record<string, unknown>;
839
+ }
840
+ export interface SessionMetadataCallable extends SessionMetadata {
841
+ close: () => Promise<void>;
842
+ }
843
+ /**
844
+ * Session creation mode
845
+ */
846
+ export type SessionMode = 'local' | 'sandbox';
847
+ /**
848
+ * Session init setup - steps to run after session creation
849
+ */
850
+ export interface SessionInitSetup {
851
+ /** Commands to run after session creation */
852
+ runCmd?: RunCmdEntry[];
853
+ /** Git repositories to clone */
854
+ gitClone?: GitCloneEntry[];
855
+ /** NPM packages to install */
856
+ npmInstall?: NpmInstallEntry[];
857
+ /** Pip packages to install */
858
+ pipInstall?: PipInstallEntry[];
859
+ }
860
+ /**
861
+ * Session init payload (for type: 'session:init')
862
+ */
863
+ export interface SessionInit {
864
+ sessionId?: string;
865
+ agentType: AgentType | string;
866
+ model?: string;
867
+ skills?: string[];
868
+ agentConfig?: Partial<AgentConfig>;
869
+ setup?: SessionInitSetup;
870
+ }
871
+ /**
872
+ * Command type discriminator
873
+ */
874
+ export type SandboxCommandType = 'session:init' | 'session:end' | 'agent:execute' | 'ping' | 'command:execute';
875
+ /**
876
+ * Command to publish to sandbox stream.
877
+ * Use cmdId to avoid conflict with Redis message id.
878
+ * type + data differentiate the kind of command.
879
+ */
880
+ export interface SandboxCommand {
881
+ cmdId?: string;
882
+ type: SandboxCommandType;
883
+ sessionId?: string;
884
+ data: Record<string, string> | TaskRequest | SessionInit | {
885
+ cmd: RunCmdEntry;
886
+ };
887
+ metadata: Record<string, string>;
888
+ apiKeys: Record<string, string>;
889
+ env?: Record<string, string>;
890
+ timestamp?: number;
891
+ }
892
+ /**
893
+ * Result from sandbox stream (response to a SandboxCommand).
894
+ * commandId correlates to the command's cmdId.
895
+ */
896
+ export interface SandboxCommandResult {
897
+ commandId: string;
898
+ type: 'success' | 'error' | 'chunk' | 'done';
899
+ sessionId?: string;
900
+ data?: unknown;
901
+ error?: string;
902
+ timestamp: number;
903
+ }
904
+ /**
905
+ * Event type for streamEvents - Session streams session chunks, Sandbox streams command results
906
+ */
907
+ export declare enum StreamEventType {
908
+ SESSION = "session",
909
+ SANDBOX = "sandbox"
910
+ }
911
+ /**
912
+ * Options for streaming events from Session or Sandbox Redis streams
913
+ */
914
+ export interface StreamEventsOptions {
915
+ /** Redis URL (defaults to REDIS_URL env var) */
916
+ redisUrl?: string;
917
+ /** Maximum time to wait in milliseconds (default: 10 minutes) */
918
+ timeout?: number;
919
+ /** Consumer group name (auto-generated if not provided) */
920
+ groupName?: string;
921
+ /** Consumer name (auto-generated if not provided) */
922
+ consumerName?: string;
923
+ /** Filter by commandId (for sandbox streams) */
924
+ commandId?: string;
925
+ /** Session ID (for session streams) */
926
+ sessionId?: string;
927
+ /** Filter function to determine if message should be processed */
928
+ filter?: (message: Record<string, string>) => boolean;
929
+ /** Transform function to convert message to result type */
930
+ transform?: (message: Record<string, string>) => any;
931
+ /** Whether to stop on 'done' or 'error' type messages (default: true for Sandbox, false for Session) */
932
+ stopOnDone?: boolean;
933
+ /** Block time in milliseconds for XREADGROUP (default: 1000) */
934
+ blockTime?: number;
935
+ /** Count of messages to read per batch (default: 100) */
936
+ count?: number;
937
+ }
938
+ /**
939
+ * Chunk data to publish
940
+ */
941
+ export interface ChunkData {
942
+ id?: string;
943
+ chunkId?: string;
944
+ chunk?: string;
945
+ segmentId?: string;
946
+ parentSegmentId?: string;
947
+ isDone?: boolean;
948
+ type?: string;
949
+ senderType?: string;
950
+ timestamp?: number;
951
+ data?: Record<string, any>;
952
+ /** Command ID for correlation when publishing to sandbox results stream */
953
+ commandId?: string;
954
+ }
955
+ /**
956
+ * Options for creating a session
957
+ */
958
+ export interface CreateSessionOptions {
959
+ /** Session creation mode: 'local' or 'sandbox' */
960
+ mode: SessionMode;
961
+ /** Sandbox ID (required when mode is 'sandbox') */
962
+ sandboxId?: string;
963
+ /** Custom session ID (optional, auto-generated if not provided) */
964
+ sessionId?: string;
965
+ /** Agent type for this session */
966
+ agentType: AgentType;
967
+ /** Model to use */
968
+ model?: string;
969
+ /** API keys for the session */
970
+ apiKeys?: Record<string, string>;
971
+ /** Additional metadata */
972
+ metadata?: Record<string, unknown>;
973
+ /** Setup steps to run after session creation */
974
+ setup?: SessionInitSetup;
975
+ }
976
+ /**
977
+ * Result of session creation
978
+ */
979
+ export interface CreateSessionResult {
980
+ /** The created session */
981
+ session: SessionMetadata;
982
+ /** Command ID (only for sandbox mode) */
983
+ commandId?: string;
984
+ }
985
+ /**
986
+ * Record of a single execution (task request and response)
987
+ */
988
+ export interface ExecutionRecord {
989
+ /** Unique execution identifier */
990
+ id: string;
991
+ /** Session ID this execution belongs to */
992
+ sessionId: string;
993
+ /** The task request that was executed */
994
+ taskRequest: {
995
+ prompt?: string;
996
+ systemPrompt?: string;
997
+ agentType?: AgentType;
998
+ model?: string;
999
+ };
1000
+ /** The full response text */
1001
+ response: string;
1002
+ /** Response chunks (optional) */
1003
+ chunks?: Array<{
1004
+ text: string;
1005
+ timestamp: number;
1006
+ }>;
1007
+ /** Execution start timestamp */
1008
+ startedAt: number;
1009
+ /** Execution completion timestamp */
1010
+ completedAt: number;
1011
+ /** Command ID if executed via Redis */
1012
+ commandId?: string;
1013
+ /** Segment ID for correlation with app */
1014
+ segmentId?: string;
1015
+ }
1016
+ /**
1017
+ * Git hosting provider types
1018
+ */
1019
+ export type GitProvider = 'github' | 'gitlab' | 'bitbucket' | 'custom';
1020
+ /**
1021
+ * Result for a single repo setup operation
1022
+ * Used for session-level repo annotations
1023
+ */
1024
+ export interface RepoPath {
1025
+ /** Repository name (extracted from URL) */
1026
+ repoName: string;
1027
+ /** Absolute path in sandbox where repo is cloned */
1028
+ path: string;
1029
+ /** Branch name */
1030
+ branch: string;
1031
+ /** Role of the repo (source, target, or all) */
1032
+ role?: 'source' | 'target' | 'all';
1033
+ /** Git provider (github, gitlab, etc.) */
1034
+ provider?: GitProvider;
1035
+ /** Whether clone/pull succeeded */
1036
+ success: boolean;
1037
+ /** Error message if failed */
1038
+ error?: string;
1039
+ /** Branch strategy for TARGET repos: new = create branch this session; follow-on = reuse branch */
1040
+ branchStrategy?: 'new' | 'follow-on';
1041
+ /** When branch was created (timestamp) */
1042
+ branchCreatedAt?: number;
1043
+ }
1044
+ /**
1045
+ * Result of repo setup operation
1046
+ */
1047
+ export interface RepoSetupResult {
1048
+ /** Array of repo paths with status */
1049
+ repoPaths: RepoPath[];
1050
+ /** Number of successfully cloned/pulled repos */
1051
+ successCount: number;
1052
+ /** Number of failed repos */
1053
+ failureCount: number;
1054
+ }
1055
+ /**
1056
+ * Data for tool_response annotation (from agent tool calls).
1057
+ * When output is too large, only id (and optional summary) is included
1058
+ * so the agent can retrieve the full response by id.
1059
+ */
1060
+ export interface ToolResponseData {
1061
+ /** Unique id to retrieve full response when output is omitted (e.g. segment id) */
1062
+ id?: string;
1063
+ /** Tool call id from the stream */
1064
+ toolCallId?: string;
1065
+ /** Tool name */
1066
+ toolName?: string;
1067
+ /** Tool call input (arguments passed to the tool) */
1068
+ input?: string | Record<string, unknown>;
1069
+ /** Full tool response output (omitted when too large) */
1070
+ output?: string;
1071
+ /** Whether the tool call succeeded or failed */
1072
+ status?: 'completed' | 'failed';
1073
+ /** Error message when status is 'failed' */
1074
+ error?: string;
1075
+ /** Short summary when output is truncated (optional) */
1076
+ summary?: string;
1077
+ /** Character length when output was truncated */
1078
+ truncatedAt?: number;
476
1079
  }
477
1080
  //# sourceMappingURL=types.d.ts.map