@makinbakin/sdk 0.0.1-rc.26 → 0.0.1-rc.28
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 +247 -3
- package/_internal/app/components/agent-avatar.d.ts +2 -1
- package/_internal/app/components/conversation/fold.d.ts +3 -129
- package/_internal/app/components/drawer.d.ts +29 -0
- package/_internal/app/components/ui/button.d.ts +2 -8
- package/_internal/app/components/ui/dialog.d.ts +2 -17
- package/_internal/app/components/ui/sheet.d.ts +2 -14
- package/_internal/app/core/conversation-turns.d.ts +83 -2
- package/_internal/app/core/tool-access.d.ts +42 -0
- package/_internal/app/hooks/use-history-back.d.ts +5 -1
- package/_internal/app/hooks/use-json-fetch.d.ts +13 -3
- package/_internal/app/hooks/use-nav-badge.d.ts +1 -1
- package/_internal/app/hooks/use-query-state.d.ts +3 -14
- package/_internal/core/adapters/runtime/channels.d.ts +231 -0
- package/_internal/core/adapters/runtime/concepts.d.ts +42 -167
- package/_internal/core/adapters/runtime/index.d.ts +2 -1
- package/_internal/core/adapters/runtime/skill-files.d.ts +12 -0
- package/_internal/core/adapters/shared.d.ts +11 -0
- package/_internal/core/delivery/bridge.d.ts +36 -0
- package/_internal/core/format.d.ts +12 -1
- package/_internal/core/plugin-types.d.ts +20 -1
- package/_internal/core/routing/define.d.ts +1 -0
- package/_internal/host/ui/action-status.d.ts +13 -0
- package/_internal/host/ui/modals.d.ts +5 -0
- package/_internal/ui/behaviors/clipboard.d.ts +10 -0
- package/_internal/ui/behaviors/selection-navigation.d.ts +5 -0
- package/_internal/ui/behaviors/use-persisted-leading-edge-resize.d.ts +29 -0
- package/_internal/ui/charts/area-chart.d.ts +27 -0
- package/_internal/ui/charts/axis.d.ts +13 -0
- package/_internal/ui/charts/bar-chart.d.ts +21 -0
- package/_internal/ui/charts/chart-data-table.d.ts +61 -0
- package/_internal/ui/charts/chart-explainer.d.ts +4 -0
- package/_internal/ui/charts/composition-bar.d.ts +41 -0
- package/_internal/ui/charts/index.d.ts +24 -0
- package/_internal/ui/charts/line-chart.d.ts +26 -0
- package/_internal/ui/charts/monotone-curve.d.ts +23 -0
- package/_internal/ui/charts/palette.d.ts +32 -0
- package/_internal/ui/charts/pie-chart.d.ts +80 -0
- package/_internal/ui/charts/ranked-bar-chart.d.ts +41 -0
- package/_internal/ui/charts/sparkline.d.ts +16 -0
- package/_internal/ui/charts/stacked-column-chart.d.ts +33 -0
- package/_internal/ui/content/code-block.d.ts +43 -0
- package/_internal/ui/content/index.d.ts +2 -0
- package/_internal/ui/conversation/activity-group.d.ts +27 -0
- package/_internal/ui/conversation/agent-turn.d.ts +47 -0
- package/_internal/ui/conversation/composer.d.ts +62 -0
- package/_internal/ui/conversation/context-meter.d.ts +37 -0
- package/_internal/ui/conversation/conversation-empty-state.d.ts +13 -0
- package/_internal/ui/conversation/conversation-header.d.ts +26 -0
- package/_internal/ui/conversation/conversation-panel.d.ts +59 -0
- package/_internal/ui/conversation/conversation.d.ts +35 -0
- package/_internal/ui/conversation/fold.d.ts +150 -0
- package/_internal/ui/conversation/glyphs.d.ts +30 -0
- package/_internal/ui/conversation/index.d.ts +31 -0
- package/_internal/ui/conversation/queued-message-list.d.ts +22 -0
- package/_internal/ui/conversation/relative-time.d.ts +8 -0
- package/_internal/ui/conversation/resize-handle.d.ts +13 -0
- package/_internal/ui/conversation/tool-call-drawer.d.ts +14 -0
- package/_internal/ui/conversation/turn-controls.d.ts +9 -0
- package/_internal/ui/conversation/turn-output.d.ts +42 -0
- package/_internal/ui/conversation/turn-usage.d.ts +16 -0
- package/_internal/ui/conversation/user-message.d.ts +13 -0
- package/_internal/ui/forms/field.d.ts +25 -0
- package/_internal/ui/forms/fieldset.d.ts +10 -0
- package/_internal/ui/forms/form.d.ts +19 -0
- package/_internal/ui/forms/index.d.ts +6 -0
- package/_internal/ui/index.d.ts +86 -0
- package/_internal/ui/layout/bounded-overflow.d.ts +42 -0
- package/_internal/ui/layout/disclosure-panel.d.ts +24 -0
- package/_internal/ui/layout/flow.d.ts +27 -0
- package/_internal/ui/layout/grid.d.ts +16 -0
- package/_internal/ui/layout/index.d.ts +14 -0
- package/_internal/ui/layout/page-shell.d.ts +11 -0
- package/_internal/ui/layout/panel.d.ts +28 -0
- package/_internal/ui/layout/section.d.ts +15 -0
- package/_internal/ui/layout/sticky-overflow-scrollbar.d.ts +11 -0
- package/_internal/ui/layout/utils.d.ts +1 -0
- package/_internal/ui/patterns/agent-filter.d.ts +20 -0
- package/_internal/ui/patterns/calendar-grid.d.ts +80 -0
- package/_internal/ui/patterns/calendar-item.d.ts +42 -0
- package/_internal/ui/patterns/calendar-nav.d.ts +21 -0
- package/_internal/ui/patterns/confirm-dialog.d.ts +29 -0
- package/_internal/ui/patterns/copy-button.d.ts +15 -0
- package/_internal/ui/patterns/danger-zone.d.ts +17 -0
- package/_internal/ui/patterns/data-table.d.ts +151 -0
- package/_internal/ui/patterns/drawer-section.d.ts +11 -0
- package/_internal/ui/patterns/facet-filter.d.ts +22 -0
- package/_internal/ui/patterns/index.d.ts +73 -0
- package/_internal/ui/patterns/inspector-panel.d.ts +39 -0
- package/_internal/ui/patterns/kanban.d.ts +70 -0
- package/_internal/ui/patterns/key-value.d.ts +35 -0
- package/_internal/ui/patterns/list-rows.d.ts +105 -0
- package/_internal/ui/patterns/nav-list.d.ts +41 -0
- package/_internal/ui/patterns/node-card.d.ts +37 -0
- package/_internal/ui/patterns/page-aside.d.ts +49 -0
- package/_internal/ui/patterns/page-body.d.ts +49 -0
- package/_internal/ui/patterns/page-canvas.d.ts +12 -0
- package/_internal/ui/patterns/page-composer.d.ts +8 -0
- package/_internal/ui/patterns/page-controls.d.ts +31 -0
- package/_internal/ui/patterns/page-header.d.ts +40 -0
- package/_internal/ui/patterns/page-timeline.d.ts +18 -0
- package/_internal/ui/patterns/page.d.ts +32 -0
- package/_internal/ui/patterns/pagination.d.ts +23 -0
- package/_internal/ui/patterns/save-bar.d.ts +21 -0
- package/_internal/ui/patterns/search-input.d.ts +20 -0
- package/_internal/ui/patterns/segmented-control.d.ts +22 -0
- package/_internal/ui/patterns/sortable-head.d.ts +13 -0
- package/_internal/ui/patterns/stat-group.d.ts +8 -0
- package/_internal/ui/patterns/stat-tile.d.ts +25 -0
- package/_internal/ui/patterns/status-badge.d.ts +15 -0
- package/_internal/ui/patterns/status-marker.d.ts +10 -0
- package/_internal/ui/patterns/timeline.d.ts +59 -0
- package/_internal/ui/patterns/unsaved-changes-dialog.d.ts +22 -0
- package/_internal/ui/patterns/workspace-page.d.ts +76 -0
- package/_internal/ui/primitives/alert.d.ts +17 -0
- package/_internal/ui/primitives/avatar.d.ts +13 -0
- package/_internal/ui/primitives/badge.d.ts +27 -0
- package/_internal/ui/primitives/button.d.ts +32 -0
- package/_internal/ui/primitives/card.d.ts +47 -0
- package/_internal/ui/primitives/checkbox.d.ts +3 -0
- package/_internal/ui/primitives/collapsible.d.ts +7 -0
- package/_internal/ui/primitives/color-input.d.ts +21 -0
- package/_internal/ui/primitives/command.d.ts +36 -0
- package/_internal/ui/primitives/dialog.d.ts +31 -0
- package/_internal/ui/primitives/dropdown-menu.d.ts +54 -0
- package/_internal/ui/primitives/file-input.d.ts +33 -0
- package/_internal/ui/primitives/input-group.d.ts +24 -0
- package/_internal/ui/primitives/input.d.ts +5 -0
- package/_internal/ui/primitives/interactive-surface.d.ts +24 -0
- package/_internal/ui/primitives/label.d.ts +3 -0
- package/_internal/ui/primitives/modal-context.d.ts +9 -0
- package/_internal/ui/primitives/option-list.d.ts +10 -0
- package/_internal/ui/primitives/popover.d.ts +18 -0
- package/_internal/ui/primitives/portal-ownership.d.ts +11 -0
- package/_internal/ui/primitives/progress.d.ts +38 -0
- package/_internal/ui/primitives/radio-group.d.ts +12 -0
- package/_internal/ui/primitives/select.d.ts +25 -0
- package/_internal/ui/primitives/separator.d.ts +7 -0
- package/_internal/ui/primitives/sheet.d.ts +34 -0
- package/_internal/ui/primitives/shimmer-text.d.ts +13 -0
- package/_internal/ui/primitives/skeleton.d.ts +6 -0
- package/_internal/ui/primitives/spinner.d.ts +31 -0
- package/_internal/ui/primitives/switch.d.ts +6 -0
- package/_internal/{app/components/ui → ui/primitives}/tabs.d.ts +1 -1
- package/_internal/ui/primitives/text.d.ts +43 -0
- package/_internal/ui/primitives/textarea.d.ts +3 -0
- package/_internal/ui/primitives/tooltip.d.ts +14 -0
- package/_internal/ui/private-ui-boundary-probe.d.ts +9 -0
- package/_internal/ui/states/banner.d.ts +15 -0
- package/_internal/ui/states/index.d.ts +6 -0
- package/_internal/ui/states/system-state.d.ts +88 -0
- package/_internal/ui/states/toast.d.ts +26 -0
- package/_internal/ui/utils.d.ts +14 -0
- package/bin/bakin-plugin-test-ui.js +6822 -0
- package/charts/index.d.ts +3 -0
- package/charts/index.js +2 -0
- package/content/index.d.ts +14 -0
- package/content/index.js +39 -0
- package/content/markdown-content.d.ts +16 -0
- package/content/markdown-editor.d.ts +35 -0
- package/conversation/index.d.ts +50 -0
- package/conversation/index.js +4 -0
- package/{_internal/app/components/conversation → conversation}/use-conversation-thread.d.ts +21 -3
- package/hooks/index.d.ts +9 -9
- package/hooks/index.js +1 -16243
- package/hooks/router.d.ts +4 -52
- package/index.d.ts +10 -3
- package/index.js +10 -14248
- package/internal/index.d.ts +18 -14
- package/internal/index.js +1 -408
- 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.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 +54 -9
- package/patterns/agent-patterns.d.ts +79 -0
- package/patterns/asset-library-picker.d.ts +38 -0
- package/patterns/channel-patterns.d.ts +32 -0
- package/patterns/index.d.ts +40 -0
- package/patterns/index.js +47 -0
- package/patterns/picker-patterns.d.ts +96 -0
- package/patterns/plugin-settings-renderer.d.ts +41 -0
- package/patterns/presentation-color.d.ts +2 -0
- package/patterns/search-patterns.d.ts +51 -0
- package/routing/index.js +10 -14054
- package/slots/index.d.ts +4 -4
- package/slots/index.js +1 -276
- package/slots/registry.d.ts +45 -0
- package/styles.css +2 -0
- package/testing/index.d.ts +1 -1
- package/testing/index.js +56 -21837
- package/testing/ui/conformance/cli.d.ts +2 -0
- package/testing/ui/conformance/contracts.d.ts +73 -0
- package/testing/ui/conformance/index.d.ts +11 -0
- package/testing/ui/conformance/index.js +85 -0
- package/testing/ui/conformance/plugin-css.d.ts +37 -0
- package/testing/ui/conformance/plugin-id.d.ts +6 -0
- package/testing/ui/conformance/runner.d.ts +13 -0
- package/testing/ui/index.d.ts +24 -0
- package/testing/ui/index.js +2 -0
- package/testing/ui/plugin-ui-fixture-host.d.ts +36 -0
- package/testing/ui/runtime.d.ts +70 -0
- package/types/api-route.d.ts +89 -0
- package/types/context.d.ts +166 -0
- package/types/conversation-turns.d.ts +229 -0
- package/types/events.d.ts +10 -0
- package/types/health.d.ts +374 -0
- package/types/index.d.ts +10 -10
- package/types/index.js +1 -16
- package/types/manifest.d.ts +221 -0
- package/types/primitives.d.ts +33 -0
- package/types/registration.d.ts +281 -0
- package/types/runtime.d.ts +286 -0
- package/types/scheduled-events.d.ts +80 -0
- package/types/services.d.ts +570 -0
- package/ui/index.d.ts +70 -31
- package/ui/index.js +38 -28705
- package/utils/asset-id.d.ts +15 -0
- package/utils/index.d.ts +5 -10
- package/utils/index.js +4 -2228
- package/utils/plugin-fetch.d.ts +23 -0
- package/_internal/app/components/agent-filter.d.ts +0 -8
- package/_internal/app/components/agent-select.d.ts +0 -29
- package/_internal/app/components/agent-status.d.ts +0 -8
- package/_internal/app/components/asset-picker.d.ts +0 -25
- package/_internal/app/components/bakin-drawer.d.ts +0 -23
- package/_internal/app/components/charts/bar-chart.d.ts +0 -16
- package/_internal/app/components/charts/chart-data-table.d.ts +0 -31
- package/_internal/app/components/charts/chart-explainer.d.ts +0 -9
- package/_internal/app/components/charts/line-chart.d.ts +0 -13
- package/_internal/app/components/charts/palette.d.ts +0 -24
- package/_internal/app/components/charts/sparkline.d.ts +0 -12
- package/_internal/app/components/charts/stacked-column-chart.d.ts +0 -40
- package/_internal/app/components/color-picker.d.ts +0 -7
- package/_internal/app/components/confirm-dialog.d.ts +0 -54
- package/_internal/app/components/conversation/activity-group.d.ts +0 -15
- package/_internal/app/components/conversation/agent-turn.d.ts +0 -36
- package/_internal/app/components/conversation/composer.d.ts +0 -35
- package/_internal/app/components/conversation/conversation-empty-state.d.ts +0 -8
- package/_internal/app/components/conversation/conversation-panel.d.ts +0 -33
- package/_internal/app/components/conversation/conversation.d.ts +0 -14
- package/_internal/app/components/conversation/relative-time.d.ts +0 -8
- package/_internal/app/components/conversation/tool-call-drawer.d.ts +0 -7
- package/_internal/app/components/conversation/user-message.d.ts +0 -11
- package/_internal/app/components/danger-zone.d.ts +0 -28
- package/_internal/app/components/empty-state.d.ts +0 -22
- 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/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 -17
- package/_internal/app/components/plugin-settings-renderer.d.ts +0 -9
- package/_internal/app/components/save-bar.d.ts +0 -32
- package/_internal/app/components/score-overlay.d.ts +0 -33
- package/_internal/app/components/search-degraded-chip.d.ts +0 -4
- package/_internal/app/components/search-partial-chip.d.ts +0 -13
- package/_internal/app/components/search-unavailable.d.ts +0 -12
- package/_internal/app/components/section-card.d.ts +0 -22
- package/_internal/app/components/segmented-control.d.ts +0 -28
- package/_internal/app/components/sortable-head.d.ts +0 -13
- package/_internal/app/components/stat-tile.d.ts +0 -26
- package/_internal/app/components/status-badge.d.ts +0 -19
- package/_internal/app/components/turn-output-view.d.ts +0 -57
- 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 -19
- package/_internal/app/components/unsaved-changes-guard.d.ts +0 -34
- 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 -140
- package/components/index.js +0 -71930
- /package/_internal/{app/components → ui}/charts/chart-tooltip.d.ts +0 -0
- /package/_internal/{app/components/ui → ui/primitives}/table.d.ts +0 -0
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Import `useHistoryBack` from `@makinbakin/sdk/navigation`.
|
|
3
|
+
* This module remains as a compatibility adapter for existing consumers.
|
|
4
|
+
*/
|
|
5
|
+
export { useHistoryBack } from '@makinbakin/sdk/navigation';
|
|
@@ -8,6 +8,15 @@ export interface UseJsonFetchResult<T> {
|
|
|
8
8
|
/** Re-run the fetch (e.g. after a mutation). */
|
|
9
9
|
refresh: () => void;
|
|
10
10
|
}
|
|
11
|
+
export interface UseJsonFetchOptions extends RequestInit {
|
|
12
|
+
/**
|
|
13
|
+
* Abort the request after this many milliseconds and report it as a timeout
|
|
14
|
+
* rather than a silent hang. Endpoints that scan the filesystem or call the
|
|
15
|
+
* runtime can stall indefinitely; without a deadline the caller shows a
|
|
16
|
+
* spinner forever.
|
|
17
|
+
*/
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
}
|
|
11
20
|
/**
|
|
12
21
|
* Cancellable JSON GET with the standard `{ data, loading, error, refresh }` lifecycle —
|
|
13
22
|
* the consolidation of the `let cancelled = false` fetch-in-useEffect boilerplate scattered
|
|
@@ -16,11 +25,12 @@ export interface UseJsonFetchResult<T> {
|
|
|
16
25
|
*
|
|
17
26
|
* Pass `url = null` to skip fetching (e.g. until an id is known); `data` resets to null and
|
|
18
27
|
* `loading` is false while skipped. `opts` is read per-request but does NOT re-trigger on its
|
|
19
|
-
* own identity — change `url` or call `refresh()` to re-fetch.
|
|
28
|
+
* own identity — change `url` or call `refresh()` to re-fetch. Set `opts.timeoutMs` to bound
|
|
29
|
+
* a request that can hang.
|
|
20
30
|
*/
|
|
21
|
-
export declare function useJsonFetch<T>(url: string | null, opts?:
|
|
31
|
+
export declare function useJsonFetch<T>(url: string | null, opts?: UseJsonFetchOptions): UseJsonFetchResult<T>;
|
|
22
32
|
/**
|
|
23
33
|
* `useJsonFetch` scoped to a plugin's own API: builds `/api/plugins/<id>/<path>`
|
|
24
34
|
* so components never hand-assemble the prefix. Pass `path = null` to skip.
|
|
25
35
|
*/
|
|
26
|
-
export declare function usePluginJsonFetch<T>(pluginId: string, path: string | null, opts?:
|
|
36
|
+
export declare function usePluginJsonFetch<T>(pluginId: string, path: string | null, opts?: UseJsonFetchOptions): UseJsonFetchResult<T>;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* - setValue uses router.replace (no history entry) — good for filters, search, view toggles
|
|
5
|
-
* - pushValue uses router.push (creates history entry) — good for opening drawers/modals
|
|
6
|
-
* When value equals defaultValue, the param is removed from the URL.
|
|
7
|
-
* Multiple setter calls in the same tick compose into one navigation.
|
|
2
|
+
* @deprecated Import URL-backed state from `@makinbakin/sdk/navigation`.
|
|
3
|
+
* This module remains as a compatibility adapter for existing consumers.
|
|
8
4
|
*/
|
|
9
|
-
export
|
|
10
|
-
/**
|
|
11
|
-
* Syncs a string[] to a URL query parameter (comma-separated).
|
|
12
|
-
* Returns [values, setValues] like useState.
|
|
13
|
-
* When array is empty, the param is removed from the URL.
|
|
14
|
-
* Composes with other setter calls in the same tick (one navigation).
|
|
15
|
-
*/
|
|
16
|
-
export declare function useQueryArrayState(key: string): [string[], (v: string[]) => void];
|
|
5
|
+
export { useQueryArrayState, useQueryState } from '@makinbakin/sdk/navigation';
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel/delivery contract types — a LEAF module (imports only
|
|
3
|
+
* ./capabilities) so both the runtime contract (concepts.ts) and the
|
|
4
|
+
* delivery-bridge seam (packages/core/src/delivery/bridge.ts, threaded
|
|
5
|
+
* through AdapterInitOpts in ../shared.ts) can share the surface without an
|
|
6
|
+
* import cycle: shared -> bridge -> channels and concepts -> channels.
|
|
7
|
+
*/
|
|
8
|
+
import type { ChannelCapability } from './capabilities';
|
|
9
|
+
export type RuntimeMetadata = Record<string, unknown>;
|
|
10
|
+
export interface ChannelInfo {
|
|
11
|
+
id: string;
|
|
12
|
+
platform: string;
|
|
13
|
+
label: string;
|
|
14
|
+
capabilities: ChannelCapability[];
|
|
15
|
+
metadata?: RuntimeMetadata;
|
|
16
|
+
}
|
|
17
|
+
export interface DeliveryResult {
|
|
18
|
+
deliveries: ApprovalDelivery[];
|
|
19
|
+
}
|
|
20
|
+
export interface NotificationArgs {
|
|
21
|
+
channels: string[];
|
|
22
|
+
notification: {
|
|
23
|
+
severity: 'info' | 'warn' | 'error' | 'success';
|
|
24
|
+
title: string;
|
|
25
|
+
body: string;
|
|
26
|
+
fields?: {
|
|
27
|
+
label: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}[];
|
|
30
|
+
metadata?: RuntimeMetadata;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface ChannelMessageArgs {
|
|
34
|
+
channels: string[];
|
|
35
|
+
message: {
|
|
36
|
+
body: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
threadId?: string;
|
|
39
|
+
metadata?: RuntimeMetadata;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface ContentDeliveryArgs {
|
|
43
|
+
channels: string[];
|
|
44
|
+
content: {
|
|
45
|
+
title: string;
|
|
46
|
+
body?: string;
|
|
47
|
+
url?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Path files are read from disk (trusted plugin/core callers only). For
|
|
50
|
+
* `{ kind: 'asset' }` refs, `filename` is the ASSET ID — providers
|
|
51
|
+
* resolve it through the `assets.resolveServe` hook; an unresolvable id
|
|
52
|
+
* degrades to a visible omission, never a failed delivery.
|
|
53
|
+
*/
|
|
54
|
+
files?: Array<{
|
|
55
|
+
name: string;
|
|
56
|
+
path: string;
|
|
57
|
+
contentType?: string;
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'asset';
|
|
60
|
+
filename: string;
|
|
61
|
+
mimeType?: string;
|
|
62
|
+
}>;
|
|
63
|
+
metadata?: RuntimeMetadata;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface CreateThreadArgs {
|
|
67
|
+
/** Channel ref the anchor message lives in (provider or provider:target). */
|
|
68
|
+
channel: string;
|
|
69
|
+
/** Delivery ref of the message to anchor the thread to (e.g. "message:<id>"). */
|
|
70
|
+
messageRef?: string;
|
|
71
|
+
name: string;
|
|
72
|
+
}
|
|
73
|
+
export interface CreatedThread {
|
|
74
|
+
threadId: string;
|
|
75
|
+
/**
|
|
76
|
+
* Provider-addressable channel ref for posting INTO the thread (opaque to
|
|
77
|
+
* callers — provider target syntax stays inside the adapter).
|
|
78
|
+
*/
|
|
79
|
+
channelRef: string;
|
|
80
|
+
}
|
|
81
|
+
export interface EditChannelMessageArgs {
|
|
82
|
+
/** Channel ref the message lives in (provider or provider:target). */
|
|
83
|
+
channel: string;
|
|
84
|
+
/** Delivery ref of the message to edit (e.g. "message:<id>"). */
|
|
85
|
+
messageRef: string;
|
|
86
|
+
body: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ApprovalOption {
|
|
89
|
+
id: string;
|
|
90
|
+
label: string;
|
|
91
|
+
variant?: 'primary' | 'destructive' | 'neutral';
|
|
92
|
+
}
|
|
93
|
+
export interface ApprovalDelivery {
|
|
94
|
+
channelId: string;
|
|
95
|
+
ref: string;
|
|
96
|
+
renderedAt: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ApprovalPatch {
|
|
99
|
+
body?: string;
|
|
100
|
+
options?: ApprovalOption[];
|
|
101
|
+
expiresAt?: string;
|
|
102
|
+
context?: RuntimeMetadata;
|
|
103
|
+
}
|
|
104
|
+
export interface ApprovalResponse {
|
|
105
|
+
selectedOption: string;
|
|
106
|
+
respondedAt: string;
|
|
107
|
+
actor: {
|
|
108
|
+
type: 'agent' | 'human';
|
|
109
|
+
id: string;
|
|
110
|
+
displayName?: string;
|
|
111
|
+
};
|
|
112
|
+
comment?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface ApprovalRenderResult {
|
|
115
|
+
deliveries: ApprovalDelivery[];
|
|
116
|
+
}
|
|
117
|
+
export interface ApprovalRenderRef {
|
|
118
|
+
approvalId: string;
|
|
119
|
+
deliveries: ApprovalDelivery[];
|
|
120
|
+
}
|
|
121
|
+
export interface CreateApprovalArgs {
|
|
122
|
+
approvalId: string;
|
|
123
|
+
channels: string[];
|
|
124
|
+
request: {
|
|
125
|
+
title: string;
|
|
126
|
+
body: string;
|
|
127
|
+
options: ApprovalOption[];
|
|
128
|
+
expiresAt?: string;
|
|
129
|
+
context?: RuntimeMetadata;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export interface EditApprovalArgs extends ApprovalRenderRef {
|
|
133
|
+
patch: ApprovalPatch;
|
|
134
|
+
}
|
|
135
|
+
export interface CancelApprovalArgs extends ApprovalRenderRef {
|
|
136
|
+
reason?: string;
|
|
137
|
+
}
|
|
138
|
+
export interface ResolveApprovalArgs extends ApprovalRenderRef {
|
|
139
|
+
response: ApprovalResponse;
|
|
140
|
+
}
|
|
141
|
+
export interface ApprovalResolveEvent {
|
|
142
|
+
approvalId: string;
|
|
143
|
+
response: ApprovalResponse;
|
|
144
|
+
channelId: string;
|
|
145
|
+
}
|
|
146
|
+
export interface DurableApprovalRecord {
|
|
147
|
+
approvalId: string;
|
|
148
|
+
owner: {
|
|
149
|
+
workflowId: string;
|
|
150
|
+
runId: string;
|
|
151
|
+
stepId: string;
|
|
152
|
+
taskId?: string;
|
|
153
|
+
};
|
|
154
|
+
status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
|
|
155
|
+
request: CreateApprovalArgs['request'];
|
|
156
|
+
deliveries: ApprovalDelivery[];
|
|
157
|
+
response?: ApprovalResponse;
|
|
158
|
+
createdAt: string;
|
|
159
|
+
updatedAt: string;
|
|
160
|
+
resolvedAt?: string;
|
|
161
|
+
}
|
|
162
|
+
/** An inbound attachment already materialized to a LOCAL file by the provider. */
|
|
163
|
+
export interface InboundChannelAttachment {
|
|
164
|
+
name: string;
|
|
165
|
+
path: string;
|
|
166
|
+
contentType?: string;
|
|
167
|
+
size?: number;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A human message arriving FROM a channel (#669 Phase B). The provider has
|
|
171
|
+
* already applied its gating (allowlists, mention requirements) — a handler
|
|
172
|
+
* receiving this may treat the sender as authorized. `channelRef` is
|
|
173
|
+
* provider-qualified and directly usable as a send target for the reply.
|
|
174
|
+
*/
|
|
175
|
+
export interface InboundChannelMessage {
|
|
176
|
+
platform: string;
|
|
177
|
+
channelRef: string;
|
|
178
|
+
authorId: string;
|
|
179
|
+
authorName?: string;
|
|
180
|
+
text: string;
|
|
181
|
+
attachments?: InboundChannelAttachment[];
|
|
182
|
+
/** Provider message ref (e.g. "message:<id>"). */
|
|
183
|
+
messageRef: string;
|
|
184
|
+
/**
|
|
185
|
+
* Structured control command (e.g. a slash command) instead of chat text —
|
|
186
|
+
* when present, `text` is empty and consumers act on the verb ("new-chat"
|
|
187
|
+
* unbinds the channel's chat so the next message starts fresh). The
|
|
188
|
+
* provider has already acked the command UI-side.
|
|
189
|
+
*/
|
|
190
|
+
command?: {
|
|
191
|
+
name: string;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The full channel surface a delivering runtime exposes (see
|
|
196
|
+
* `AgentRuntimeAdapter.channels` for the capability semantics — the member
|
|
197
|
+
* is OPTIONAL there; this type is the shape when present).
|
|
198
|
+
*/
|
|
199
|
+
export interface RuntimeChannelSurface {
|
|
200
|
+
list(): Promise<ChannelInfo[]>;
|
|
201
|
+
sendNotification(args: NotificationArgs): Promise<DeliveryResult>;
|
|
202
|
+
sendMessage(args: ChannelMessageArgs): Promise<DeliveryResult>;
|
|
203
|
+
deliverContent(args: ContentDeliveryArgs): Promise<DeliveryResult>;
|
|
204
|
+
createApproval(args: CreateApprovalArgs): Promise<ApprovalRenderResult>;
|
|
205
|
+
editApproval(args: EditApprovalArgs): Promise<ApprovalRenderResult>;
|
|
206
|
+
cancelApproval(args: CancelApprovalArgs): Promise<void>;
|
|
207
|
+
resolveApproval(args: ResolveApprovalArgs): Promise<void>;
|
|
208
|
+
subscribeApprovalResponses(handler: (event: ApprovalResolveEvent) => void): () => void;
|
|
209
|
+
/**
|
|
210
|
+
* Optional threading/editing capabilities. Adapters for providers without
|
|
211
|
+
* threads or message editing omit them; callers MUST feature-detect and
|
|
212
|
+
* fall back to flat channel messages — never error on absence.
|
|
213
|
+
*/
|
|
214
|
+
createThread?(args: CreateThreadArgs): Promise<CreatedThread | null>;
|
|
215
|
+
editMessage?(args: EditChannelMessageArgs): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* OPTIONAL inbound stream (#669 Phase B): human messages from the channel
|
|
218
|
+
* platform, pre-gated by the provider (allowlists fail closed; guild
|
|
219
|
+
* messages mention-gated). Runtimes that handle inbound themselves
|
|
220
|
+
* (OpenClaw) OMIT this member — consumers feature-detect.
|
|
221
|
+
*/
|
|
222
|
+
subscribeInboundMessages?(handler: (message: InboundChannelMessage) => void): () => void;
|
|
223
|
+
/**
|
|
224
|
+
* OPTIONAL ephemeral typing/activity signal (#669 Phase B, D10). Providers
|
|
225
|
+
* without the concept omit it; callers feature-detect and repeat while
|
|
226
|
+
* work runs (platform typing states expire — Discord's after ~10s).
|
|
227
|
+
*/
|
|
228
|
+
sendTyping?(args: {
|
|
229
|
+
channel: string;
|
|
230
|
+
}): Promise<void>;
|
|
231
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { AdapterInitOpts, MessageUsage, RuntimeExecToolProvider
|
|
1
|
+
import type { AdapterInitOpts, MessageUsage, RuntimeExecToolProvider } from '../shared';
|
|
2
2
|
import type { ActivityClass } from '@makinbakin/sdk/types';
|
|
3
|
-
import type {
|
|
3
|
+
import type { RuntimeChannelSurface, RuntimeMetadata } from './channels';
|
|
4
4
|
export type { MessageUsage } from '../shared';
|
|
5
|
-
export type RuntimeMetadata
|
|
5
|
+
export type { RuntimeMetadata } from './channels';
|
|
6
6
|
export interface RuntimeAgent {
|
|
7
7
|
id: string;
|
|
8
8
|
name: string;
|
|
@@ -243,152 +243,7 @@ export type ChatChunk =
|
|
|
243
243
|
content?: string;
|
|
244
244
|
data?: RuntimeMetadata;
|
|
245
245
|
};
|
|
246
|
-
export
|
|
247
|
-
id: string;
|
|
248
|
-
platform: string;
|
|
249
|
-
label: string;
|
|
250
|
-
capabilities: ChannelCapability[];
|
|
251
|
-
metadata?: RuntimeMetadata;
|
|
252
|
-
}
|
|
253
|
-
export interface DeliveryResult {
|
|
254
|
-
deliveries: ApprovalDelivery[];
|
|
255
|
-
}
|
|
256
|
-
export interface NotificationArgs {
|
|
257
|
-
channels: string[];
|
|
258
|
-
notification: {
|
|
259
|
-
severity: 'info' | 'warn' | 'error' | 'success';
|
|
260
|
-
title: string;
|
|
261
|
-
body: string;
|
|
262
|
-
fields?: {
|
|
263
|
-
label: string;
|
|
264
|
-
value: string;
|
|
265
|
-
}[];
|
|
266
|
-
metadata?: RuntimeMetadata;
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
export interface ChannelMessageArgs {
|
|
270
|
-
channels: string[];
|
|
271
|
-
message: {
|
|
272
|
-
body: string;
|
|
273
|
-
title?: string;
|
|
274
|
-
threadId?: string;
|
|
275
|
-
metadata?: RuntimeMetadata;
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
export interface ContentDeliveryArgs {
|
|
279
|
-
channels: string[];
|
|
280
|
-
content: {
|
|
281
|
-
title: string;
|
|
282
|
-
body?: string;
|
|
283
|
-
url?: string;
|
|
284
|
-
files?: Array<{
|
|
285
|
-
name: string;
|
|
286
|
-
path: string;
|
|
287
|
-
contentType?: string;
|
|
288
|
-
} | {
|
|
289
|
-
kind: 'asset';
|
|
290
|
-
filename: string;
|
|
291
|
-
mimeType?: string;
|
|
292
|
-
}>;
|
|
293
|
-
metadata?: RuntimeMetadata;
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
export interface CreateThreadArgs {
|
|
297
|
-
/** Channel ref the anchor message lives in (provider or provider:target). */
|
|
298
|
-
channel: string;
|
|
299
|
-
/** Delivery ref of the message to anchor the thread to (e.g. "message:<id>"). */
|
|
300
|
-
messageRef?: string;
|
|
301
|
-
name: string;
|
|
302
|
-
}
|
|
303
|
-
export interface CreatedThread {
|
|
304
|
-
threadId: string;
|
|
305
|
-
/**
|
|
306
|
-
* Provider-addressable channel ref for posting INTO the thread (opaque to
|
|
307
|
-
* callers — provider target syntax stays inside the adapter).
|
|
308
|
-
*/
|
|
309
|
-
channelRef: string;
|
|
310
|
-
}
|
|
311
|
-
export interface EditChannelMessageArgs {
|
|
312
|
-
/** Channel ref the message lives in (provider or provider:target). */
|
|
313
|
-
channel: string;
|
|
314
|
-
/** Delivery ref of the message to edit (e.g. "message:<id>"). */
|
|
315
|
-
messageRef: string;
|
|
316
|
-
body: string;
|
|
317
|
-
}
|
|
318
|
-
export interface ApprovalOption {
|
|
319
|
-
id: string;
|
|
320
|
-
label: string;
|
|
321
|
-
variant?: 'primary' | 'destructive' | 'neutral';
|
|
322
|
-
}
|
|
323
|
-
export interface ApprovalDelivery {
|
|
324
|
-
channelId: string;
|
|
325
|
-
ref: string;
|
|
326
|
-
renderedAt: string;
|
|
327
|
-
}
|
|
328
|
-
export interface ApprovalPatch {
|
|
329
|
-
body?: string;
|
|
330
|
-
options?: ApprovalOption[];
|
|
331
|
-
expiresAt?: string;
|
|
332
|
-
context?: RuntimeMetadata;
|
|
333
|
-
}
|
|
334
|
-
export interface ApprovalResponse {
|
|
335
|
-
selectedOption: string;
|
|
336
|
-
respondedAt: string;
|
|
337
|
-
actor: {
|
|
338
|
-
type: 'agent' | 'human';
|
|
339
|
-
id: string;
|
|
340
|
-
displayName?: string;
|
|
341
|
-
};
|
|
342
|
-
comment?: string;
|
|
343
|
-
}
|
|
344
|
-
export interface ApprovalRenderResult {
|
|
345
|
-
deliveries: ApprovalDelivery[];
|
|
346
|
-
}
|
|
347
|
-
export interface ApprovalRenderRef {
|
|
348
|
-
approvalId: string;
|
|
349
|
-
deliveries: ApprovalDelivery[];
|
|
350
|
-
}
|
|
351
|
-
export interface CreateApprovalArgs {
|
|
352
|
-
approvalId: string;
|
|
353
|
-
channels: string[];
|
|
354
|
-
request: {
|
|
355
|
-
title: string;
|
|
356
|
-
body: string;
|
|
357
|
-
options: ApprovalOption[];
|
|
358
|
-
expiresAt?: string;
|
|
359
|
-
context?: RuntimeMetadata;
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
export interface EditApprovalArgs extends ApprovalRenderRef {
|
|
363
|
-
patch: ApprovalPatch;
|
|
364
|
-
}
|
|
365
|
-
export interface CancelApprovalArgs extends ApprovalRenderRef {
|
|
366
|
-
reason?: string;
|
|
367
|
-
}
|
|
368
|
-
export interface ResolveApprovalArgs extends ApprovalRenderRef {
|
|
369
|
-
response: ApprovalResponse;
|
|
370
|
-
}
|
|
371
|
-
export interface ApprovalResolveEvent {
|
|
372
|
-
approvalId: string;
|
|
373
|
-
response: ApprovalResponse;
|
|
374
|
-
channelId: string;
|
|
375
|
-
}
|
|
376
|
-
export interface DurableApprovalRecord {
|
|
377
|
-
approvalId: string;
|
|
378
|
-
owner: {
|
|
379
|
-
workflowId: string;
|
|
380
|
-
runId: string;
|
|
381
|
-
stepId: string;
|
|
382
|
-
taskId?: string;
|
|
383
|
-
};
|
|
384
|
-
status: 'pending' | 'approved' | 'rejected' | 'cancelled' | 'expired';
|
|
385
|
-
request: CreateApprovalArgs['request'];
|
|
386
|
-
deliveries: ApprovalDelivery[];
|
|
387
|
-
response?: ApprovalResponse;
|
|
388
|
-
createdAt: string;
|
|
389
|
-
updatedAt: string;
|
|
390
|
-
resolvedAt?: string;
|
|
391
|
-
}
|
|
246
|
+
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';
|
|
392
247
|
export interface RuntimeSkill {
|
|
393
248
|
name: string;
|
|
394
249
|
path?: string;
|
|
@@ -404,6 +259,31 @@ export interface RuntimeSession {
|
|
|
404
259
|
updatedAt?: string;
|
|
405
260
|
metadata?: RuntimeMetadata;
|
|
406
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* A session's context reading (#737) — runtime truth only, read AT REST.
|
|
264
|
+
* Null-honesty is the contract: `tokens: null` means honestly unknown
|
|
265
|
+
* (e.g. immediately after a compaction before the next assistant reply,
|
|
266
|
+
* or a stale store entry) — NEVER a stale or derived number; billing
|
|
267
|
+
* aggregates (which sum across a turn's internal tool-loop requests) are
|
|
268
|
+
* banned as a source. `compactionThreshold: null` when the runtime owns
|
|
269
|
+
* compaction opaquely (e.g. codex-native).
|
|
270
|
+
*/
|
|
271
|
+
export interface RuntimeSessionContextStats {
|
|
272
|
+
/** Current context tokens; null = honestly unknown. */
|
|
273
|
+
tokens: number | null;
|
|
274
|
+
/** The model's context window; null when unknown. */
|
|
275
|
+
contextWindow: number | null;
|
|
276
|
+
/** Auto-compaction trigger point in tokens; null when unknowable. */
|
|
277
|
+
compactionThreshold: number | null;
|
|
278
|
+
/** Last compaction, when detectable from durable runtime records. */
|
|
279
|
+
lastCompaction?: {
|
|
280
|
+
at?: string;
|
|
281
|
+
tokensBefore?: number;
|
|
282
|
+
reason?: string;
|
|
283
|
+
};
|
|
284
|
+
/** Model the stats describe (`provider/modelId` form), when known. */
|
|
285
|
+
model?: string;
|
|
286
|
+
}
|
|
407
287
|
export interface RuntimeSessionStoreStats {
|
|
408
288
|
agentId: string;
|
|
409
289
|
/** Live entries in the runtime's session store for this agent. */
|
|
@@ -896,24 +776,7 @@ export interface AgentRuntimeAdapter {
|
|
|
896
776
|
* honestly: empty channel lists, log-only alerts, UI-only approval gates.
|
|
897
777
|
* `capabilities().delivery.mode` reports the same fact declaratively.
|
|
898
778
|
*/
|
|
899
|
-
channels?:
|
|
900
|
-
list(): Promise<ChannelInfo[]>;
|
|
901
|
-
sendNotification(args: NotificationArgs): Promise<DeliveryResult>;
|
|
902
|
-
sendMessage(args: ChannelMessageArgs): Promise<DeliveryResult>;
|
|
903
|
-
deliverContent(args: ContentDeliveryArgs): Promise<DeliveryResult>;
|
|
904
|
-
createApproval(args: CreateApprovalArgs): Promise<ApprovalRenderResult>;
|
|
905
|
-
editApproval(args: EditApprovalArgs): Promise<ApprovalRenderResult>;
|
|
906
|
-
cancelApproval(args: CancelApprovalArgs): Promise<void>;
|
|
907
|
-
resolveApproval(args: ResolveApprovalArgs): Promise<void>;
|
|
908
|
-
subscribeApprovalResponses(handler: (event: ApprovalResolveEvent) => void): Unsubscribe;
|
|
909
|
-
/**
|
|
910
|
-
* Optional threading/editing capabilities. Adapters for providers without
|
|
911
|
-
* threads or message editing omit them; callers MUST feature-detect and
|
|
912
|
-
* fall back to flat channel messages — never error on absence.
|
|
913
|
-
*/
|
|
914
|
-
createThread?(args: CreateThreadArgs): Promise<CreatedThread | null>;
|
|
915
|
-
editMessage?(args: EditChannelMessageArgs): Promise<void>;
|
|
916
|
-
};
|
|
779
|
+
channels?: RuntimeChannelSurface;
|
|
917
780
|
skills: {
|
|
918
781
|
list(agentId?: string): Promise<RuntimeSkill[]>;
|
|
919
782
|
get(name: string, agentId?: string): Promise<RuntimeSkill | null>;
|
|
@@ -929,6 +792,18 @@ export interface AgentRuntimeAdapter {
|
|
|
929
792
|
* as "stats unavailable" — skip, never error.
|
|
930
793
|
*/
|
|
931
794
|
storeStats?(): Promise<RuntimeSessionStoreStats[]>;
|
|
795
|
+
/**
|
|
796
|
+
* Context stats for one Bakin thread's session (#737), read AT REST —
|
|
797
|
+
* no gateway calls, no turn, no session mutation, no thread locks.
|
|
798
|
+
* Keyed on {agentId, threadId} because the thread→session mapping is
|
|
799
|
+
* adapter-private on every runtime. Optional: runtimes that cannot
|
|
800
|
+
* answer omit the member; callers treat absence as unavailable —
|
|
801
|
+
* skip, never error. Null = no session / nothing honest to report.
|
|
802
|
+
*/
|
|
803
|
+
contextStats?(opts: {
|
|
804
|
+
agentId: string;
|
|
805
|
+
threadId: string;
|
|
806
|
+
}): Promise<RuntimeSessionContextStats | null>;
|
|
932
807
|
};
|
|
933
808
|
memory: {
|
|
934
809
|
listTiers(): Promise<RuntimeMemoryTier[]>;
|
|
@@ -6,5 +6,6 @@ export { hasChannelCapability } from './capabilities';
|
|
|
6
6
|
export { RuntimeError, RuntimeTurnError } from './errors';
|
|
7
7
|
export type { RuntimeErrorKind, RuntimeErrorOptions, RuntimeProviderInfo, RuntimeTurnDiagnosis, RuntimeTurnFailureReason, } from './errors';
|
|
8
8
|
export { getRuntimeMainAgent, getRuntimeMainAgentId, getRuntimeMainAgentName, selectRuntimeMainAgent, } from './helpers';
|
|
9
|
-
export type { AgentRuntimeAdapter, ApprovalDelivery, ApprovalOption, ApprovalPatch, ApprovalRenderRef, ApprovalRenderResult, ApprovalResolveEvent, ApprovalResponse, CancelApprovalArgs, ChannelInfo, ChannelMessageArgs, ChatChunk, ChatTextFormat, ContentDeliveryArgs, CreateApprovalArgs, CreateCronJobInput, CreateRuntimeAgentInput, CronJob, CronRun, DeliveryResult, DurableApprovalRecord, EditApprovalArgs, MessageArgs, MessageAttachment, MessageResult, MessageUsage, NotificationArgs, ResolveApprovalArgs, RuntimeAgent, RuntimeAllowlistPatch, RuntimeToolActivity, RuntimeAvailableModel, RuntimeCapabilities, CapabilityMode, ToolAccessStyle, RuntimeToolAccess, ToolAccessProvisioningStatus, RuntimeCredentialStatus, RuntimeRoutingPolicy, RuntimeRoutingSupport, CapabilitySet, RuntimeImageBackground, RuntimeImageEditInput, RuntimeImageFile, RuntimeImageGenerateInput, RuntimeImageGenerationResult, RuntimeImageOutputFormat, RuntimeImageProvider, RuntimeImageProviderCapabilities, RuntimeImagesAccess, RuntimeExtensionInfo, RuntimeExtensionsAccess, RuntimeMemoryEntry, RuntimeMemoryEntryStat, RuntimeMemoryPathMatch, RuntimeMemoryReadRange, RuntimeMemorySearchResult, RuntimeMemoryTier, RuntimeMessageToolPolicy, RuntimeMessageToolsMode, RuntimeMetadata, RawCronSnapshot, RuntimeSession, RuntimeSessionStoreStats, RuntimeSkill, UpdateCronJobInput, UpdateRuntimeAgentInput, WorkspaceFile, WorkspaceFileStat, } from './concepts';
|
|
9
|
+
export type { AgentRuntimeAdapter, ApprovalDelivery, ApprovalOption, ApprovalPatch, ApprovalRenderRef, ApprovalRenderResult, ApprovalResolveEvent, ApprovalResponse, CancelApprovalArgs, ChannelInfo, ChannelMessageArgs, ChatChunk, ChatTextFormat, ContentDeliveryArgs, CreateApprovalArgs, CreateThreadArgs, CreatedThread, CreateCronJobInput, CreateRuntimeAgentInput, CronJob, CronRun, DeliveryResult, DurableApprovalRecord, EditApprovalArgs, EditChannelMessageArgs, InboundChannelAttachment, InboundChannelMessage, MessageArgs, MessageAttachment, MessageResult, MessageUsage, NotificationArgs, ResolveApprovalArgs, RuntimeAgent, RuntimeAllowlistPatch, RuntimeToolActivity, RuntimeAvailableModel, RuntimeCapabilities, CapabilityMode, ToolAccessStyle, RuntimeToolAccess, ToolAccessProvisioningStatus, RuntimeCredentialStatus, RuntimeRoutingPolicy, RuntimeRoutingSupport, CapabilitySet, RuntimeImageBackground, RuntimeImageEditInput, RuntimeImageFile, RuntimeImageGenerateInput, RuntimeImageGenerationResult, RuntimeImageOutputFormat, RuntimeImageProvider, RuntimeImageProviderCapabilities, RuntimeImagesAccess, RuntimeExtensionInfo, RuntimeExtensionsAccess, RuntimeMemoryEntry, RuntimeMemoryEntryStat, RuntimeMemoryPathMatch, RuntimeMemoryReadRange, RuntimeMemorySearchResult, RuntimeMemoryTier, RuntimeMessageToolPolicy, RuntimeMessageToolsMode, RuntimeMetadata, RawCronSnapshot, RuntimeSession, RuntimeSessionStoreStats, RuntimeSessionContextStats, RuntimeSkill, UpdateCronJobInput, UpdateRuntimeAgentInput, WorkspaceFile, WorkspaceFileStat, } from './concepts';
|
|
10
10
|
export { RUNTIME_MEDIA_URI_SCHEME, DEFAULT_OVERSIZED_OUTPUT_BYTES } from './concepts';
|
|
11
|
+
export { isSafeSkillFilePath, isExecutableSkillFile, readSkillTree, SKILL_SIDECAR_NAMES } from './skill-files';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Relative path inside a skill dir: no absolute, no backslash, no `..`/empty segments. */
|
|
2
|
+
export declare function isSafeSkillFilePath(path: string): boolean;
|
|
3
|
+
/** Metadata sidecars — never part of a skill's file map. */
|
|
4
|
+
export declare const SKILL_SIDECAR_NAMES: Set<string>;
|
|
5
|
+
/** Scripts get the executable bit at projection: shebang or a script extension. */
|
|
6
|
+
export declare function isExecutableSkillFile(path: string, content: string): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Read a skill directory into a relative-path→content map, skipping
|
|
9
|
+
* symlinks and the metadata sidecars (`.installedBy`/`.userEdited`) at any
|
|
10
|
+
* depth. Unreadable roots read as empty.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readSkillTree(root: string): Record<string, string>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ActivityClass } from '@makinbakin/sdk/types';
|
|
2
|
+
import type { ChannelBridge } from '../delivery/bridge';
|
|
2
3
|
export type Unsubscribe = () => void;
|
|
3
4
|
export interface AdapterLogger {
|
|
4
5
|
debug(message: string, data?: unknown): void;
|
|
@@ -108,6 +109,14 @@ export interface RuntimeExecToolProvider {
|
|
|
108
109
|
}
|
|
109
110
|
export interface AdapterInitOpts {
|
|
110
111
|
contentDir: string;
|
|
112
|
+
/**
|
|
113
|
+
* Optional runtime-neutral channel bridge (issue #669). Runtimes without a
|
|
114
|
+
* native delivery layer (Pi) expose `runtime.channels` by delegating to
|
|
115
|
+
* this handle when `isConfigured()`; natively-delivering runtimes ignore
|
|
116
|
+
* it. This is a HANDLE only — the server owns `boot()`/`shutdown()`;
|
|
117
|
+
* adapters never connect transports.
|
|
118
|
+
*/
|
|
119
|
+
channelBridge?: ChannelBridge;
|
|
111
120
|
settings?: Record<string, unknown>;
|
|
112
121
|
/**
|
|
113
122
|
* LIVE view of the adapter-private settings bag. `settings` is a boot-time
|
|
@@ -138,6 +147,8 @@ export interface AdapterInitOpts {
|
|
|
138
147
|
* (Pi) ignore it.
|
|
139
148
|
*/
|
|
140
149
|
bakinMcpBaseUrl?: string;
|
|
150
|
+
/** Host-issued credential scoped to a single agent; never log this value. */
|
|
151
|
+
getMcpCredential?: (agentId: string) => string;
|
|
141
152
|
}
|
|
142
153
|
export interface AdapterVersionInfo {
|
|
143
154
|
readonly name: string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-neutral channel bridge contract (issue #669).
|
|
3
|
+
*
|
|
4
|
+
* A ChannelBridge gives a runtime WITHOUT a native channel/delivery layer
|
|
5
|
+
* (Pi) a `runtime.channels` surface by delegation. The concrete Discord
|
|
6
|
+
* implementation lives in `src/core/delivery/` — app code; this package only
|
|
7
|
+
* defines the seam so adapter packages can accept a bridge without importing
|
|
8
|
+
* app modules (adapters never import `src/`).
|
|
9
|
+
*
|
|
10
|
+
* Lifecycle: the HANDLE is threaded through `AdapterInitOpts.channelBridge`
|
|
11
|
+
* at adapter init (cheap, no I/O); `boot()`/`shutdown()` are called by the
|
|
12
|
+
* server only — never inside `createAppServices()`, which read-only CLI
|
|
13
|
+
* paths also call. `isConfigured()` must be side-effect-free and callable
|
|
14
|
+
* before boot: adapters use it to decide whether to expose `channels` and
|
|
15
|
+
* whether `capabilities().delivery.mode` reports `'shimmed'` or
|
|
16
|
+
* `'unavailable'`.
|
|
17
|
+
*/
|
|
18
|
+
import type { RuntimeChannelSurface } from '../adapters/runtime/channels';
|
|
19
|
+
/** The full channel surface, contract-identical to a native adapter's. */
|
|
20
|
+
export type ChannelSurface = RuntimeChannelSurface;
|
|
21
|
+
export interface ChannelBridge {
|
|
22
|
+
/**
|
|
23
|
+
* True when non-secret config AND the transport secret are present.
|
|
24
|
+
* Side-effect-free; the gate for exposing `channels` on an adapter.
|
|
25
|
+
*/
|
|
26
|
+
isConfigured(): boolean;
|
|
27
|
+
/** Connect transports. Server-boot only; idempotent. */
|
|
28
|
+
boot(): Promise<void>;
|
|
29
|
+
/** Disconnect and release transports. Safe when never booted. */
|
|
30
|
+
shutdown(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* The delegated channel surface. Only meaningful when `isConfigured()`;
|
|
33
|
+
* adapters must not expose it otherwise.
|
|
34
|
+
*/
|
|
35
|
+
channels: ChannelSurface;
|
|
36
|
+
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
export interface FormatAgeOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Resolve below a minute ("42s ago") instead of flattening to "just now".
|
|
4
|
+
*
|
|
5
|
+
* Live-status surfaces need it: on a heartbeat or an activity feed the
|
|
6
|
+
* difference between five seconds and fifty is the signal, and minute
|
|
7
|
+
* granularity erases it. Everything under ten seconds still reads
|
|
8
|
+
* "just now" so a ticking feed does not flicker through 1s/2s/3s.
|
|
9
|
+
*/
|
|
10
|
+
precise?: boolean;
|
|
11
|
+
}
|
|
1
12
|
/** Human-readable relative time from an ISO timestamp */
|
|
2
|
-
export declare function formatAge(timestamp: string): string;
|
|
13
|
+
export declare function formatAge(timestamp: string, options?: FormatAgeOptions): string;
|
|
3
14
|
/**
|
|
4
15
|
* Human-readable absolute date+time with calendar awareness:
|
|
5
16
|
* "Today 3:45 PM" / "Yesterday 9:02 AM" / "Jan 5 3:45 PM", carrying the year
|