@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
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import type { AvailableModel } from './services';
|
|
2
|
+
/** An agent registered with the runtime (OpenClaw, etc.). */
|
|
3
|
+
export interface RuntimeAgent {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
role?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
status?: 'active' | 'inactive' | 'unknown';
|
|
9
|
+
metadata?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
/** A messaging channel (Discord, Slack, email, etc.) registered with the runtime. */
|
|
12
|
+
export interface RuntimeChannel {
|
|
13
|
+
id: string;
|
|
14
|
+
platform: string;
|
|
15
|
+
label: string;
|
|
16
|
+
capabilities: string[];
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
/** Whether to expose runtime-native tools for this agent turn. */
|
|
20
|
+
export type RuntimeMessageToolsMode = 'auto' | 'none';
|
|
21
|
+
/** Per-turn policy for which tools the agent may call. */
|
|
22
|
+
export interface RuntimeMessageToolPolicy {
|
|
23
|
+
/**
|
|
24
|
+
* Controls whether runtime-native tools are available for this agent turn.
|
|
25
|
+
* `none` disables tools. Omit or use `auto` for runtime/provider defaults.
|
|
26
|
+
*/
|
|
27
|
+
toolsMode?: RuntimeMessageToolsMode;
|
|
28
|
+
/**
|
|
29
|
+
* Per-turn allowlist of BAKIN EXEC TOOLS by exact name (never
|
|
30
|
+
* runtime-native tools — those are governed only by `toolsMode`).
|
|
31
|
+
* Runtimes whose exec tools ride session-static transports cannot filter
|
|
32
|
+
* per-turn and ignore these fields with a warning.
|
|
33
|
+
*/
|
|
34
|
+
toolsAllow?: string[];
|
|
35
|
+
/** Per-turn denylist of Bakin exec tools by exact name (same scope as `toolsAllow`). */
|
|
36
|
+
toolsDeny?: string[];
|
|
37
|
+
}
|
|
38
|
+
/** Arguments for a single message dispatched to an agent. */
|
|
39
|
+
export interface RuntimeMessageArgs extends RuntimeMessageToolPolicy {
|
|
40
|
+
agentId: string;
|
|
41
|
+
content: string;
|
|
42
|
+
/**
|
|
43
|
+
* Adapter-neutral durable conversation key. Runtime adapters should map the
|
|
44
|
+
* same agentId + threadId pair to the same provider/runtime session.
|
|
45
|
+
*/
|
|
46
|
+
threadId?: string;
|
|
47
|
+
/** Per-turn model override (`provider/model` id); omit for the agent default. */
|
|
48
|
+
model?: string;
|
|
49
|
+
/** Per-turn thinking level; omit for the runtime/agent default. */
|
|
50
|
+
thinking?: string;
|
|
51
|
+
metadata?: Record<string, unknown>;
|
|
52
|
+
}
|
|
53
|
+
/** Per-turn token usage, when the runtime reports it. */
|
|
54
|
+
export interface RuntimeMessageUsage {
|
|
55
|
+
input?: number;
|
|
56
|
+
output?: number;
|
|
57
|
+
total?: number;
|
|
58
|
+
/** Cached-input tokens read (priced far below fresh input when known). */
|
|
59
|
+
cacheRead?: number;
|
|
60
|
+
/** Cached-input tokens written (cache creation). */
|
|
61
|
+
cacheWrite?: number;
|
|
62
|
+
/** Resolved model the runtime ran, when known. */
|
|
63
|
+
model?: string;
|
|
64
|
+
}
|
|
65
|
+
/** Result returned by a non-streaming runtime message. */
|
|
66
|
+
export interface RuntimeMessageResult {
|
|
67
|
+
id: string;
|
|
68
|
+
content?: string;
|
|
69
|
+
/** Per-turn token usage, omitted when the runtime reported none. */
|
|
70
|
+
usage?: RuntimeMessageUsage;
|
|
71
|
+
metadata?: Record<string, unknown>;
|
|
72
|
+
}
|
|
73
|
+
/** Tool call/result event surfaced during a streaming agent turn. */
|
|
74
|
+
export interface RuntimeToolActivity {
|
|
75
|
+
phase: 'call' | 'result';
|
|
76
|
+
callId?: string;
|
|
77
|
+
toolName: string;
|
|
78
|
+
status?: 'running' | 'completed' | 'failed' | string;
|
|
79
|
+
summary?: string;
|
|
80
|
+
inputPreview?: string;
|
|
81
|
+
outputPreview?: string;
|
|
82
|
+
durationMs?: number;
|
|
83
|
+
exitCode?: number;
|
|
84
|
+
metadata?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/** Render format for a text chunk's content. Absent means 'markdown'. */
|
|
87
|
+
export type RuntimeChatTextFormat = 'markdown' | 'plain' | 'code';
|
|
88
|
+
/**
|
|
89
|
+
* One chunk in a streaming agent response — the normalized turn-output
|
|
90
|
+
* contract. Granularity varies by runtime (per-token to whole-turn);
|
|
91
|
+
* `done` arrives exactly once and last on success AND on deliberate abort
|
|
92
|
+
* (abort is a clean end, never an `error` chunk); terminal failure ends
|
|
93
|
+
* the stream with an `error` chunk (`data.kind` = typed error kind when
|
|
94
|
+
* known) and no `done`; tool/status chunks are best-effort liveness.
|
|
95
|
+
*/
|
|
96
|
+
export type RuntimeChatChunk =
|
|
97
|
+
/** Assistant text. `format` hints rendering; absent = markdown. */
|
|
98
|
+
{
|
|
99
|
+
type: 'text';
|
|
100
|
+
content: string;
|
|
101
|
+
format?: RuntimeChatTextFormat;
|
|
102
|
+
data?: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
/** Tool activity; `data` is always the structured RuntimeToolActivity. */
|
|
105
|
+
| {
|
|
106
|
+
type: 'tool';
|
|
107
|
+
content?: string;
|
|
108
|
+
data: RuntimeToolActivity;
|
|
109
|
+
}
|
|
110
|
+
/** Turn lifecycle hint (e.g. 'thinking'). */
|
|
111
|
+
| {
|
|
112
|
+
type: 'status';
|
|
113
|
+
content?: string;
|
|
114
|
+
data?: Record<string, unknown>;
|
|
115
|
+
}
|
|
116
|
+
/** Clean turn end (success or deliberate abort) — exactly once, always last.
|
|
117
|
+
* `usage` carries the turn's token accounting when the runtime reports it. */
|
|
118
|
+
| {
|
|
119
|
+
type: 'done';
|
|
120
|
+
content?: string;
|
|
121
|
+
data?: Record<string, unknown>;
|
|
122
|
+
usage?: RuntimeMessageUsage;
|
|
123
|
+
}
|
|
124
|
+
/** Terminal failure — `data.kind` carries the typed error kind when known. */
|
|
125
|
+
| {
|
|
126
|
+
type: 'error';
|
|
127
|
+
content?: string;
|
|
128
|
+
data?: Record<string, unknown>;
|
|
129
|
+
};
|
|
130
|
+
/** A cron-scheduled job tracked by the runtime. */
|
|
131
|
+
export interface CronJob {
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
schedule: string;
|
|
135
|
+
command: string;
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
toolsAllow?: string[];
|
|
138
|
+
metadata?: Record<string, unknown>;
|
|
139
|
+
}
|
|
140
|
+
/** Execution record for a single cron job run. */
|
|
141
|
+
export interface CronRun {
|
|
142
|
+
id: string;
|
|
143
|
+
jobId: string;
|
|
144
|
+
status: 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
145
|
+
startedAt?: string;
|
|
146
|
+
endedAt?: string;
|
|
147
|
+
output?: string;
|
|
148
|
+
error?: string;
|
|
149
|
+
}
|
|
150
|
+
/** A skill (runtime-side capability) registered with an agent. */
|
|
151
|
+
export interface RuntimeSkill {
|
|
152
|
+
name: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
}
|
|
155
|
+
/** A file in an agent's runtime workspace. */
|
|
156
|
+
export interface WorkspaceFile {
|
|
157
|
+
path: string;
|
|
158
|
+
content?: string;
|
|
159
|
+
}
|
|
160
|
+
/** Provider-agnostic interface for agent runtime adapters (OpenClaw, etc.). */
|
|
161
|
+
export interface AgentRuntimeAdapter {
|
|
162
|
+
agents: {
|
|
163
|
+
list(): Promise<RuntimeAgent[]>;
|
|
164
|
+
get(agentId: string): Promise<RuntimeAgent | null>;
|
|
165
|
+
};
|
|
166
|
+
messaging: {
|
|
167
|
+
send(input: RuntimeMessageArgs): Promise<RuntimeMessageResult>;
|
|
168
|
+
stream(input: RuntimeMessageArgs): AsyncIterable<RuntimeChatChunk>;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* OPTIONAL: absent when the active runtime has no channel surface (e.g.
|
|
172
|
+
* in-process runtimes). Feature-detect (`if (runtime.channels)`) — never
|
|
173
|
+
* bare-deref; absence is the honest signal, not an error.
|
|
174
|
+
*/
|
|
175
|
+
channels?: {
|
|
176
|
+
list(): Promise<RuntimeChannel[]>;
|
|
177
|
+
sendMessage(input: {
|
|
178
|
+
channels: string[];
|
|
179
|
+
message: {
|
|
180
|
+
body: string;
|
|
181
|
+
title?: string;
|
|
182
|
+
threadId?: string;
|
|
183
|
+
metadata?: Record<string, unknown>;
|
|
184
|
+
};
|
|
185
|
+
}): Promise<{
|
|
186
|
+
deliveries: Array<{
|
|
187
|
+
channelId: string;
|
|
188
|
+
ref: string;
|
|
189
|
+
renderedAt: string;
|
|
190
|
+
}>;
|
|
191
|
+
}>;
|
|
192
|
+
deliverContent(input: {
|
|
193
|
+
channels: string[];
|
|
194
|
+
content: {
|
|
195
|
+
title: string;
|
|
196
|
+
body?: string;
|
|
197
|
+
url?: string;
|
|
198
|
+
files?: Array<{
|
|
199
|
+
name: string;
|
|
200
|
+
path: string;
|
|
201
|
+
contentType?: string;
|
|
202
|
+
}>;
|
|
203
|
+
metadata?: Record<string, unknown>;
|
|
204
|
+
};
|
|
205
|
+
}): Promise<{
|
|
206
|
+
deliveries: Array<{
|
|
207
|
+
channelId: string;
|
|
208
|
+
ref: string;
|
|
209
|
+
renderedAt: string;
|
|
210
|
+
}>;
|
|
211
|
+
}>;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* OPTIONAL: absent when the active runtime has no native cron surface.
|
|
215
|
+
* Feature-detect like `channels` — Bakin-owned scheduling is unaffected.
|
|
216
|
+
*/
|
|
217
|
+
cron?: {
|
|
218
|
+
list(): Promise<CronJob[]>;
|
|
219
|
+
get(id: string): Promise<CronJob | null>;
|
|
220
|
+
create(input: {
|
|
221
|
+
id?: string;
|
|
222
|
+
name: string;
|
|
223
|
+
schedule: string;
|
|
224
|
+
command: string;
|
|
225
|
+
enabled?: boolean;
|
|
226
|
+
toolsAllow?: string[];
|
|
227
|
+
metadata?: Record<string, unknown>;
|
|
228
|
+
}): Promise<CronJob>;
|
|
229
|
+
update(id: string, patch: Partial<Omit<CronJob, 'id' | 'toolsAllow'>> & {
|
|
230
|
+
toolsAllow?: string[] | null;
|
|
231
|
+
}): Promise<CronJob>;
|
|
232
|
+
remove(id: string): Promise<void>;
|
|
233
|
+
runNow(id: string): Promise<CronRun>;
|
|
234
|
+
listRuns(jobId: string): Promise<CronRun[]>;
|
|
235
|
+
getRaw(id: string, reason: string): Promise<unknown | null>;
|
|
236
|
+
restoreRaw(id: string, snapshot: unknown, reason: string): Promise<CronJob>;
|
|
237
|
+
};
|
|
238
|
+
skills?: {
|
|
239
|
+
list(): Promise<RuntimeSkill[]>;
|
|
240
|
+
};
|
|
241
|
+
models?: {
|
|
242
|
+
listAvailable(opts?: {
|
|
243
|
+
includeUnavailable?: boolean;
|
|
244
|
+
}): Promise<AvailableModel[]>;
|
|
245
|
+
/** OPTIONAL (#852): 1-token account-callability probe. Feature-detect
|
|
246
|
+
* (`models.probe?.`); rejects typed on failure, `model_not_supported`
|
|
247
|
+
* when the provider rejected the model id. */
|
|
248
|
+
probe?(modelId: string, opts?: {
|
|
249
|
+
signal?: AbortSignal;
|
|
250
|
+
}): Promise<void>;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Runtime session reads (declares the surface the host facade already
|
|
254
|
+
* forwards — previously reachable but undeclared). `contextStats?` is
|
|
255
|
+
* itself optional within the member (the cron pattern): feature-detect,
|
|
256
|
+
* never bare-deref; null = no session / nothing honest to report.
|
|
257
|
+
*/
|
|
258
|
+
sessions?: {
|
|
259
|
+
list(agentId?: string): Promise<RuntimeSessionInfo[]>;
|
|
260
|
+
get(sessionId: string): Promise<RuntimeSessionInfo | null>;
|
|
261
|
+
contextStats?(opts: {
|
|
262
|
+
agentId: string;
|
|
263
|
+
threadId: string;
|
|
264
|
+
}): Promise<RuntimeSessionContextStats | null>;
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
export interface RuntimeSessionInfo {
|
|
268
|
+
id: string;
|
|
269
|
+
agentId: string;
|
|
270
|
+
title?: string;
|
|
271
|
+
startedAt?: string;
|
|
272
|
+
updatedAt?: string;
|
|
273
|
+
metadata?: Record<string, unknown>;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* A session's context reading (#737) — runtime truth only. Null-honesty
|
|
277
|
+
* is the contract: `tokens: null` = honestly unknown (e.g. a
|
|
278
|
+
* post-compaction gap before the next reply); `compactionThreshold:
|
|
279
|
+
* null` when the runtime owns compaction opaquely. Context is NEVER
|
|
280
|
+
* derived from billing aggregates.
|
|
281
|
+
*/
|
|
282
|
+
export interface RuntimeSessionContextStats {
|
|
283
|
+
tokens: number | null;
|
|
284
|
+
contextWindow: number | null;
|
|
285
|
+
compactionThreshold: number | null;
|
|
286
|
+
lastCompaction?: {
|
|
287
|
+
at?: string;
|
|
288
|
+
tokensBefore?: number;
|
|
289
|
+
reason?: string;
|
|
290
|
+
};
|
|
291
|
+
model?: string;
|
|
292
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin-contributed scheduled domain events (#191).
|
|
3
|
+
*
|
|
4
|
+
* Plugins own dates that are NOT cron jobs — publish dates, milestones,
|
|
5
|
+
* deadlines. The Schedule plugin renders them on its calendars alongside job
|
|
6
|
+
* occurrences, read-only, with clear source labels. Ownership never moves:
|
|
7
|
+
* Schedule displays; the owning plugin mutates.
|
|
8
|
+
*
|
|
9
|
+
* ## The contract (hook convention — no registration API)
|
|
10
|
+
*
|
|
11
|
+
* A provider registers ONE hook in `activate()`, named by suffix convention:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* ctx.hooks.register(
|
|
15
|
+
* 'myplugin.scheduledEvents',
|
|
16
|
+
* async ({ from, to }: ScheduledEventsQuery): Promise<ScheduledDomainEvent[]> =>
|
|
17
|
+
* listMyEventsBetween(from, to),
|
|
18
|
+
* { hookKind: 'rpc', label: 'My scheduled events' },
|
|
19
|
+
* )
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Schedule discovers every hook ending in `.scheduledEvents`, invokes each
|
|
23
|
+
* with the query range (bounded timeout, parallel), validates rows, and
|
|
24
|
+
* drops a failing/invalid/slow provider from that response with a warning —
|
|
25
|
+
* a missing or broken plugin never breaks the calendar.
|
|
26
|
+
*
|
|
27
|
+
* Optionally, a provider may also register `myplugin.rescheduleEvent`
|
|
28
|
+
* (`ScheduledEventReschedule` → `ScheduledEventRescheduleResult`) and set
|
|
29
|
+
* `reschedulable: true` on its events — Schedule then offers a date-picker
|
|
30
|
+
* that calls the owner to move the event's PRIMARY date. This is the one
|
|
31
|
+
* mutation verb in the contract; everything else is a deep link.
|
|
32
|
+
*
|
|
33
|
+
* When a provider's underlying dates change, emit
|
|
34
|
+
* `ctx.activity.audit('scheduled_events_changed', …)` so calendars refetch.
|
|
35
|
+
*/
|
|
36
|
+
/** One read-only dated event owned by a plugin, rendered by Schedule. */
|
|
37
|
+
export interface ScheduledDomainEvent {
|
|
38
|
+
/** Stable within the owning plugin (used as the reschedule target). */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Must equal the registering plugin's id — validated at the boundary. */
|
|
41
|
+
pluginId: string;
|
|
42
|
+
title: string;
|
|
43
|
+
/** ISO instant the event starts/happens. One of startsAt/dueAt required. */
|
|
44
|
+
startsAt?: string;
|
|
45
|
+
/** ISO instant a ranged event ends. */
|
|
46
|
+
endsAt?: string;
|
|
47
|
+
/** ISO deadline — rendered distinctly from startsAt. */
|
|
48
|
+
dueAt?: string;
|
|
49
|
+
/** Owner vocabulary, e.g. 'task-scheduled' | 'task-due' | 'publish' | 'milestone'. */
|
|
50
|
+
kind: string;
|
|
51
|
+
/** Owner vocabulary, display-only. */
|
|
52
|
+
status?: string;
|
|
53
|
+
/** Deep link into the owning plugin's UI. */
|
|
54
|
+
url?: string;
|
|
55
|
+
/** True ⇒ the owner registered `{pluginId}.rescheduleEvent`. */
|
|
56
|
+
reschedulable?: boolean;
|
|
57
|
+
/** Read-only extras for popover display. */
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
/** Input to `{pluginId}.scheduledEvents`. */
|
|
61
|
+
export interface ScheduledEventsQuery {
|
|
62
|
+
/** ISO instant, inclusive lower bound. */
|
|
63
|
+
from: string;
|
|
64
|
+
/** ISO instant, exclusive upper bound. */
|
|
65
|
+
to: string;
|
|
66
|
+
}
|
|
67
|
+
/** Input to the optional `{pluginId}.rescheduleEvent` hook. */
|
|
68
|
+
export interface ScheduledEventReschedule {
|
|
69
|
+
/** The event's `id` as the owner reported it. */
|
|
70
|
+
eventId: string;
|
|
71
|
+
/** New ISO instant for the event's primary date (startsAt, or dueAt for
|
|
72
|
+
* deadline-kinded events) — the owner decides which field moves. */
|
|
73
|
+
to: string;
|
|
74
|
+
}
|
|
75
|
+
export type ScheduledEventRescheduleResult = {
|
|
76
|
+
ok: true;
|
|
77
|
+
} | {
|
|
78
|
+
ok: false;
|
|
79
|
+
error: string;
|
|
80
|
+
};
|