@gitterm/sdk 0.6.1 → 0.8.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.
@@ -31,51 +31,88 @@ export type DirectOAuthModelCredential = {
31
31
  enterpriseUrl?: string;
32
32
  };
33
33
  export type DirectModelCredential = DirectApiModelCredential | DirectOAuthModelCredential;
34
- export type DirectAuthPrompt = {
35
- type: "text";
34
+ type DirectAuthPromptBase = {
36
35
  key: string;
37
- message: string;
38
- placeholder?: string;
39
- when?: {
36
+ title?: string;
37
+ description?: string;
38
+ required?: boolean;
39
+ hidden?: boolean;
40
+ /** Show the field only when every condition holds for an earlier answer. */
41
+ when?: Array<{
40
42
  key: string;
41
43
  op: "eq" | "neq";
42
- value: string;
43
- };
44
- } | {
45
- type: "select";
46
- key: string;
47
- message: string;
48
- options: Array<{
49
- label: string;
50
- value: string;
51
- hint?: string;
44
+ value: string | number | boolean;
52
45
  }>;
53
- when?: {
54
- key: string;
55
- op: "eq" | "neq";
56
- value: string;
57
- };
58
46
  };
47
+ type DirectAuthPromptOption = {
48
+ value: string;
49
+ label: string;
50
+ description?: string;
51
+ };
52
+ type DirectAuthPromptNumber = number | "Infinity" | "-Infinity" | "NaN";
53
+ /** A field an OAuth or key method asks for (OpenCode 2 `FormField`); answer it with `connectOAuth({ inputs })`. */
54
+ export type DirectAuthPrompt = (DirectAuthPromptBase & {
55
+ type: "string";
56
+ format?: "email" | "uri" | "date" | "date-time";
57
+ minLength?: number;
58
+ maxLength?: number;
59
+ pattern?: string;
60
+ placeholder?: string;
61
+ default?: string;
62
+ options?: DirectAuthPromptOption[];
63
+ custom?: boolean;
64
+ }) | (DirectAuthPromptBase & {
65
+ type: "number" | "integer";
66
+ minimum?: DirectAuthPromptNumber;
67
+ maximum?: DirectAuthPromptNumber;
68
+ default?: DirectAuthPromptNumber;
69
+ }) | (DirectAuthPromptBase & {
70
+ type: "boolean";
71
+ default?: boolean;
72
+ }) | (DirectAuthPromptBase & {
73
+ type: "multiselect";
74
+ options: DirectAuthPromptOption[];
75
+ minItems?: number;
76
+ maxItems?: number;
77
+ custom?: boolean;
78
+ default?: string[];
79
+ }) | {
80
+ key: string;
81
+ type: "external";
82
+ url: string;
83
+ title?: string;
84
+ description?: string;
85
+ };
86
+ /** OpenCode 2 `IntegrationMethod`. */
59
87
  export type DirectAuthMethod = {
60
88
  type: "oauth";
61
89
  id: string;
62
90
  label: string;
63
- prompts?: DirectAuthPrompt[];
91
+ form?: DirectAuthPrompt[];
92
+ } | {
93
+ type: "command";
94
+ id: string;
95
+ label: string;
96
+ command: string[];
64
97
  } | {
65
98
  type: "key";
66
99
  label?: string;
100
+ form?: DirectAuthPrompt[];
67
101
  } | {
68
102
  type: "env";
69
103
  names: string[];
70
104
  };
105
+ /** OpenCode 2 `IntegrationInfo`. */
71
106
  export type DirectAuthIntegration = {
72
107
  id: string;
73
108
  name: string;
109
+ metadata?: Record<string, unknown>;
74
110
  methods: DirectAuthMethod[];
75
111
  connections: Array<{
76
112
  type: "credential";
77
113
  id: string;
78
114
  label: string;
115
+ method: "key" | "oauth";
79
116
  } | {
80
117
  type: "env";
81
118
  name: string;
@@ -321,3 +358,4 @@ export type DirectRun = AgentRun & {
321
358
  };
322
359
  export type DirectRunMessage = AgentRunMessage;
323
360
  export type DirectRunWaitOptions = RunWaitOptions;
361
+ export {};
package/dist/index.d.ts CHANGED
@@ -6,4 +6,4 @@ export type { DeviceCodeInfo, LoginWithDeviceCodeOptions } from "./device-login.
6
6
  export { AgentRunError, GittermError, WorkspaceLifecycleError } from "./errors.js";
7
7
  export { createGittermWorkspaceClient, getWorkspaceEnvironment, type GittermWorkspaceClient, type WorkspaceClientOptions, type WorkspaceEnvironment, type WorkspacePort, type WorkspacePortVisibility, type WorkspaceSelf, } from "./workspace-client.js";
8
8
  export type { CredentialErrorCode, GittermErrorCode, WorkspaceLifecycleErrorCode, } from "./errors.js";
9
- export type { AgentPermissionRequest, AgentQuestion, AgentQuestionOption, AgentQuestionRequest, AgentRun, AgentRunCreateInput, AgentRunInputRequest, AgentRunMessage, AgentRunMessagePart, AgentRunReply, AgentRunStatus, AgentRunEvent, AgentRunResult, AgentRunReplyPermission, AgentRunReplyQuestion, RunResultOptions, RunRef, RunWaitOptions, RunWatchOptions, AgentType, AgentKey, AuthStatus, BuiltInAgentKey, CloudProvider, ProviderKey, Workspace, WorkspaceCreateInput, WorkspaceCreateResult, WorkspaceCatalog, WorkspaceEnsureRunningResult, WorkspaceHostingType, WorkspaceListOptions, WorkspaceListResult, WorkspaceRestartResult, WorkspaceRuntimeAccess, WorkspaceStatus, WorkspaceSetupStatus, ModelCredential, ModelProviderInfo, ModelCredentialSource, WorkspaceModelsInput, WorkspaceModelAccess, WorkspacePauseResult, WorkspaceTerminateResult, WorkspaceProviderSelection, Integration, IntegrationKey, IntegrationCategory, Connection, ConnectionKind, ConnectionStatus, ConnectionDetails, GitHubConnectionDetails, GoogleConnectionDetails, CreateConnectionInput, CreateConnectionResult, GitHubRepository, GitHubBranch, GoogleSetup, } from "./types.js";
9
+ export type { AgentPermissionRequest, AgentQuestion, AgentQuestionOption, AgentQuestionRequest, AgentRun, AgentRunAttachment, AgentRunCreateInput, AgentRunInputRequest, AgentRunMessage, AgentRunMessagePart, AgentRunReply, AgentRunStatus, AgentRunEvent, AgentRunResult, AgentRunReplyPermission, AgentRunReplyQuestion, RunResultOptions, RunRef, RunWaitOptions, RunWatchOptions, AgentType, AgentKey, AuthStatus, BuiltInAgentKey, CloudProvider, ProviderKey, Workspace, WorkspaceCreateInput, WorkspaceCreateResult, WorkspaceCatalog, WorkspaceEnsureRunningResult, WorkspaceHostingType, WorkspaceListOptions, WorkspaceListResult, WorkspaceRestartResult, WorkspaceRuntimeAccess, WorkspaceStatus, WorkspaceSetupStatus, ModelCredential, ModelProviderInfo, ModelCredentialSource, WorkspaceModelsInput, WorkspaceModelAccess, WorkspacePauseResult, WorkspaceTerminateResult, WorkspaceProviderSelection, Integration, IntegrationKey, IntegrationCategory, Connection, ConnectionKind, ConnectionStatus, ConnectionDetails, GitHubConnectionDetails, GoogleConnectionDetails, CreateConnectionInput, CreateConnectionResult, GitHubRepository, GitHubBranch, GoogleSetup, } from "./types.js";
package/dist/types.d.ts CHANGED
@@ -479,6 +479,14 @@ export type AgentRunListResult = {
479
479
  hasMore: boolean;
480
480
  };
481
481
  };
482
+ export type AgentRunAttachment = {
483
+ /** Shown to the agent so the prompt can refer to the file by name. */
484
+ name?: string;
485
+ /** e.g. `image/png`. */
486
+ mime: string;
487
+ /** Base64-encoded content. */
488
+ data: string;
489
+ };
482
490
  export type AgentRunCreateInput = {
483
491
  workspace: WorkspaceRef;
484
492
  /**
@@ -488,6 +496,11 @@ export type AgentRunCreateInput = {
488
496
  */
489
497
  idempotencyKey?: string;
490
498
  prompt: string;
499
+ /**
500
+ * Files the agent receives together with the prompt, e.g. screenshots for a vision model.
501
+ * At most 10 per run and 20 MB of base64 in total.
502
+ */
503
+ attachments?: AgentRunAttachment[];
491
504
  title?: string;
492
505
  agent?: string;
493
506
  /** OpenCode model in provider/model format. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitterm/sdk",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -25,14 +25,13 @@
25
25
  "access": "public"
26
26
  },
27
27
  "scripts": {
28
- "build": "rm -rf dist && bun build src/index.ts src/direct/index.ts --outdir dist --target node --format esm --external @trpc/client --external eventsource --external @opencode-ai/sdk --external @opencode-ai/sdk/v2 --external e2b --external @asciidev/box-sdk --external @daytonaio/sdk --external @vercel/sandbox && tsc -p tsconfig.build.json",
28
+ "build": "rm -rf dist && bun build src/index.ts src/direct/index.ts --outdir dist --target node --format esm --external @trpc/client --external eventsource --external e2b --external @asciidev/box-sdk --external @daytonaio/sdk --external @vercel/sandbox && tsc -p tsconfig.build.json",
29
29
  "prepublishOnly": "bun run check-types && bun run build",
30
30
  "check-types": "tsc --noEmit"
31
31
  },
32
32
  "dependencies": {
33
33
  "@asciidev/box-sdk": "^0.0.34",
34
34
  "@daytonaio/sdk": "^0.207.0",
35
- "@opencode-ai/sdk": "^1.18.25",
36
35
  "@trpc/client": "^11.8.1",
37
36
  "@vercel/sandbox": "^3.2.1",
38
37
  "e2b": "^2.46.1",
@@ -41,6 +40,7 @@
41
40
  "devDependencies": {
42
41
  "@gitterm/agent-runtime": "workspace:*",
43
42
  "@gitterm/api": "workspace:*",
43
+ "@opencode/client": "^2.0.19",
44
44
  "@trpc/server": "catalog:",
45
45
  "@types/bun": "^1.2.6",
46
46
  "typescript": "^5.8.2"