@aipoch/open-science 0.0.0-stage → 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.
- package/CLI.md +814 -0
- package/LICENSE +201 -0
- package/README.md +284 -2
- package/appimage-launcher.mjs +90 -0
- package/browser-import.d.ts +66 -0
- package/browser-import.mjs +389 -0
- package/cli.mjs +1845 -0
- package/codex-login.mjs +298 -0
- package/config-root.mjs +65 -0
- package/index.d.ts +677 -0
- package/index.mjs +761 -0
- package/installation-startup.cjs +205 -0
- package/locate-app.mjs +95 -0
- package/locate-backend.mjs +63 -0
- package/package.json +45 -4
- package/runtime-control.mjs +51 -0
- package/runtime-package.mjs +19 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
export type BootstrapRequest =
|
|
2
|
+
| { action: 'status' | 'runtime' | 'codex-prepare' | 'codex-complete' }
|
|
3
|
+
| { action: 'provider'; key: string; model: string }
|
|
4
|
+
| { action: 'openalex'; key: string }
|
|
5
|
+
export type BootstrapResult =
|
|
6
|
+
| { ok: true; providerId?: string; next?: { runtime?: string[]; provider?: string[] } }
|
|
7
|
+
| {
|
|
8
|
+
ok: false
|
|
9
|
+
code:
|
|
10
|
+
| 'invalid_request'
|
|
11
|
+
| 'configuration_conflict'
|
|
12
|
+
| 'runtime_unavailable'
|
|
13
|
+
| 'credential_invalid'
|
|
14
|
+
| 'bootstrap_failed'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Keep these standalone published types aligned with the safe Settings contracts.
|
|
18
|
+
// cli/connector-contract.test.ts verifies complete request and response equivalence.
|
|
19
|
+
export type ToolPermission = 'allow' | 'ask' | 'block'
|
|
20
|
+
|
|
21
|
+
export type ConnectorToolView = {
|
|
22
|
+
id: string // "<connector>/<method>"
|
|
23
|
+
method: string
|
|
24
|
+
description: string
|
|
25
|
+
permission: ToolPermission
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type ConnectorGroup = 'featured' | 'directory'
|
|
29
|
+
|
|
30
|
+
export type ConnectorView = {
|
|
31
|
+
id: string
|
|
32
|
+
// Immutable invocation/export name. Bundled Connectors currently use the same value as id.
|
|
33
|
+
name: string
|
|
34
|
+
displayName: string
|
|
35
|
+
description: string
|
|
36
|
+
sources: string[]
|
|
37
|
+
requiresNcbi: boolean
|
|
38
|
+
enabled: boolean // !disabledConnectorIds.includes(id)
|
|
39
|
+
autoAllow: boolean // autoAllowIds.includes(id) — "Skip approvals"
|
|
40
|
+
group: ConnectorGroup
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ConnectorDetailView = ConnectorView & {
|
|
44
|
+
useWhen: string
|
|
45
|
+
termsUrl?: string
|
|
46
|
+
tools: ConnectorToolView[]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type NcbiCredentialsView = { contactEmail?: string; hasApiKey: boolean }
|
|
50
|
+
|
|
51
|
+
export type OpenAlexCredentialView = { hasApiKey: boolean }
|
|
52
|
+
|
|
53
|
+
export type CustomServerTransport = 'stdio' | 'streamable_http' | 'sse'
|
|
54
|
+
|
|
55
|
+
export type CustomServerView = {
|
|
56
|
+
id: string
|
|
57
|
+
// Immutable agent-facing name used by host.mcp, Specialists, and generated MCP skills.
|
|
58
|
+
name: string
|
|
59
|
+
// User-facing label; spaces, punctuation, and duplicates are allowed.
|
|
60
|
+
displayName: string
|
|
61
|
+
description?: string
|
|
62
|
+
transport: CustomServerTransport
|
|
63
|
+
enabled: boolean
|
|
64
|
+
// Physical availability is independent of Main's enabled toggle. An invalid persisted server may
|
|
65
|
+
// remain visible to a Specialist but can never be selected or dispatched.
|
|
66
|
+
availability?: 'unavailable' | 'unauthenticated' | 'credential_unavailable'
|
|
67
|
+
// Background discovery is transient and does not make the Connector unavailable by itself.
|
|
68
|
+
checking?: boolean
|
|
69
|
+
// Display-only config summary. Environment/header names are safe to show; values stay write-only.
|
|
70
|
+
command?: string
|
|
71
|
+
args?: string[]
|
|
72
|
+
url?: string
|
|
73
|
+
hasHeaders?: boolean
|
|
74
|
+
headerNames?: string[]
|
|
75
|
+
hasEnv?: boolean
|
|
76
|
+
environmentNames?: string[]
|
|
77
|
+
// Opaque device credential reference used to preselect a shared OAuth credential in Configure.
|
|
78
|
+
oauthCredentialId?: string
|
|
79
|
+
oauth?: {
|
|
80
|
+
clientMetadataUrl?: string
|
|
81
|
+
authorizationServerUrl?: string
|
|
82
|
+
scopes?: string[]
|
|
83
|
+
clientId?: string
|
|
84
|
+
redirectUri?: string
|
|
85
|
+
hasTokens: boolean
|
|
86
|
+
// Optional for compatibility with snapshots from an older main process during development.
|
|
87
|
+
hasClientSecret?: boolean
|
|
88
|
+
sharedCredential?: boolean
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type ConnectorsSnapshot = {
|
|
93
|
+
connectors: ConnectorView[]
|
|
94
|
+
customServers: CustomServerView[]
|
|
95
|
+
// Derived Agent Skill documents can fail independently after durable Connector settings save.
|
|
96
|
+
skillProjectionStatus?: 'degraded'
|
|
97
|
+
// Local IDs reserved until interrupted custom Connector deletion cleanup completes.
|
|
98
|
+
reservedCustomServerIds?: string[]
|
|
99
|
+
ncbi: NcbiCredentialsView
|
|
100
|
+
// Optional only for compatibility with an older main process during local development.
|
|
101
|
+
openAlex?: OpenAlexCredentialView
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type DeviceCredentialKind = 'api_key' | 'token' | 'oauth'
|
|
105
|
+
|
|
106
|
+
export type DeviceOAuthTransport = Extract<CustomServerTransport, 'streamable_http' | 'sse'>
|
|
107
|
+
|
|
108
|
+
export type DeviceOAuthRegistration = {
|
|
109
|
+
clientMetadataUrl?: string
|
|
110
|
+
authorizationServerUrl?: string
|
|
111
|
+
scopes?: string[]
|
|
112
|
+
clientId?: string
|
|
113
|
+
redirectUri?: string
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type DeviceCredentialView = {
|
|
117
|
+
id: string
|
|
118
|
+
displayName: string
|
|
119
|
+
kind: DeviceCredentialKind
|
|
120
|
+
status: 'stored' | 'connected' | 'disconnected'
|
|
121
|
+
needsSecret: boolean
|
|
122
|
+
resourceUri?: string
|
|
123
|
+
transport?: DeviceOAuthTransport
|
|
124
|
+
oauth?: DeviceOAuthRegistration
|
|
125
|
+
hasClientSecret?: boolean
|
|
126
|
+
// Derived separately from unreadable OAuth login state; never persisted.
|
|
127
|
+
needsClientSecret?: boolean
|
|
128
|
+
consumerCount: number
|
|
129
|
+
consumerNames: string[]
|
|
130
|
+
createdAt: number
|
|
131
|
+
updatedAt: number
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type DeviceCredentialsSnapshot = { credentials: DeviceCredentialView[] }
|
|
135
|
+
|
|
136
|
+
export type CreateDeviceCredentialResult = {
|
|
137
|
+
// Missing when creation committed but the full consumer projection could not be read.
|
|
138
|
+
credentials?: DeviceCredentialView[]
|
|
139
|
+
createdCredential: DeviceCredentialView
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export type CreateDeviceCredentialRequest =
|
|
143
|
+
| { displayName: string; kind: 'api_key' | 'token'; secret: string }
|
|
144
|
+
| {
|
|
145
|
+
displayName: string
|
|
146
|
+
kind: 'oauth'
|
|
147
|
+
resourceUri: string
|
|
148
|
+
transport: DeviceOAuthTransport
|
|
149
|
+
oauth: DeviceOAuthRegistration & {
|
|
150
|
+
clientSecret?: string
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type UpdateDeviceCredentialRequest = {
|
|
155
|
+
id: string
|
|
156
|
+
displayName?: string
|
|
157
|
+
secret?: string
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export type AddCustomServerRequest = {
|
|
161
|
+
// Optional immutable local ID. Omission lets main infer one from `name` and fall back to a UUID.
|
|
162
|
+
id?: string
|
|
163
|
+
name: string
|
|
164
|
+
displayName: string
|
|
165
|
+
description?: string
|
|
166
|
+
transport: CustomServerTransport
|
|
167
|
+
command?: string
|
|
168
|
+
args?: string[]
|
|
169
|
+
envCredentialIds?: Record<string, string>
|
|
170
|
+
url?: string
|
|
171
|
+
headerCredentialIds?: Record<string, string>
|
|
172
|
+
oauthCredentialId?: string
|
|
173
|
+
// Non-secret registration requirements checked against a selected shared OAuth credential.
|
|
174
|
+
// They are validation input only and are not persisted on the Connector.
|
|
175
|
+
oauthRequirements?: DeviceOAuthRegistration
|
|
176
|
+
// Request-only marker from an imported template. Main validates the selected shared credential;
|
|
177
|
+
// the marker is never persisted on the Connector.
|
|
178
|
+
requiresOAuthClientSecret?: boolean
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type UpdateCustomServerRequest = {
|
|
182
|
+
id: string
|
|
183
|
+
displayName?: string
|
|
184
|
+
description?: string
|
|
185
|
+
transport: CustomServerTransport
|
|
186
|
+
command?: string
|
|
187
|
+
// Omitted keeps saved args while staying on stdio; [] explicitly clears them.
|
|
188
|
+
args?: string[]
|
|
189
|
+
env?: Record<string, string>
|
|
190
|
+
envCredentialIds?: Record<string, string>
|
|
191
|
+
url?: string
|
|
192
|
+
headers?: Record<string, string>
|
|
193
|
+
headerCredentialIds?: Record<string, string>
|
|
194
|
+
// Omitted retains the current shared OAuth binding; a value selects or replaces it.
|
|
195
|
+
oauthCredentialId?: string
|
|
196
|
+
oauth?: {
|
|
197
|
+
clientMetadataUrl?: string
|
|
198
|
+
authorizationServerUrl?: string
|
|
199
|
+
scopes?: string[]
|
|
200
|
+
clientId?: string
|
|
201
|
+
redirectUri?: string
|
|
202
|
+
// Omitted keeps the stored secret; null explicitly removes it.
|
|
203
|
+
clientSecret?: string | null
|
|
204
|
+
} | null
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export type ConnectorTransport = CustomServerTransport
|
|
208
|
+
export type ConnectorConfiguration = Omit<UpdateCustomServerRequest, 'id'>
|
|
209
|
+
export type ConnectorTestResult = { success: boolean; toolCount?: number; message: string }
|
|
210
|
+
export type CredentialInput = CreateDeviceCredentialRequest
|
|
211
|
+
export type CredentialView = DeviceCredentialView
|
|
212
|
+
export type CredentialsSnapshot = DeviceCredentialsSnapshot
|
|
213
|
+
|
|
214
|
+
export type PermissionProfile = 'ask' | 'auto' | 'full'
|
|
215
|
+
export type DelegationPolicy = 'allow' | 'deny'
|
|
216
|
+
export type TurnIntent = 'plan-first'
|
|
217
|
+
export type ReasoningEffort = 'default' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'
|
|
218
|
+
export type AgentFramework = 'claude-code' | 'opencode' | 'codex' | 'codebuddy'
|
|
219
|
+
export type ReadinessStatus = 'ready' | 'missing' | 'not_ready'
|
|
220
|
+
export type ProviderReadinessReason =
|
|
221
|
+
| 'credential_invalid'
|
|
222
|
+
| 'network'
|
|
223
|
+
| 'model-not-found'
|
|
224
|
+
| 'bad-url'
|
|
225
|
+
| 'timeout'
|
|
226
|
+
| 'incompatible'
|
|
227
|
+
| 'server-error'
|
|
228
|
+
| 'unknown'
|
|
229
|
+
export type DoctorReport = {
|
|
230
|
+
ready: boolean
|
|
231
|
+
checks: {
|
|
232
|
+
daemon: { status: 'ready' }
|
|
233
|
+
runtime: { status: ReadinessStatus; framework: AgentFramework }
|
|
234
|
+
provider:
|
|
235
|
+
{ status: 'ready' | 'missing' } | { status: 'not_ready'; reason?: ProviderReadinessReason }
|
|
236
|
+
skills: { status: 'ready'; enabled: string[] }
|
|
237
|
+
}
|
|
238
|
+
next: Array<{
|
|
239
|
+
code: 'runtime_missing' | 'runtime_not_ready' | 'provider_missing' | 'provider_not_ready'
|
|
240
|
+
argv?: readonly string[]
|
|
241
|
+
}>
|
|
242
|
+
}
|
|
243
|
+
export type AgentRuntime = {
|
|
244
|
+
framework: AgentFramework
|
|
245
|
+
status: ReadinessStatus
|
|
246
|
+
version?: string
|
|
247
|
+
source?: 'managed' | 'external'
|
|
248
|
+
}
|
|
249
|
+
export type AgentConfiguration = {
|
|
250
|
+
providerId: string
|
|
251
|
+
model?: string
|
|
252
|
+
reasoningEffort: ReasoningEffort
|
|
253
|
+
}
|
|
254
|
+
export type ComputeHosts = { enabled: string[]; selected: string[] }
|
|
255
|
+
export type ProjectSessionDefaults = {
|
|
256
|
+
agentConfiguration?: AgentConfiguration
|
|
257
|
+
permissionProfile?: PermissionProfile
|
|
258
|
+
autoReviewEnabled?: boolean
|
|
259
|
+
memoryEnabled?: boolean
|
|
260
|
+
delegationPolicy?: DelegationPolicy
|
|
261
|
+
specialistId?: string
|
|
262
|
+
computeHosts?: ComputeHosts
|
|
263
|
+
}
|
|
264
|
+
export type ProjectSessionDefaultsPatch = {
|
|
265
|
+
agentConfiguration?: {
|
|
266
|
+
providerId?: string
|
|
267
|
+
model?: string | null
|
|
268
|
+
reasoningEffort?: ReasoningEffort
|
|
269
|
+
} | null
|
|
270
|
+
permissionProfile?: PermissionProfile | null
|
|
271
|
+
autoReviewEnabled?: boolean | null
|
|
272
|
+
memoryEnabled?: boolean | null
|
|
273
|
+
delegationPolicy?: DelegationPolicy | null
|
|
274
|
+
specialistId?: string | null
|
|
275
|
+
computeHosts?: ComputeHosts | null
|
|
276
|
+
}
|
|
277
|
+
export type ModelRouting =
|
|
278
|
+
| { mode: 'inherit' }
|
|
279
|
+
| {
|
|
280
|
+
mode: 'fixed'
|
|
281
|
+
providerId: string
|
|
282
|
+
model: string
|
|
283
|
+
reasoningEffort: ReasoningEffort
|
|
284
|
+
}
|
|
285
|
+
export type RequestOptions = {
|
|
286
|
+
idempotencyKey?: string
|
|
287
|
+
/** Aborts this request, not work already accepted by the service. */
|
|
288
|
+
signal?: AbortSignal
|
|
289
|
+
/** Per-request deadline in milliseconds, including response-body consumption. */
|
|
290
|
+
timeoutMs?: number
|
|
291
|
+
}
|
|
292
|
+
export type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled'
|
|
293
|
+
export type RunFailureCode = 'process_restarted'
|
|
294
|
+
export type RunProgressPhase =
|
|
295
|
+
| 'accepted'
|
|
296
|
+
| 'session-ready'
|
|
297
|
+
| 'prompt-dispatched'
|
|
298
|
+
| 'provider-accepted'
|
|
299
|
+
| 'first-visible-output'
|
|
300
|
+
| 'completed'
|
|
301
|
+
| 'failed'
|
|
302
|
+
| 'cancelled'
|
|
303
|
+
|
|
304
|
+
export type RunProgress = {
|
|
305
|
+
runId: string
|
|
306
|
+
sessionId: string
|
|
307
|
+
projectId: string
|
|
308
|
+
phase: RunProgressPhase
|
|
309
|
+
timestamp: number
|
|
310
|
+
elapsedMs: number
|
|
311
|
+
heartbeat: boolean
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export type TaskEventIdentity = {
|
|
315
|
+
sequence: number
|
|
316
|
+
runId: string
|
|
317
|
+
sessionId: string
|
|
318
|
+
projectId: string
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export type TaskEvent =
|
|
322
|
+
| (TaskEventIdentity & { type: 'run.progress'; data: RunProgress })
|
|
323
|
+
| (TaskEventIdentity & { type: 'run.event' | 'permission.requested'; data: unknown })
|
|
324
|
+
| {
|
|
325
|
+
type: 'stream.resync-required'
|
|
326
|
+
data: {
|
|
327
|
+
protocolVersion: 1
|
|
328
|
+
streamId: string
|
|
329
|
+
latestSequence: number
|
|
330
|
+
reason: 'stream-changed' | 'cursor-expired'
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export type Project = {
|
|
335
|
+
id: string
|
|
336
|
+
name: string
|
|
337
|
+
description: string
|
|
338
|
+
hasAgentContext: boolean
|
|
339
|
+
isExample: boolean
|
|
340
|
+
createdAt: number
|
|
341
|
+
updatedAt: number
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export type PlanLifecycle =
|
|
345
|
+
'awaiting_approval' | 'approved' | 'in_progress' | 'blocked' | 'completed' | 'rejected'
|
|
346
|
+
|
|
347
|
+
export type SessionPlan = {
|
|
348
|
+
artifactId: string
|
|
349
|
+
artifactVersionId: string
|
|
350
|
+
artifactChecksum: string
|
|
351
|
+
originatingPromptMessageId?: string
|
|
352
|
+
materializedAt?: number
|
|
353
|
+
revision: number
|
|
354
|
+
approval: 'pending' | 'approved' | 'rejected'
|
|
355
|
+
lifecycle: PlanLifecycle
|
|
356
|
+
document: unknown
|
|
357
|
+
stepStatuses: Record<string, unknown>
|
|
358
|
+
stepStates: Record<string, unknown>
|
|
359
|
+
counts: {
|
|
360
|
+
phases: number
|
|
361
|
+
delegations: number
|
|
362
|
+
steps: number
|
|
363
|
+
completed: number
|
|
364
|
+
inProgress: number
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export type RunAttention = { kind: 'plan-approval'; plan: SessionPlan }
|
|
369
|
+
|
|
370
|
+
export type PlanDecisionResponse = {
|
|
371
|
+
projection: SessionPlan
|
|
372
|
+
changed: boolean
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export type PlanFeedbackResponse = {
|
|
376
|
+
kind: 'feedback'
|
|
377
|
+
routeToInteractionId: string
|
|
378
|
+
artifactVersionId: string
|
|
379
|
+
text: string
|
|
380
|
+
message: {
|
|
381
|
+
id: string
|
|
382
|
+
role: 'user'
|
|
383
|
+
content: string
|
|
384
|
+
status: 'complete'
|
|
385
|
+
responseToMessageId: string
|
|
386
|
+
eventIds: string[]
|
|
387
|
+
createdAt: number
|
|
388
|
+
updatedAt: number
|
|
389
|
+
}
|
|
390
|
+
planRevision: number
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export type PlanResponse = PlanDecisionResponse | PlanFeedbackResponse
|
|
394
|
+
|
|
395
|
+
export type Run = {
|
|
396
|
+
id: string
|
|
397
|
+
sessionId: string
|
|
398
|
+
projectId: string
|
|
399
|
+
cwd: string
|
|
400
|
+
status: RunStatus
|
|
401
|
+
startedAt: number
|
|
402
|
+
cancelRequestedAt?: number
|
|
403
|
+
cancelledAt?: number
|
|
404
|
+
completedAt?: number
|
|
405
|
+
output?: string
|
|
406
|
+
error?: string
|
|
407
|
+
failureCode?: RunFailureCode
|
|
408
|
+
artifacts: Artifact[]
|
|
409
|
+
attention?: RunAttention
|
|
410
|
+
review?: {
|
|
411
|
+
started: boolean
|
|
412
|
+
reason?: string
|
|
413
|
+
id?: string
|
|
414
|
+
lifecycle?: 'running' | 'complete' | 'error'
|
|
415
|
+
outcome?: 'pass' | 'flagged' | null
|
|
416
|
+
errorMessage?: string
|
|
417
|
+
}
|
|
418
|
+
preferredComputeHostIds: string[]
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
export type SessionStatus =
|
|
422
|
+
'idle' | 'running' | 'waiting-for-user' | 'waiting-permission' | 'waiting-plan-approval' | 'error'
|
|
423
|
+
|
|
424
|
+
export type Session = {
|
|
425
|
+
id: string
|
|
426
|
+
projectId: string
|
|
427
|
+
title: string
|
|
428
|
+
status: SessionStatus
|
|
429
|
+
permissionProfile?: PermissionProfile
|
|
430
|
+
autoReviewEnabled: boolean
|
|
431
|
+
specialistId?: string
|
|
432
|
+
delegationPolicy: DelegationPolicy
|
|
433
|
+
pinned: boolean
|
|
434
|
+
archivedAt?: number
|
|
435
|
+
createdAt: number
|
|
436
|
+
updatedAt: number
|
|
437
|
+
output?: string
|
|
438
|
+
error?: string
|
|
439
|
+
artifactCount: number
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export type SessionConfiguration = {
|
|
443
|
+
sessionId: string
|
|
444
|
+
projectId: string
|
|
445
|
+
revision: number
|
|
446
|
+
cwd: string
|
|
447
|
+
specialistId?: string
|
|
448
|
+
persisted: {
|
|
449
|
+
agentConfiguration?: AgentConfiguration
|
|
450
|
+
permissionProfile?: PermissionProfile
|
|
451
|
+
autoReviewEnabled?: boolean
|
|
452
|
+
memoryEnabled?: boolean
|
|
453
|
+
delegationPolicy?: DelegationPolicy
|
|
454
|
+
computeHosts: ComputeHosts
|
|
455
|
+
}
|
|
456
|
+
effective: {
|
|
457
|
+
agentConfiguration?: AgentConfiguration
|
|
458
|
+
permissionProfile: PermissionProfile
|
|
459
|
+
autoReviewEnabled: boolean
|
|
460
|
+
memoryEnabled: boolean
|
|
461
|
+
delegationPolicy: DelegationPolicy
|
|
462
|
+
computeHosts: ComputeHosts
|
|
463
|
+
}
|
|
464
|
+
availability: {
|
|
465
|
+
agentConfiguration?: { available: boolean; reason?: string }
|
|
466
|
+
specialist?: { available: boolean; reason?: string }
|
|
467
|
+
computeHosts: Record<string, { available: boolean; reason?: string }>
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export type AgentRouting = {
|
|
472
|
+
configured: { framework: AgentFramework; reviewer: ModelRouting; subagent: ModelRouting }
|
|
473
|
+
effective: {
|
|
474
|
+
reviewer:
|
|
475
|
+
| { source: 'application_main'; providerId?: string; model?: string }
|
|
476
|
+
| ({ source: 'fixed' } & Omit<Extract<ModelRouting, { mode: 'fixed' }>, 'mode'>)
|
|
477
|
+
subagent:
|
|
478
|
+
| { source: 'session_main' }
|
|
479
|
+
| ({ source: 'fixed' } & Omit<Extract<ModelRouting, { mode: 'fixed' }>, 'mode'>)
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export type Artifact = {
|
|
484
|
+
id: string
|
|
485
|
+
kind: 'workspace-file' | 'external-file' | 'managed-file'
|
|
486
|
+
path: string
|
|
487
|
+
name?: string
|
|
488
|
+
mimeType?: string
|
|
489
|
+
size?: number
|
|
490
|
+
mtimeMs?: number
|
|
491
|
+
sha256?: string
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
export class OpenScienceApiError extends Error {
|
|
495
|
+
code: string
|
|
496
|
+
status?: number
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
export class OpenScienceClient {
|
|
500
|
+
constructor(options: {
|
|
501
|
+
baseUrl: string
|
|
502
|
+
token: string
|
|
503
|
+
fetch?: typeof globalThis.fetch
|
|
504
|
+
sleep?: (milliseconds: number) => Promise<void>
|
|
505
|
+
requestTimeoutMs?: number
|
|
506
|
+
})
|
|
507
|
+
health(options?: RequestOptions): Promise<unknown>
|
|
508
|
+
bootstrap(request: BootstrapRequest, options?: RequestOptions): Promise<BootstrapResult>
|
|
509
|
+
installCli(
|
|
510
|
+
options?: RequestOptions
|
|
511
|
+
): Promise<{ installed: boolean; onPath: boolean; target: string; pathHint?: string }>
|
|
512
|
+
doctor(options?: RequestOptions): Promise<DoctorReport>
|
|
513
|
+
listRuntimes(options?: RequestOptions): Promise<AgentRuntime[]>
|
|
514
|
+
listConnectors(options?: RequestOptions): Promise<ConnectorsSnapshot>
|
|
515
|
+
getConnector(
|
|
516
|
+
id: string,
|
|
517
|
+
options?: RequestOptions
|
|
518
|
+
): Promise<ConnectorDetailView | CustomServerView>
|
|
519
|
+
setConnectorEnabled(
|
|
520
|
+
id: string,
|
|
521
|
+
enabled: boolean,
|
|
522
|
+
options?: RequestOptions
|
|
523
|
+
): Promise<ConnectorsSnapshot>
|
|
524
|
+
addConnector(
|
|
525
|
+
request: AddCustomServerRequest,
|
|
526
|
+
options?: RequestOptions
|
|
527
|
+
): Promise<ConnectorsSnapshot>
|
|
528
|
+
updateConnector(
|
|
529
|
+
id: string,
|
|
530
|
+
request: ConnectorConfiguration,
|
|
531
|
+
options?: RequestOptions
|
|
532
|
+
): Promise<ConnectorsSnapshot>
|
|
533
|
+
removeConnector(id: string, options?: RequestOptions): Promise<ConnectorsSnapshot>
|
|
534
|
+
testConnector(id: string, options?: RequestOptions): Promise<ConnectorTestResult>
|
|
535
|
+
listCredentials(options?: RequestOptions): Promise<CredentialsSnapshot>
|
|
536
|
+
createCredential(
|
|
537
|
+
request: CredentialInput,
|
|
538
|
+
options?: RequestOptions
|
|
539
|
+
): Promise<CreateDeviceCredentialResult>
|
|
540
|
+
updateCredential(
|
|
541
|
+
id: string,
|
|
542
|
+
request: { displayName?: string; secret?: string },
|
|
543
|
+
options?: RequestOptions
|
|
544
|
+
): Promise<CredentialsSnapshot>
|
|
545
|
+
listProjects(options?: RequestOptions): Promise<Project[]>
|
|
546
|
+
createProject(
|
|
547
|
+
request: {
|
|
548
|
+
name: string
|
|
549
|
+
description?: string
|
|
550
|
+
agentContext?: string
|
|
551
|
+
},
|
|
552
|
+
options?: RequestOptions
|
|
553
|
+
): Promise<Project>
|
|
554
|
+
updateProject(
|
|
555
|
+
projectId: string,
|
|
556
|
+
request: {
|
|
557
|
+
expectedUpdatedAt: number
|
|
558
|
+
name?: string
|
|
559
|
+
description?: string
|
|
560
|
+
agentContext?: string
|
|
561
|
+
},
|
|
562
|
+
options?: RequestOptions
|
|
563
|
+
): Promise<Project>
|
|
564
|
+
getProjectSessionDefaults(
|
|
565
|
+
projectId: string,
|
|
566
|
+
options?: RequestOptions
|
|
567
|
+
): Promise<{
|
|
568
|
+
projectId: string
|
|
569
|
+
updatedAt: number
|
|
570
|
+
configured: ProjectSessionDefaults
|
|
571
|
+
availability: {
|
|
572
|
+
agentConfiguration?: { available: boolean; reason?: string }
|
|
573
|
+
specialist?: { available: boolean; reason?: string }
|
|
574
|
+
computeHosts: Record<string, { available: boolean; reason?: string }>
|
|
575
|
+
}
|
|
576
|
+
}>
|
|
577
|
+
updateProjectSessionDefaults(
|
|
578
|
+
projectId: string,
|
|
579
|
+
request: {
|
|
580
|
+
expectedUpdatedAt: number
|
|
581
|
+
patch: ProjectSessionDefaultsPatch
|
|
582
|
+
},
|
|
583
|
+
options?: RequestOptions
|
|
584
|
+
): ReturnType<OpenScienceClient['getProjectSessionDefaults']>
|
|
585
|
+
listSessions(projectId?: string, options?: RequestOptions): Promise<Session[]>
|
|
586
|
+
getSession(sessionId: string, options?: RequestOptions): Promise<Session>
|
|
587
|
+
getSessionConfiguration(
|
|
588
|
+
sessionId: string,
|
|
589
|
+
options?: RequestOptions
|
|
590
|
+
): Promise<SessionConfiguration>
|
|
591
|
+
updateSessionConfiguration(
|
|
592
|
+
sessionId: string,
|
|
593
|
+
request: {
|
|
594
|
+
expectedRevision: number
|
|
595
|
+
agentConfiguration?: {
|
|
596
|
+
providerId?: string
|
|
597
|
+
model?: string | null
|
|
598
|
+
reasoningEffort?: ReasoningEffort
|
|
599
|
+
}
|
|
600
|
+
permissionProfile?: PermissionProfile
|
|
601
|
+
autoReviewEnabled?: boolean
|
|
602
|
+
memoryEnabled?: boolean
|
|
603
|
+
delegationPolicy?: DelegationPolicy
|
|
604
|
+
computeHosts?: ComputeHosts
|
|
605
|
+
},
|
|
606
|
+
options?: RequestOptions
|
|
607
|
+
): Promise<SessionConfiguration>
|
|
608
|
+
getAgentRouting(options?: RequestOptions): Promise<AgentRouting>
|
|
609
|
+
updateAgentRouting(
|
|
610
|
+
request: { framework?: AgentFramework; reviewer?: ModelRouting; subagent?: ModelRouting },
|
|
611
|
+
options?: RequestOptions
|
|
612
|
+
): Promise<AgentRouting>
|
|
613
|
+
getSessionPlan(sessionId: string, options?: RequestOptions): Promise<SessionPlan | null>
|
|
614
|
+
respondSessionPlan(
|
|
615
|
+
sessionId: string,
|
|
616
|
+
response:
|
|
617
|
+
| {
|
|
618
|
+
decision: 'approved' | 'rejected'
|
|
619
|
+
artifactVersionId: string
|
|
620
|
+
expectedRevision: number
|
|
621
|
+
}
|
|
622
|
+
| { feedback: string },
|
|
623
|
+
options?: RequestOptions
|
|
624
|
+
): Promise<PlanResponse>
|
|
625
|
+
startRun(
|
|
626
|
+
request: {
|
|
627
|
+
project: string
|
|
628
|
+
prompt: string
|
|
629
|
+
cwd?: string
|
|
630
|
+
sessionId?: string
|
|
631
|
+
permissionProfile?: PermissionProfile
|
|
632
|
+
skillIds?: string[]
|
|
633
|
+
turnIntent?: TurnIntent
|
|
634
|
+
/** Deny unresolved human interactions without changing the authorization profile. */
|
|
635
|
+
permissionPrompts?: 'none'
|
|
636
|
+
autoReviewEnabled?: boolean
|
|
637
|
+
specialist?: string
|
|
638
|
+
delegationPolicy?: DelegationPolicy
|
|
639
|
+
agentConfiguration?: Partial<AgentConfiguration> & { model?: string | null }
|
|
640
|
+
memoryEnabled?: boolean
|
|
641
|
+
computeHostIds?: string[]
|
|
642
|
+
enabledComputeHostIds?: string[]
|
|
643
|
+
},
|
|
644
|
+
options?: RequestOptions
|
|
645
|
+
): Promise<Run>
|
|
646
|
+
getRun(runId: string, options?: RequestOptions): Promise<Run>
|
|
647
|
+
/** Explicitly cancels the server run and waits for finalization. */
|
|
648
|
+
cancelRun(runId: string, options?: RequestOptions): Promise<Run>
|
|
649
|
+
waitForRun(
|
|
650
|
+
runId: string,
|
|
651
|
+
options?: {
|
|
652
|
+
/** Finite positive delay between polls; defaults to 250 milliseconds. */
|
|
653
|
+
pollIntervalMs?: number
|
|
654
|
+
/** Returns a still-running run when it needs attention; defaults to false. */
|
|
655
|
+
returnOnAttention?: boolean
|
|
656
|
+
/** Stops local waiting without cancelling the run. */
|
|
657
|
+
signal?: AbortSignal
|
|
658
|
+
/** Total wait budget; omitted means no total deadline. Each poll retains requestTimeoutMs. */
|
|
659
|
+
timeoutMs?: number
|
|
660
|
+
}
|
|
661
|
+
): Promise<Run>
|
|
662
|
+
listArtifacts(sessionId: string, options?: RequestOptions): Promise<Artifact[]>
|
|
663
|
+
downloadArtifact(artifactId: string, options?: RequestOptions): Promise<Response>
|
|
664
|
+
events(options?: {
|
|
665
|
+
idleTimeoutMs?: number
|
|
666
|
+
signal?: AbortSignal
|
|
667
|
+
WebSocket?: typeof globalThis.WebSocket
|
|
668
|
+
}): AsyncIterable<TaskEvent> & { ready: Promise<void> }
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export function connectToOpenScience(options?: {
|
|
672
|
+
configRoot?: string
|
|
673
|
+
env?: Record<string, string | undefined>
|
|
674
|
+
fetch?: typeof globalThis.fetch
|
|
675
|
+
requestTimeoutMs?: number
|
|
676
|
+
signal?: AbortSignal
|
|
677
|
+
}): Promise<OpenScienceClient>
|