@makinbakin/sdk 0.0.1-rc.4 → 0.0.1-rc.40
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 +61 -0
- package/_internal/app/components/drawer.d.ts +27 -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 +25 -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-runtime-status.d.ts +22 -6
- 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 +13 -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 +794 -235
- 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 +99 -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 +11 -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/pin-data.d.ts +36 -0
- package/_internal/core/media/pin.d.ts +22 -0
- package/_internal/core/media/sharp-import.d.ts +10 -0
- package/_internal/core/media/sharp-loader.d.ts +41 -0
- package/_internal/core/media/store.d.ts +21 -0
- package/_internal/core/plugin-types.d.ts +248 -500
- package/_internal/core/routing/define.d.ts +33 -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/host/ui/resize.d.ts +2 -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/resize-handle.d.ts +15 -0
- package/_internal/ui/behaviors/selection-navigation.d.ts +5 -0
- package/_internal/ui/behaviors/use-persisted-leading-edge-resize.d.ts +31 -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 +46 -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 +61 -0
- package/_internal/ui/conversation/conversation.d.ts +37 -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/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 +30 -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 +89 -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 +21 -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 +157 -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/filter-indicator.d.ts +3 -0
- package/_internal/ui/patterns/guide-card.d.ts +33 -0
- package/_internal/ui/patterns/index.d.ts +75 -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 +33 -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 +55 -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/combobox.d.ts +40 -0
- package/_internal/ui/primitives/command.d.ts +36 -0
- package/_internal/ui/primitives/control-styles.d.ts +10 -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 +30 -0
- package/_internal/ui/primitives/input.d.ts +10 -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 +35 -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 +19 -0
- package/_internal/ui/primitives/tooltip.d.ts +14 -0
- package/_internal/ui/primitives/use-textarea-autosize.d.ts +3 -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 +6854 -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 +38 -0
- package/content/markdown-comparison.d.ts +12 -0
- package/content/markdown-content.d.ts +18 -0
- package/content/markdown-document.d.ts +4 -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 +86 -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 +63 -10
- package/patterns/agent-patterns.d.ts +81 -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 +108 -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 +376 -0
- package/types/index.d.ts +19 -919
- package/types/index.js +1 -0
- package/types/manifest.d.ts +255 -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 +599 -0
- package/ui/index.d.ts +73 -31
- package/ui/index.js +38 -28704
- package/utils/asset-id.d.ts +15 -0
- package/utils/index.d.ts +27 -7
- package/utils/index.js +4 -2098
- package/utils/plugin-fetch.d.ts +44 -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;
|
|
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;
|
|
200
217
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
218
|
+
/** Tool activity; `data` is always the structured RuntimeToolActivity. */
|
|
219
|
+
| {
|
|
220
|
+
type: 'tool';
|
|
221
|
+
content?: string;
|
|
222
|
+
data: RuntimeToolActivity;
|
|
205
223
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
id: string;
|
|
212
|
-
displayName?: string;
|
|
213
|
-
};
|
|
214
|
-
body: string;
|
|
215
|
-
threadId?: string;
|
|
216
|
-
receivedAt: string;
|
|
217
|
-
metadata?: RuntimeMetadata;
|
|
224
|
+
/** Turn lifecycle hint (e.g. 'thinking'). */
|
|
225
|
+
| {
|
|
226
|
+
type: 'status';
|
|
227
|
+
content?: string;
|
|
228
|
+
data?: RuntimeMetadata;
|
|
218
229
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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;
|
|
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;
|
|
246
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;
|
|
@@ -305,41 +533,188 @@ export interface RuntimeAvailableModel {
|
|
|
305
533
|
contextWindow?: number;
|
|
306
534
|
local?: boolean;
|
|
307
535
|
available?: boolean;
|
|
536
|
+
/**
|
|
537
|
+
* WHY `available` is false, when the runtime knows (#907). Pi reports
|
|
538
|
+
* `no_credentials` for catalog models whose provider has no configured
|
|
539
|
+
* auth — the model exists, the account cannot reach it. Consumers never
|
|
540
|
+
* infer a reason the runtime did not give: absent ⇒ "runtime reports
|
|
541
|
+
* this model unavailable", never "retired".
|
|
542
|
+
*/
|
|
543
|
+
unavailableReason?: 'no_credentials' | 'not_configured' | 'other';
|
|
308
544
|
tags?: string[];
|
|
309
545
|
metadata?: RuntimeMetadata;
|
|
310
546
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
547
|
+
/**
|
|
548
|
+
* Status-only record for ONE LLM provider (#907 / the model slice of #378).
|
|
549
|
+
* `configured` is the runtime's own auth resolution (Pi: configured auth;
|
|
550
|
+
* OpenClaw: the merged auth-profiles + CLI probe) — never config-key
|
|
551
|
+
* presence. `authFree` marks providers that need no credential (local
|
|
552
|
+
* models). NEVER carries secret material — the declared field set is
|
|
553
|
+
* pinned by tests/architecture/provider-inventory-shape.test.ts and the
|
|
554
|
+
* runtime values by the conformance suite.
|
|
555
|
+
*/
|
|
556
|
+
export interface ProviderCredentialStatus {
|
|
557
|
+
providerId: string;
|
|
558
|
+
configured: boolean;
|
|
559
|
+
authFree?: boolean;
|
|
560
|
+
source?: 'runtime' | 'env' | 'store';
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* The provider inventory `credentials.providers()` returns. `evidence` is
|
|
564
|
+
* HONEST: 'partial' whenever one of the adapter's credential sources failed
|
|
565
|
+
* (OpenClaw's CLI probe), so consumers treat providers absent from a partial
|
|
566
|
+
* inventory as UNKNOWN — never as credential-less.
|
|
567
|
+
*/
|
|
568
|
+
export interface ProviderCredentialInventory {
|
|
569
|
+
providers: ProviderCredentialStatus[];
|
|
570
|
+
evidence: 'complete' | 'partial';
|
|
571
|
+
detail?: string;
|
|
572
|
+
}
|
|
573
|
+
/** Kinds of Bakin-initiated config change an adapter may need a restart to apply. */
|
|
574
|
+
export type RuntimeConfigChangeKind = 'model-config' | 'roster' | 'routing-policy';
|
|
575
|
+
/**
|
|
576
|
+
* What the runtime says about applying a config change (#878 Models half).
|
|
577
|
+
* The Models page renders this verbatim — title/body/action come from the
|
|
578
|
+
* adapter, never from adapter-id branching upstream. `needed: false` means
|
|
579
|
+
* the change is live already (Pi re-reads its stores per turn).
|
|
580
|
+
*/
|
|
581
|
+
export interface RestartAdvice {
|
|
582
|
+
needed: boolean;
|
|
583
|
+
title?: string;
|
|
584
|
+
body?: string;
|
|
585
|
+
action?: {
|
|
586
|
+
label: string;
|
|
587
|
+
kind: 'restart-runtime';
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
export type RuntimeImageOutputFormat = 'png' | 'jpeg' | 'jpg' | 'webp';
|
|
591
|
+
export type RuntimeImageBackground = 'transparent' | 'opaque' | 'auto';
|
|
592
|
+
/**
|
|
593
|
+
* Image capability is intentionally all-optional. A thin runtime that exposes a
|
|
594
|
+
* single image tool maps on by filling minimal fields (e.g. one synthesized
|
|
595
|
+
* provider with a defaultModel); a rich runtime fills more. Consumers MUST
|
|
596
|
+
* treat a sparse capability as normal and never require a field a thin runtime
|
|
597
|
+
* cannot provide — gaps are filled below, in the adapter/shim, not pushed up
|
|
598
|
+
* into plugins. See .claude/knowledge/media-generation-adapter-architecture.md.
|
|
599
|
+
*/
|
|
600
|
+
export interface RuntimeImageProviderCapabilities {
|
|
601
|
+
generate?: {
|
|
602
|
+
maxCount?: number;
|
|
603
|
+
supportsSize?: boolean;
|
|
604
|
+
supportsAspectRatio?: boolean;
|
|
605
|
+
supportsResolution?: boolean;
|
|
606
|
+
};
|
|
607
|
+
edit?: {
|
|
608
|
+
enabled?: boolean;
|
|
609
|
+
maxCount?: number;
|
|
610
|
+
maxInputImages?: number;
|
|
611
|
+
supportsSize?: boolean;
|
|
612
|
+
supportsAspectRatio?: boolean;
|
|
613
|
+
supportsResolution?: boolean;
|
|
614
|
+
};
|
|
615
|
+
geometry?: {
|
|
616
|
+
sizes?: string[];
|
|
617
|
+
aspectRatios?: string[];
|
|
618
|
+
resolutions?: string[];
|
|
619
|
+
};
|
|
620
|
+
output?: {
|
|
621
|
+
formats?: string[];
|
|
622
|
+
qualities?: string[];
|
|
623
|
+
backgrounds?: string[];
|
|
624
|
+
};
|
|
316
625
|
metadata?: RuntimeMetadata;
|
|
317
626
|
}
|
|
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;
|
|
627
|
+
export interface RuntimeImageProvider {
|
|
628
|
+
id: string;
|
|
629
|
+
label?: string;
|
|
630
|
+
defaultModel?: string;
|
|
631
|
+
models?: string[];
|
|
632
|
+
available?: boolean;
|
|
633
|
+
configured?: boolean;
|
|
634
|
+
selected?: boolean;
|
|
635
|
+
capabilities?: RuntimeImageProviderCapabilities;
|
|
331
636
|
metadata?: RuntimeMetadata;
|
|
332
637
|
}
|
|
333
|
-
export interface
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
638
|
+
export interface RuntimeImageGenerateInput {
|
|
639
|
+
prompt: string;
|
|
640
|
+
provider?: string;
|
|
641
|
+
model?: string;
|
|
642
|
+
count?: number;
|
|
643
|
+
width?: number;
|
|
644
|
+
height?: number;
|
|
645
|
+
size?: string;
|
|
646
|
+
aspectRatio?: string;
|
|
647
|
+
resolution?: string;
|
|
648
|
+
outputFormat?: RuntimeImageOutputFormat;
|
|
649
|
+
background?: RuntimeImageBackground;
|
|
650
|
+
/**
|
|
651
|
+
* Reference/context image file paths conditioning the generation. The caller
|
|
652
|
+
* (Bakin) resolves managed asset ids to concrete paths before the adapter
|
|
653
|
+
* sees them. Native generation has no file input, so a generate carrying
|
|
654
|
+
* references is routed through the edit-style invocation (#418).
|
|
655
|
+
*/
|
|
656
|
+
referenceImages?: string[];
|
|
657
|
+
timeoutMs?: number;
|
|
658
|
+
metadata?: RuntimeMetadata;
|
|
659
|
+
}
|
|
660
|
+
export interface RuntimeImageEditInput extends RuntimeImageGenerateInput {
|
|
661
|
+
files: string[];
|
|
338
662
|
}
|
|
339
|
-
export interface
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
663
|
+
export interface RuntimeImageFile {
|
|
664
|
+
filePath: string;
|
|
665
|
+
mimeType?: string;
|
|
666
|
+
width?: number;
|
|
667
|
+
height?: number;
|
|
668
|
+
provider?: string;
|
|
669
|
+
model?: string;
|
|
670
|
+
url?: string;
|
|
671
|
+
metadata?: RuntimeMetadata;
|
|
672
|
+
}
|
|
673
|
+
export interface RuntimeImageGenerationResult {
|
|
674
|
+
images: RuntimeImageFile[];
|
|
675
|
+
provider?: string;
|
|
676
|
+
model?: string;
|
|
677
|
+
providerText?: string;
|
|
678
|
+
metadata?: RuntimeMetadata;
|
|
679
|
+
}
|
|
680
|
+
export interface RuntimeImagesAccess {
|
|
681
|
+
providers(): Promise<RuntimeImageProvider[]>;
|
|
682
|
+
generate(input: RuntimeImageGenerateInput): Promise<RuntimeImageGenerationResult>;
|
|
683
|
+
edit(input: RuntimeImageEditInput): Promise<RuntimeImageGenerationResult>;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* A runtime extension: third-party code the RUNTIME loads in-process during
|
|
687
|
+
* agent turns (Pi extensions today). Provider-neutral shape — ids/labels/
|
|
688
|
+
* paths only, never provider config. Discovery is INERT: listing never
|
|
689
|
+
* executes extension code.
|
|
690
|
+
*/
|
|
691
|
+
export interface RuntimeExtensionInfo {
|
|
692
|
+
/** Stable identifier used for allow/revoke — the real absolute module path. */
|
|
693
|
+
id: string;
|
|
694
|
+
label: string;
|
|
695
|
+
/** Where it came from, human-readable (e.g. "npm:some-pkg", "extensions dir"). */
|
|
696
|
+
source: string;
|
|
697
|
+
/** Real absolute load path (symlinks resolved) — half the trust identity. */
|
|
698
|
+
path: string;
|
|
699
|
+
/** Current content hash of the file — the other half of the trust identity. */
|
|
700
|
+
sha256: string;
|
|
701
|
+
/**
|
|
702
|
+
* pending — discovered but NOT loaded into turns (unapproved, or its
|
|
703
|
+
* content changed since approval)
|
|
704
|
+
* allowed — approved path+hash; loads into agent turns
|
|
705
|
+
* blocked — policy mode 'none': nothing loads
|
|
706
|
+
*/
|
|
707
|
+
status: 'allowed' | 'pending' | 'blocked';
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* OPTIONAL: trust management for runtime-loaded extensions. Runtimes without
|
|
711
|
+
* an extension mechanism OMIT the member; callers feature-detect
|
|
712
|
+
* (`runtime.extensions?.`). Listing is read-only and inert. The trust store
|
|
713
|
+
* itself (allowlist) is Bakin-owned settings — see
|
|
714
|
+
* `src/core/runtime-extensions.ts` for the ONE mutation engine.
|
|
715
|
+
*/
|
|
716
|
+
export interface RuntimeExtensionsAccess {
|
|
717
|
+
list(): Promise<RuntimeExtensionInfo[]>;
|
|
343
718
|
}
|
|
344
719
|
export interface CronJob {
|
|
345
720
|
id: string;
|
|
@@ -376,21 +751,57 @@ export interface RawCronSnapshot {
|
|
|
376
751
|
capturedAt: string;
|
|
377
752
|
snapshot: unknown;
|
|
378
753
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
754
|
+
/**
|
|
755
|
+
* URI scheme for runtime-private media references (`media://inbound/…`).
|
|
756
|
+
* The ONE place upstream code may learn the scheme: callers detect
|
|
757
|
+
* media references with this constant and hand them to `media.resolveUri`
|
|
758
|
+
* (feature-detected) — the adapter owns what the URI means.
|
|
759
|
+
*/
|
|
760
|
+
export declare const RUNTIME_MEDIA_URI_SCHEME = "media://";
|
|
385
761
|
export interface AgentRuntimeAdapter {
|
|
386
762
|
readonly name: string;
|
|
387
763
|
readonly version: string;
|
|
388
764
|
readonly requiredCoreVersion: string;
|
|
389
765
|
initialize(opts: AdapterInitOpts): Promise<void>;
|
|
390
766
|
shutdown(): Promise<void>;
|
|
767
|
+
/**
|
|
768
|
+
* "Can this runtime serve a turn?" — a CHEAP probe (an HTTP health hit, a
|
|
769
|
+
* credential-presence read; never an LLM call). Resolves `false` rather
|
|
770
|
+
* than throwing when the runtime cannot serve (unreachable process,
|
|
771
|
+
* uninitialized adapter, no LLM credentials). Deeper diagnostics are
|
|
772
|
+
* registered separately with the canonical Health registry.
|
|
773
|
+
*/
|
|
391
774
|
ping(): Promise<boolean>;
|
|
775
|
+
/**
|
|
776
|
+
* Re-read ALL durable config: credentials, model registry, settings,
|
|
777
|
+
* provisioned tool access. External-process runtimes may bounce the
|
|
778
|
+
* process; in-process runtimes must drop every cache so the next call
|
|
779
|
+
* re-reads disk. Callers (team/models plugins) invoke this after config
|
|
780
|
+
* writes and expect the next read to reflect them.
|
|
781
|
+
*/
|
|
392
782
|
restart(): Promise<void>;
|
|
393
|
-
|
|
783
|
+
/**
|
|
784
|
+
* OPTIONAL (#878): does a change of this kind need `restart()` before the
|
|
785
|
+
* runtime applies it, and how should the UI say so? SYNC + static, like
|
|
786
|
+
* describeToolAccess(). Adapters that omit the member get a conservative
|
|
787
|
+
* generic banner from the caller; absence is member omission, never a
|
|
788
|
+
* throwing stub (conformance-pinned). Callers feature-detect
|
|
789
|
+
* (`runtime.restartAdvice?.(kind)`).
|
|
790
|
+
*/
|
|
791
|
+
restartAdvice?(change: RuntimeConfigChangeKind): RestartAdvice | undefined;
|
|
792
|
+
/**
|
|
793
|
+
* CRUD error contract (R28): `get` returns `null` for a missing agent —
|
|
794
|
+
* absence is a value, never a throw. Mutations addressing a MISSING agent
|
|
795
|
+
* (`update`, `updateAllowlist`, `remove`) reject with a typed
|
|
796
|
+
* `RuntimeError` kind `'not_found'`. Workspace-file writes are exempt BY
|
|
797
|
+
* DESIGN: they provision the workspace directory on demand (creating an
|
|
798
|
+
* agent's first file is a legitimate provisioning step, not an error).
|
|
799
|
+
* Provider/runtime failures on these surfaces are typed `RuntimeError`s
|
|
800
|
+
* (adapters map them in their own errors module — core never classifies
|
|
801
|
+
* on message text); caller-INPUT validation (invalid names/paths,
|
|
802
|
+
* unsupported options) may throw plain `Error`s — those signal programmer
|
|
803
|
+
* error before any runtime interaction, not runtime state.
|
|
804
|
+
*/
|
|
394
805
|
agents: {
|
|
395
806
|
list(): Promise<RuntimeAgent[]>;
|
|
396
807
|
get(agentId: string): Promise<RuntimeAgent | null>;
|
|
@@ -401,31 +812,44 @@ export interface AgentRuntimeAdapter {
|
|
|
401
812
|
readWorkspaceFile(agentId: string, path: string): Promise<WorkspaceFile | null>;
|
|
402
813
|
writeWorkspaceFile(agentId: string, file: WorkspaceFile): Promise<void>;
|
|
403
814
|
removeWorkspaceFile(agentId: string, path: string): Promise<void>;
|
|
404
|
-
|
|
815
|
+
/**
|
|
816
|
+
* Read-only size stats for the files the runtime loads at session start
|
|
817
|
+
* (canonical bootstrap files, skills, memory notes). Null when the agent
|
|
818
|
+
* has no workspace. Optional: runtimes without a file-backed workspace
|
|
819
|
+
* omit it, and callers must treat absence as "stats unavailable" —
|
|
820
|
+
* skip, never error.
|
|
821
|
+
*/
|
|
822
|
+
workspaceFileStats?(agentId: string): Promise<WorkspaceFileStat[] | null>;
|
|
823
|
+
/**
|
|
824
|
+
* The SUBAGENT-DISPATCH allowlist: the patch strings are AGENT IDS this
|
|
825
|
+
* agent may dispatch subtasks to (P5.3 live incident: these were once fed
|
|
826
|
+
* into an exec-tool name filter — they are never tool names). OpenClaw
|
|
827
|
+
* writes `agents.list[].subagents.allowAgents` in its config; Pi stores
|
|
828
|
+
* the registry record's `allowlist`, consumed by its tool bridge when
|
|
829
|
+
* filtering subagent dispatch targets. Installer/team flows add every
|
|
830
|
+
* newly installed agent to its dispatchers here.
|
|
831
|
+
*/
|
|
405
832
|
updateAllowlist(agentId: string, patch: RuntimeAllowlistPatch): Promise<void>;
|
|
406
|
-
heartbeat(agentId: string): Promise<boolean>;
|
|
407
833
|
};
|
|
408
834
|
messaging: {
|
|
409
835
|
send(args: MessageArgs): Promise<MessageResult>;
|
|
836
|
+
/**
|
|
837
|
+
* Stream one agent turn as normalized ChatChunks. See the ChatChunk
|
|
838
|
+
* doc for the behavioral contract: adapter-varying granularity,
|
|
839
|
+
* `done` exactly once and last, best-effort tool/status liveness,
|
|
840
|
+
* terminal failure = `error` chunk then end (never a throw from
|
|
841
|
+
* iteration), classified/structured chunks only.
|
|
842
|
+
*/
|
|
410
843
|
stream(args: MessageArgs): AsyncIterable<ChatChunk>;
|
|
411
844
|
};
|
|
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
|
-
};
|
|
845
|
+
/**
|
|
846
|
+
* OPTIONAL capability (P2.1): runtimes without a channel/delivery layer
|
|
847
|
+
* (Pi) OMIT this member entirely — no throwing stubs. Callers MUST
|
|
848
|
+
* feature-detect (`runtime.channels?.…` or a guarded local) and degrade
|
|
849
|
+
* honestly: empty channel lists, log-only alerts, UI-only approval gates.
|
|
850
|
+
* `capabilities().delivery.mode` reports the same fact declaratively.
|
|
851
|
+
*/
|
|
852
|
+
channels?: RuntimeChannelSurface;
|
|
429
853
|
skills: {
|
|
430
854
|
list(agentId?: string): Promise<RuntimeSkill[]>;
|
|
431
855
|
get(name: string, agentId?: string): Promise<RuntimeSkill | null>;
|
|
@@ -435,6 +859,24 @@ export interface AgentRuntimeAdapter {
|
|
|
435
859
|
sessions: {
|
|
436
860
|
list(agentId?: string): Promise<RuntimeSession[]>;
|
|
437
861
|
get(sessionId: string): Promise<RuntimeSession | null>;
|
|
862
|
+
/**
|
|
863
|
+
* Per-agent session-store disk stats. Optional: runtimes without a
|
|
864
|
+
* file-backed session store omit it, and callers must treat absence
|
|
865
|
+
* as "stats unavailable" — skip, never error.
|
|
866
|
+
*/
|
|
867
|
+
storeStats?(): Promise<RuntimeSessionStoreStats[]>;
|
|
868
|
+
/**
|
|
869
|
+
* Context stats for one Bakin thread's session (#737), read AT REST —
|
|
870
|
+
* no gateway calls, no turn, no session mutation, no thread locks.
|
|
871
|
+
* Keyed on {agentId, threadId} because the thread→session mapping is
|
|
872
|
+
* adapter-private on every runtime. Optional: runtimes that cannot
|
|
873
|
+
* answer omit the member; callers treat absence as unavailable —
|
|
874
|
+
* skip, never error. Null = no session / nothing honest to report.
|
|
875
|
+
*/
|
|
876
|
+
contextStats?(opts: {
|
|
877
|
+
agentId: string;
|
|
878
|
+
threadId: string;
|
|
879
|
+
}): Promise<RuntimeSessionContextStats | null>;
|
|
438
880
|
};
|
|
439
881
|
memory: {
|
|
440
882
|
listTiers(): Promise<RuntimeMemoryTier[]>;
|
|
@@ -463,15 +905,133 @@ export interface AgentRuntimeAdapter {
|
|
|
463
905
|
listAvailable(opts?: {
|
|
464
906
|
includeUnavailable?: boolean;
|
|
465
907
|
}): Promise<RuntimeAvailableModel[]>;
|
|
908
|
+
/**
|
|
909
|
+
* OPTIONAL capability (#852): verify the ACCOUNT can actually call this
|
|
910
|
+
* model by firing a minimal (~1-token) completion. Resolves on success;
|
|
911
|
+
* rejects with a typed RuntimeError — `model_not_supported` when the
|
|
912
|
+
* provider rejected the model id itself. Adapters without a cheap probe
|
|
913
|
+
* transport OMIT the member; callers feature-detect (`models.probe?.`).
|
|
914
|
+
* Billed (~pennies) and user-triggered only — never called on a
|
|
915
|
+
* schedule or from background refresh paths.
|
|
916
|
+
*/
|
|
917
|
+
probe?(modelId: string, opts?: {
|
|
918
|
+
signal?: AbortSignal;
|
|
919
|
+
}): Promise<void>;
|
|
920
|
+
/**
|
|
921
|
+
* OPTIONAL (#907 review): the catalog id this runtime would RUN `ref`
|
|
922
|
+
* as — `ref` itself when the catalog lists it verbatim, the runtime's
|
|
923
|
+
* OWN resolution of a non-verbatim reference (Pi accepts bare model
|
|
924
|
+
* ids and resolves them by its registry rule), or null when the
|
|
925
|
+
* runtime would not resolve it. The eligibility engine judges a
|
|
926
|
+
* persisted selection by this row, so the verdict follows the
|
|
927
|
+
* adapter's actual turn-time semantics — never a catalog-shape guess.
|
|
928
|
+
* A runtime that omits the member runs exactly what its catalog lists.
|
|
929
|
+
* Read-only: no network, no turn.
|
|
930
|
+
*/
|
|
931
|
+
resolveId?(ref: string): Promise<string | null>;
|
|
932
|
+
/** Static declaration of which routing-policy fields this runtime honors. */
|
|
933
|
+
routingSupport(): RuntimeRoutingSupport;
|
|
934
|
+
/** The runtime's current routing policy (unsupported fields empty). */
|
|
935
|
+
routingPolicy(): Promise<RuntimeRoutingPolicy>;
|
|
936
|
+
/**
|
|
937
|
+
* Merge a partial policy into the runtime's native store. MUST throw on
|
|
938
|
+
* a patch carrying a field `routingSupport()` declares unsupported.
|
|
939
|
+
* `reason` feeds the adapter's audit trail.
|
|
940
|
+
*/
|
|
941
|
+
setRoutingPolicy(patch: Partial<RuntimeRoutingPolicy>, reason: string): Promise<void>;
|
|
942
|
+
};
|
|
943
|
+
/**
|
|
944
|
+
* The unified capability declaration for this runtime, evaluated for
|
|
945
|
+
* `opts.agentId`'s effective model (default: the main agent) where
|
|
946
|
+
* model-dependent (input modality). Async: the report surface for the
|
|
947
|
+
* runtime-switch UI + plugin capability queries. `input` is conservative-
|
|
948
|
+
* false on any ambiguity, never model-name heuristics.
|
|
949
|
+
*
|
|
950
|
+
* Modes are HONEST: a static `'native'` declaration is acceptable only
|
|
951
|
+
* when the surface is unconditionally implemented (the standard the T28
|
|
952
|
+
* sessions fix restored — a declared-native stub is a contract violation,
|
|
953
|
+
* pinned by the runtime conformance suite's capability-honesty check).
|
|
954
|
+
*/
|
|
955
|
+
capabilities(opts?: {
|
|
956
|
+
agentId?: string;
|
|
957
|
+
}): Promise<CapabilitySet>;
|
|
958
|
+
/**
|
|
959
|
+
* How agents on this runtime invoke Bakin exec tools — drives the
|
|
960
|
+
* tool-usage wording of dispatch prompts + projected AGENTS.md. SYNC +
|
|
961
|
+
* static (declared wiring, not probed state) so it's callable from the
|
|
962
|
+
* synchronous prompt-assembly path; `capabilities().toolCalling.access`
|
|
963
|
+
* returns the same facts for the async report surface.
|
|
964
|
+
*/
|
|
965
|
+
describeToolAccess(): RuntimeToolAccess;
|
|
966
|
+
/**
|
|
967
|
+
* Presence-only credential report for the runtime's LLM providers and
|
|
968
|
+
* channels (P2.2). `opts.agentId` scopes provider credentials to one
|
|
969
|
+
* agent's profile where the runtime keys them per-agent (default: the
|
|
970
|
+
* main agent). Never returns secret material.
|
|
971
|
+
*/
|
|
972
|
+
credentialStatus(opts?: {
|
|
973
|
+
agentId?: string;
|
|
974
|
+
}): Promise<RuntimeCredentialStatus>;
|
|
975
|
+
/**
|
|
976
|
+
* OPTIONAL (#907 / #378 model slice): the per-provider STATUS-ONLY
|
|
977
|
+
* credential inventory the model-eligibility engine reads. Derived from
|
|
978
|
+
* the adapter's real auth resolution (the same path `credentialStatus`
|
|
979
|
+
* uses), with honest `evidence` when a source failed. `opts.agentId`
|
|
980
|
+
* scopes it where the runtime keys credentials per agent. Absence is
|
|
981
|
+
* member omission (conformance-pinned); callers feature-detect
|
|
982
|
+
* (`runtime.credentials?.providers(...)`) and treat absence as
|
|
983
|
+
* "credential evidence unavailable".
|
|
984
|
+
*/
|
|
985
|
+
credentials?: {
|
|
986
|
+
providers(opts?: {
|
|
987
|
+
agentId?: string;
|
|
988
|
+
}): Promise<ProviderCredentialInventory>;
|
|
466
989
|
};
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
990
|
+
/**
|
|
991
|
+
* Wire up this runtime so its agents can reach Bakin's exec tools.
|
|
992
|
+
* Idempotent + re-invokable: run at init AND whenever the agent roster or
|
|
993
|
+
* exec-tool set changes (agent-create, plugin (un)load).
|
|
994
|
+
* - in-process (Pi): no-op — tools are injected per session via the
|
|
995
|
+
* `execTools` provider passed to `initialize`.
|
|
996
|
+
* - mcp (OpenClaw): write `config.mcp.servers[bakin-<agent>]` for every
|
|
997
|
+
* agent, pruning stale Bakin entries; needs `bakinMcpBaseUrl` (init opt).
|
|
998
|
+
* - cli-shim: no-op stub.
|
|
999
|
+
* The `execTools` provider reads the LIVE registry; runtimes that inject
|
|
1000
|
+
* tools by value re-read it here so late registrations become visible.
|
|
1001
|
+
*/
|
|
1002
|
+
provisionToolAccess(execTools?: RuntimeExecToolProvider): Promise<void>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Tear down what `provisionToolAccess` wrote. in-process/cli-shim: no-op.
|
|
1005
|
+
* mcp: remove Bakin-owned `bakin-*` server entries. Called by the
|
|
1006
|
+
* runtime-switch flow (P3.2) on switch-away.
|
|
1007
|
+
*/
|
|
1008
|
+
deprovisionToolAccess(): Promise<void>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Report whether tool-access provisioning is currently in place, WITHOUT
|
|
1011
|
+
* writing. Drives the onboarding/doctor drift surfaces through a
|
|
1012
|
+
* runtime-neutral status so core never inspects a provider's config shape.
|
|
1013
|
+
*/
|
|
1014
|
+
verifyToolAccess(): Promise<ToolAccessProvisioningStatus>;
|
|
1015
|
+
images?: RuntimeImagesAccess;
|
|
1016
|
+
extensions?: RuntimeExtensionsAccess;
|
|
1017
|
+
/**
|
|
1018
|
+
* Access to the runtime's private media store (e.g. channel attachments).
|
|
1019
|
+
* `resolveUri` maps a runtime-private URI (`RUNTIME_MEDIA_URI_SCHEME`-
|
|
1020
|
+
* prefixed) to an absolute local file path; null for unknown schemes or
|
|
1021
|
+
* missing files — never throws for not-found. Optional: runtimes without a
|
|
1022
|
+
* media store omit it, and callers must treat absence as "cannot resolve".
|
|
1023
|
+
*/
|
|
1024
|
+
media?: {
|
|
1025
|
+
resolveUri(uri: string): Promise<string | null>;
|
|
473
1026
|
};
|
|
474
|
-
|
|
1027
|
+
/**
|
|
1028
|
+
* OPTIONAL capability (P2.1): the RUNTIME's native cron surface (jobs the
|
|
1029
|
+
* runtime/agents create for themselves — Bakin surfaces them read-only and
|
|
1030
|
+
* can adopt them). Runtimes without one (Pi) OMIT the member; Bakin-owned
|
|
1031
|
+
* task scheduling (the schedule plugin's own tick scheduler) is unaffected.
|
|
1032
|
+
* Callers MUST feature-detect and treat absence as "no native jobs".
|
|
1033
|
+
*/
|
|
1034
|
+
cron?: {
|
|
475
1035
|
list(): Promise<CronJob[]>;
|
|
476
1036
|
get(id: string): Promise<CronJob | null>;
|
|
477
1037
|
create(input: CreateCronJobInput): Promise<CronJob>;
|
|
@@ -482,5 +1042,4 @@ export interface AgentRuntimeAdapter {
|
|
|
482
1042
|
getRaw(id: string, reason: string): Promise<unknown | null>;
|
|
483
1043
|
restoreRaw(id: string, snapshot: unknown, reason: string): Promise<CronJob>;
|
|
484
1044
|
};
|
|
485
|
-
config: RuntimeConfigAccess;
|
|
486
1045
|
}
|