@gitterm/sdk 0.1.3 → 0.2.1

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.
package/dist/client.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { AgentType, AgentRun, AgentRunCreateInput, AgentRunListOptions, AgentRunListResult, AgentRunMessage, AgentRunReply, AuthStatus, CloudProvider, RunRef, RunWaitOptions, WaitOptions, Workspace, WorkspaceCreateInput, WorkspaceCreateResult, WorkspaceEnsureRunningResult, WorkspaceListOptions, WorkspaceListResult, WorkspaceRef, WorkspaceRestartResult, WorkspaceRuntimeAccess, WorkspacePauseResult, WorkspaceTerminateResult, WorkspaceCatalog, WorkspaceSetupStatus, ModelCredential, ModelProviderInfo } from "./types.js";
1
+ import type { AgentType, AgentRun, AgentRunCreateInput, AgentRunListOptions, AgentRunListResult, AgentRunMessage, AgentRunReply, AuthStatus, CloudProvider, RunRef, RunWaitOptions, RunWatchOptions, WaitOptions, Workspace, WorkspaceCreateInput, WorkspaceCreateResult, WorkspaceEnsureRunningResult, WorkspaceListOptions, WorkspaceListResult, WorkspaceRef, WorkspaceRestartResult, WorkspaceRuntimeAccess, WorkspacePauseResult, WorkspaceTerminateResult, WorkspaceCatalog, WorkspaceSetupStatus, ModelCredential, ModelProviderInfo } from "./types.js";
2
+ import type { AgentRunEvent, AgentRunResult, RunResultOptions, ModelInfo, WorkspaceModelAccess } from "./types.js";
2
3
  export type GittermClientOptions = {
3
4
  serverUrl?: string;
4
5
  token?: string;
@@ -21,32 +22,36 @@ export type GittermClient = {
21
22
  terminate(workspace: WorkspaceRef): Promise<WorkspaceTerminateResult>;
22
23
  create(input: WorkspaceCreateInput): Promise<WorkspaceCreateResult>;
23
24
  setupStatus(workspace: WorkspaceRef): Promise<WorkspaceSetupStatus>;
25
+ /** Credential-source metadata and known models; never wakes the runtime. */
26
+ models(workspace: WorkspaceRef): Promise<WorkspaceModelAccess>;
24
27
  waitForSetup(workspace: WorkspaceRef, options?: WaitOptions): Promise<WorkspaceSetupStatus>;
25
28
  };
26
29
  runs: {
27
30
  create(input: AgentRunCreateInput): Promise<AgentRun>;
28
31
  list(workspace: WorkspaceRef, options?: AgentRunListOptions): Promise<AgentRunListResult>;
29
32
  get(run: RunRef): Promise<AgentRun>;
30
- get(workspaceId: string, runId: string): Promise<AgentRun>;
31
33
  messages(run: RunRef): Promise<AgentRunMessage[]>;
32
- messages(workspaceId: string, runId: string): Promise<AgentRunMessage[]>;
33
34
  cancel(run: RunRef): Promise<{
34
35
  cancelled: boolean;
35
36
  }>;
36
- cancel(workspaceId: string, runId: string): Promise<{
37
- cancelled: boolean;
38
- }>;
39
37
  /** Answer the permission prompt or question a run is `awaiting_input` on. */
40
38
  respond(run: RunRef, input: {
41
39
  requestId: string;
42
40
  reply: AgentRunReply;
43
41
  }): Promise<AgentRun>;
44
42
  /**
45
- * Resolve once the run needs attention: terminal, or `awaiting_input`
46
- * unless `until: "terminal"`. Push-based; no polling.
43
+ * Every lifecycle state of the run, starting with its current one, until a
44
+ * terminal state is yielded. Push-based (server-sent events); no polling.
45
+ * Answer `awaiting_input` states with `runs.respond()` while iterating.
46
+ */
47
+ watch(run: RunRef, options?: RunWatchOptions): AsyncIterable<AgentRun>;
48
+ /**
49
+ * Resolve with the first state that needs attention: terminal, or
50
+ * `awaiting_input` unless `until: "terminal"`. A thin helper over `watch()`.
47
51
  */
48
52
  wait(run: RunRef, options?: RunWaitOptions): Promise<AgentRun>;
49
- wait(workspaceId: string, runId: string, options?: RunWaitOptions): Promise<AgentRun>;
53
+ events(run: RunRef, options?: RunWatchOptions): AsyncIterable<AgentRunEvent>;
54
+ result(run: RunRef, options?: RunResultOptions): Promise<AgentRunResult>;
50
55
  };
51
56
  catalog: {
52
57
  agentTypes(input?: {
@@ -64,5 +69,10 @@ export type GittermClient = {
64
69
  list(): Promise<ModelCredential[]>;
65
70
  listProviders(): Promise<ModelProviderInfo[]>;
66
71
  };
72
+ models: {
73
+ list(options?: {
74
+ provider?: string;
75
+ }): Promise<ModelInfo[]>;
76
+ };
67
77
  };
68
78
  export declare function createGittermClient(options?: GittermClientOptions): GittermClient;
@@ -1,6 +1,8 @@
1
- import type { DirectProviderAdapter, DirectProviderConfig, DirectAuthAttempt, DirectAuthAttemptStatus, DirectAuthIntegration, DirectAuthWaitOptions, DirectModelCredential, DirectRun, DirectRunCreateInput, DirectRunMessage, DirectRunWaitOptions, DirectWorkspace, DirectWorkspaceCreateInput, DirectWorkspaceSetupStatus, DirectWorkspaceSetupWaitOptions } from "./types.js";
1
+ import type { DirectProviderAdapter, DirectProviderConfig, DirectAuthAttempt, DirectAuthAttemptStatus, DirectAuthIntegration, DirectAuthWaitOptions, DirectModelCredential, DirectRun, DirectRunCreateInput, DirectWorkspace, DirectWorkspaceCreateInput, DirectWorkspaceSetupStatus, DirectWorkspaceSetupWaitOptions } from "./types.js";
2
2
  export type DirectGittermClientOptions = {
3
3
  provider: DirectProviderAdapter | DirectProviderConfig;
4
+ /** Used for OpenCode runtime requests (provider adapters own their own transports). */
5
+ fetch?: typeof fetch;
4
6
  };
5
7
  export declare function createDirectGittermClient(options: DirectGittermClientOptions): {
6
8
  provider: {
@@ -41,20 +43,19 @@ export declare function createDirectGittermClient(options: DirectGittermClientOp
41
43
  };
42
44
  runs: {
43
45
  create(input: DirectRunCreateInput): Promise<DirectRun>;
44
- get: (run: DirectRun, workspace: DirectWorkspace) => Promise<{
45
- status: "running" | "completed" | "failed" | "cancelled" | "retrying";
46
- error: string | null;
47
- finalText: string | null;
48
- id: string;
49
- workspaceId: string;
50
- sessionId: string;
51
- messageId: string;
52
- title: string;
53
- submittedAt: string;
46
+ messages(run: DirectRun): Promise<import("./types.js").DirectRunMessage[]>;
47
+ cancel(run: DirectRun): Promise<{
48
+ cancelled: boolean;
54
49
  }>;
55
- wait(run: DirectRun, workspace: DirectWorkspace, wait?: DirectRunWaitOptions): Promise<DirectRun>;
56
- messages(run: DirectRun, workspace: DirectWorkspace): Promise<DirectRunMessage[]>;
57
- cancel(run: DirectRun, workspace: DirectWorkspace): Promise<boolean>;
50
+ events: (ref: DirectRun, options?: import("../types.js").RunWatchOptions) => AsyncIterable<import("../types.js").AgentRunEvent<DirectRun>>;
51
+ wait: (ref: DirectRun, options?: import("../types.js").RunWaitOptions) => Promise<DirectRun>;
52
+ result: (ref: DirectRun, options?: import("../types.js").RunResultOptions) => Promise<import("../types.js").AgentRunResult<DirectRun>>;
53
+ get: (run: DirectRun) => Promise<DirectRun>;
54
+ watch: (run: DirectRun, options?: import("../types.js").RunWatchOptions) => AsyncGenerator<DirectRun>;
55
+ respond: (run: DirectRun, input: {
56
+ requestId: string;
57
+ reply: import("../types.js").AgentRunReply;
58
+ }) => Promise<DirectRun>;
58
59
  };
59
60
  };
60
61
  export type DirectGittermClient = ReturnType<typeof createDirectGittermClient>;