@makinbakin/sdk 0.0.0-bootstrap.0 → 0.0.1-rc.1
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 +20 -10
- package/_internal/app/components/integrated-brainstorm/activity.d.ts +23 -0
- package/_internal/app/components/integrated-brainstorm/index.d.ts +6 -1
- package/_internal/app/components/integrated-brainstorm/session.d.ts +16 -0
- package/_internal/app/components/integrated-brainstorm/sse.d.ts +8 -0
- package/_internal/app/components/integrated-brainstorm/types.d.ts +7 -5
- package/_internal/app/components/ui/badge.d.ts +1 -1
- package/_internal/app/components/ui/button.d.ts +1 -1
- package/_internal/core/adapters/runtime/concepts.d.ts +17 -1
- package/_internal/core/adapters/runtime/index.d.ts +1 -1
- package/_internal/core/constants.d.ts +15 -0
- package/_internal/core/content-dir.d.ts +42 -0
- package/_internal/core/generated-version.d.ts +1 -0
- package/_internal/core/logger.d.ts +8 -0
- package/_internal/core/plugin-types.d.ts +66 -5
- package/_internal/core/routing/index.d.ts +1 -1
- package/components/index.d.ts +3 -2
- package/components/index.js +727 -74
- package/hooks/index.d.ts +1 -1
- package/hooks/index.js +10 -0
- package/index.d.ts +8 -8
- package/index.js +327 -0
- package/metadata/index.d.ts +2 -2
- package/package.json +2 -2
- package/routing/index.d.ts +2 -2
- package/routing/index.js +327 -0
- package/slots/index.d.ts +1 -1
- package/types/index.d.ts +77 -3
- package/ui/index.d.ts +2 -2
- package/utils/index.d.ts +6 -1
- package/utils/index.js +269 -1
package/routing/index.js
CHANGED
|
@@ -13696,6 +13696,333 @@ var errorEnvelope = exports_external.object({
|
|
|
13696
13696
|
error: exports_external.string(),
|
|
13697
13697
|
issues: exports_external.array(exports_external.unknown()).optional()
|
|
13698
13698
|
});
|
|
13699
|
+
|
|
13700
|
+
// packages/core/src/logger.ts
|
|
13701
|
+
import { createWriteStream, existsSync, mkdirSync, renameSync, statSync } from "fs";
|
|
13702
|
+
import { join as join2 } from "path";
|
|
13703
|
+
|
|
13704
|
+
// packages/core/src/content-dir.ts
|
|
13705
|
+
import { join } from "path";
|
|
13706
|
+
import { homedir } from "os";
|
|
13707
|
+
// packages/core/src/constants.ts
|
|
13708
|
+
var APP_SLUG = "bakin";
|
|
13709
|
+
|
|
13710
|
+
// packages/core/src/content-dir.ts
|
|
13711
|
+
function bakinHomeDefault() {
|
|
13712
|
+
return join(homedir(), `.${APP_SLUG}`);
|
|
13713
|
+
}
|
|
13714
|
+
var resolvedContentDir = null;
|
|
13715
|
+
function isTestEnv() {
|
|
13716
|
+
return process.env.VITEST === "true" || !!process.env.VITEST;
|
|
13717
|
+
}
|
|
13718
|
+
function realBakinHome() {
|
|
13719
|
+
const realHome = process.env.HOME || process.env.USERPROFILE || "";
|
|
13720
|
+
if (!realHome)
|
|
13721
|
+
return "";
|
|
13722
|
+
return join(realHome, `.${APP_SLUG}`);
|
|
13723
|
+
}
|
|
13724
|
+
function assertSafeForTest(path) {
|
|
13725
|
+
if (!isTestEnv())
|
|
13726
|
+
return;
|
|
13727
|
+
const real = realBakinHome();
|
|
13728
|
+
if (real && path === real) {
|
|
13729
|
+
throw new Error(`[bakin] getContentDir() resolved to the real Bakin home (${real}) ` + `during a test run. This would write test data to your production instance. ` + `Fix: mock src/core/content-dir in this test, or set BAKIN_HOME to a temp ` + `directory before importing any Bakin module. See CLAUDE.md \xA7 Testing Rules.`);
|
|
13730
|
+
}
|
|
13731
|
+
}
|
|
13732
|
+
function getContentDir() {
|
|
13733
|
+
if (resolvedContentDir)
|
|
13734
|
+
return resolvedContentDir;
|
|
13735
|
+
const resolved = resolveContentDirInner();
|
|
13736
|
+
assertSafeForTest(resolved);
|
|
13737
|
+
resolvedContentDir = resolved;
|
|
13738
|
+
return resolvedContentDir;
|
|
13739
|
+
}
|
|
13740
|
+
function resolveContentDirInner() {
|
|
13741
|
+
if (process.env.BAKIN_HOME)
|
|
13742
|
+
return process.env.BAKIN_HOME;
|
|
13743
|
+
return bakinHomeDefault();
|
|
13744
|
+
}
|
|
13745
|
+
function getBakinPaths() {
|
|
13746
|
+
const home = getContentDir();
|
|
13747
|
+
const assets = join(home, "assets");
|
|
13748
|
+
return {
|
|
13749
|
+
home,
|
|
13750
|
+
memoryLog: join(home, "MEMORY-LOG.md"),
|
|
13751
|
+
audit: join(home, "audit.jsonl"),
|
|
13752
|
+
assets,
|
|
13753
|
+
"assets.store": join(assets, "store"),
|
|
13754
|
+
"assets.inbox": join(assets, "inbox"),
|
|
13755
|
+
"assets.trash": join(assets, ".trash"),
|
|
13756
|
+
agents: join(home, "agents"),
|
|
13757
|
+
personas: join(home, "team", "personas"),
|
|
13758
|
+
team: join(home, "team"),
|
|
13759
|
+
heartbeats: join(home, "heartbeats"),
|
|
13760
|
+
inbox: join(home, "inbox"),
|
|
13761
|
+
tasks: join(home, "tasks"),
|
|
13762
|
+
workflows: join(home, "workflows"),
|
|
13763
|
+
settings: join(home, "settings.json"),
|
|
13764
|
+
logs: join(home, "logs")
|
|
13765
|
+
};
|
|
13766
|
+
}
|
|
13767
|
+
|
|
13768
|
+
// packages/core/src/logger.ts
|
|
13769
|
+
var MAX_LOG_BYTES = 10 * 1024 * 1024;
|
|
13770
|
+
var LEVEL_RANK = {
|
|
13771
|
+
debug: 10,
|
|
13772
|
+
info: 20,
|
|
13773
|
+
warn: 30,
|
|
13774
|
+
error: 40
|
|
13775
|
+
};
|
|
13776
|
+
var COLOR_RESET = "\x1B[0m";
|
|
13777
|
+
var COLORS = {
|
|
13778
|
+
dim: "\x1B[2m",
|
|
13779
|
+
blue: "\x1B[34m",
|
|
13780
|
+
cyan: "\x1B[36m",
|
|
13781
|
+
green: "\x1B[32m",
|
|
13782
|
+
magenta: "\x1B[35m",
|
|
13783
|
+
red: "\x1B[31m",
|
|
13784
|
+
yellow: "\x1B[33m"
|
|
13785
|
+
};
|
|
13786
|
+
var fileStream = null;
|
|
13787
|
+
var fileTransportInitialized = false;
|
|
13788
|
+
var fileTransportDisabled = false;
|
|
13789
|
+
function fileTransportEnabled() {
|
|
13790
|
+
if (fileTransportDisabled)
|
|
13791
|
+
return false;
|
|
13792
|
+
if (false)
|
|
13793
|
+
;
|
|
13794
|
+
if (process.env.VITEST)
|
|
13795
|
+
return false;
|
|
13796
|
+
if (process.env.BAKIN_DISABLE_FILE_LOG === "1")
|
|
13797
|
+
return false;
|
|
13798
|
+
return true;
|
|
13799
|
+
}
|
|
13800
|
+
function ensureFileStream() {
|
|
13801
|
+
if (fileTransportInitialized)
|
|
13802
|
+
return fileStream;
|
|
13803
|
+
fileTransportInitialized = true;
|
|
13804
|
+
if (!fileTransportEnabled())
|
|
13805
|
+
return null;
|
|
13806
|
+
try {
|
|
13807
|
+
const logsDir = getBakinPaths().logs;
|
|
13808
|
+
if (!existsSync(logsDir))
|
|
13809
|
+
mkdirSync(logsDir, { recursive: true });
|
|
13810
|
+
const logPath = join2(logsDir, "server.log");
|
|
13811
|
+
if (existsSync(logPath)) {
|
|
13812
|
+
try {
|
|
13813
|
+
const size = statSync(logPath).size;
|
|
13814
|
+
if (size > MAX_LOG_BYTES) {
|
|
13815
|
+
const rotated = join2(logsDir, "server.log.1");
|
|
13816
|
+
renameSync(logPath, rotated);
|
|
13817
|
+
}
|
|
13818
|
+
} catch {}
|
|
13819
|
+
}
|
|
13820
|
+
fileStream = createWriteStream(logPath, { flags: "a" });
|
|
13821
|
+
fileStream.on("error", () => {
|
|
13822
|
+
fileTransportDisabled = true;
|
|
13823
|
+
fileStream = null;
|
|
13824
|
+
});
|
|
13825
|
+
} catch {
|
|
13826
|
+
fileTransportDisabled = true;
|
|
13827
|
+
fileStream = null;
|
|
13828
|
+
}
|
|
13829
|
+
return fileStream;
|
|
13830
|
+
}
|
|
13831
|
+
function formatEntry(entry) {
|
|
13832
|
+
const parts = [`[${entry.ts}] [${entry.level.toUpperCase()}] [${entry.module}] ${entry.message}`];
|
|
13833
|
+
if (entry.error)
|
|
13834
|
+
parts.push(` error: ${entry.error}`);
|
|
13835
|
+
if (entry.data)
|
|
13836
|
+
parts.push(` data: ${JSON.stringify(entry.data)}`);
|
|
13837
|
+
return parts.join(`
|
|
13838
|
+
`);
|
|
13839
|
+
}
|
|
13840
|
+
function consoleFormat() {
|
|
13841
|
+
const configured = process.env.BAKIN_CONSOLE_FORMAT;
|
|
13842
|
+
if (configured === "pretty" || configured === "verbose" || configured === "plain" || configured === "silent") {
|
|
13843
|
+
return configured;
|
|
13844
|
+
}
|
|
13845
|
+
return process.stdout.isTTY === true ? "pretty" : "plain";
|
|
13846
|
+
}
|
|
13847
|
+
function consoleMinLevel(format) {
|
|
13848
|
+
const configured = process.env.BAKIN_LOG_LEVEL;
|
|
13849
|
+
if (configured === "debug" || configured === "info" || configured === "warn" || configured === "error") {
|
|
13850
|
+
return configured;
|
|
13851
|
+
}
|
|
13852
|
+
if (format === "verbose")
|
|
13853
|
+
return "debug";
|
|
13854
|
+
if (format === "silent")
|
|
13855
|
+
return "error";
|
|
13856
|
+
if (format === "pretty")
|
|
13857
|
+
return "info";
|
|
13858
|
+
return "debug";
|
|
13859
|
+
}
|
|
13860
|
+
function colorEnabled(format) {
|
|
13861
|
+
if (format === "plain")
|
|
13862
|
+
return false;
|
|
13863
|
+
if (process.env.NO_COLOR || process.env.BAKIN_NO_COLOR === "1")
|
|
13864
|
+
return false;
|
|
13865
|
+
return process.stdout.isTTY === true;
|
|
13866
|
+
}
|
|
13867
|
+
function colorize(text, color, enabled) {
|
|
13868
|
+
return enabled ? `${COLORS[color]}${text}${COLOR_RESET}` : text;
|
|
13869
|
+
}
|
|
13870
|
+
function sourceLabel(entry) {
|
|
13871
|
+
const data = entry.data;
|
|
13872
|
+
const explicitSource = typeof data?.source === "string" ? data.source : undefined;
|
|
13873
|
+
const pluginId = typeof data?.pluginId === "string" ? data.pluginId : undefined;
|
|
13874
|
+
if (explicitSource === "antfly")
|
|
13875
|
+
return "antfly";
|
|
13876
|
+
if (explicitSource === "dev")
|
|
13877
|
+
return "dev";
|
|
13878
|
+
if (explicitSource === "plugin" && pluginId)
|
|
13879
|
+
return `plugin:${pluginId}`;
|
|
13880
|
+
if (entry.module === "plugin-registry" && pluginId)
|
|
13881
|
+
return `plugin:${pluginId}`;
|
|
13882
|
+
if (entry.module.startsWith("api:"))
|
|
13883
|
+
return "api";
|
|
13884
|
+
return entry.module;
|
|
13885
|
+
}
|
|
13886
|
+
function sourceColor(source) {
|
|
13887
|
+
if (source === "dev")
|
|
13888
|
+
return "cyan";
|
|
13889
|
+
if (source === "server")
|
|
13890
|
+
return "blue";
|
|
13891
|
+
if (source === "antfly")
|
|
13892
|
+
return "magenta";
|
|
13893
|
+
if (source.startsWith("plugin:"))
|
|
13894
|
+
return "green";
|
|
13895
|
+
if (source.includes("search"))
|
|
13896
|
+
return "cyan";
|
|
13897
|
+
if (source.includes("runtime"))
|
|
13898
|
+
return "magenta";
|
|
13899
|
+
return "dim";
|
|
13900
|
+
}
|
|
13901
|
+
function levelColor(level) {
|
|
13902
|
+
if (level === "debug")
|
|
13903
|
+
return "dim";
|
|
13904
|
+
if (level === "warn")
|
|
13905
|
+
return "yellow";
|
|
13906
|
+
if (level === "error")
|
|
13907
|
+
return "red";
|
|
13908
|
+
return "blue";
|
|
13909
|
+
}
|
|
13910
|
+
function isImportantAntflyInfo(entry) {
|
|
13911
|
+
return [
|
|
13912
|
+
"Metadata API server is ready",
|
|
13913
|
+
"Store HTTP server is ready",
|
|
13914
|
+
"Swarm mode: all servers are ready",
|
|
13915
|
+
"Termite's api server starting"
|
|
13916
|
+
].some((message) => entry.message.includes(message));
|
|
13917
|
+
}
|
|
13918
|
+
function suppressPrettyInfo(entry) {
|
|
13919
|
+
if (entry.level !== "info")
|
|
13920
|
+
return false;
|
|
13921
|
+
if (entry.data?.source === "antfly")
|
|
13922
|
+
return !isImportantAntflyInfo(entry);
|
|
13923
|
+
if (entry.module === "plugin-registry") {
|
|
13924
|
+
return entry.message === "plugin activated" || entry.message.startsWith("Auto-registered ") || entry.message.startsWith("Plugin activation order:");
|
|
13925
|
+
}
|
|
13926
|
+
return [
|
|
13927
|
+
"search-registry",
|
|
13928
|
+
"search-reconcile",
|
|
13929
|
+
"search-cleanup",
|
|
13930
|
+
"hot-reload-coordinator",
|
|
13931
|
+
"mcporter",
|
|
13932
|
+
"dispatch",
|
|
13933
|
+
"watchdog",
|
|
13934
|
+
"doctor",
|
|
13935
|
+
"lifecycle"
|
|
13936
|
+
].includes(entry.module);
|
|
13937
|
+
}
|
|
13938
|
+
function shouldWriteConsole(entry, format) {
|
|
13939
|
+
if (format === "silent")
|
|
13940
|
+
return false;
|
|
13941
|
+
const minLevel = consoleMinLevel(format);
|
|
13942
|
+
if (LEVEL_RANK[entry.level] < LEVEL_RANK[minLevel])
|
|
13943
|
+
return false;
|
|
13944
|
+
if (format === "pretty" && suppressPrettyInfo(entry))
|
|
13945
|
+
return false;
|
|
13946
|
+
return true;
|
|
13947
|
+
}
|
|
13948
|
+
function formatPrettyEntry(entry, format) {
|
|
13949
|
+
const colors = colorEnabled(format);
|
|
13950
|
+
const time3 = new Date(entry.ts).toTimeString().slice(0, 8);
|
|
13951
|
+
const level = entry.level.padEnd(5);
|
|
13952
|
+
const source = sourceLabel(entry);
|
|
13953
|
+
const label = source.padEnd(18);
|
|
13954
|
+
const levelPart = colorize(level, levelColor(entry.level), colors);
|
|
13955
|
+
const sourcePart = colorize(label, sourceColor(source), colors);
|
|
13956
|
+
const messagePart = entry.level === "error" ? colorize(entry.message, "red", colors) : entry.message;
|
|
13957
|
+
const parts = [`${colorize(time3, "dim", colors)} ${levelPart} ${sourcePart} ${messagePart}`];
|
|
13958
|
+
if (entry.error)
|
|
13959
|
+
parts[0] += ` - ${entry.error}`;
|
|
13960
|
+
if (format === "verbose" && entry.data) {
|
|
13961
|
+
parts.push(` data: ${JSON.stringify(entry.data)}`);
|
|
13962
|
+
}
|
|
13963
|
+
return parts.join(`
|
|
13964
|
+
`);
|
|
13965
|
+
}
|
|
13966
|
+
function formatConsoleEntry(entry) {
|
|
13967
|
+
const format = consoleFormat();
|
|
13968
|
+
if (format === "plain")
|
|
13969
|
+
return formatEntry(entry);
|
|
13970
|
+
if (format === "silent")
|
|
13971
|
+
return "";
|
|
13972
|
+
return formatPrettyEntry(entry, format);
|
|
13973
|
+
}
|
|
13974
|
+
function writeToFile(entry) {
|
|
13975
|
+
const stream = ensureFileStream();
|
|
13976
|
+
if (!stream)
|
|
13977
|
+
return;
|
|
13978
|
+
try {
|
|
13979
|
+
stream.write(JSON.stringify(entry) + `
|
|
13980
|
+
`);
|
|
13981
|
+
} catch {
|
|
13982
|
+
fileTransportDisabled = true;
|
|
13983
|
+
fileStream = null;
|
|
13984
|
+
}
|
|
13985
|
+
}
|
|
13986
|
+
function createLogger(module) {
|
|
13987
|
+
function log(level, message, errorOrData, data) {
|
|
13988
|
+
const entry = {
|
|
13989
|
+
ts: new Date().toISOString(),
|
|
13990
|
+
level,
|
|
13991
|
+
module,
|
|
13992
|
+
message
|
|
13993
|
+
};
|
|
13994
|
+
if (errorOrData instanceof Error) {
|
|
13995
|
+
entry.error = errorOrData.message;
|
|
13996
|
+
entry.data = data ? { ...data, stack: errorOrData.stack } : { stack: errorOrData.stack };
|
|
13997
|
+
} else if (typeof errorOrData === "string") {
|
|
13998
|
+
entry.error = errorOrData;
|
|
13999
|
+
entry.data = data;
|
|
14000
|
+
} else if (errorOrData && typeof errorOrData === "object") {
|
|
14001
|
+
entry.data = errorOrData;
|
|
14002
|
+
}
|
|
14003
|
+
const format = consoleFormat();
|
|
14004
|
+
if (shouldWriteConsole(entry, format)) {
|
|
14005
|
+
const formatted = formatConsoleEntry(entry);
|
|
14006
|
+
if (level === "error") {
|
|
14007
|
+
console.error(formatted);
|
|
14008
|
+
} else if (level === "warn") {
|
|
14009
|
+
console.warn(formatted);
|
|
14010
|
+
} else {
|
|
14011
|
+
console.log(formatted);
|
|
14012
|
+
}
|
|
14013
|
+
}
|
|
14014
|
+
writeToFile(entry);
|
|
14015
|
+
}
|
|
14016
|
+
return {
|
|
14017
|
+
debug: (message, data) => log("debug", message, data),
|
|
14018
|
+
info: (message, data) => log("info", message, data),
|
|
14019
|
+
warn: (message, errorOrData, data) => log("warn", message, errorOrData, data),
|
|
14020
|
+
error: (message, errorOrData, data) => log("error", message, errorOrData, data)
|
|
14021
|
+
};
|
|
14022
|
+
}
|
|
14023
|
+
|
|
14024
|
+
// packages/core/src/routing/dispatcher.ts
|
|
14025
|
+
var log = createLogger("dispatcher");
|
|
13699
14026
|
// packages/core/src/routing/search-route.ts
|
|
13700
14027
|
var searchQuery = exports_external.object({
|
|
13701
14028
|
q: exports_external.string().min(1),
|
package/slots/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@
|
|
2
|
+
* `@makinbakin/sdk/slots` — client-side slot registry + `<Slot>` primitive.
|
|
3
3
|
*
|
|
4
4
|
* The slot system lets a plugin render components contributed by other
|
|
5
5
|
* plugins at a named extension point. Today it's used for:
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Public Bakin plugin contract types.
|
|
3
3
|
*
|
|
4
4
|
* This module is intentionally self-contained. External plugins must be able
|
|
5
|
-
* to typecheck against `@
|
|
5
|
+
* to typecheck against `@makinbakin/sdk/types` without resolving `@bakin/core`,
|
|
6
6
|
* Bakin source aliases, adapter packages, or another plugin's internals.
|
|
7
7
|
*/
|
|
8
8
|
import type { ComponentType } from 'react';
|
|
@@ -40,6 +40,14 @@ export interface PluginEntryPoints {
|
|
|
40
40
|
server: string;
|
|
41
41
|
client?: string;
|
|
42
42
|
}
|
|
43
|
+
export interface SecretDeclaration {
|
|
44
|
+
/** Canonical environment variable name, for example `ANTHROPIC_API_KEY`. */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Human-readable setup note. Never include a secret value here. */
|
|
47
|
+
description: string;
|
|
48
|
+
/** Missing required secrets should be reported by setup/health checks. Defaults to true. */
|
|
49
|
+
required: boolean;
|
|
50
|
+
}
|
|
43
51
|
export interface ApiRouteContribution {
|
|
44
52
|
method: HttpMethod;
|
|
45
53
|
/** Plugin-relative path. Exposed as `/api/plugins/{pluginId}{path}`. */
|
|
@@ -140,7 +148,7 @@ export interface PluginManifest {
|
|
|
140
148
|
description: string;
|
|
141
149
|
entry: PluginEntryPoints;
|
|
142
150
|
contentFiles?: string[];
|
|
143
|
-
secrets?:
|
|
151
|
+
secrets?: SecretDeclaration[];
|
|
144
152
|
tests?: string;
|
|
145
153
|
dependencies?: string[];
|
|
146
154
|
permissions?: PluginPermission[];
|
|
@@ -182,6 +190,12 @@ export interface ActivityAPI {
|
|
|
182
190
|
}): void;
|
|
183
191
|
audit(event: string, agent: string, data?: Record<string, unknown>): void;
|
|
184
192
|
}
|
|
193
|
+
export interface PluginLogger {
|
|
194
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
195
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
196
|
+
warn(message: string, errorOrData?: unknown, data?: Record<string, unknown>): void;
|
|
197
|
+
error(message: string, errorOrData?: unknown, data?: Record<string, unknown>): void;
|
|
198
|
+
}
|
|
185
199
|
export interface HookAPI {
|
|
186
200
|
register(name: string, handler: (data: unknown) => unknown, metadata?: HookRegistrationMetadata): () => void;
|
|
187
201
|
call<T>(name: string, data: T): Promise<T>;
|
|
@@ -251,6 +265,10 @@ export interface RuntimeChannel {
|
|
|
251
265
|
export interface RuntimeMessageArgs {
|
|
252
266
|
agentId: string;
|
|
253
267
|
content: string;
|
|
268
|
+
/**
|
|
269
|
+
* Adapter-neutral durable conversation key. Runtime adapters should map the
|
|
270
|
+
* same agentId + threadId pair to the same provider/runtime session.
|
|
271
|
+
*/
|
|
254
272
|
threadId?: string;
|
|
255
273
|
metadata?: Record<string, unknown>;
|
|
256
274
|
}
|
|
@@ -259,10 +277,22 @@ export interface RuntimeMessageResult {
|
|
|
259
277
|
content?: string;
|
|
260
278
|
metadata?: Record<string, unknown>;
|
|
261
279
|
}
|
|
280
|
+
export interface RuntimeToolActivity {
|
|
281
|
+
phase: 'call' | 'result';
|
|
282
|
+
callId?: string;
|
|
283
|
+
toolName: string;
|
|
284
|
+
status?: 'running' | 'completed' | 'failed' | string;
|
|
285
|
+
summary?: string;
|
|
286
|
+
inputPreview?: string;
|
|
287
|
+
outputPreview?: string;
|
|
288
|
+
durationMs?: number;
|
|
289
|
+
exitCode?: number;
|
|
290
|
+
metadata?: Record<string, unknown>;
|
|
291
|
+
}
|
|
262
292
|
export interface RuntimeChatChunk {
|
|
263
293
|
type: 'text' | 'tool' | 'status' | 'done' | 'error';
|
|
264
294
|
content?: string;
|
|
265
|
-
data?: unknown;
|
|
295
|
+
data?: Record<string, unknown> | RuntimeToolActivity;
|
|
266
296
|
}
|
|
267
297
|
export interface CronJob {
|
|
268
298
|
id: string;
|
|
@@ -385,10 +415,19 @@ export interface Task {
|
|
|
385
415
|
workflowId?: string;
|
|
386
416
|
scheduleJobId?: string;
|
|
387
417
|
projectId?: string;
|
|
418
|
+
availableAt?: string;
|
|
419
|
+
dueAt?: string;
|
|
420
|
+
source?: TaskSource;
|
|
388
421
|
order?: number;
|
|
389
422
|
createdAt?: string;
|
|
390
423
|
updatedAt?: string;
|
|
391
424
|
}
|
|
425
|
+
export interface TaskSource {
|
|
426
|
+
pluginId?: string;
|
|
427
|
+
entityType?: string;
|
|
428
|
+
entityId?: string;
|
|
429
|
+
purpose?: string;
|
|
430
|
+
}
|
|
392
431
|
export interface TaskColumns {
|
|
393
432
|
backlog: Task[];
|
|
394
433
|
inProgress: Task[];
|
|
@@ -414,6 +453,9 @@ export interface TaskCreateInput {
|
|
|
414
453
|
workflowId?: string;
|
|
415
454
|
projectId?: string;
|
|
416
455
|
parentId?: string | null;
|
|
456
|
+
availableAt?: string;
|
|
457
|
+
dueAt?: string;
|
|
458
|
+
source?: TaskSource;
|
|
417
459
|
skipWorkflowReason?: string;
|
|
418
460
|
}
|
|
419
461
|
export interface TaskUpdateInput {
|
|
@@ -429,6 +471,9 @@ export interface TaskUpdateInput {
|
|
|
429
471
|
scheduleJobId?: string;
|
|
430
472
|
projectId?: string;
|
|
431
473
|
parentId?: string | null;
|
|
474
|
+
availableAt?: string | null;
|
|
475
|
+
dueAt?: string | null;
|
|
476
|
+
source?: TaskSource | null;
|
|
432
477
|
}
|
|
433
478
|
export interface TaskService {
|
|
434
479
|
create(input: TaskCreateInput): Promise<Task>;
|
|
@@ -667,11 +712,39 @@ export interface HealthCheckResult {
|
|
|
667
712
|
message: string;
|
|
668
713
|
autoFixable: boolean;
|
|
669
714
|
}
|
|
715
|
+
export type HealthRepairSafety = 'safe' | 'manual' | 'destructive';
|
|
716
|
+
export interface HealthRepairChange {
|
|
717
|
+
kind: 'file' | 'setting' | 'service' | 'runtime' | 'task' | 'other';
|
|
718
|
+
target: string;
|
|
719
|
+
action: 'create' | 'update' | 'delete' | 'install' | 'invoke';
|
|
720
|
+
description: string;
|
|
721
|
+
}
|
|
722
|
+
export interface HealthRepairPlanItem {
|
|
723
|
+
id: string;
|
|
724
|
+
checkId: string;
|
|
725
|
+
title: string;
|
|
726
|
+
reason: string;
|
|
727
|
+
safety: HealthRepairSafety;
|
|
728
|
+
requiresConfirmation: boolean;
|
|
729
|
+
changes: HealthRepairChange[];
|
|
730
|
+
}
|
|
731
|
+
export interface HealthRepairApplyResult {
|
|
732
|
+
id: string;
|
|
733
|
+
checkId: string;
|
|
734
|
+
status: 'applied' | 'skipped' | 'failed';
|
|
735
|
+
message: string;
|
|
736
|
+
changes: HealthRepairChange[];
|
|
737
|
+
}
|
|
738
|
+
export interface HealthRepairHandler {
|
|
739
|
+
plan(rows: HealthCheckResult[]): Promise<HealthRepairPlanItem[]>;
|
|
740
|
+
apply(items: HealthRepairPlanItem[]): Promise<HealthRepairApplyResult[]>;
|
|
741
|
+
}
|
|
670
742
|
export interface PluginHealthCheckInput {
|
|
671
743
|
id: string;
|
|
672
744
|
name: string;
|
|
673
745
|
run: () => Promise<HealthCheckResult[]>;
|
|
674
746
|
autoFix?: boolean;
|
|
747
|
+
repair?: HealthRepairHandler;
|
|
675
748
|
}
|
|
676
749
|
interface BaseSettingsField {
|
|
677
750
|
key: string;
|
|
@@ -734,6 +807,7 @@ export interface PluginContext {
|
|
|
734
807
|
getSettings<T = Record<string, unknown>>(): T;
|
|
735
808
|
updateSettings(patch: Record<string, unknown>): void;
|
|
736
809
|
activity: ActivityAPI;
|
|
810
|
+
log?: PluginLogger;
|
|
737
811
|
hooks: HookAPI;
|
|
738
812
|
search: SearchAPI;
|
|
739
813
|
}
|
package/ui/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@
|
|
2
|
+
* `@makinbakin/sdk/ui` — shadcn base UI primitives for plugin authors.
|
|
3
3
|
*
|
|
4
4
|
* These are re-exports from Bakin's `src/components/ui/*`. At Bakin build time
|
|
5
5
|
* they resolve to source. At plugin build time (Phase 3) the plugin author
|
|
6
|
-
* marks `@
|
|
6
|
+
* marks `@makinbakin/sdk` and `@makinbakin/sdk/ui` as externals so the plugin bundle
|
|
7
7
|
* doesn't duplicate these. At runtime the browser's import map resolves the
|
|
8
8
|
* externals to Bakin's bundled copy.
|
|
9
9
|
*/
|
package/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@
|
|
2
|
+
* `@makinbakin/sdk/utils` — tiny utilities for plugin authors.
|
|
3
3
|
*
|
|
4
4
|
* `cn(...)` is the Tailwind class merger every shadcn-flavored component
|
|
5
5
|
* needs. The `format*` helpers are re-exported from `@bakin/core/format`
|
|
@@ -7,3 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { cn } from '../_internal/app/lib/utils';
|
|
9
9
|
export { formatAge, formatSize, isStale } from '../_internal/core/format';
|
|
10
|
+
export { brainstormActivityMessageFromCustom, runtimeChunkToBrainstormActivity, toBrainstormTimeline, } from '../_internal/app/components/integrated-brainstorm/activity';
|
|
11
|
+
export { brainstormThreadId, normalizeBrainstormActivityForStorage, normalizeBrainstormActivityMessageForStorage, } from '../_internal/app/components/integrated-brainstorm/session';
|
|
12
|
+
export type { BrainstormActivityInput, BrainstormTimelineActivityInput, BrainstormTimelineMessageInput, } from '../_internal/app/components/integrated-brainstorm/activity';
|
|
13
|
+
export type { BrainstormActivityStorageInput, BrainstormActivityStorageRecord, } from '../_internal/app/components/integrated-brainstorm/session';
|
|
14
|
+
export { readBrainstormSseResponse } from '../_internal/app/components/integrated-brainstorm/sse';
|