@makinbakin/sdk 0.0.1-rc.3 → 0.0.1-rc.31
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/README.md +248 -3
- package/_internal/app/components/agent-avatar.d.ts +2 -1
- package/_internal/app/components/conversation/attention.d.ts +56 -0
- package/_internal/app/components/conversation/fold.d.ts +3 -0
- package/_internal/app/components/conversation/notification-sound.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/turn-recorder.d.ts +37 -0
- package/_internal/app/components/conversation/use-conversation-attention.d.ts +64 -0
- package/_internal/app/components/drawer.d.ts +29 -0
- package/_internal/app/components/ui/button.d.ts +2 -8
- package/_internal/app/components/ui/dialog.d.ts +2 -17
- package/_internal/app/components/ui/sheet.d.ts +2 -14
- package/_internal/app/core/conversation-turns.d.ts +229 -0
- package/_internal/app/core/logger.d.ts +1 -0
- package/_internal/app/core/tool-access.d.ts +42 -0
- package/_internal/app/hooks/use-available-models.d.ts +5 -0
- package/_internal/app/hooks/use-content-store.d.ts +0 -9
- package/_internal/app/hooks/use-history-back.d.ts +5 -0
- package/_internal/app/hooks/use-horizontal-resize.d.ts +21 -0
- package/_internal/app/hooks/use-json-fetch.d.ts +36 -0
- package/_internal/app/hooks/use-nav-badge.d.ts +13 -0
- package/_internal/app/hooks/use-plugin-event.d.ts +19 -0
- package/_internal/app/hooks/use-query-state.d.ts +3 -12
- package/_internal/app/hooks/use-resizable-pane.d.ts +35 -0
- package/_internal/app/hooks/use-schedule.d.ts +47 -1
- package/_internal/app/hooks/use-search.d.ts +27 -8
- package/_internal/app/hooks/use-task-run-history.d.ts +26 -0
- package/_internal/app/hooks/use-toast.d.ts +3 -3
- package/_internal/app/lib/browser-notify.d.ts +12 -1
- package/_internal/app/types/index.d.ts +1 -105
- package/_internal/core/adapters/runtime/channels.d.ts +231 -0
- package/_internal/core/adapters/runtime/concepts.d.ts +709 -237
- package/_internal/core/adapters/runtime/errors.d.ts +105 -0
- package/_internal/core/adapters/runtime/helpers.d.ts +19 -0
- package/_internal/core/adapters/runtime/index.d.ts +8 -2
- package/_internal/core/adapters/runtime/skill-files.d.ts +12 -0
- 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 +133 -12
- package/_internal/core/content-dir.d.ts +9 -0
- package/_internal/core/delivery/bridge.d.ts +36 -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 +25 -1
- package/_internal/core/health/observation-builders.d.ts +42 -0
- 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 +236 -500
- package/_internal/core/routing/define.d.ts +27 -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/host/ui/action-status.d.ts +13 -0
- package/_internal/host/ui/modals.d.ts +5 -0
- package/_internal/plugins/team/types.d.ts +61 -4
- package/_internal/plugins/workflows/hooks/use-notification-channels.d.ts +1 -1
- package/_internal/ui/behaviors/clipboard.d.ts +10 -0
- package/_internal/ui/behaviors/selection-navigation.d.ts +5 -0
- package/_internal/ui/behaviors/use-persisted-leading-edge-resize.d.ts +29 -0
- package/_internal/ui/charts/area-chart.d.ts +27 -0
- package/_internal/ui/charts/axis.d.ts +13 -0
- package/_internal/ui/charts/bar-chart.d.ts +21 -0
- package/_internal/ui/charts/chart-data-table.d.ts +61 -0
- package/_internal/ui/charts/chart-explainer.d.ts +4 -0
- package/_internal/ui/charts/chart-tooltip.d.ts +8 -0
- package/_internal/ui/charts/composition-bar.d.ts +41 -0
- package/_internal/ui/charts/index.d.ts +24 -0
- package/_internal/ui/charts/line-chart.d.ts +26 -0
- package/_internal/ui/charts/monotone-curve.d.ts +23 -0
- package/_internal/ui/charts/palette.d.ts +32 -0
- package/_internal/ui/charts/pie-chart.d.ts +80 -0
- package/_internal/ui/charts/ranked-bar-chart.d.ts +41 -0
- package/_internal/ui/charts/sparkline.d.ts +16 -0
- package/_internal/ui/charts/stacked-column-chart.d.ts +33 -0
- package/_internal/ui/content/code-block.d.ts +43 -0
- package/_internal/ui/content/index.d.ts +2 -0
- package/_internal/ui/conversation/activity-group.d.ts +27 -0
- package/_internal/ui/conversation/agent-turn.d.ts +47 -0
- package/_internal/ui/conversation/composer.d.ts +62 -0
- package/_internal/ui/conversation/context-meter.d.ts +37 -0
- package/_internal/ui/conversation/conversation-empty-state.d.ts +13 -0
- package/_internal/ui/conversation/conversation-header.d.ts +26 -0
- package/_internal/ui/conversation/conversation-panel.d.ts +59 -0
- package/_internal/ui/conversation/conversation.d.ts +35 -0
- package/_internal/ui/conversation/fold.d.ts +150 -0
- package/_internal/ui/conversation/glyphs.d.ts +30 -0
- package/_internal/ui/conversation/index.d.ts +31 -0
- package/_internal/ui/conversation/queued-message-list.d.ts +22 -0
- package/_internal/ui/conversation/relative-time.d.ts +8 -0
- package/_internal/ui/conversation/resize-handle.d.ts +13 -0
- package/_internal/ui/conversation/tool-call-drawer.d.ts +14 -0
- package/_internal/ui/conversation/turn-controls.d.ts +9 -0
- package/_internal/ui/conversation/turn-output.d.ts +42 -0
- package/_internal/ui/conversation/turn-usage.d.ts +16 -0
- package/_internal/ui/conversation/user-message.d.ts +13 -0
- package/_internal/ui/forms/field.d.ts +25 -0
- package/_internal/ui/forms/fieldset.d.ts +10 -0
- package/_internal/ui/forms/form.d.ts +19 -0
- package/_internal/ui/forms/index.d.ts +6 -0
- package/_internal/ui/index.d.ts +86 -0
- package/_internal/ui/layout/bounded-overflow.d.ts +42 -0
- package/_internal/ui/layout/disclosure-panel.d.ts +24 -0
- package/_internal/ui/layout/flow.d.ts +27 -0
- package/_internal/ui/layout/grid.d.ts +16 -0
- package/_internal/ui/layout/index.d.ts +14 -0
- package/_internal/ui/layout/page-shell.d.ts +11 -0
- package/_internal/ui/layout/panel.d.ts +28 -0
- package/_internal/ui/layout/section.d.ts +15 -0
- package/_internal/ui/layout/sticky-overflow-scrollbar.d.ts +11 -0
- package/_internal/ui/layout/utils.d.ts +1 -0
- package/_internal/ui/patterns/agent-filter.d.ts +20 -0
- package/_internal/ui/patterns/calendar-grid.d.ts +80 -0
- package/_internal/ui/patterns/calendar-item.d.ts +42 -0
- package/_internal/ui/patterns/calendar-nav.d.ts +21 -0
- package/_internal/ui/patterns/confirm-dialog.d.ts +29 -0
- package/_internal/ui/patterns/copy-button.d.ts +15 -0
- package/_internal/ui/patterns/danger-zone.d.ts +17 -0
- package/_internal/ui/patterns/data-table.d.ts +151 -0
- package/_internal/ui/patterns/drawer-section.d.ts +11 -0
- package/_internal/ui/patterns/facet-filter.d.ts +22 -0
- package/_internal/ui/patterns/index.d.ts +73 -0
- package/_internal/ui/patterns/inspector-panel.d.ts +39 -0
- package/_internal/ui/patterns/kanban.d.ts +70 -0
- package/_internal/ui/patterns/key-value.d.ts +35 -0
- package/_internal/ui/patterns/list-rows.d.ts +111 -0
- package/_internal/ui/patterns/nav-list.d.ts +41 -0
- package/_internal/ui/patterns/node-card.d.ts +37 -0
- package/_internal/ui/patterns/page-aside.d.ts +49 -0
- package/_internal/ui/patterns/page-body.d.ts +49 -0
- package/_internal/ui/patterns/page-canvas.d.ts +12 -0
- package/_internal/ui/patterns/page-composer.d.ts +8 -0
- package/_internal/ui/patterns/page-controls.d.ts +31 -0
- package/_internal/ui/patterns/page-header.d.ts +40 -0
- package/_internal/ui/patterns/page-timeline.d.ts +18 -0
- package/_internal/ui/patterns/page.d.ts +32 -0
- package/_internal/ui/patterns/pagination.d.ts +23 -0
- package/_internal/ui/patterns/save-bar.d.ts +21 -0
- package/_internal/ui/patterns/search-input.d.ts +20 -0
- package/_internal/ui/patterns/segmented-control.d.ts +22 -0
- package/_internal/ui/patterns/sortable-head.d.ts +13 -0
- package/_internal/ui/patterns/stat-group.d.ts +8 -0
- package/_internal/ui/patterns/stat-tile.d.ts +25 -0
- package/_internal/ui/patterns/status-badge.d.ts +15 -0
- package/_internal/ui/patterns/status-marker.d.ts +10 -0
- package/_internal/ui/patterns/timeline.d.ts +59 -0
- package/_internal/ui/patterns/unsaved-changes-dialog.d.ts +22 -0
- package/_internal/ui/patterns/workspace-page.d.ts +76 -0
- package/_internal/ui/primitives/alert.d.ts +17 -0
- package/_internal/ui/primitives/avatar.d.ts +13 -0
- package/_internal/ui/primitives/badge.d.ts +27 -0
- package/_internal/ui/primitives/button.d.ts +32 -0
- package/_internal/ui/primitives/card.d.ts +47 -0
- package/_internal/ui/primitives/checkbox.d.ts +3 -0
- package/_internal/ui/primitives/collapsible.d.ts +7 -0
- package/_internal/ui/primitives/color-input.d.ts +21 -0
- package/_internal/ui/primitives/command.d.ts +36 -0
- package/_internal/ui/primitives/dialog.d.ts +31 -0
- package/_internal/ui/primitives/dropdown-menu.d.ts +54 -0
- package/_internal/ui/primitives/file-input.d.ts +33 -0
- package/_internal/ui/primitives/input-group.d.ts +24 -0
- package/_internal/ui/primitives/input.d.ts +5 -0
- package/_internal/ui/primitives/interactive-surface.d.ts +24 -0
- package/_internal/ui/primitives/label.d.ts +3 -0
- package/_internal/ui/primitives/modal-context.d.ts +9 -0
- package/_internal/ui/primitives/option-list.d.ts +10 -0
- package/_internal/ui/primitives/popover.d.ts +18 -0
- package/_internal/ui/primitives/portal-ownership.d.ts +11 -0
- package/_internal/ui/primitives/progress.d.ts +38 -0
- package/_internal/ui/primitives/radio-group.d.ts +12 -0
- package/_internal/ui/primitives/select.d.ts +25 -0
- package/_internal/ui/primitives/separator.d.ts +7 -0
- package/_internal/ui/primitives/sheet.d.ts +34 -0
- package/_internal/ui/primitives/shimmer-text.d.ts +13 -0
- package/_internal/ui/primitives/skeleton.d.ts +6 -0
- package/_internal/ui/primitives/spinner.d.ts +31 -0
- package/_internal/ui/primitives/switch.d.ts +6 -0
- package/_internal/{app/components/ui → ui/primitives}/tabs.d.ts +1 -1
- package/_internal/ui/primitives/text.d.ts +43 -0
- package/_internal/ui/primitives/textarea.d.ts +3 -0
- package/_internal/ui/primitives/tooltip.d.ts +14 -0
- package/_internal/ui/private-ui-boundary-probe.d.ts +9 -0
- package/_internal/ui/states/banner.d.ts +15 -0
- package/_internal/ui/states/index.d.ts +6 -0
- package/_internal/ui/states/system-state.d.ts +88 -0
- package/_internal/ui/states/toast.d.ts +26 -0
- package/_internal/ui/utils.d.ts +14 -0
- package/bin/bakin-plugin-test-ui.js +6822 -0
- package/charts/index.d.ts +3 -0
- package/charts/index.js +2 -0
- package/content/index.d.ts +14 -0
- package/content/index.js +39 -0
- package/content/markdown-content.d.ts +16 -0
- package/content/markdown-editor.d.ts +35 -0
- package/conversation/index.d.ts +50 -0
- package/conversation/index.js +4 -0
- package/conversation/use-conversation-thread.d.ts +73 -0
- package/hooks/index.d.ts +85 -11
- package/hooks/index.js +1 -1747
- package/hooks/router.d.ts +4 -36
- package/index.d.ts +30 -6
- package/index.js +10 -14210
- package/internal/index.d.ts +74 -0
- package/internal/index.js +2 -0
- package/internal/lazy.d.ts +58 -0
- package/internal/plugin-ownership.d.ts +18 -0
- package/internal/private-ui-boundary-probe.d.ts +2 -0
- package/layout/index.d.ts +9 -0
- package/layout/index.js +2 -0
- package/metadata/index.d.ts +14 -1
- package/metadata/index.js +1 -30
- package/navigation/history-back.d.ts +5 -0
- package/navigation/index.d.ts +23 -0
- package/navigation/index.js +2 -0
- package/navigation/plugin-link.d.ts +11 -0
- package/navigation/query-state.d.ts +7 -0
- package/navigation/router.d.ts +35 -0
- package/navigation/search-params.d.ts +7 -0
- package/navigation/unsaved-changes-guard.d.ts +35 -0
- package/package.json +62 -10
- package/patterns/agent-patterns.d.ts +79 -0
- package/patterns/asset-library-picker.d.ts +38 -0
- package/patterns/channel-patterns.d.ts +32 -0
- package/patterns/index.d.ts +40 -0
- package/patterns/index.js +47 -0
- package/patterns/picker-patterns.d.ts +96 -0
- package/patterns/plugin-settings-renderer.d.ts +41 -0
- package/patterns/presentation-color.d.ts +2 -0
- package/patterns/search-patterns.d.ts +51 -0
- package/register.d.ts +63 -9
- package/routing/index.d.ts +6 -1
- package/routing/index.js +10 -14014
- package/slots/index.d.ts +12 -24
- package/slots/index.js +1 -91
- package/slots/registry.d.ts +45 -0
- package/styles.css +2 -0
- package/testing/index.d.ts +122 -0
- package/testing/index.js +93 -0
- package/testing/ui/conformance/cli.d.ts +2 -0
- package/testing/ui/conformance/contracts.d.ts +73 -0
- package/testing/ui/conformance/index.d.ts +11 -0
- package/testing/ui/conformance/index.js +85 -0
- package/testing/ui/conformance/plugin-css.d.ts +37 -0
- package/testing/ui/conformance/plugin-id.d.ts +6 -0
- package/testing/ui/conformance/runner.d.ts +13 -0
- package/testing/ui/index.d.ts +24 -0
- package/testing/ui/index.js +2 -0
- package/testing/ui/plugin-ui-fixture-host.d.ts +36 -0
- package/testing/ui/runtime.d.ts +70 -0
- package/types/api-route.d.ts +89 -0
- package/types/context.d.ts +166 -0
- package/types/conversation-turns.d.ts +229 -0
- package/types/events.d.ts +10 -0
- package/types/health.d.ts +374 -0
- package/types/index.d.ts +19 -919
- package/types/index.js +1 -0
- package/types/manifest.d.ts +221 -0
- package/types/primitives.d.ts +33 -0
- package/types/registration.d.ts +281 -0
- package/types/runtime.d.ts +292 -0
- package/types/scheduled-events.d.ts +80 -0
- package/types/services.d.ts +578 -0
- package/ui/index.d.ts +70 -31
- package/ui/index.js +38 -28704
- package/utils/asset-id.d.ts +15 -0
- package/utils/index.d.ts +25 -7
- package/utils/index.js +4 -2098
- package/utils/plugin-fetch.d.ts +23 -0
- package/_internal/app/components/agent-filter.d.ts +0 -8
- package/_internal/app/components/agent-select.d.ts +0 -15
- package/_internal/app/components/agent-status.d.ts +0 -8
- package/_internal/app/components/bakin-drawer.d.ts +0 -23
- package/_internal/app/components/color-picker.d.ts +0 -7
- package/_internal/app/components/empty-state.d.ts +0 -10
- package/_internal/app/components/error-banner.d.ts +0 -6
- package/_internal/app/components/error-state.d.ts +0 -8
- package/_internal/app/components/facet-filter.d.ts +0 -17
- 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/app/components/markdown-content.d.ts +0 -3
- package/_internal/app/components/markdown-editor.d.ts +0 -11
- package/_internal/app/components/model-select.d.ts +0 -9
- package/_internal/app/components/page-layout.d.ts +0 -9
- package/_internal/app/components/plugin-header.d.ts +0 -16
- package/_internal/app/components/plugin-settings-renderer.d.ts +0 -9
- package/_internal/app/components/sortable-head.d.ts +0 -13
- package/_internal/app/components/ui/alert.d.ts +0 -10
- package/_internal/app/components/ui/avatar.d.ts +0 -11
- package/_internal/app/components/ui/badge.d.ts +0 -7
- package/_internal/app/components/ui/card.d.ts +0 -11
- package/_internal/app/components/ui/checkbox.d.ts +0 -3
- package/_internal/app/components/ui/collapsible.d.ts +0 -5
- package/_internal/app/components/ui/command.d.ts +0 -19
- package/_internal/app/components/ui/dropdown-menu.d.ts +0 -29
- package/_internal/app/components/ui/form.d.ts +0 -23
- package/_internal/app/components/ui/input-group.d.ts +0 -18
- package/_internal/app/components/ui/input.d.ts +0 -3
- package/_internal/app/components/ui/label.d.ts +0 -3
- package/_internal/app/components/ui/popover.d.ts +0 -9
- package/_internal/app/components/ui/progress.d.ts +0 -7
- package/_internal/app/components/ui/select.d.ts +0 -15
- package/_internal/app/components/ui/separator.d.ts +0 -3
- package/_internal/app/components/ui/skeleton.d.ts +0 -2
- package/_internal/app/components/ui/switch.d.ts +0 -5
- package/_internal/app/components/ui/textarea.d.ts +0 -3
- package/_internal/app/components/ui/tooltip.d.ts +0 -6
- package/_internal/app/components/underline-tabs.d.ts +0 -15
- package/_internal/app/hooks/use-assets.d.ts +0 -25
- package/_internal/app/hooks/use-form-guard.d.ts +0 -5
- package/_internal/app/hooks/use-vertical-resize.d.ts +0 -22
- package/_internal/app/lib/utils.d.ts +0 -2
- package/_internal/plugins/workflows/hooks/channel-icon.d.ts +0 -6
- package/components/index.d.ts +0 -34
- package/components/index.js +0 -40175
- /package/_internal/{app/components/ui → ui/primitives}/table.d.ts +0 -0
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import type { AdapterInitOpts, MessageUsage, RuntimeExecToolProvider } from '../shared';
|
|
2
|
+
import type { ActivityClass } from '@makinbakin/sdk/types';
|
|
3
|
+
import type { RuntimeChannelSurface, RuntimeMetadata } from './channels';
|
|
4
|
+
export type { MessageUsage } from '../shared';
|
|
5
|
+
export type { RuntimeMetadata } from './channels';
|
|
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,31 +40,132 @@ 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;
|
|
118
|
+
/**
|
|
119
|
+
* Per-turn model override (`provider/model` id). Omit to use the agent's
|
|
120
|
+
* configured model. The caller (Bakin's routing policy) resolves it.
|
|
121
|
+
*/
|
|
122
|
+
model?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Per-turn thinking level. Omit to use the runtime/agent default.
|
|
125
|
+
*/
|
|
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;
|
|
61
154
|
metadata?: RuntimeMetadata;
|
|
62
155
|
}
|
|
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;
|
|
63
164
|
export interface MessageResult {
|
|
64
165
|
id: string;
|
|
65
166
|
content?: string;
|
|
167
|
+
/** Per-turn token usage, omitted when the runtime reported none. */
|
|
168
|
+
usage?: MessageUsage;
|
|
66
169
|
metadata?: RuntimeMetadata;
|
|
67
170
|
}
|
|
68
171
|
export interface RuntimeToolActivity {
|
|
@@ -77,173 +180,72 @@ export interface RuntimeToolActivity {
|
|
|
77
180
|
exitCode?: number;
|
|
78
181
|
metadata?: RuntimeMetadata;
|
|
79
182
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
fields?: {
|
|
115
|
-
label: string;
|
|
116
|
-
value: string;
|
|
117
|
-
}[];
|
|
118
|
-
metadata?: RuntimeMetadata;
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
export interface ChannelMessageArgs {
|
|
122
|
-
channels: string[];
|
|
123
|
-
message: {
|
|
124
|
-
body: string;
|
|
125
|
-
title?: string;
|
|
126
|
-
threadId?: string;
|
|
127
|
-
metadata?: RuntimeMetadata;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
export interface ContentDeliveryArgs {
|
|
131
|
-
channels: string[];
|
|
132
|
-
content: {
|
|
133
|
-
title: string;
|
|
134
|
-
body?: string;
|
|
135
|
-
url?: string;
|
|
136
|
-
files?: Array<{
|
|
137
|
-
name: string;
|
|
138
|
-
path: string;
|
|
139
|
-
contentType?: string;
|
|
140
|
-
} | {
|
|
141
|
-
kind: 'asset';
|
|
142
|
-
filename: string;
|
|
143
|
-
mimeType?: string;
|
|
144
|
-
}>;
|
|
145
|
-
metadata?: RuntimeMetadata;
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
export interface ApprovalOption {
|
|
149
|
-
id: string;
|
|
150
|
-
label: string;
|
|
151
|
-
variant?: 'primary' | 'destructive' | 'neutral';
|
|
152
|
-
}
|
|
153
|
-
export interface ApprovalDelivery {
|
|
154
|
-
channelId: string;
|
|
155
|
-
ref: string;
|
|
156
|
-
renderedAt: string;
|
|
157
|
-
}
|
|
158
|
-
export interface ApprovalPatch {
|
|
159
|
-
body?: string;
|
|
160
|
-
options?: ApprovalOption[];
|
|
161
|
-
expiresAt?: string;
|
|
162
|
-
context?: RuntimeMetadata;
|
|
163
|
-
}
|
|
164
|
-
export interface ApprovalResponse {
|
|
165
|
-
selectedOption: string;
|
|
166
|
-
respondedAt: string;
|
|
167
|
-
actor: {
|
|
168
|
-
type: 'agent' | 'human';
|
|
169
|
-
id: string;
|
|
170
|
-
displayName?: string;
|
|
171
|
-
};
|
|
172
|
-
comment?: string;
|
|
173
|
-
}
|
|
174
|
-
export interface ApprovalRenderResult {
|
|
175
|
-
deliveries: ApprovalDelivery[];
|
|
176
|
-
}
|
|
177
|
-
export interface ApprovalRenderRef {
|
|
178
|
-
approvalId: string;
|
|
179
|
-
deliveries: ApprovalDelivery[];
|
|
180
|
-
}
|
|
181
|
-
export interface CreateApprovalArgs {
|
|
182
|
-
approvalId: string;
|
|
183
|
-
channels: string[];
|
|
184
|
-
request: {
|
|
185
|
-
title: string;
|
|
186
|
-
body: string;
|
|
187
|
-
options: ApprovalOption[];
|
|
188
|
-
expiresAt?: string;
|
|
189
|
-
context?: RuntimeMetadata;
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
export interface EditApprovalArgs extends ApprovalRenderRef {
|
|
193
|
-
patch: ApprovalPatch;
|
|
194
|
-
}
|
|
195
|
-
export interface CancelApprovalArgs extends ApprovalRenderRef {
|
|
196
|
-
reason?: string;
|
|
197
|
-
}
|
|
198
|
-
export interface ResolveApprovalArgs extends ApprovalRenderRef {
|
|
199
|
-
response: ApprovalResponse;
|
|
200
|
-
}
|
|
201
|
-
export interface ApprovalResolveEvent {
|
|
202
|
-
approvalId: string;
|
|
203
|
-
response: ApprovalResponse;
|
|
204
|
-
channelId: string;
|
|
205
|
-
}
|
|
206
|
-
export interface ChannelMessageEvent {
|
|
207
|
-
channelId: string;
|
|
208
|
-
messageId: string;
|
|
209
|
-
actor: {
|
|
210
|
-
type: 'agent' | 'human';
|
|
211
|
-
id: string;
|
|
212
|
-
displayName?: string;
|
|
213
|
-
};
|
|
214
|
-
body: string;
|
|
215
|
-
threadId?: string;
|
|
216
|
-
receivedAt: string;
|
|
217
|
-
metadata?: RuntimeMetadata;
|
|
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;
|
|
218
217
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
id: string;
|
|
225
|
-
displayName?: string;
|
|
226
|
-
};
|
|
227
|
-
kind: string;
|
|
228
|
-
payload: RuntimeMetadata;
|
|
229
|
-
receivedAt: string;
|
|
230
|
-
}
|
|
231
|
-
export interface DurableApprovalRecord {
|
|
232
|
-
approvalId: string;
|
|
233
|
-
owner: {
|
|
234
|
-
workflowId: string;
|
|
235
|
-
runId: string;
|
|
236
|
-
stepId: string;
|
|
237
|
-
taskId?: string;
|
|
238
|
-
};
|
|
239
|
-
status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
|
|
240
|
-
request: CreateApprovalArgs['request'];
|
|
241
|
-
deliveries: ApprovalDelivery[];
|
|
242
|
-
response?: ApprovalResponse;
|
|
243
|
-
createdAt: string;
|
|
244
|
-
updatedAt: string;
|
|
245
|
-
resolvedAt?: string;
|
|
218
|
+
/** Tool activity; `data` is always the structured RuntimeToolActivity. */
|
|
219
|
+
| {
|
|
220
|
+
type: 'tool';
|
|
221
|
+
content?: string;
|
|
222
|
+
data: RuntimeToolActivity;
|
|
246
223
|
}
|
|
224
|
+
/** Turn lifecycle hint (e.g. 'thinking'). */
|
|
225
|
+
| {
|
|
226
|
+
type: 'status';
|
|
227
|
+
content?: string;
|
|
228
|
+
data?: RuntimeMetadata;
|
|
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
|
+
* `data.model` names the qualified model id when the failure was the
|
|
242
|
+
* provider rejecting that model (kind 'model_not_supported', #852). */
|
|
243
|
+
| {
|
|
244
|
+
type: 'error';
|
|
245
|
+
content?: string;
|
|
246
|
+
data?: RuntimeMetadata;
|
|
247
|
+
};
|
|
248
|
+
export type { ChannelInfo, DeliveryResult, NotificationArgs, ChannelMessageArgs, ContentDeliveryArgs, CreateThreadArgs, CreatedThread, EditChannelMessageArgs, ApprovalOption, ApprovalDelivery, ApprovalPatch, ApprovalResponse, ApprovalRenderResult, ApprovalRenderRef, CreateApprovalArgs, EditApprovalArgs, CancelApprovalArgs, ResolveApprovalArgs, ApprovalResolveEvent, DurableApprovalRecord, InboundChannelAttachment, InboundChannelMessage, RuntimeChannelSurface, } from './channels';
|
|
247
249
|
export interface RuntimeSkill {
|
|
248
250
|
name: string;
|
|
249
251
|
path?: string;
|
|
@@ -259,6 +261,50 @@ export interface RuntimeSession {
|
|
|
259
261
|
updatedAt?: string;
|
|
260
262
|
metadata?: RuntimeMetadata;
|
|
261
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* A session's context reading (#737) — runtime truth only, read AT REST.
|
|
266
|
+
* Null-honesty is the contract: `tokens: null` means honestly unknown
|
|
267
|
+
* (e.g. immediately after a compaction before the next assistant reply,
|
|
268
|
+
* or a stale store entry) — NEVER a stale or derived number; billing
|
|
269
|
+
* aggregates (which sum across a turn's internal tool-loop requests) are
|
|
270
|
+
* banned as a source. `compactionThreshold: null` when the runtime owns
|
|
271
|
+
* compaction opaquely (e.g. codex-native).
|
|
272
|
+
*/
|
|
273
|
+
export interface RuntimeSessionContextStats {
|
|
274
|
+
/** Current context tokens; null = honestly unknown. */
|
|
275
|
+
tokens: number | null;
|
|
276
|
+
/** The model's context window; null when unknown. */
|
|
277
|
+
contextWindow: number | null;
|
|
278
|
+
/** Auto-compaction trigger point in tokens; null when unknowable. */
|
|
279
|
+
compactionThreshold: number | null;
|
|
280
|
+
/** Last compaction, when detectable from durable runtime records. */
|
|
281
|
+
lastCompaction?: {
|
|
282
|
+
at?: string;
|
|
283
|
+
tokensBefore?: number;
|
|
284
|
+
reason?: string;
|
|
285
|
+
};
|
|
286
|
+
/** Model the stats describe (`provider/modelId` form), when known. */
|
|
287
|
+
model?: string;
|
|
288
|
+
}
|
|
289
|
+
export interface RuntimeSessionStoreStats {
|
|
290
|
+
agentId: string;
|
|
291
|
+
/** Live entries in the runtime's session store for this agent. */
|
|
292
|
+
storeEntries: number;
|
|
293
|
+
/**
|
|
294
|
+
* Top-level files in the agent's sessions directory (session artifacts,
|
|
295
|
+
* including the store itself) — cache subtrees are excluded so the
|
|
296
|
+
* orphaned-artifact ratio stays meaningful.
|
|
297
|
+
*/
|
|
298
|
+
fileCount: number;
|
|
299
|
+
/** Total bytes of the agent's sessions directory, subtrees included. */
|
|
300
|
+
diskBytes: number;
|
|
301
|
+
/**
|
|
302
|
+
* Adapter-owned operator guidance for shrinking this agent's store (CLI
|
|
303
|
+
* commands, config knobs). Health surfaces render it verbatim — provider
|
|
304
|
+
* specifics belong HERE, never hardcoded upstream of the adapter.
|
|
305
|
+
*/
|
|
306
|
+
remediation?: string;
|
|
307
|
+
}
|
|
262
308
|
export interface RuntimeMemoryTier {
|
|
263
309
|
id: string;
|
|
264
310
|
label: string;
|
|
@@ -298,6 +344,188 @@ export interface RuntimeMemorySearchResult {
|
|
|
298
344
|
results: unknown[];
|
|
299
345
|
metadata?: RuntimeMetadata;
|
|
300
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* What the runtime's ACTIVE configuration can accept as model input
|
|
349
|
+
* (spec: enrichment-runtime-fallback §3). Adapter-declared from the
|
|
350
|
+
* runtime's own model catalog for the SELECTED agent's effective model
|
|
351
|
+
* (default: the main agent) — conservative false on any ambiguity, never
|
|
352
|
+
* model-name heuristics.
|
|
353
|
+
*/
|
|
354
|
+
export interface RuntimeCapabilities {
|
|
355
|
+
imageInput: boolean;
|
|
356
|
+
audioInput: boolean;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* One capability's provisioning state on a runtime:
|
|
360
|
+
* - 'native' — the runtime provides it directly.
|
|
361
|
+
* - 'shimmed' — the runtime doesn't, but a Bakin-owned shim fills it.
|
|
362
|
+
* - 'unavailable' — neither; degrade honestly + surface in the UI.
|
|
363
|
+
*/
|
|
364
|
+
export type CapabilityMode = 'native' | 'shimmed' | 'unavailable';
|
|
365
|
+
/**
|
|
366
|
+
* How agents on this runtime invoke Bakin exec tools:
|
|
367
|
+
* - 'in-process' — exec tools are first-class session tools; the agent calls
|
|
368
|
+
* `bakin_exec_*` directly (Pi's in-process bridge).
|
|
369
|
+
* - 'mcp' — the runtime's native MCP client reaches Bakin's MCP server;
|
|
370
|
+
* tools appear namespaced as `<mcpServerTemplate>.<tool>`.
|
|
371
|
+
* - 'cli-shim' — the agent shells `<shimCommand>` (inert extension point for
|
|
372
|
+
* a future runtime that can neither embed nor speak MCP).
|
|
373
|
+
*/
|
|
374
|
+
export type ToolAccessStyle = 'in-process' | 'mcp' | 'cli-shim';
|
|
375
|
+
export interface RuntimeToolAccess {
|
|
376
|
+
style: ToolAccessStyle;
|
|
377
|
+
/** 'mcp': per-agent server-name template, e.g. `bakin-<agent>`. */
|
|
378
|
+
mcpServerTemplate?: string;
|
|
379
|
+
/** 'cli-shim': shell command template. */
|
|
380
|
+
shimCommand?: string;
|
|
381
|
+
/** One canonical, style-appropriate example call. */
|
|
382
|
+
example?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Whether this runtime can ENFORCE `MessageArgs.toolsAllow`/`toolsDeny`
|
|
385
|
+
* per turn. In-process runtimes filter their tool bridge per call (true);
|
|
386
|
+
* runtimes whose exec tools ride session-static transports (OpenClaw's
|
|
387
|
+
* per-agent MCP servers) cannot (false) — they ignore the fields with a
|
|
388
|
+
* loud warning. Callers needing a RESTRICTED turn must feature-detect
|
|
389
|
+
* this and refuse rather than degrade fail-open.
|
|
390
|
+
*/
|
|
391
|
+
perTurnExecToolFiltering?: boolean;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Result of `verifyToolAccess()` — a runtime-neutral report on whether this
|
|
395
|
+
* runtime's tool-access wiring is currently in place, so core (onboarding,
|
|
396
|
+
* doctor) can surface drift WITHOUT knowing any provider's config shape.
|
|
397
|
+
* `in-process` runtimes report `ok: true` with no issues (nothing to
|
|
398
|
+
* provision); `mcp` runtimes report missing/stale server entries.
|
|
399
|
+
*/
|
|
400
|
+
export interface ToolAccessProvisioningStatus {
|
|
401
|
+
style: ToolAccessStyle;
|
|
402
|
+
ok: boolean;
|
|
403
|
+
/** Human-readable drift descriptions when `ok` is false. */
|
|
404
|
+
issues: string[];
|
|
405
|
+
details?: Record<string, unknown>;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* The unified capability declaration — every runtime-provided capability that
|
|
409
|
+
* has a native/shim/gap choice. Bakin renders agent instructions from it,
|
|
410
|
+
* routes to shims when `shimmed`, degrades honestly when `unavailable`, and
|
|
411
|
+
* plugins query it instead of assuming. Always-Bakin-owned capabilities
|
|
412
|
+
* (scheduling, heartbeats, tasks, assets, audit) are NOT here — they have no
|
|
413
|
+
* native/shim choice. `input` folds in the former modality-only capabilities.
|
|
414
|
+
*/
|
|
415
|
+
export interface CapabilitySet {
|
|
416
|
+
toolCalling: {
|
|
417
|
+
mode: 'native';
|
|
418
|
+
access: RuntimeToolAccess;
|
|
419
|
+
};
|
|
420
|
+
delivery: {
|
|
421
|
+
mode: CapabilityMode;
|
|
422
|
+
};
|
|
423
|
+
imageGen: {
|
|
424
|
+
mode: CapabilityMode;
|
|
425
|
+
};
|
|
426
|
+
memory: {
|
|
427
|
+
mode: 'native' | 'unavailable';
|
|
428
|
+
};
|
|
429
|
+
sessions: {
|
|
430
|
+
mode: 'native' | 'unavailable';
|
|
431
|
+
};
|
|
432
|
+
workspaceFiles: {
|
|
433
|
+
mode: 'native' | 'unavailable';
|
|
434
|
+
};
|
|
435
|
+
input: RuntimeCapabilities;
|
|
436
|
+
/**
|
|
437
|
+
* Can two turns for ONE agent run simultaneously without colliding?
|
|
438
|
+
* - 'isolated' — the adapter honors `MessageArgs.runWorkspace` (per-turn
|
|
439
|
+
* cwd), so concurrent same-agent turns each work in their
|
|
440
|
+
* own directory; parallel-safe.
|
|
441
|
+
* - 'serialized' — the adapter/provider cannot isolate runs (one shared
|
|
442
|
+
* workspace per agent); dispatch clamps that agent to one
|
|
443
|
+
* turn at a time regardless of settings, with a visible
|
|
444
|
+
* receipt — never a silent drop.
|
|
445
|
+
* Conformance-pinned: declaring 'isolated' without actually honoring
|
|
446
|
+
* runWorkspace fails the runtime conformance suite.
|
|
447
|
+
*/
|
|
448
|
+
concurrency: {
|
|
449
|
+
sameAgentTurns: 'isolated' | 'serialized';
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Presence-only credential report (P2.2): WHICH LLM providers and channels
|
|
454
|
+
* have usable credentials configured in the runtime — names only, NEVER
|
|
455
|
+
* secret material. Drives the onboarding llm/channels checks; each adapter
|
|
456
|
+
* reads its own config internally so credential shapes never leak upstream.
|
|
457
|
+
*/
|
|
458
|
+
/**
|
|
459
|
+
* Presence-only credential KIND: 'api-key' = metered pay-per-use billing;
|
|
460
|
+
* 'oauth' = subscription login (plan quota). An entry carrying both reports
|
|
461
|
+
* 'api-key' — the key is what the provider bills. Never carries values.
|
|
462
|
+
*/
|
|
463
|
+
export type RuntimeCredentialKind = 'api-key' | 'oauth';
|
|
464
|
+
export interface RuntimeCredentialStatus {
|
|
465
|
+
/** Provider names with usable credentials (api key / token / OAuth). */
|
|
466
|
+
llmProviders: string[];
|
|
467
|
+
/**
|
|
468
|
+
* Per-provider credential kind (billing-lane detection, cost-control v2).
|
|
469
|
+
* Optional — consumers treat absence as unknown and stay conservative
|
|
470
|
+
* (unknown bills as metered, never silently uncapped-as-free).
|
|
471
|
+
*/
|
|
472
|
+
llmCredentials?: Array<{
|
|
473
|
+
provider: string;
|
|
474
|
+
kind: RuntimeCredentialKind;
|
|
475
|
+
}>;
|
|
476
|
+
/** Channel names with usable credentials. Empty on channel-less runtimes. */
|
|
477
|
+
channels: string[];
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Runtime-owned model routing policy (P2.3): the knobs the RUNTIME honors at
|
|
481
|
+
* session time — default model for agents without an assignment, failover
|
|
482
|
+
* order, subagent default, alias map. Bakin manages these through this
|
|
483
|
+
* neutral surface; each adapter maps to its native store, so a runtime's
|
|
484
|
+
* policy survives untouched while another runtime is active (round-trip by
|
|
485
|
+
* construction).
|
|
486
|
+
*/
|
|
487
|
+
export interface RuntimeRoutingPolicy {
|
|
488
|
+
/** Default model for agents without an explicit assignment. '' when unset. */
|
|
489
|
+
defaultModel: string;
|
|
490
|
+
/** Failover models tried in order when the default fails. */
|
|
491
|
+
fallbackModels: string[];
|
|
492
|
+
/** Default model for spawned subagents. Null when unset/unsupported. */
|
|
493
|
+
defaultSubagentModel: string | null;
|
|
494
|
+
/** Alias name → target model id. */
|
|
495
|
+
aliases: Record<string, string>;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Which routing-policy fields this runtime actually HONORS. Static
|
|
499
|
+
* declaration (like describeToolAccess): UIs hide unsupported controls and
|
|
500
|
+
* `setRoutingPolicy` rejects patches carrying unsupported fields — a knob
|
|
501
|
+
* the runtime ignores must never be silently stored.
|
|
502
|
+
*/
|
|
503
|
+
export interface RuntimeRoutingSupport {
|
|
504
|
+
defaultModel: boolean;
|
|
505
|
+
fallbackModels: boolean;
|
|
506
|
+
defaultSubagentModel: boolean;
|
|
507
|
+
aliases: boolean;
|
|
508
|
+
/** Per-agent subagentModel via agents.update. */
|
|
509
|
+
perAgentSubagentModel: boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Per-turn thinking levels this runtime HONORS on messaging.send. Bakin's
|
|
512
|
+
* routing layer clamps requested levels to this set (with receipt + audit
|
|
513
|
+
* evidence) before the send — an adapter must honor every level it
|
|
514
|
+
* declares and declare every level it honors (conformance-pinned).
|
|
515
|
+
*/
|
|
516
|
+
supportedThinkingLevels: readonly string[];
|
|
517
|
+
/**
|
|
518
|
+
* Whether messaging.send/stream turns may carry a per-turn `model`
|
|
519
|
+
* override (#880: OpenClaw 2026.9.5 gates this behind operator.admin
|
|
520
|
+
* scope). MAY BE DYNAMIC — OpenClaw derives it from the gateway
|
|
521
|
+
* connection's GRANTED scopes (optimistic true before first connect;
|
|
522
|
+
* flips false after a scope downgrade or an admission rejection). Bakin's
|
|
523
|
+
* routing layer clamps routed models to the agent default (with a
|
|
524
|
+
* modelClamp receipt + audit) when false — same posture as thinking
|
|
525
|
+
* levels: declare only what the runtime will honor (conformance-pinned).
|
|
526
|
+
*/
|
|
527
|
+
perTurnModel: boolean;
|
|
528
|
+
}
|
|
301
529
|
export interface RuntimeAvailableModel {
|
|
302
530
|
id: string;
|
|
303
531
|
name?: string;
|
|
@@ -308,38 +536,134 @@ export interface RuntimeAvailableModel {
|
|
|
308
536
|
tags?: string[];
|
|
309
537
|
metadata?: RuntimeMetadata;
|
|
310
538
|
}
|
|
311
|
-
export
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
539
|
+
export type RuntimeImageOutputFormat = 'png' | 'jpeg' | 'jpg' | 'webp';
|
|
540
|
+
export type RuntimeImageBackground = 'transparent' | 'opaque' | 'auto';
|
|
541
|
+
/**
|
|
542
|
+
* Image capability is intentionally all-optional. A thin runtime that exposes a
|
|
543
|
+
* single image tool maps on by filling minimal fields (e.g. one synthesized
|
|
544
|
+
* provider with a defaultModel); a rich runtime fills more. Consumers MUST
|
|
545
|
+
* treat a sparse capability as normal and never require a field a thin runtime
|
|
546
|
+
* cannot provide — gaps are filled below, in the adapter/shim, not pushed up
|
|
547
|
+
* into plugins. See .claude/knowledge/media-generation-adapter-architecture.md.
|
|
548
|
+
*/
|
|
549
|
+
export interface RuntimeImageProviderCapabilities {
|
|
550
|
+
generate?: {
|
|
551
|
+
maxCount?: number;
|
|
552
|
+
supportsSize?: boolean;
|
|
553
|
+
supportsAspectRatio?: boolean;
|
|
554
|
+
supportsResolution?: boolean;
|
|
555
|
+
};
|
|
556
|
+
edit?: {
|
|
557
|
+
enabled?: boolean;
|
|
558
|
+
maxCount?: number;
|
|
559
|
+
maxInputImages?: number;
|
|
560
|
+
supportsSize?: boolean;
|
|
561
|
+
supportsAspectRatio?: boolean;
|
|
562
|
+
supportsResolution?: boolean;
|
|
563
|
+
};
|
|
564
|
+
geometry?: {
|
|
565
|
+
sizes?: string[];
|
|
566
|
+
aspectRatios?: string[];
|
|
567
|
+
resolutions?: string[];
|
|
568
|
+
};
|
|
569
|
+
output?: {
|
|
570
|
+
formats?: string[];
|
|
571
|
+
qualities?: string[];
|
|
572
|
+
backgrounds?: string[];
|
|
573
|
+
};
|
|
316
574
|
metadata?: RuntimeMetadata;
|
|
317
575
|
}
|
|
318
|
-
export interface
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
retryCount?: number;
|
|
328
|
-
startedAt?: string | null;
|
|
329
|
-
endedAt?: string | null;
|
|
330
|
-
updatedAt?: string | null;
|
|
576
|
+
export interface RuntimeImageProvider {
|
|
577
|
+
id: string;
|
|
578
|
+
label?: string;
|
|
579
|
+
defaultModel?: string;
|
|
580
|
+
models?: string[];
|
|
581
|
+
available?: boolean;
|
|
582
|
+
configured?: boolean;
|
|
583
|
+
selected?: boolean;
|
|
584
|
+
capabilities?: RuntimeImageProviderCapabilities;
|
|
331
585
|
metadata?: RuntimeMetadata;
|
|
332
586
|
}
|
|
333
|
-
export interface
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
587
|
+
export interface RuntimeImageGenerateInput {
|
|
588
|
+
prompt: string;
|
|
589
|
+
provider?: string;
|
|
590
|
+
model?: string;
|
|
591
|
+
count?: number;
|
|
592
|
+
width?: number;
|
|
593
|
+
height?: number;
|
|
594
|
+
size?: string;
|
|
595
|
+
aspectRatio?: string;
|
|
596
|
+
resolution?: string;
|
|
597
|
+
outputFormat?: RuntimeImageOutputFormat;
|
|
598
|
+
background?: RuntimeImageBackground;
|
|
599
|
+
/**
|
|
600
|
+
* Reference/context image file paths conditioning the generation. The caller
|
|
601
|
+
* (Bakin) resolves managed asset ids to concrete paths before the adapter
|
|
602
|
+
* sees them. Native generation has no file input, so a generate carrying
|
|
603
|
+
* references is routed through the edit-style invocation (#418).
|
|
604
|
+
*/
|
|
605
|
+
referenceImages?: string[];
|
|
606
|
+
timeoutMs?: number;
|
|
607
|
+
metadata?: RuntimeMetadata;
|
|
338
608
|
}
|
|
339
|
-
export interface
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
609
|
+
export interface RuntimeImageEditInput extends RuntimeImageGenerateInput {
|
|
610
|
+
files: string[];
|
|
611
|
+
}
|
|
612
|
+
export interface RuntimeImageFile {
|
|
613
|
+
filePath: string;
|
|
614
|
+
mimeType?: string;
|
|
615
|
+
width?: number;
|
|
616
|
+
height?: number;
|
|
617
|
+
provider?: string;
|
|
618
|
+
model?: string;
|
|
619
|
+
url?: string;
|
|
620
|
+
metadata?: RuntimeMetadata;
|
|
621
|
+
}
|
|
622
|
+
export interface RuntimeImageGenerationResult {
|
|
623
|
+
images: RuntimeImageFile[];
|
|
624
|
+
provider?: string;
|
|
625
|
+
model?: string;
|
|
626
|
+
providerText?: string;
|
|
627
|
+
metadata?: RuntimeMetadata;
|
|
628
|
+
}
|
|
629
|
+
export interface RuntimeImagesAccess {
|
|
630
|
+
providers(): Promise<RuntimeImageProvider[]>;
|
|
631
|
+
generate(input: RuntimeImageGenerateInput): Promise<RuntimeImageGenerationResult>;
|
|
632
|
+
edit(input: RuntimeImageEditInput): Promise<RuntimeImageGenerationResult>;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* A runtime extension: third-party code the RUNTIME loads in-process during
|
|
636
|
+
* agent turns (Pi extensions today). Provider-neutral shape — ids/labels/
|
|
637
|
+
* paths only, never provider config. Discovery is INERT: listing never
|
|
638
|
+
* executes extension code.
|
|
639
|
+
*/
|
|
640
|
+
export interface RuntimeExtensionInfo {
|
|
641
|
+
/** Stable identifier used for allow/revoke — the real absolute module path. */
|
|
642
|
+
id: string;
|
|
643
|
+
label: string;
|
|
644
|
+
/** Where it came from, human-readable (e.g. "npm:some-pkg", "extensions dir"). */
|
|
645
|
+
source: string;
|
|
646
|
+
/** Real absolute load path (symlinks resolved) — half the trust identity. */
|
|
647
|
+
path: string;
|
|
648
|
+
/** Current content hash of the file — the other half of the trust identity. */
|
|
649
|
+
sha256: string;
|
|
650
|
+
/**
|
|
651
|
+
* pending — discovered but NOT loaded into turns (unapproved, or its
|
|
652
|
+
* content changed since approval)
|
|
653
|
+
* allowed — approved path+hash; loads into agent turns
|
|
654
|
+
* blocked — policy mode 'none': nothing loads
|
|
655
|
+
*/
|
|
656
|
+
status: 'allowed' | 'pending' | 'blocked';
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* OPTIONAL: trust management for runtime-loaded extensions. Runtimes without
|
|
660
|
+
* an extension mechanism OMIT the member; callers feature-detect
|
|
661
|
+
* (`runtime.extensions?.`). Listing is read-only and inert. The trust store
|
|
662
|
+
* itself (allowlist) is Bakin-owned settings — see
|
|
663
|
+
* `src/core/runtime-extensions.ts` for the ONE mutation engine.
|
|
664
|
+
*/
|
|
665
|
+
export interface RuntimeExtensionsAccess {
|
|
666
|
+
list(): Promise<RuntimeExtensionInfo[]>;
|
|
343
667
|
}
|
|
344
668
|
export interface CronJob {
|
|
345
669
|
id: string;
|
|
@@ -376,21 +700,48 @@ export interface RawCronSnapshot {
|
|
|
376
700
|
capturedAt: string;
|
|
377
701
|
snapshot: unknown;
|
|
378
702
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
703
|
+
/**
|
|
704
|
+
* URI scheme for runtime-private media references (`media://inbound/…`).
|
|
705
|
+
* The ONE place upstream code may learn the scheme: callers detect
|
|
706
|
+
* media references with this constant and hand them to `media.resolveUri`
|
|
707
|
+
* (feature-detected) — the adapter owns what the URI means.
|
|
708
|
+
*/
|
|
709
|
+
export declare const RUNTIME_MEDIA_URI_SCHEME = "media://";
|
|
385
710
|
export interface AgentRuntimeAdapter {
|
|
386
711
|
readonly name: string;
|
|
387
712
|
readonly version: string;
|
|
388
713
|
readonly requiredCoreVersion: string;
|
|
389
714
|
initialize(opts: AdapterInitOpts): Promise<void>;
|
|
390
715
|
shutdown(): Promise<void>;
|
|
716
|
+
/**
|
|
717
|
+
* "Can this runtime serve a turn?" — a CHEAP probe (an HTTP health hit, a
|
|
718
|
+
* credential-presence read; never an LLM call). Resolves `false` rather
|
|
719
|
+
* than throwing when the runtime cannot serve (unreachable process,
|
|
720
|
+
* uninitialized adapter, no LLM credentials). Deeper diagnostics are
|
|
721
|
+
* registered separately with the canonical Health registry.
|
|
722
|
+
*/
|
|
391
723
|
ping(): Promise<boolean>;
|
|
724
|
+
/**
|
|
725
|
+
* Re-read ALL durable config: credentials, model registry, settings,
|
|
726
|
+
* provisioned tool access. External-process runtimes may bounce the
|
|
727
|
+
* process; in-process runtimes must drop every cache so the next call
|
|
728
|
+
* re-reads disk. Callers (team/models plugins) invoke this after config
|
|
729
|
+
* writes and expect the next read to reflect them.
|
|
730
|
+
*/
|
|
392
731
|
restart(): Promise<void>;
|
|
393
|
-
|
|
732
|
+
/**
|
|
733
|
+
* CRUD error contract (R28): `get` returns `null` for a missing agent —
|
|
734
|
+
* absence is a value, never a throw. Mutations addressing a MISSING agent
|
|
735
|
+
* (`update`, `updateAllowlist`, `remove`) reject with a typed
|
|
736
|
+
* `RuntimeError` kind `'not_found'`. Workspace-file writes are exempt BY
|
|
737
|
+
* DESIGN: they provision the workspace directory on demand (creating an
|
|
738
|
+
* agent's first file is a legitimate provisioning step, not an error).
|
|
739
|
+
* Provider/runtime failures on these surfaces are typed `RuntimeError`s
|
|
740
|
+
* (adapters map them in their own errors module — core never classifies
|
|
741
|
+
* on message text); caller-INPUT validation (invalid names/paths,
|
|
742
|
+
* unsupported options) may throw plain `Error`s — those signal programmer
|
|
743
|
+
* error before any runtime interaction, not runtime state.
|
|
744
|
+
*/
|
|
394
745
|
agents: {
|
|
395
746
|
list(): Promise<RuntimeAgent[]>;
|
|
396
747
|
get(agentId: string): Promise<RuntimeAgent | null>;
|
|
@@ -401,31 +752,44 @@ export interface AgentRuntimeAdapter {
|
|
|
401
752
|
readWorkspaceFile(agentId: string, path: string): Promise<WorkspaceFile | null>;
|
|
402
753
|
writeWorkspaceFile(agentId: string, file: WorkspaceFile): Promise<void>;
|
|
403
754
|
removeWorkspaceFile(agentId: string, path: string): Promise<void>;
|
|
404
|
-
|
|
755
|
+
/**
|
|
756
|
+
* Read-only size stats for the files the runtime loads at session start
|
|
757
|
+
* (canonical bootstrap files, skills, memory notes). Null when the agent
|
|
758
|
+
* has no workspace. Optional: runtimes without a file-backed workspace
|
|
759
|
+
* omit it, and callers must treat absence as "stats unavailable" —
|
|
760
|
+
* skip, never error.
|
|
761
|
+
*/
|
|
762
|
+
workspaceFileStats?(agentId: string): Promise<WorkspaceFileStat[] | null>;
|
|
763
|
+
/**
|
|
764
|
+
* The SUBAGENT-DISPATCH allowlist: the patch strings are AGENT IDS this
|
|
765
|
+
* agent may dispatch subtasks to (P5.3 live incident: these were once fed
|
|
766
|
+
* into an exec-tool name filter — they are never tool names). OpenClaw
|
|
767
|
+
* writes `agents.list[].subagents.allowAgents` in its config; Pi stores
|
|
768
|
+
* the registry record's `allowlist`, consumed by its tool bridge when
|
|
769
|
+
* filtering subagent dispatch targets. Installer/team flows add every
|
|
770
|
+
* newly installed agent to its dispatchers here.
|
|
771
|
+
*/
|
|
405
772
|
updateAllowlist(agentId: string, patch: RuntimeAllowlistPatch): Promise<void>;
|
|
406
|
-
heartbeat(agentId: string): Promise<boolean>;
|
|
407
773
|
};
|
|
408
774
|
messaging: {
|
|
409
775
|
send(args: MessageArgs): Promise<MessageResult>;
|
|
776
|
+
/**
|
|
777
|
+
* Stream one agent turn as normalized ChatChunks. See the ChatChunk
|
|
778
|
+
* doc for the behavioral contract: adapter-varying granularity,
|
|
779
|
+
* `done` exactly once and last, best-effort tool/status liveness,
|
|
780
|
+
* terminal failure = `error` chunk then end (never a throw from
|
|
781
|
+
* iteration), classified/structured chunks only.
|
|
782
|
+
*/
|
|
410
783
|
stream(args: MessageArgs): AsyncIterable<ChatChunk>;
|
|
411
784
|
};
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
deliverContent(args: ContentDeliveryArgs): Promise<DeliveryResult>;
|
|
421
|
-
createApproval(args: CreateApprovalArgs): Promise<ApprovalRenderResult>;
|
|
422
|
-
editApproval(args: EditApprovalArgs): Promise<ApprovalRenderResult>;
|
|
423
|
-
cancelApproval(args: CancelApprovalArgs): Promise<void>;
|
|
424
|
-
resolveApproval(args: ResolveApprovalArgs): Promise<void>;
|
|
425
|
-
subscribeApprovalResponses(handler: (event: ApprovalResolveEvent) => void): Unsubscribe;
|
|
426
|
-
onMessage(handler: (event: ChannelMessageEvent) => void): Unsubscribe;
|
|
427
|
-
onInteraction(handler: (event: ChannelInteractionEvent) => void): Unsubscribe;
|
|
428
|
-
};
|
|
785
|
+
/**
|
|
786
|
+
* OPTIONAL capability (P2.1): runtimes without a channel/delivery layer
|
|
787
|
+
* (Pi) OMIT this member entirely — no throwing stubs. Callers MUST
|
|
788
|
+
* feature-detect (`runtime.channels?.…` or a guarded local) and degrade
|
|
789
|
+
* honestly: empty channel lists, log-only alerts, UI-only approval gates.
|
|
790
|
+
* `capabilities().delivery.mode` reports the same fact declaratively.
|
|
791
|
+
*/
|
|
792
|
+
channels?: RuntimeChannelSurface;
|
|
429
793
|
skills: {
|
|
430
794
|
list(agentId?: string): Promise<RuntimeSkill[]>;
|
|
431
795
|
get(name: string, agentId?: string): Promise<RuntimeSkill | null>;
|
|
@@ -435,6 +799,24 @@ export interface AgentRuntimeAdapter {
|
|
|
435
799
|
sessions: {
|
|
436
800
|
list(agentId?: string): Promise<RuntimeSession[]>;
|
|
437
801
|
get(sessionId: string): Promise<RuntimeSession | null>;
|
|
802
|
+
/**
|
|
803
|
+
* Per-agent session-store disk stats. Optional: runtimes without a
|
|
804
|
+
* file-backed session store omit it, and callers must treat absence
|
|
805
|
+
* as "stats unavailable" — skip, never error.
|
|
806
|
+
*/
|
|
807
|
+
storeStats?(): Promise<RuntimeSessionStoreStats[]>;
|
|
808
|
+
/**
|
|
809
|
+
* Context stats for one Bakin thread's session (#737), read AT REST —
|
|
810
|
+
* no gateway calls, no turn, no session mutation, no thread locks.
|
|
811
|
+
* Keyed on {agentId, threadId} because the thread→session mapping is
|
|
812
|
+
* adapter-private on every runtime. Optional: runtimes that cannot
|
|
813
|
+
* answer omit the member; callers treat absence as unavailable —
|
|
814
|
+
* skip, never error. Null = no session / nothing honest to report.
|
|
815
|
+
*/
|
|
816
|
+
contextStats?(opts: {
|
|
817
|
+
agentId: string;
|
|
818
|
+
threadId: string;
|
|
819
|
+
}): Promise<RuntimeSessionContextStats | null>;
|
|
438
820
|
};
|
|
439
821
|
memory: {
|
|
440
822
|
listTiers(): Promise<RuntimeMemoryTier[]>;
|
|
@@ -463,15 +845,106 @@ export interface AgentRuntimeAdapter {
|
|
|
463
845
|
listAvailable(opts?: {
|
|
464
846
|
includeUnavailable?: boolean;
|
|
465
847
|
}): Promise<RuntimeAvailableModel[]>;
|
|
848
|
+
/**
|
|
849
|
+
* OPTIONAL capability (#852): verify the ACCOUNT can actually call this
|
|
850
|
+
* model by firing a minimal (~1-token) completion. Resolves on success;
|
|
851
|
+
* rejects with a typed RuntimeError — `model_not_supported` when the
|
|
852
|
+
* provider rejected the model id itself. Adapters without a cheap probe
|
|
853
|
+
* transport OMIT the member; callers feature-detect (`models.probe?.`).
|
|
854
|
+
* Billed (~pennies) and user-triggered only — never called on a
|
|
855
|
+
* schedule or from background refresh paths.
|
|
856
|
+
*/
|
|
857
|
+
probe?(modelId: string, opts?: {
|
|
858
|
+
signal?: AbortSignal;
|
|
859
|
+
}): Promise<void>;
|
|
860
|
+
/** Static declaration of which routing-policy fields this runtime honors. */
|
|
861
|
+
routingSupport(): RuntimeRoutingSupport;
|
|
862
|
+
/** The runtime's current routing policy (unsupported fields empty). */
|
|
863
|
+
routingPolicy(): Promise<RuntimeRoutingPolicy>;
|
|
864
|
+
/**
|
|
865
|
+
* Merge a partial policy into the runtime's native store. MUST throw on
|
|
866
|
+
* a patch carrying a field `routingSupport()` declares unsupported.
|
|
867
|
+
* `reason` feeds the adapter's audit trail.
|
|
868
|
+
*/
|
|
869
|
+
setRoutingPolicy(patch: Partial<RuntimeRoutingPolicy>, reason: string): Promise<void>;
|
|
466
870
|
};
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
871
|
+
/**
|
|
872
|
+
* The unified capability declaration for this runtime, evaluated for
|
|
873
|
+
* `opts.agentId`'s effective model (default: the main agent) where
|
|
874
|
+
* model-dependent (input modality). Async: the report surface for the
|
|
875
|
+
* runtime-switch UI + plugin capability queries. `input` is conservative-
|
|
876
|
+
* false on any ambiguity, never model-name heuristics.
|
|
877
|
+
*
|
|
878
|
+
* Modes are HONEST: a static `'native'` declaration is acceptable only
|
|
879
|
+
* when the surface is unconditionally implemented (the standard the T28
|
|
880
|
+
* sessions fix restored — a declared-native stub is a contract violation,
|
|
881
|
+
* pinned by the runtime conformance suite's capability-honesty check).
|
|
882
|
+
*/
|
|
883
|
+
capabilities(opts?: {
|
|
884
|
+
agentId?: string;
|
|
885
|
+
}): Promise<CapabilitySet>;
|
|
886
|
+
/**
|
|
887
|
+
* How agents on this runtime invoke Bakin exec tools — drives the
|
|
888
|
+
* tool-usage wording of dispatch prompts + projected AGENTS.md. SYNC +
|
|
889
|
+
* static (declared wiring, not probed state) so it's callable from the
|
|
890
|
+
* synchronous prompt-assembly path; `capabilities().toolCalling.access`
|
|
891
|
+
* returns the same facts for the async report surface.
|
|
892
|
+
*/
|
|
893
|
+
describeToolAccess(): RuntimeToolAccess;
|
|
894
|
+
/**
|
|
895
|
+
* Presence-only credential report for the runtime's LLM providers and
|
|
896
|
+
* channels (P2.2). `opts.agentId` scopes provider credentials to one
|
|
897
|
+
* agent's profile where the runtime keys them per-agent (default: the
|
|
898
|
+
* main agent). Never returns secret material.
|
|
899
|
+
*/
|
|
900
|
+
credentialStatus(opts?: {
|
|
901
|
+
agentId?: string;
|
|
902
|
+
}): Promise<RuntimeCredentialStatus>;
|
|
903
|
+
/**
|
|
904
|
+
* Wire up this runtime so its agents can reach Bakin's exec tools.
|
|
905
|
+
* Idempotent + re-invokable: run at init AND whenever the agent roster or
|
|
906
|
+
* exec-tool set changes (agent-create, plugin (un)load).
|
|
907
|
+
* - in-process (Pi): no-op — tools are injected per session via the
|
|
908
|
+
* `execTools` provider passed to `initialize`.
|
|
909
|
+
* - mcp (OpenClaw): write `config.mcp.servers[bakin-<agent>]` for every
|
|
910
|
+
* agent, pruning stale Bakin entries; needs `bakinMcpBaseUrl` (init opt).
|
|
911
|
+
* - cli-shim: no-op stub.
|
|
912
|
+
* The `execTools` provider reads the LIVE registry; runtimes that inject
|
|
913
|
+
* tools by value re-read it here so late registrations become visible.
|
|
914
|
+
*/
|
|
915
|
+
provisionToolAccess(execTools?: RuntimeExecToolProvider): Promise<void>;
|
|
916
|
+
/**
|
|
917
|
+
* Tear down what `provisionToolAccess` wrote. in-process/cli-shim: no-op.
|
|
918
|
+
* mcp: remove Bakin-owned `bakin-*` server entries. Called by the
|
|
919
|
+
* runtime-switch flow (P3.2) on switch-away.
|
|
920
|
+
*/
|
|
921
|
+
deprovisionToolAccess(): Promise<void>;
|
|
922
|
+
/**
|
|
923
|
+
* Report whether tool-access provisioning is currently in place, WITHOUT
|
|
924
|
+
* writing. Drives the onboarding/doctor drift surfaces through a
|
|
925
|
+
* runtime-neutral status so core never inspects a provider's config shape.
|
|
926
|
+
*/
|
|
927
|
+
verifyToolAccess(): Promise<ToolAccessProvisioningStatus>;
|
|
928
|
+
images?: RuntimeImagesAccess;
|
|
929
|
+
extensions?: RuntimeExtensionsAccess;
|
|
930
|
+
/**
|
|
931
|
+
* Access to the runtime's private media store (e.g. channel attachments).
|
|
932
|
+
* `resolveUri` maps a runtime-private URI (`RUNTIME_MEDIA_URI_SCHEME`-
|
|
933
|
+
* prefixed) to an absolute local file path; null for unknown schemes or
|
|
934
|
+
* missing files — never throws for not-found. Optional: runtimes without a
|
|
935
|
+
* media store omit it, and callers must treat absence as "cannot resolve".
|
|
936
|
+
*/
|
|
937
|
+
media?: {
|
|
938
|
+
resolveUri(uri: string): Promise<string | null>;
|
|
473
939
|
};
|
|
474
|
-
|
|
940
|
+
/**
|
|
941
|
+
* OPTIONAL capability (P2.1): the RUNTIME's native cron surface (jobs the
|
|
942
|
+
* runtime/agents create for themselves — Bakin surfaces them read-only and
|
|
943
|
+
* can adopt them). Runtimes without one (Pi) OMIT the member; Bakin-owned
|
|
944
|
+
* task scheduling (the schedule plugin's own tick scheduler) is unaffected.
|
|
945
|
+
* Callers MUST feature-detect and treat absence as "no native jobs".
|
|
946
|
+
*/
|
|
947
|
+
cron?: {
|
|
475
948
|
list(): Promise<CronJob[]>;
|
|
476
949
|
get(id: string): Promise<CronJob | null>;
|
|
477
950
|
create(input: CreateCronJobInput): Promise<CronJob>;
|
|
@@ -482,5 +955,4 @@ export interface AgentRuntimeAdapter {
|
|
|
482
955
|
getRaw(id: string, reason: string): Promise<unknown | null>;
|
|
483
956
|
restoreRaw(id: string, snapshot: unknown, reason: string): Promise<CronJob>;
|
|
484
957
|
};
|
|
485
|
-
config: RuntimeConfigAccess;
|
|
486
958
|
}
|