@makinbakin/sdk 0.0.1-rc.20 → 0.0.1-rc.21
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/_internal/app/components/agent-select.d.ts +10 -1
- package/_internal/app/components/asset-picker.d.ts +25 -0
- package/_internal/app/components/charts/bar-chart.d.ts +16 -0
- package/_internal/app/components/charts/chart-data-table.d.ts +31 -0
- package/_internal/app/components/charts/chart-explainer.d.ts +9 -0
- package/_internal/app/components/charts/chart-tooltip.d.ts +8 -0
- package/_internal/app/components/charts/line-chart.d.ts +13 -0
- package/_internal/app/components/charts/palette.d.ts +24 -0
- package/_internal/app/components/charts/sparkline.d.ts +12 -0
- package/_internal/app/components/charts/stacked-column-chart.d.ts +40 -0
- package/_internal/app/components/confirm-dialog.d.ts +23 -2
- package/_internal/app/components/conversation/activity-group.d.ts +15 -0
- package/_internal/app/components/conversation/agent-turn.d.ts +36 -0
- package/_internal/app/components/conversation/attention.d.ts +56 -0
- package/_internal/app/components/conversation/composer.d.ts +35 -0
- package/_internal/app/components/conversation/conversation-empty-state.d.ts +8 -0
- package/_internal/app/components/conversation/conversation-panel.d.ts +33 -0
- package/_internal/app/components/conversation/conversation.d.ts +14 -0
- package/_internal/app/components/conversation/fold.d.ts +129 -0
- package/_internal/app/components/conversation/notification-sound.d.ts +8 -0
- package/_internal/app/components/conversation/relative-time.d.ts +8 -0
- package/_internal/app/components/conversation/reply-toast.d.ts +15 -0
- package/_internal/app/components/conversation/thread-id.d.ts +8 -0
- package/_internal/app/components/conversation/tool-call-drawer.d.ts +7 -0
- package/_internal/app/components/conversation/turn-recorder.d.ts +37 -0
- package/_internal/app/components/conversation/use-conversation-attention.d.ts +64 -0
- package/_internal/app/components/conversation/use-conversation-thread.d.ts +55 -0
- package/_internal/app/components/conversation/user-message.d.ts +11 -0
- package/_internal/app/components/danger-zone.d.ts +28 -0
- package/_internal/app/components/empty-state.d.ts +5 -2
- package/_internal/app/components/plugin-header.d.ts +4 -3
- package/_internal/app/components/save-bar.d.ts +32 -0
- package/_internal/app/components/score-overlay.d.ts +33 -0
- package/_internal/app/components/search-degraded-chip.d.ts +4 -0
- package/_internal/app/components/search-partial-chip.d.ts +13 -0
- package/_internal/app/components/search-unavailable.d.ts +12 -0
- package/_internal/app/components/section-card.d.ts +22 -0
- package/_internal/app/components/segmented-control.d.ts +28 -0
- package/_internal/app/components/stat-tile.d.ts +26 -0
- package/_internal/app/components/status-badge.d.ts +19 -0
- package/_internal/app/components/turn-output-view.d.ts +57 -0
- package/_internal/app/components/ui/button.d.ts +1 -1
- package/_internal/app/components/underline-tabs.d.ts +6 -2
- package/_internal/app/components/unsaved-changes-guard.d.ts +34 -0
- package/_internal/app/core/conversation-turns.d.ts +148 -0
- package/_internal/app/core/logger.d.ts +1 -0
- package/_internal/app/hooks/use-file-drop.d.ts +25 -0
- package/_internal/app/hooks/use-history-back.d.ts +1 -0
- package/_internal/app/hooks/use-json-fetch.d.ts +5 -0
- package/_internal/app/hooks/use-query-state.d.ts +2 -0
- package/_internal/app/hooks/use-schedule.d.ts +45 -0
- package/_internal/app/hooks/use-search.d.ts +27 -8
- package/_internal/app/hooks/use-toast.d.ts +3 -3
- package/_internal/app/lib/browser-notify.d.ts +12 -1
- package/_internal/core/adapters/runtime/concepts.d.ts +547 -49
- package/_internal/core/adapters/runtime/errors.d.ts +13 -1
- package/_internal/core/adapters/runtime/helpers.d.ts +19 -0
- package/_internal/core/adapters/runtime/index.d.ts +5 -2
- package/_internal/core/adapters/runtime/testing.d.ts +79 -0
- package/_internal/core/adapters/runtime/turn-activity.d.ts +23 -0
- package/_internal/core/adapters/shared.d.ts +122 -12
- package/_internal/core/content-dir.d.ts +8 -0
- package/_internal/core/docs/route.d.ts +1 -1
- package/_internal/core/format/structured.d.ts +44 -0
- package/_internal/core/format.d.ts +5 -1
- package/_internal/core/media/downscale.d.ts +18 -0
- package/_internal/core/media/sharp-loader.d.ts +36 -0
- package/_internal/core/plugin-types.d.ts +102 -39
- package/_internal/core/routing/define.d.ts +26 -3
- package/_internal/core/routing/dispatcher.d.ts +15 -6
- package/_internal/core/routing/index.d.ts +1 -1
- package/_internal/core/routing/types.d.ts +13 -70
- package/_internal/core/storage/atomic-write.d.ts +11 -0
- package/_internal/core/tasks/store.d.ts +129 -0
- package/_internal/core/tasks/testing.d.ts +2 -0
- package/_internal/{plugins/workflows/lib → core/workflows}/notification-channel-registry.d.ts +1 -1
- package/_internal/plugins/team/types.d.ts +47 -0
- package/_internal/plugins/workflows/hooks/use-notification-channels.d.ts +1 -1
- package/components/index.d.ts +87 -19
- package/components/index.js +32904 -15368
- package/hooks/index.d.ts +24 -4
- package/hooks/index.js +837 -561
- package/hooks/router.d.ts +20 -4
- package/index.d.ts +5 -50
- package/index.js +223 -406
- package/internal/index.d.ts +70 -0
- package/internal/index.js +409 -0
- package/package.json +9 -2
- package/register.d.ts +19 -1
- package/routing/index.js +175 -147
- package/slots/index.js +20 -1
- package/testing/index.d.ts +122 -0
- package/testing/index.js +21874 -0
- package/types/index.d.ts +4 -0
- package/types/index.js +16 -0
- package/utils/index.d.ts +28 -25
- package/utils/index.js +279 -263
- package/_internal/app/components/integrated-brainstorm/activity.d.ts +0 -23
- package/_internal/app/components/integrated-brainstorm/collapsed-header.d.ts +0 -14
- package/_internal/app/components/integrated-brainstorm/empty-state.d.ts +0 -5
- package/_internal/app/components/integrated-brainstorm/index.d.ts +0 -8
- package/_internal/app/components/integrated-brainstorm/input-row.d.ts +0 -16
- package/_internal/app/components/integrated-brainstorm/message-list.d.ts +0 -8
- package/_internal/app/components/integrated-brainstorm/session.d.ts +0 -16
- package/_internal/app/components/integrated-brainstorm/sse.d.ts +0 -8
- package/_internal/app/components/integrated-brainstorm/thinking-indicator.d.ts +0 -19
- package/_internal/app/components/integrated-brainstorm/types.d.ts +0 -63
- package/_internal/app/components/integrated-brainstorm/use-auto-grow.d.ts +0 -6
- package/_internal/app/components/integrated-brainstorm/use-brainstorm-state.d.ts +0 -21
- /package/_internal/{plugins/models → app}/hooks/use-available-models.d.ts +0 -0
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AdapterInitOpts, MessageUsage, RuntimeExecToolProvider, Unsubscribe } from '../shared';
|
|
2
|
+
import type { ActivityClass } from '@makinbakin/sdk/types';
|
|
2
3
|
import type { ChannelCapability } from './capabilities';
|
|
4
|
+
export type { MessageUsage } from '../shared';
|
|
3
5
|
export type RuntimeMetadata = Record<string, unknown>;
|
|
4
6
|
export interface RuntimeAgent {
|
|
5
7
|
id: string;
|
|
6
8
|
name: string;
|
|
7
9
|
role?: string;
|
|
8
10
|
model?: string;
|
|
11
|
+
/** Model this agent's spawned subagents use (runtimes with a subagent concept). */
|
|
12
|
+
subagentModel?: string;
|
|
9
13
|
status?: 'active' | 'inactive' | 'unknown';
|
|
10
14
|
metadata?: RuntimeMetadata;
|
|
11
15
|
}
|
|
@@ -19,14 +23,12 @@ export interface CreateRuntimeAgentInput {
|
|
|
19
23
|
export interface UpdateRuntimeAgentInput {
|
|
20
24
|
name?: string;
|
|
21
25
|
role?: string;
|
|
22
|
-
|
|
26
|
+
/** `null` clears the assignment (agent falls back to the routing default). */
|
|
27
|
+
model?: string | null;
|
|
28
|
+
/** `null` clears. Reject via routingSupport().perAgentSubagentModel=false runtimes. */
|
|
29
|
+
subagentModel?: string | null;
|
|
23
30
|
metadata?: RuntimeMetadata;
|
|
24
31
|
}
|
|
25
|
-
export interface RuntimePermissionPatch {
|
|
26
|
-
allow?: string[];
|
|
27
|
-
deny?: string[];
|
|
28
|
-
replace?: boolean;
|
|
29
|
-
}
|
|
30
32
|
export interface RuntimeAllowlistPatch {
|
|
31
33
|
add?: string[];
|
|
32
34
|
remove?: string[];
|
|
@@ -38,26 +40,81 @@ export interface WorkspaceFile {
|
|
|
38
40
|
updatedAt?: string;
|
|
39
41
|
metadata?: RuntimeMetadata;
|
|
40
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Size stats for one file the runtime loads at session start. Names + sizes
|
|
45
|
+
* only — content never crosses the adapter boundary (#357). `kind` is
|
|
46
|
+
* classified by the adapter so callers never re-derive runtime-private
|
|
47
|
+
* file conventions.
|
|
48
|
+
*/
|
|
49
|
+
export interface WorkspaceFileStat {
|
|
50
|
+
/** Path relative to the agent's workspace root (e.g. 'AGENTS.md', 'skills/foo/SKILL.md'). */
|
|
51
|
+
name: string;
|
|
52
|
+
bytes: number;
|
|
53
|
+
mtimeMs: number;
|
|
54
|
+
kind: 'canonical' | 'skill' | 'memory';
|
|
55
|
+
}
|
|
41
56
|
export type RuntimeMessageToolsMode = 'auto' | 'none';
|
|
42
57
|
export interface RuntimeMessageToolPolicy {
|
|
43
58
|
/**
|
|
44
59
|
* Controls whether runtime-native tools are available for this agent turn.
|
|
45
60
|
* `none` disables tools. Omit or use `auto` for runtime/provider defaults.
|
|
61
|
+
* Native tool policy beyond on/off is ADAPTER-PRIVATE — callers never name
|
|
62
|
+
* native tools.
|
|
46
63
|
*/
|
|
47
64
|
toolsMode?: RuntimeMessageToolsMode;
|
|
48
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Per-turn allowlist of BAKIN EXEC TOOLS by exact name (e.g.
|
|
67
|
+
* `bakin_exec_tasks_get`). Scope is the exec-tool set ONLY — never
|
|
68
|
+
* runtime-native tools (audit M3: OpenClaw once forwarded these as native
|
|
69
|
+
* policy while Pi filtered exec tools, so `toolsAllow: ['read']` meant two
|
|
70
|
+
* different things). Enforcement is mechanism-dependent: in-process
|
|
71
|
+
* runtimes filter the tool bridge per turn; runtimes whose exec tools ride
|
|
72
|
+
* session-static transports (OpenClaw's per-agent MCP servers) cannot
|
|
73
|
+
* filter per-turn and must IGNORE the fields with a loud warning — never
|
|
74
|
+
* misapply them to native tools.
|
|
75
|
+
*/
|
|
49
76
|
toolsAllow?: string[];
|
|
50
|
-
/**
|
|
77
|
+
/** Per-turn denylist of Bakin exec tools by exact name (same scope/enforcement as `toolsAllow`). */
|
|
51
78
|
toolsDeny?: string[];
|
|
52
79
|
}
|
|
80
|
+
/** Local file offered to the runtime as model input for one turn. */
|
|
81
|
+
export interface MessageAttachment {
|
|
82
|
+
path: string;
|
|
83
|
+
mimeType: string;
|
|
84
|
+
}
|
|
53
85
|
export interface MessageArgs extends RuntimeMessageToolPolicy {
|
|
54
86
|
agentId: string;
|
|
55
87
|
content: string;
|
|
88
|
+
/** Producer-assigned usage class; omitted interactive turns default to user. */
|
|
89
|
+
activityClass?: ActivityClass;
|
|
90
|
+
/**
|
|
91
|
+
* Image attachments for the turn (runtime support is declared by
|
|
92
|
+
* `capabilities().imageInput`; adapters reject unsupported media loudly
|
|
93
|
+
* rather than silently dropping pixels).
|
|
94
|
+
*/
|
|
95
|
+
attachments?: MessageAttachment[];
|
|
96
|
+
/**
|
|
97
|
+
* Utility turn: ask the runtime to suppress visible session side effects
|
|
98
|
+
* (control-UI visibility, prompt persistence) where it supports them.
|
|
99
|
+
* The thread still exists for idempotency; it just stays out of the way.
|
|
100
|
+
*/
|
|
101
|
+
ephemeral?: boolean;
|
|
56
102
|
/**
|
|
57
103
|
* Adapter-neutral durable conversation key. Runtime adapters should map the
|
|
58
104
|
* same agentId + threadId pair to the same provider/runtime session.
|
|
59
105
|
*/
|
|
60
106
|
threadId?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Absolute path of a per-run working directory for this turn. Set ONLY by
|
|
109
|
+
* dispatch, only for runtimes declaring `concurrency.sameAgentTurns:
|
|
110
|
+
* 'isolated'` — core allocates the dir (under Bakin territory, never the
|
|
111
|
+
* runtime's home) and the adapter uses it as the session cwd, seeding its
|
|
112
|
+
* own context conventions (project context, skills, memory write paths) so
|
|
113
|
+
* the isolated turn loses nothing. Chat and ephemeral/system sends never
|
|
114
|
+
* carry it: the agent's shared workspace stays their cwd. Adapters that
|
|
115
|
+
* declare 'serialized' never receive the field.
|
|
116
|
+
*/
|
|
117
|
+
runWorkspace?: string;
|
|
61
118
|
/**
|
|
62
119
|
* Per-turn model override (`provider/model` id). Omit to use the agent's
|
|
63
120
|
* configured model. The caller (Bakin's routing policy) resolves it.
|
|
@@ -67,20 +124,43 @@ export interface MessageArgs extends RuntimeMessageToolPolicy {
|
|
|
67
124
|
* Per-turn thinking level. Omit to use the runtime/agent default.
|
|
68
125
|
*/
|
|
69
126
|
thinking?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Best-effort turn cancellation. On abort, adapters MUST reject the send
|
|
129
|
+
* promptly with RuntimeError kind 'aborted' and SHOULD cancel the
|
|
130
|
+
* provider-side run where the runtime supports it (fail-open: a provider
|
|
131
|
+
* that can't cancel still gets the local rejection).
|
|
132
|
+
*/
|
|
133
|
+
signal?: AbortSignal;
|
|
134
|
+
/**
|
|
135
|
+
* Best-effort live-activity tap for a `send()` turn (prelaunch-hardening
|
|
136
|
+
* R7/D-plan-1): invoked with `tool` and `status` chunks as the runtime
|
|
137
|
+
* surfaces them — text deltas do NOT flow here (use `messaging.stream`
|
|
138
|
+
* to render prose live). No delivery guarantee, no chunk is required to
|
|
139
|
+
* appear, and no ordering guarantee relative to the send() settle (a
|
|
140
|
+
* late-arriving frame may tap after the promise resolves). Adapters
|
|
141
|
+
* contain callback exceptions — a throwing tap never fails the turn.
|
|
142
|
+
* Ignored by `messaging.stream`, whose iterator already carries chunks.
|
|
143
|
+
*/
|
|
144
|
+
onActivity?: (chunk: ChatChunk) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Byte threshold above which a died turn's completion counts as
|
|
147
|
+
* "oversized output" in its RuntimeTurnDiagnosis (the recovery ladder
|
|
148
|
+
* treats runaway-output deaths differently from ordinary interrupts).
|
|
149
|
+
* Dispatch passes `settings.dispatch.oversizedOutputBytes`; adapters fall
|
|
150
|
+
* back to their own default (128 KiB) when omitted. Typed here — NOT a
|
|
151
|
+
* metadata-bag key (audit M4: core policy must never ride the opaque bag).
|
|
152
|
+
*/
|
|
153
|
+
oversizedOutputBytes?: number;
|
|
70
154
|
metadata?: RuntimeMetadata;
|
|
71
155
|
}
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
cacheWrite?: number;
|
|
81
|
-
/** Resolved model the runtime ran, when known. */
|
|
82
|
-
model?: string;
|
|
83
|
-
}
|
|
156
|
+
/**
|
|
157
|
+
* Fallback for `MessageArgs.oversizedOutputBytes` when the caller omits it —
|
|
158
|
+
* THE single source both adapters and `settings.dispatch.oversizedOutputBytes`
|
|
159
|
+
* default from (previously duplicated per adapter; parity by reference, not
|
|
160
|
+
* by copy). Both adapters measure the same thing: UTF-8 bytes of the turn's
|
|
161
|
+
* assistant output text, strict `>`.
|
|
162
|
+
*/
|
|
163
|
+
export declare const DEFAULT_OVERSIZED_OUTPUT_BYTES: number;
|
|
84
164
|
export interface MessageResult {
|
|
85
165
|
id: string;
|
|
86
166
|
content?: string;
|
|
@@ -100,19 +180,69 @@ export interface RuntimeToolActivity {
|
|
|
100
180
|
exitCode?: number;
|
|
101
181
|
metadata?: RuntimeMetadata;
|
|
102
182
|
}
|
|
103
|
-
|
|
104
|
-
|
|
183
|
+
/** Render format for a text chunk's content. Absent means 'markdown'. */
|
|
184
|
+
export type ChatTextFormat = 'markdown' | 'plain' | 'code';
|
|
185
|
+
/**
|
|
186
|
+
* One chunk of a streaming agent turn — the turn-output normalization
|
|
187
|
+
* contract every adapter emits and every consumer renders against.
|
|
188
|
+
*
|
|
189
|
+
* Behavioral contract (pinned today by the per-adapter suites —
|
|
190
|
+
* tests/adapter-openclaw/stream-events.test.ts and
|
|
191
|
+
* tests/integration/pi/turn.test.ts; the cross-adapter conformance suite
|
|
192
|
+
* lands with prelaunch-hardening PR 3):
|
|
193
|
+
* - Chunk GRANULARITY may vary by adapter: per-token deltas, coalesced
|
|
194
|
+
* spans, or one chunk per turn are all legal. Consumers accumulate
|
|
195
|
+
* `text` content in arrival order and must not assume a cadence.
|
|
196
|
+
* - `done` is yielded EXACTLY ONCE, always last; no chunk of any kind
|
|
197
|
+
* follows it.
|
|
198
|
+
* - A DELIBERATE abort (the turn's `kind:'aborted'` settle) ends the
|
|
199
|
+
* stream with a clean `done` — never an `error` chunk. Abort is a
|
|
200
|
+
* clean end, not a failure.
|
|
201
|
+
* - `tool` and `status` chunks are BEST-EFFORT liveness: adapters emit
|
|
202
|
+
* what their runtime exposes, and none is guaranteed to appear.
|
|
203
|
+
* - Terminal failure ends the stream with an `error` chunk (its `data`
|
|
204
|
+
* carries `{ kind }` — the RuntimeError kind — when known) and NO
|
|
205
|
+
* `done`; the iterator itself never throws.
|
|
206
|
+
* - Adapters emit CLASSIFIED, STRUCTURED chunks only — never
|
|
207
|
+
* pre-rendered HTML/ANSI or raw JSON/shell dumps in `content`.
|
|
208
|
+
* Stripping runtime-specific noise is the adapter's job.
|
|
209
|
+
*/
|
|
210
|
+
export type ChatChunk =
|
|
211
|
+
/** Assistant text. `format` hints rendering; absent = markdown. */
|
|
212
|
+
{
|
|
213
|
+
type: 'text';
|
|
214
|
+
content: string;
|
|
215
|
+
format?: ChatTextFormat;
|
|
216
|
+
data?: RuntimeMetadata;
|
|
217
|
+
}
|
|
218
|
+
/** Tool activity; `data` is always the structured RuntimeToolActivity. */
|
|
219
|
+
| {
|
|
220
|
+
type: 'tool';
|
|
105
221
|
content?: string;
|
|
106
|
-
data
|
|
222
|
+
data: RuntimeToolActivity;
|
|
107
223
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
recoverable: boolean;
|
|
114
|
-
};
|
|
224
|
+
/** Turn lifecycle hint (e.g. 'thinking'). */
|
|
225
|
+
| {
|
|
226
|
+
type: 'status';
|
|
227
|
+
content?: string;
|
|
228
|
+
data?: RuntimeMetadata;
|
|
115
229
|
}
|
|
230
|
+
/** Clean turn end (success or deliberate abort) — exactly once, always last.
|
|
231
|
+
* `usage` carries the turn's token accounting when the runtime reports it —
|
|
232
|
+
* parity with `send()`: a runtime whose send results carry usage must
|
|
233
|
+
* attach it here too (conformance-pinned), so streamed turns are meterable. */
|
|
234
|
+
| {
|
|
235
|
+
type: 'done';
|
|
236
|
+
content?: string;
|
|
237
|
+
data?: RuntimeMetadata;
|
|
238
|
+
usage?: MessageUsage;
|
|
239
|
+
}
|
|
240
|
+
/** Terminal failure — `data.kind` carries the RuntimeError kind when known. */
|
|
241
|
+
| {
|
|
242
|
+
type: 'error';
|
|
243
|
+
content?: string;
|
|
244
|
+
data?: RuntimeMetadata;
|
|
245
|
+
};
|
|
116
246
|
export interface ChannelInfo {
|
|
117
247
|
id: string;
|
|
118
248
|
platform: string;
|
|
@@ -163,6 +293,28 @@ export interface ContentDeliveryArgs {
|
|
|
163
293
|
metadata?: RuntimeMetadata;
|
|
164
294
|
};
|
|
165
295
|
}
|
|
296
|
+
export interface CreateThreadArgs {
|
|
297
|
+
/** Channel ref the anchor message lives in (provider or provider:target). */
|
|
298
|
+
channel: string;
|
|
299
|
+
/** Delivery ref of the message to anchor the thread to (e.g. "message:<id>"). */
|
|
300
|
+
messageRef?: string;
|
|
301
|
+
name: string;
|
|
302
|
+
}
|
|
303
|
+
export interface CreatedThread {
|
|
304
|
+
threadId: string;
|
|
305
|
+
/**
|
|
306
|
+
* Provider-addressable channel ref for posting INTO the thread (opaque to
|
|
307
|
+
* callers — provider target syntax stays inside the adapter).
|
|
308
|
+
*/
|
|
309
|
+
channelRef: string;
|
|
310
|
+
}
|
|
311
|
+
export interface EditChannelMessageArgs {
|
|
312
|
+
/** Channel ref the message lives in (provider or provider:target). */
|
|
313
|
+
channel: string;
|
|
314
|
+
/** Delivery ref of the message to edit (e.g. "message:<id>"). */
|
|
315
|
+
messageRef: string;
|
|
316
|
+
body: string;
|
|
317
|
+
}
|
|
166
318
|
export interface ApprovalOption {
|
|
167
319
|
id: string;
|
|
168
320
|
label: string;
|
|
@@ -264,6 +416,12 @@ export interface RuntimeSessionStoreStats {
|
|
|
264
416
|
fileCount: number;
|
|
265
417
|
/** Total bytes of the agent's sessions directory, subtrees included. */
|
|
266
418
|
diskBytes: number;
|
|
419
|
+
/**
|
|
420
|
+
* Adapter-owned operator guidance for shrinking this agent's store (CLI
|
|
421
|
+
* commands, config knobs). Health surfaces render it verbatim — provider
|
|
422
|
+
* specifics belong HERE, never hardcoded upstream of the adapter.
|
|
423
|
+
*/
|
|
424
|
+
remediation?: string;
|
|
267
425
|
}
|
|
268
426
|
export interface RuntimeMemoryTier {
|
|
269
427
|
id: string;
|
|
@@ -304,6 +462,177 @@ export interface RuntimeMemorySearchResult {
|
|
|
304
462
|
results: unknown[];
|
|
305
463
|
metadata?: RuntimeMetadata;
|
|
306
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* What the runtime's ACTIVE configuration can accept as model input
|
|
467
|
+
* (spec: enrichment-runtime-fallback §3). Adapter-declared from the
|
|
468
|
+
* runtime's own model catalog for the SELECTED agent's effective model
|
|
469
|
+
* (default: the main agent) — conservative false on any ambiguity, never
|
|
470
|
+
* model-name heuristics.
|
|
471
|
+
*/
|
|
472
|
+
export interface RuntimeCapabilities {
|
|
473
|
+
imageInput: boolean;
|
|
474
|
+
audioInput: boolean;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* One capability's provisioning state on a runtime:
|
|
478
|
+
* - 'native' — the runtime provides it directly.
|
|
479
|
+
* - 'shimmed' — the runtime doesn't, but a Bakin-owned shim fills it.
|
|
480
|
+
* - 'unavailable' — neither; degrade honestly + surface in the UI.
|
|
481
|
+
*/
|
|
482
|
+
export type CapabilityMode = 'native' | 'shimmed' | 'unavailable';
|
|
483
|
+
/**
|
|
484
|
+
* How agents on this runtime invoke Bakin exec tools:
|
|
485
|
+
* - 'in-process' — exec tools are first-class session tools; the agent calls
|
|
486
|
+
* `bakin_exec_*` directly (Pi's in-process bridge).
|
|
487
|
+
* - 'mcp' — the runtime's native MCP client reaches Bakin's MCP server;
|
|
488
|
+
* tools appear namespaced as `<mcpServerTemplate>.<tool>`.
|
|
489
|
+
* - 'cli-shim' — the agent shells `<shimCommand>` (inert extension point for
|
|
490
|
+
* a future runtime that can neither embed nor speak MCP).
|
|
491
|
+
*/
|
|
492
|
+
export type ToolAccessStyle = 'in-process' | 'mcp' | 'cli-shim';
|
|
493
|
+
export interface RuntimeToolAccess {
|
|
494
|
+
style: ToolAccessStyle;
|
|
495
|
+
/** 'mcp': per-agent server-name template, e.g. `bakin-<agent>`. */
|
|
496
|
+
mcpServerTemplate?: string;
|
|
497
|
+
/** 'cli-shim': shell command template. */
|
|
498
|
+
shimCommand?: string;
|
|
499
|
+
/** One canonical, style-appropriate example call. */
|
|
500
|
+
example?: string;
|
|
501
|
+
/**
|
|
502
|
+
* Whether this runtime can ENFORCE `MessageArgs.toolsAllow`/`toolsDeny`
|
|
503
|
+
* per turn. In-process runtimes filter their tool bridge per call (true);
|
|
504
|
+
* runtimes whose exec tools ride session-static transports (OpenClaw's
|
|
505
|
+
* per-agent MCP servers) cannot (false) — they ignore the fields with a
|
|
506
|
+
* loud warning. Callers needing a RESTRICTED turn must feature-detect
|
|
507
|
+
* this and refuse rather than degrade fail-open.
|
|
508
|
+
*/
|
|
509
|
+
perTurnExecToolFiltering?: boolean;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Result of `verifyToolAccess()` — a runtime-neutral report on whether this
|
|
513
|
+
* runtime's tool-access wiring is currently in place, so core (onboarding,
|
|
514
|
+
* doctor) can surface drift WITHOUT knowing any provider's config shape.
|
|
515
|
+
* `in-process` runtimes report `ok: true` with no issues (nothing to
|
|
516
|
+
* provision); `mcp` runtimes report missing/stale server entries.
|
|
517
|
+
*/
|
|
518
|
+
export interface ToolAccessProvisioningStatus {
|
|
519
|
+
style: ToolAccessStyle;
|
|
520
|
+
ok: boolean;
|
|
521
|
+
/** Human-readable drift descriptions when `ok` is false. */
|
|
522
|
+
issues: string[];
|
|
523
|
+
details?: Record<string, unknown>;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* The unified capability declaration — every runtime-provided capability that
|
|
527
|
+
* has a native/shim/gap choice. Bakin renders agent instructions from it,
|
|
528
|
+
* routes to shims when `shimmed`, degrades honestly when `unavailable`, and
|
|
529
|
+
* plugins query it instead of assuming. Always-Bakin-owned capabilities
|
|
530
|
+
* (scheduling, heartbeats, tasks, assets, audit) are NOT here — they have no
|
|
531
|
+
* native/shim choice. `input` folds in the former modality-only capabilities.
|
|
532
|
+
*/
|
|
533
|
+
export interface CapabilitySet {
|
|
534
|
+
toolCalling: {
|
|
535
|
+
mode: 'native';
|
|
536
|
+
access: RuntimeToolAccess;
|
|
537
|
+
};
|
|
538
|
+
delivery: {
|
|
539
|
+
mode: CapabilityMode;
|
|
540
|
+
};
|
|
541
|
+
imageGen: {
|
|
542
|
+
mode: CapabilityMode;
|
|
543
|
+
};
|
|
544
|
+
memory: {
|
|
545
|
+
mode: 'native' | 'unavailable';
|
|
546
|
+
};
|
|
547
|
+
sessions: {
|
|
548
|
+
mode: 'native' | 'unavailable';
|
|
549
|
+
};
|
|
550
|
+
workspaceFiles: {
|
|
551
|
+
mode: 'native' | 'unavailable';
|
|
552
|
+
};
|
|
553
|
+
input: RuntimeCapabilities;
|
|
554
|
+
/**
|
|
555
|
+
* Can two turns for ONE agent run simultaneously without colliding?
|
|
556
|
+
* - 'isolated' — the adapter honors `MessageArgs.runWorkspace` (per-turn
|
|
557
|
+
* cwd), so concurrent same-agent turns each work in their
|
|
558
|
+
* own directory; parallel-safe.
|
|
559
|
+
* - 'serialized' — the adapter/provider cannot isolate runs (one shared
|
|
560
|
+
* workspace per agent); dispatch clamps that agent to one
|
|
561
|
+
* turn at a time regardless of settings, with a visible
|
|
562
|
+
* receipt — never a silent drop.
|
|
563
|
+
* Conformance-pinned: declaring 'isolated' without actually honoring
|
|
564
|
+
* runWorkspace fails the runtime conformance suite.
|
|
565
|
+
*/
|
|
566
|
+
concurrency: {
|
|
567
|
+
sameAgentTurns: 'isolated' | 'serialized';
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Presence-only credential report (P2.2): WHICH LLM providers and channels
|
|
572
|
+
* have usable credentials configured in the runtime — names only, NEVER
|
|
573
|
+
* secret material. Drives the onboarding llm/channels checks; each adapter
|
|
574
|
+
* reads its own config internally so credential shapes never leak upstream.
|
|
575
|
+
*/
|
|
576
|
+
/**
|
|
577
|
+
* Presence-only credential KIND: 'api-key' = metered pay-per-use billing;
|
|
578
|
+
* 'oauth' = subscription login (plan quota). An entry carrying both reports
|
|
579
|
+
* 'api-key' — the key is what the provider bills. Never carries values.
|
|
580
|
+
*/
|
|
581
|
+
export type RuntimeCredentialKind = 'api-key' | 'oauth';
|
|
582
|
+
export interface RuntimeCredentialStatus {
|
|
583
|
+
/** Provider names with usable credentials (api key / token / OAuth). */
|
|
584
|
+
llmProviders: string[];
|
|
585
|
+
/**
|
|
586
|
+
* Per-provider credential kind (billing-lane detection, cost-control v2).
|
|
587
|
+
* Optional — consumers treat absence as unknown and stay conservative
|
|
588
|
+
* (unknown bills as metered, never silently uncapped-as-free).
|
|
589
|
+
*/
|
|
590
|
+
llmCredentials?: Array<{
|
|
591
|
+
provider: string;
|
|
592
|
+
kind: RuntimeCredentialKind;
|
|
593
|
+
}>;
|
|
594
|
+
/** Channel names with usable credentials. Empty on channel-less runtimes. */
|
|
595
|
+
channels: string[];
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Runtime-owned model routing policy (P2.3): the knobs the RUNTIME honors at
|
|
599
|
+
* session time — default model for agents without an assignment, failover
|
|
600
|
+
* order, subagent default, alias map. Bakin manages these through this
|
|
601
|
+
* neutral surface; each adapter maps to its native store, so a runtime's
|
|
602
|
+
* policy survives untouched while another runtime is active (round-trip by
|
|
603
|
+
* construction).
|
|
604
|
+
*/
|
|
605
|
+
export interface RuntimeRoutingPolicy {
|
|
606
|
+
/** Default model for agents without an explicit assignment. '' when unset. */
|
|
607
|
+
defaultModel: string;
|
|
608
|
+
/** Failover models tried in order when the default fails. */
|
|
609
|
+
fallbackModels: string[];
|
|
610
|
+
/** Default model for spawned subagents. Null when unset/unsupported. */
|
|
611
|
+
defaultSubagentModel: string | null;
|
|
612
|
+
/** Alias name → target model id. */
|
|
613
|
+
aliases: Record<string, string>;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Which routing-policy fields this runtime actually HONORS. Static
|
|
617
|
+
* declaration (like describeToolAccess): UIs hide unsupported controls and
|
|
618
|
+
* `setRoutingPolicy` rejects patches carrying unsupported fields — a knob
|
|
619
|
+
* the runtime ignores must never be silently stored.
|
|
620
|
+
*/
|
|
621
|
+
export interface RuntimeRoutingSupport {
|
|
622
|
+
defaultModel: boolean;
|
|
623
|
+
fallbackModels: boolean;
|
|
624
|
+
defaultSubagentModel: boolean;
|
|
625
|
+
aliases: boolean;
|
|
626
|
+
/** Per-agent subagentModel via agents.update. */
|
|
627
|
+
perAgentSubagentModel: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Per-turn thinking levels this runtime HONORS on messaging.send. Bakin's
|
|
630
|
+
* routing layer clamps requested levels to this set (with receipt + audit
|
|
631
|
+
* evidence) before the send — an adapter must honor every level it
|
|
632
|
+
* declares and declare every level it honors (conformance-pinned).
|
|
633
|
+
*/
|
|
634
|
+
supportedThinkingLevels: readonly string[];
|
|
635
|
+
}
|
|
307
636
|
export interface RuntimeAvailableModel {
|
|
308
637
|
id: string;
|
|
309
638
|
name?: string;
|
|
@@ -409,6 +738,40 @@ export interface RuntimeImagesAccess {
|
|
|
409
738
|
generate(input: RuntimeImageGenerateInput): Promise<RuntimeImageGenerationResult>;
|
|
410
739
|
edit(input: RuntimeImageEditInput): Promise<RuntimeImageGenerationResult>;
|
|
411
740
|
}
|
|
741
|
+
/**
|
|
742
|
+
* A runtime extension: third-party code the RUNTIME loads in-process during
|
|
743
|
+
* agent turns (Pi extensions today). Provider-neutral shape — ids/labels/
|
|
744
|
+
* paths only, never provider config. Discovery is INERT: listing never
|
|
745
|
+
* executes extension code.
|
|
746
|
+
*/
|
|
747
|
+
export interface RuntimeExtensionInfo {
|
|
748
|
+
/** Stable identifier used for allow/revoke — the real absolute module path. */
|
|
749
|
+
id: string;
|
|
750
|
+
label: string;
|
|
751
|
+
/** Where it came from, human-readable (e.g. "npm:some-pkg", "extensions dir"). */
|
|
752
|
+
source: string;
|
|
753
|
+
/** Real absolute load path (symlinks resolved) — half the trust identity. */
|
|
754
|
+
path: string;
|
|
755
|
+
/** Current content hash of the file — the other half of the trust identity. */
|
|
756
|
+
sha256: string;
|
|
757
|
+
/**
|
|
758
|
+
* pending — discovered but NOT loaded into turns (unapproved, or its
|
|
759
|
+
* content changed since approval)
|
|
760
|
+
* allowed — approved path+hash; loads into agent turns
|
|
761
|
+
* blocked — policy mode 'none': nothing loads
|
|
762
|
+
*/
|
|
763
|
+
status: 'allowed' | 'pending' | 'blocked';
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* OPTIONAL: trust management for runtime-loaded extensions. Runtimes without
|
|
767
|
+
* an extension mechanism OMIT the member; callers feature-detect
|
|
768
|
+
* (`runtime.extensions?.`). Listing is read-only and inert. The trust store
|
|
769
|
+
* itself (allowlist) is Bakin-owned settings — see
|
|
770
|
+
* `src/core/runtime-extensions.ts` for the ONE mutation engine.
|
|
771
|
+
*/
|
|
772
|
+
export interface RuntimeExtensionsAccess {
|
|
773
|
+
list(): Promise<RuntimeExtensionInfo[]>;
|
|
774
|
+
}
|
|
412
775
|
export interface CronJob {
|
|
413
776
|
id: string;
|
|
414
777
|
name: string;
|
|
@@ -444,21 +807,48 @@ export interface RawCronSnapshot {
|
|
|
444
807
|
capturedAt: string;
|
|
445
808
|
snapshot: unknown;
|
|
446
809
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
810
|
+
/**
|
|
811
|
+
* URI scheme for runtime-private media references (`media://inbound/…`).
|
|
812
|
+
* The ONE place upstream code may learn the scheme: callers detect
|
|
813
|
+
* media references with this constant and hand them to `media.resolveUri`
|
|
814
|
+
* (feature-detected) — the adapter owns what the URI means.
|
|
815
|
+
*/
|
|
816
|
+
export declare const RUNTIME_MEDIA_URI_SCHEME = "media://";
|
|
453
817
|
export interface AgentRuntimeAdapter {
|
|
454
818
|
readonly name: string;
|
|
455
819
|
readonly version: string;
|
|
456
820
|
readonly requiredCoreVersion: string;
|
|
457
821
|
initialize(opts: AdapterInitOpts): Promise<void>;
|
|
458
822
|
shutdown(): Promise<void>;
|
|
823
|
+
/**
|
|
824
|
+
* "Can this runtime serve a turn?" — a CHEAP probe (an HTTP health hit, a
|
|
825
|
+
* credential-presence read; never an LLM call). Resolves `false` rather
|
|
826
|
+
* than throwing when the runtime cannot serve (unreachable process,
|
|
827
|
+
* uninitialized adapter, no LLM credentials). Deeper diagnostics are
|
|
828
|
+
* registered separately with the canonical Health registry.
|
|
829
|
+
*/
|
|
459
830
|
ping(): Promise<boolean>;
|
|
831
|
+
/**
|
|
832
|
+
* Re-read ALL durable config: credentials, model registry, settings,
|
|
833
|
+
* provisioned tool access. External-process runtimes may bounce the
|
|
834
|
+
* process; in-process runtimes must drop every cache so the next call
|
|
835
|
+
* re-reads disk. Callers (team/models plugins) invoke this after config
|
|
836
|
+
* writes and expect the next read to reflect them.
|
|
837
|
+
*/
|
|
460
838
|
restart(): Promise<void>;
|
|
461
|
-
|
|
839
|
+
/**
|
|
840
|
+
* CRUD error contract (R28): `get` returns `null` for a missing agent —
|
|
841
|
+
* absence is a value, never a throw. Mutations addressing a MISSING agent
|
|
842
|
+
* (`update`, `updateAllowlist`, `remove`) reject with a typed
|
|
843
|
+
* `RuntimeError` kind `'not_found'`. Workspace-file writes are exempt BY
|
|
844
|
+
* DESIGN: they provision the workspace directory on demand (creating an
|
|
845
|
+
* agent's first file is a legitimate provisioning step, not an error).
|
|
846
|
+
* Provider/runtime failures on these surfaces are typed `RuntimeError`s
|
|
847
|
+
* (adapters map them in their own errors module — core never classifies
|
|
848
|
+
* on message text); caller-INPUT validation (invalid names/paths,
|
|
849
|
+
* unsupported options) may throw plain `Error`s — those signal programmer
|
|
850
|
+
* error before any runtime interaction, not runtime state.
|
|
851
|
+
*/
|
|
462
852
|
agents: {
|
|
463
853
|
list(): Promise<RuntimeAgent[]>;
|
|
464
854
|
get(agentId: string): Promise<RuntimeAgent | null>;
|
|
@@ -469,17 +859,44 @@ export interface AgentRuntimeAdapter {
|
|
|
469
859
|
readWorkspaceFile(agentId: string, path: string): Promise<WorkspaceFile | null>;
|
|
470
860
|
writeWorkspaceFile(agentId: string, file: WorkspaceFile): Promise<void>;
|
|
471
861
|
removeWorkspaceFile(agentId: string, path: string): Promise<void>;
|
|
472
|
-
|
|
862
|
+
/**
|
|
863
|
+
* Read-only size stats for the files the runtime loads at session start
|
|
864
|
+
* (canonical bootstrap files, skills, memory notes). Null when the agent
|
|
865
|
+
* has no workspace. Optional: runtimes without a file-backed workspace
|
|
866
|
+
* omit it, and callers must treat absence as "stats unavailable" —
|
|
867
|
+
* skip, never error.
|
|
868
|
+
*/
|
|
869
|
+
workspaceFileStats?(agentId: string): Promise<WorkspaceFileStat[] | null>;
|
|
870
|
+
/**
|
|
871
|
+
* The SUBAGENT-DISPATCH allowlist: the patch strings are AGENT IDS this
|
|
872
|
+
* agent may dispatch subtasks to (P5.3 live incident: these were once fed
|
|
873
|
+
* into an exec-tool name filter — they are never tool names). OpenClaw
|
|
874
|
+
* writes `agents.list[].subagents.allowAgents` in its config; Pi stores
|
|
875
|
+
* the registry record's `allowlist`, consumed by its tool bridge when
|
|
876
|
+
* filtering subagent dispatch targets. Installer/team flows add every
|
|
877
|
+
* newly installed agent to its dispatchers here.
|
|
878
|
+
*/
|
|
473
879
|
updateAllowlist(agentId: string, patch: RuntimeAllowlistPatch): Promise<void>;
|
|
474
880
|
};
|
|
475
881
|
messaging: {
|
|
476
882
|
send(args: MessageArgs): Promise<MessageResult>;
|
|
883
|
+
/**
|
|
884
|
+
* Stream one agent turn as normalized ChatChunks. See the ChatChunk
|
|
885
|
+
* doc for the behavioral contract: adapter-varying granularity,
|
|
886
|
+
* `done` exactly once and last, best-effort tool/status liveness,
|
|
887
|
+
* terminal failure = `error` chunk then end (never a throw from
|
|
888
|
+
* iteration), classified/structured chunks only.
|
|
889
|
+
*/
|
|
477
890
|
stream(args: MessageArgs): AsyncIterable<ChatChunk>;
|
|
478
891
|
};
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
892
|
+
/**
|
|
893
|
+
* OPTIONAL capability (P2.1): runtimes without a channel/delivery layer
|
|
894
|
+
* (Pi) OMIT this member entirely — no throwing stubs. Callers MUST
|
|
895
|
+
* feature-detect (`runtime.channels?.…` or a guarded local) and degrade
|
|
896
|
+
* honestly: empty channel lists, log-only alerts, UI-only approval gates.
|
|
897
|
+
* `capabilities().delivery.mode` reports the same fact declaratively.
|
|
898
|
+
*/
|
|
899
|
+
channels?: {
|
|
483
900
|
list(): Promise<ChannelInfo[]>;
|
|
484
901
|
sendNotification(args: NotificationArgs): Promise<DeliveryResult>;
|
|
485
902
|
sendMessage(args: ChannelMessageArgs): Promise<DeliveryResult>;
|
|
@@ -489,6 +906,13 @@ export interface AgentRuntimeAdapter {
|
|
|
489
906
|
cancelApproval(args: CancelApprovalArgs): Promise<void>;
|
|
490
907
|
resolveApproval(args: ResolveApprovalArgs): Promise<void>;
|
|
491
908
|
subscribeApprovalResponses(handler: (event: ApprovalResolveEvent) => void): Unsubscribe;
|
|
909
|
+
/**
|
|
910
|
+
* Optional threading/editing capabilities. Adapters for providers without
|
|
911
|
+
* threads or message editing omit them; callers MUST feature-detect and
|
|
912
|
+
* fall back to flat channel messages — never error on absence.
|
|
913
|
+
*/
|
|
914
|
+
createThread?(args: CreateThreadArgs): Promise<CreatedThread | null>;
|
|
915
|
+
editMessage?(args: EditChannelMessageArgs): Promise<void>;
|
|
492
916
|
};
|
|
493
917
|
skills: {
|
|
494
918
|
list(agentId?: string): Promise<RuntimeSkill[]>;
|
|
@@ -533,19 +957,94 @@ export interface AgentRuntimeAdapter {
|
|
|
533
957
|
listAvailable(opts?: {
|
|
534
958
|
includeUnavailable?: boolean;
|
|
535
959
|
}): Promise<RuntimeAvailableModel[]>;
|
|
960
|
+
/** Static declaration of which routing-policy fields this runtime honors. */
|
|
961
|
+
routingSupport(): RuntimeRoutingSupport;
|
|
962
|
+
/** The runtime's current routing policy (unsupported fields empty). */
|
|
963
|
+
routingPolicy(): Promise<RuntimeRoutingPolicy>;
|
|
964
|
+
/**
|
|
965
|
+
* Merge a partial policy into the runtime's native store. MUST throw on
|
|
966
|
+
* a patch carrying a field `routingSupport()` declares unsupported.
|
|
967
|
+
* `reason` feeds the adapter's audit trail.
|
|
968
|
+
*/
|
|
969
|
+
setRoutingPolicy(patch: Partial<RuntimeRoutingPolicy>, reason: string): Promise<void>;
|
|
536
970
|
};
|
|
971
|
+
/**
|
|
972
|
+
* The unified capability declaration for this runtime, evaluated for
|
|
973
|
+
* `opts.agentId`'s effective model (default: the main agent) where
|
|
974
|
+
* model-dependent (input modality). Async: the report surface for the
|
|
975
|
+
* runtime-switch UI + plugin capability queries. `input` is conservative-
|
|
976
|
+
* false on any ambiguity, never model-name heuristics.
|
|
977
|
+
*
|
|
978
|
+
* Modes are HONEST: a static `'native'` declaration is acceptable only
|
|
979
|
+
* when the surface is unconditionally implemented (the standard the T28
|
|
980
|
+
* sessions fix restored — a declared-native stub is a contract violation,
|
|
981
|
+
* pinned by the runtime conformance suite's capability-honesty check).
|
|
982
|
+
*/
|
|
983
|
+
capabilities(opts?: {
|
|
984
|
+
agentId?: string;
|
|
985
|
+
}): Promise<CapabilitySet>;
|
|
986
|
+
/**
|
|
987
|
+
* How agents on this runtime invoke Bakin exec tools — drives the
|
|
988
|
+
* tool-usage wording of dispatch prompts + projected AGENTS.md. SYNC +
|
|
989
|
+
* static (declared wiring, not probed state) so it's callable from the
|
|
990
|
+
* synchronous prompt-assembly path; `capabilities().toolCalling.access`
|
|
991
|
+
* returns the same facts for the async report surface.
|
|
992
|
+
*/
|
|
993
|
+
describeToolAccess(): RuntimeToolAccess;
|
|
994
|
+
/**
|
|
995
|
+
* Presence-only credential report for the runtime's LLM providers and
|
|
996
|
+
* channels (P2.2). `opts.agentId` scopes provider credentials to one
|
|
997
|
+
* agent's profile where the runtime keys them per-agent (default: the
|
|
998
|
+
* main agent). Never returns secret material.
|
|
999
|
+
*/
|
|
1000
|
+
credentialStatus(opts?: {
|
|
1001
|
+
agentId?: string;
|
|
1002
|
+
}): Promise<RuntimeCredentialStatus>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Wire up this runtime so its agents can reach Bakin's exec tools.
|
|
1005
|
+
* Idempotent + re-invokable: run at init AND whenever the agent roster or
|
|
1006
|
+
* exec-tool set changes (agent-create, plugin (un)load).
|
|
1007
|
+
* - in-process (Pi): no-op — tools are injected per session via the
|
|
1008
|
+
* `execTools` provider passed to `initialize`.
|
|
1009
|
+
* - mcp (OpenClaw): write `config.mcp.servers[bakin-<agent>]` for every
|
|
1010
|
+
* agent, pruning stale Bakin entries; needs `bakinMcpBaseUrl` (init opt).
|
|
1011
|
+
* - cli-shim: no-op stub.
|
|
1012
|
+
* The `execTools` provider reads the LIVE registry; runtimes that inject
|
|
1013
|
+
* tools by value re-read it here so late registrations become visible.
|
|
1014
|
+
*/
|
|
1015
|
+
provisionToolAccess(execTools?: RuntimeExecToolProvider): Promise<void>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Tear down what `provisionToolAccess` wrote. in-process/cli-shim: no-op.
|
|
1018
|
+
* mcp: remove Bakin-owned `bakin-*` server entries. Called by the
|
|
1019
|
+
* runtime-switch flow (P3.2) on switch-away.
|
|
1020
|
+
*/
|
|
1021
|
+
deprovisionToolAccess(): Promise<void>;
|
|
1022
|
+
/**
|
|
1023
|
+
* Report whether tool-access provisioning is currently in place, WITHOUT
|
|
1024
|
+
* writing. Drives the onboarding/doctor drift surfaces through a
|
|
1025
|
+
* runtime-neutral status so core never inspects a provider's config shape.
|
|
1026
|
+
*/
|
|
1027
|
+
verifyToolAccess(): Promise<ToolAccessProvisioningStatus>;
|
|
537
1028
|
images?: RuntimeImagesAccess;
|
|
1029
|
+
extensions?: RuntimeExtensionsAccess;
|
|
538
1030
|
/**
|
|
539
1031
|
* Access to the runtime's private media store (e.g. channel attachments).
|
|
540
|
-
* `resolveUri` maps a runtime-private URI (
|
|
541
|
-
* absolute local file path; null for unknown schemes or
|
|
542
|
-
* never throws for not-found. Optional: runtimes without a
|
|
543
|
-
* omit it, and callers must treat absence as "cannot resolve".
|
|
1032
|
+
* `resolveUri` maps a runtime-private URI (`RUNTIME_MEDIA_URI_SCHEME`-
|
|
1033
|
+
* prefixed) to an absolute local file path; null for unknown schemes or
|
|
1034
|
+
* missing files — never throws for not-found. Optional: runtimes without a
|
|
1035
|
+
* media store omit it, and callers must treat absence as "cannot resolve".
|
|
544
1036
|
*/
|
|
545
1037
|
media?: {
|
|
546
1038
|
resolveUri(uri: string): Promise<string | null>;
|
|
547
1039
|
};
|
|
548
|
-
|
|
1040
|
+
/**
|
|
1041
|
+
* OPTIONAL capability (P2.1): the RUNTIME's native cron surface (jobs the
|
|
1042
|
+
* runtime/agents create for themselves — Bakin surfaces them read-only and
|
|
1043
|
+
* can adopt them). Runtimes without one (Pi) OMIT the member; Bakin-owned
|
|
1044
|
+
* task scheduling (the schedule plugin's own tick scheduler) is unaffected.
|
|
1045
|
+
* Callers MUST feature-detect and treat absence as "no native jobs".
|
|
1046
|
+
*/
|
|
1047
|
+
cron?: {
|
|
549
1048
|
list(): Promise<CronJob[]>;
|
|
550
1049
|
get(id: string): Promise<CronJob | null>;
|
|
551
1050
|
create(input: CreateCronJobInput): Promise<CronJob>;
|
|
@@ -556,5 +1055,4 @@ export interface AgentRuntimeAdapter {
|
|
|
556
1055
|
getRaw(id: string, reason: string): Promise<unknown | null>;
|
|
557
1056
|
restoreRaw(id: string, snapshot: unknown, reason: string): Promise<CronJob>;
|
|
558
1057
|
};
|
|
559
|
-
config: RuntimeConfigAccess;
|
|
560
1058
|
}
|