yaml-flow 8.2.5 → 8.4.0
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/browser/asset-integrity.json +3 -3
- package/browser/board-livecards-client.js +1 -1
- package/browser/board-livecards-localstorage.js +6 -4
- package/browser/live-cards.js +19 -25
- package/cli/{board-live-cards-lib-Iq_XAC09.d.ts → board-live-cards-lib-tjYsPt5U.d.ts} +1 -1
- package/cli/browser-api/board-live-cards-browser-adapter.d.ts +3 -3
- package/cli/browser-api/board-live-cards-browser-adapter.js +3 -2
- package/cli/browser-api/card-store-browser-api.d.ts +1 -1
- package/cli/browser-api/card-store-browser-api.js +1 -1
- package/cli/{execution-interface-ftO1W7Po.d.ts → execution-interface-DCFBy4L8.d.ts} +151 -2
- package/cli/node/artifacts-store-cli.js +5 -5
- package/cli/node/batch-runner-cli.d.ts +3 -0
- package/cli/node/batch-runner-cli.js +2 -1
- package/cli/node/board-live-cards-cli.js +14 -8
- package/cli/node/card-store-cli.js +6 -6
- package/cli/node/chat-store-cli.d.ts +23 -0
- package/cli/node/chat-store-cli.js +8 -0
- package/cli/node/execution-adapter.d.ts +4 -2
- package/cli/node/execution-adapter.js +2 -2
- package/cli/node/fs-board-adapter.d.ts +75 -75
- package/cli/node/fs-board-adapter.js +14 -10
- package/cli/node/source-cli-task-executor.js +4 -4
- package/cli/node/step-machine-cli.js +3 -3
- package/cli/{types--rXGWbSR.d.ts → types-Dc2VRMUw.d.ts} +27 -124
- package/examples/board/demo-shell-with-server.html +3 -196
- package/examples/board/doc.html +465 -0
- package/examples/board/server/board-server.js +30 -82
- package/examples/board/server/board-worker/source_def_flows.json +2 -2
- package/examples/board/server/chat-flow/copilot-chat/assistant.js +44 -185
- package/examples/board/server/chat-flow/copilot-chat/copilot_wrapper.bat +157 -0
- package/examples/board/server/chat-flow/copilot-chat/copilot_wrapper_helper.ps1 +190 -0
- package/examples/board/server/chat-flow/flow-steps.json +122 -56
- package/examples/board/test/server-http-test.js +252 -220
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/{artifacts-store-lib-public-GD4H-fFp.d.ts → artifacts-store-lib-454TAuov.d.ts} +2 -32
- package/lib/{artifacts-store-lib-public-C5UL5tyG.d.cts → artifacts-store-lib-zsGFbBV8.d.cts} +2 -32
- package/lib/artifacts-store-public.d.cts +34 -3
- package/lib/artifacts-store-public.d.ts +34 -3
- package/lib/board-live-cards-node.cjs +14 -10
- package/lib/board-live-cards-node.d.cts +42 -21
- package/lib/board-live-cards-node.d.ts +42 -21
- package/lib/board-live-cards-node.js +14 -10
- package/lib/{board-live-cards-public-BLXbcBNk.d.cts → board-live-cards-public-BM6jCEIa.d.cts} +25 -5
- package/lib/{board-live-cards-public-BZaNb2mi.d.ts → board-live-cards-public-Bz07XKRK.d.ts} +25 -5
- package/lib/board-live-cards-public.cjs +2 -2
- package/lib/board-live-cards-public.d.cts +2 -2
- package/lib/board-live-cards-public.d.ts +2 -2
- package/lib/board-live-cards-public.js +2 -2
- package/lib/board-live-cards-server-runtime.cjs +4 -4
- package/lib/board-live-cards-server-runtime.d.cts +5 -3
- package/lib/board-live-cards-server-runtime.d.ts +5 -3
- package/lib/board-live-cards-server-runtime.js +4 -4
- package/lib/board-worker-adapter.cjs +2 -2
- package/lib/board-worker-adapter.js +2 -2
- package/lib/card-store-public.d.cts +2 -2
- package/lib/card-store-public.d.ts +2 -2
- package/lib/chat-storage-lib-DGaKrjVe.d.ts +53 -0
- package/lib/chat-storage-lib-OX0Q_Ttf.d.cts +53 -0
- package/lib/chat-store-public.cjs +2 -0
- package/lib/chat-store-public.d.cts +128 -0
- package/lib/chat-store-public.d.ts +128 -0
- package/lib/chat-store-public.js +2 -0
- package/lib/execution-refs.cjs +1 -1
- package/lib/execution-refs.d.cts +10 -1
- package/lib/execution-refs.d.ts +10 -1
- package/lib/execution-refs.js +1 -1
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/server-runtime/index.cjs +4 -4
- package/lib/server-runtime/index.d.cts +6 -4
- package/lib/server-runtime/index.d.ts +6 -4
- package/lib/server-runtime/index.js +4 -4
- package/lib/step-machine-public/index.cjs +3 -3
- package/lib/step-machine-public/index.d.cts +1 -1
- package/lib/step-machine-public/index.d.ts +1 -1
- package/lib/step-machine-public/index.js +3 -3
- package/lib/{storage-interface-B6ecOulj.d.ts → storage-interface-B-7pDHwD.d.cts} +36 -1
- package/lib/{storage-interface-B6ecOulj.d.cts → storage-interface-B-7pDHwD.d.ts} +36 -1
- package/lib/stores/index.d.cts +1 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/kv.d.cts +1 -1
- package/lib/stores/kv.d.ts +1 -1
- package/lib/{types-D-xVWPdY.d.ts → types-Cn0b8G-i.d.ts} +16 -65
- package/lib/{types-Bztd1KoK.d.cts → types-Dszjwfud.d.cts} +16 -65
- package/package.json +8 -2
- package/examples/board/.board-ws/cards/store/_index.json +0 -17
- package/examples/board/.board-ws/cards/store/card-market-prices.json +0 -80
- package/examples/board/.board-ws/cards/store/card-portfolio-value.json +0 -90
- package/examples/board/.board-ws/cards/store/card-portfolio.json +0 -78
- package/examples/board/server/chat-flow/chat-clear-processing.js +0 -41
- package/examples/board/server/chat-flow/chat-open-turn.js +0 -144
- package/examples/board/server/chat-flow/chat-write-assistant.js +0 -44
- package/examples/board/server/chat-flow/echo-probe/assistant.js +0 -28
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { J as JournalStorage, K as KVStorage } from './storage-interface-B-7pDHwD.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* chat-storage-lib.ts
|
|
5
|
+
*
|
|
6
|
+
* ChatStorage interface + factories backed by JournalStorage (history) and
|
|
7
|
+
* KVStorage (processing state and config).
|
|
8
|
+
*
|
|
9
|
+
* Platform-free — no node:fs or node:crypto imports.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface ChatRecord {
|
|
13
|
+
/** Journal entry id — also used as SSE cursor. */
|
|
14
|
+
id: string;
|
|
15
|
+
role: string;
|
|
16
|
+
text: string;
|
|
17
|
+
files: unknown[];
|
|
18
|
+
updated_at: string;
|
|
19
|
+
}
|
|
20
|
+
interface ChatConfig {
|
|
21
|
+
systemPrompt?: string;
|
|
22
|
+
}
|
|
23
|
+
interface ChatReadAfterResult {
|
|
24
|
+
records: ChatRecord[];
|
|
25
|
+
/** Pass as cursor on the next call. Null when the journal is empty. */
|
|
26
|
+
cursor: string | null;
|
|
27
|
+
}
|
|
28
|
+
interface ChatStorage {
|
|
29
|
+
/** Append a message; returns the new entry id (usable as a cursor). */
|
|
30
|
+
append(cardId: string, role: string, text: string, files?: unknown[]): string;
|
|
31
|
+
/** Read all messages in insertion order. */
|
|
32
|
+
readAll(cardId: string): ChatRecord[];
|
|
33
|
+
/**
|
|
34
|
+
* Read messages appended after cursor.
|
|
35
|
+
* Pass null to read from the beginning.
|
|
36
|
+
*/
|
|
37
|
+
readAfter(cardId: string, cursor: string | null): ChatReadAfterResult;
|
|
38
|
+
/** Remove all messages for this card. */
|
|
39
|
+
clear(cardId: string): void;
|
|
40
|
+
setProcessing(cardId: string, active: boolean): void;
|
|
41
|
+
isProcessing(cardId: string): boolean;
|
|
42
|
+
getConfig(cardId: string): ChatConfig;
|
|
43
|
+
setConfig(cardId: string, patch: Partial<ChatConfig>): void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a ChatStorage backed by:
|
|
47
|
+
* - journalFactory(cardId) → JournalStorage (one per-card journal for history)
|
|
48
|
+
* - kv → KVStorage (shared processing flags + config)
|
|
49
|
+
*/
|
|
50
|
+
declare function createChatStorage(journalFactory: (cardId: string) => JournalStorage, kv: KVStorage): ChatStorage;
|
|
51
|
+
declare function createInMemoryChatStorage(): ChatStorage;
|
|
52
|
+
|
|
53
|
+
export { type ChatRecord as C, type ChatReadAfterResult as a, type ChatConfig as b, type ChatStorage as c, createChatStorage as d, createInMemoryChatStorage as e };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function f(d){function o(r){return {status:"success",data:r}}function a(r){return {status:"fail",error:r}}function m(r){return {status:"error",error:r instanceof Error?r.message:String(r)}}function i(r,t="command envelope"){let n=typeof r.cardId=="string"?r.cardId:void 0;if(!r.command)return a(`chat-store: ${t} missing "command"`);if(!n)return a(`chat-store: ${t} missing "cardId"`);if(r.command==="append")return s.append({params:{cardId:n},body:{role:r.role,text:r.text,files:r.files}});if(r.command==="read-all")return s.readAll({params:{cardId:n}});if(r.command==="read-after")return s.readAfter({params:{cardId:n},body:{cursor:r.cursor??null}});if(r.command==="clear")return s.clear({params:{cardId:n}});if(r.command==="set-processing")return s.setProcessing({params:{cardId:n},body:{active:r.active}});if(r.command==="is-processing")return s.isProcessing({params:{cardId:n}});if(r.command==="get-config")return s.getConfig({params:{cardId:n}});if(r.command==="set-config"){let{command:e,cardId:u,...c}=r;return s.setConfig({params:{cardId:n},body:c})}return a(`chat-store: unknown command "${String(r.command)}"`)}function C(r){if(!Array.isArray(r.commands)||r.commands.length===0)return a('chat-store: command envelope must include a non-empty "commands" array');let t=[];for(let n=0;n<r.commands.length;n+=1){let e=r.commands[n];if(!e||typeof e!="object"||Array.isArray(e))return a(`chat-store: command envelope entry ${n} must be an object`);let u={cardId:r.cardId,...e},c=i(u,`command envelope entry ${n}`);if(c.status!=="success")return c;t.push({index:n,command:String(u.command),data:c.data});}return o({results:t})}let s={append(r){try{let t=r.params?.cardId;if(!t)return a("append requires params.cardId");let n=r.body??{},e=typeof n.role=="string"?n.role:"",u=typeof n.text=="string"?n.text:"",c=Array.isArray(n.files)?n.files:[];if(!e)return a("append requires body.role");let l=d.append(t,e,u,c);return o({id:l})}catch(t){return m(t)}},readAll(r){try{let t=r.params?.cardId;return t?o({records:d.readAll(t)}):a("readAll requires params.cardId")}catch(t){return m(t)}},readAfter(r){try{let t=r.params?.cardId;if(!t)return a("readAfter requires params.cardId");let e=(r.body??{}).cursor??null;return o(d.readAfter(t,e))}catch(t){return m(t)}},clear(r){try{let t=r.params?.cardId;return t?(d.clear(t),o({ok:!0})):a("clear requires params.cardId")}catch(t){return m(t)}},setProcessing(r){try{let t=r.params?.cardId;if(!t)return a("setProcessing requires params.cardId");let n=r.body??{};return typeof n.active!="boolean"?a("setProcessing requires body.active (boolean)"):(d.setProcessing(t,n.active),o({ok:!0}))}catch(t){return m(t)}},isProcessing(r){try{let t=r.params?.cardId;return t?o({active:d.isProcessing(t)}):a("isProcessing requires params.cardId")}catch(t){return m(t)}},getConfig(r){try{let t=r.params?.cardId;return t?o({config:d.getConfig(t)}):a("getConfig requires params.cardId")}catch(t){return m(t)}},setConfig(r){try{let t=r.params?.cardId;if(!t)return a("setConfig requires params.cardId");let n=r.body??{};return d.setConfig(t,n),o({ok:!0})}catch(t){return m(t)}},run:i,runBatch:C};return s}exports.createChatStorePublic=f;//# sourceMappingURL=chat-store-public.cjs.map
|
|
2
|
+
//# sourceMappingURL=chat-store-public.cjs.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { C as CommandInput, a as CommandResult } from './board-live-cards-public-BM6jCEIa.cjs';
|
|
2
|
+
import { C as ChatRecord, a as ChatReadAfterResult, b as ChatConfig, c as ChatStorage } from './chat-storage-lib-OX0Q_Ttf.cjs';
|
|
3
|
+
import './storage-interface-B-7pDHwD.cjs';
|
|
4
|
+
import './execution-refs.cjs';
|
|
5
|
+
import './types-BBhqYGhE.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* chat-store-lib-public.ts
|
|
9
|
+
*
|
|
10
|
+
* Platform-free public API for ChatStorage operations.
|
|
11
|
+
*
|
|
12
|
+
* Follows the same CommandInput / CommandResult convention as
|
|
13
|
+
* card-store-lib-public.ts and artifacts-store-lib-public.ts.
|
|
14
|
+
* No platform code here — inject a ChatStorage built from your platform adapter.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* import { createChatStorePublic } from './chat-store-lib-public.js';
|
|
18
|
+
* import { createFsBoardChatStorage } from '../node/fs-board-adapter.js';
|
|
19
|
+
*
|
|
20
|
+
* const store = createChatStorePublic(createFsBoardChatStorage(boardDir));
|
|
21
|
+
* const result = store.append({ params: { cardId: 'c1' }, body: { role: 'user', text: 'hello' } });
|
|
22
|
+
* const result = store.readAll({ params: { cardId: 'c1' } });
|
|
23
|
+
* const result = store.readAfter({ params: { cardId: 'c1', cursor: '<id>' } });
|
|
24
|
+
* const result = store.clear({ params: { cardId: 'c1' } });
|
|
25
|
+
* const result = store.setProcessing({ params: { cardId: 'c1' }, body: { active: true } });
|
|
26
|
+
* const result = store.isProcessing({ params: { cardId: 'c1' } });
|
|
27
|
+
* const result = store.getConfig({ params: { cardId: 'c1' } });
|
|
28
|
+
* const result = store.setConfig({ params: { cardId: 'c1' }, body: { systemPrompt: '...' } });
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
type ChatStoreCommandName = 'append' | 'read-all' | 'read-after' | 'clear' | 'set-processing' | 'is-processing' | 'get-config' | 'set-config';
|
|
32
|
+
type ChatStoreCommandEnvelope = {
|
|
33
|
+
command: ChatStoreCommandName;
|
|
34
|
+
cardId?: string;
|
|
35
|
+
role?: unknown;
|
|
36
|
+
text?: unknown;
|
|
37
|
+
files?: unknown;
|
|
38
|
+
cursor?: unknown;
|
|
39
|
+
active?: unknown;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
type ChatStoreCommandBatchEnvelope = {
|
|
43
|
+
cardId?: string;
|
|
44
|
+
commands: ChatStoreCommandEnvelope[];
|
|
45
|
+
};
|
|
46
|
+
type ChatStoreBatchResult = {
|
|
47
|
+
results: Array<{
|
|
48
|
+
index: number;
|
|
49
|
+
command: string;
|
|
50
|
+
data?: unknown;
|
|
51
|
+
}>;
|
|
52
|
+
};
|
|
53
|
+
interface ChatStorePublic {
|
|
54
|
+
/**
|
|
55
|
+
* Append a message to a card's chat history.
|
|
56
|
+
* params.cardId: string
|
|
57
|
+
* body.role: string
|
|
58
|
+
* body.text: string
|
|
59
|
+
* body.files?: unknown[]
|
|
60
|
+
*/
|
|
61
|
+
append(input: CommandInput): CommandResult<{
|
|
62
|
+
id: string;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Read all messages for a card in insertion order.
|
|
66
|
+
* params.cardId: string
|
|
67
|
+
*/
|
|
68
|
+
readAll(input: CommandInput): CommandResult<{
|
|
69
|
+
records: ChatRecord[];
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Read messages appended after a cursor.
|
|
73
|
+
* params.cardId: string
|
|
74
|
+
* params.cursor?: string | null (omit or null to read from the beginning)
|
|
75
|
+
*/
|
|
76
|
+
readAfter(input: CommandInput): CommandResult<ChatReadAfterResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Remove all messages for a card.
|
|
79
|
+
* params.cardId: string
|
|
80
|
+
*/
|
|
81
|
+
clear(input: CommandInput): CommandResult<{
|
|
82
|
+
ok: true;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Set or clear the processing flag for a card.
|
|
86
|
+
* params.cardId: string
|
|
87
|
+
* body.active: boolean
|
|
88
|
+
*/
|
|
89
|
+
setProcessing(input: CommandInput): CommandResult<{
|
|
90
|
+
ok: true;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Check whether a card is currently processing.
|
|
94
|
+
* params.cardId: string
|
|
95
|
+
*/
|
|
96
|
+
isProcessing(input: CommandInput): CommandResult<{
|
|
97
|
+
active: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Read the chat config for a card.
|
|
101
|
+
* params.cardId: string
|
|
102
|
+
*/
|
|
103
|
+
getConfig(input: CommandInput): CommandResult<{
|
|
104
|
+
config: ChatConfig;
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Patch (merge) the chat config for a card.
|
|
108
|
+
* params.cardId: string
|
|
109
|
+
* body: Partial<ChatConfig> e.g. { systemPrompt: '...' }
|
|
110
|
+
*/
|
|
111
|
+
setConfig(input: CommandInput): CommandResult<{
|
|
112
|
+
ok: true;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* Run a single command envelope against this store instance.
|
|
116
|
+
* The store is already bound to a backing adapter, so boardDir is not part
|
|
117
|
+
* of the public contract here.
|
|
118
|
+
*/
|
|
119
|
+
run(envelope: ChatStoreCommandEnvelope, label?: string): CommandResult<unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* Run a sequence of command envelopes with optional top-level cardId default.
|
|
122
|
+
* Stops on first non-success result and returns that failure/error.
|
|
123
|
+
*/
|
|
124
|
+
runBatch(envelope: ChatStoreCommandBatchEnvelope): CommandResult<ChatStoreBatchResult>;
|
|
125
|
+
}
|
|
126
|
+
declare function createChatStorePublic(store: ChatStorage): ChatStorePublic;
|
|
127
|
+
|
|
128
|
+
export { type ChatStoreBatchResult, type ChatStoreCommandBatchEnvelope, type ChatStoreCommandEnvelope, type ChatStoreCommandName, type ChatStorePublic, createChatStorePublic };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { C as CommandInput, a as CommandResult } from './board-live-cards-public-Bz07XKRK.js';
|
|
2
|
+
import { C as ChatRecord, a as ChatReadAfterResult, b as ChatConfig, c as ChatStorage } from './chat-storage-lib-DGaKrjVe.js';
|
|
3
|
+
import './storage-interface-B-7pDHwD.js';
|
|
4
|
+
import './execution-refs.js';
|
|
5
|
+
import './types-BBhqYGhE.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* chat-store-lib-public.ts
|
|
9
|
+
*
|
|
10
|
+
* Platform-free public API for ChatStorage operations.
|
|
11
|
+
*
|
|
12
|
+
* Follows the same CommandInput / CommandResult convention as
|
|
13
|
+
* card-store-lib-public.ts and artifacts-store-lib-public.ts.
|
|
14
|
+
* No platform code here — inject a ChatStorage built from your platform adapter.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* import { createChatStorePublic } from './chat-store-lib-public.js';
|
|
18
|
+
* import { createFsBoardChatStorage } from '../node/fs-board-adapter.js';
|
|
19
|
+
*
|
|
20
|
+
* const store = createChatStorePublic(createFsBoardChatStorage(boardDir));
|
|
21
|
+
* const result = store.append({ params: { cardId: 'c1' }, body: { role: 'user', text: 'hello' } });
|
|
22
|
+
* const result = store.readAll({ params: { cardId: 'c1' } });
|
|
23
|
+
* const result = store.readAfter({ params: { cardId: 'c1', cursor: '<id>' } });
|
|
24
|
+
* const result = store.clear({ params: { cardId: 'c1' } });
|
|
25
|
+
* const result = store.setProcessing({ params: { cardId: 'c1' }, body: { active: true } });
|
|
26
|
+
* const result = store.isProcessing({ params: { cardId: 'c1' } });
|
|
27
|
+
* const result = store.getConfig({ params: { cardId: 'c1' } });
|
|
28
|
+
* const result = store.setConfig({ params: { cardId: 'c1' }, body: { systemPrompt: '...' } });
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
type ChatStoreCommandName = 'append' | 'read-all' | 'read-after' | 'clear' | 'set-processing' | 'is-processing' | 'get-config' | 'set-config';
|
|
32
|
+
type ChatStoreCommandEnvelope = {
|
|
33
|
+
command: ChatStoreCommandName;
|
|
34
|
+
cardId?: string;
|
|
35
|
+
role?: unknown;
|
|
36
|
+
text?: unknown;
|
|
37
|
+
files?: unknown;
|
|
38
|
+
cursor?: unknown;
|
|
39
|
+
active?: unknown;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
type ChatStoreCommandBatchEnvelope = {
|
|
43
|
+
cardId?: string;
|
|
44
|
+
commands: ChatStoreCommandEnvelope[];
|
|
45
|
+
};
|
|
46
|
+
type ChatStoreBatchResult = {
|
|
47
|
+
results: Array<{
|
|
48
|
+
index: number;
|
|
49
|
+
command: string;
|
|
50
|
+
data?: unknown;
|
|
51
|
+
}>;
|
|
52
|
+
};
|
|
53
|
+
interface ChatStorePublic {
|
|
54
|
+
/**
|
|
55
|
+
* Append a message to a card's chat history.
|
|
56
|
+
* params.cardId: string
|
|
57
|
+
* body.role: string
|
|
58
|
+
* body.text: string
|
|
59
|
+
* body.files?: unknown[]
|
|
60
|
+
*/
|
|
61
|
+
append(input: CommandInput): CommandResult<{
|
|
62
|
+
id: string;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Read all messages for a card in insertion order.
|
|
66
|
+
* params.cardId: string
|
|
67
|
+
*/
|
|
68
|
+
readAll(input: CommandInput): CommandResult<{
|
|
69
|
+
records: ChatRecord[];
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Read messages appended after a cursor.
|
|
73
|
+
* params.cardId: string
|
|
74
|
+
* params.cursor?: string | null (omit or null to read from the beginning)
|
|
75
|
+
*/
|
|
76
|
+
readAfter(input: CommandInput): CommandResult<ChatReadAfterResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Remove all messages for a card.
|
|
79
|
+
* params.cardId: string
|
|
80
|
+
*/
|
|
81
|
+
clear(input: CommandInput): CommandResult<{
|
|
82
|
+
ok: true;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Set or clear the processing flag for a card.
|
|
86
|
+
* params.cardId: string
|
|
87
|
+
* body.active: boolean
|
|
88
|
+
*/
|
|
89
|
+
setProcessing(input: CommandInput): CommandResult<{
|
|
90
|
+
ok: true;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Check whether a card is currently processing.
|
|
94
|
+
* params.cardId: string
|
|
95
|
+
*/
|
|
96
|
+
isProcessing(input: CommandInput): CommandResult<{
|
|
97
|
+
active: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Read the chat config for a card.
|
|
101
|
+
* params.cardId: string
|
|
102
|
+
*/
|
|
103
|
+
getConfig(input: CommandInput): CommandResult<{
|
|
104
|
+
config: ChatConfig;
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Patch (merge) the chat config for a card.
|
|
108
|
+
* params.cardId: string
|
|
109
|
+
* body: Partial<ChatConfig> e.g. { systemPrompt: '...' }
|
|
110
|
+
*/
|
|
111
|
+
setConfig(input: CommandInput): CommandResult<{
|
|
112
|
+
ok: true;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* Run a single command envelope against this store instance.
|
|
116
|
+
* The store is already bound to a backing adapter, so boardDir is not part
|
|
117
|
+
* of the public contract here.
|
|
118
|
+
*/
|
|
119
|
+
run(envelope: ChatStoreCommandEnvelope, label?: string): CommandResult<unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* Run a sequence of command envelopes with optional top-level cardId default.
|
|
122
|
+
* Stops on first non-success result and returns that failure/error.
|
|
123
|
+
*/
|
|
124
|
+
runBatch(envelope: ChatStoreCommandBatchEnvelope): CommandResult<ChatStoreBatchResult>;
|
|
125
|
+
}
|
|
126
|
+
declare function createChatStorePublic(store: ChatStorage): ChatStorePublic;
|
|
127
|
+
|
|
128
|
+
export { type ChatStoreBatchResult, type ChatStoreCommandBatchEnvelope, type ChatStoreCommandEnvelope, type ChatStoreCommandName, type ChatStorePublic, createChatStorePublic };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function f(d){function o(r){return {status:"success",data:r}}function a(r){return {status:"fail",error:r}}function m(r){return {status:"error",error:r instanceof Error?r.message:String(r)}}function i(r,t="command envelope"){let n=typeof r.cardId=="string"?r.cardId:void 0;if(!r.command)return a(`chat-store: ${t} missing "command"`);if(!n)return a(`chat-store: ${t} missing "cardId"`);if(r.command==="append")return s.append({params:{cardId:n},body:{role:r.role,text:r.text,files:r.files}});if(r.command==="read-all")return s.readAll({params:{cardId:n}});if(r.command==="read-after")return s.readAfter({params:{cardId:n},body:{cursor:r.cursor??null}});if(r.command==="clear")return s.clear({params:{cardId:n}});if(r.command==="set-processing")return s.setProcessing({params:{cardId:n},body:{active:r.active}});if(r.command==="is-processing")return s.isProcessing({params:{cardId:n}});if(r.command==="get-config")return s.getConfig({params:{cardId:n}});if(r.command==="set-config"){let{command:e,cardId:u,...c}=r;return s.setConfig({params:{cardId:n},body:c})}return a(`chat-store: unknown command "${String(r.command)}"`)}function C(r){if(!Array.isArray(r.commands)||r.commands.length===0)return a('chat-store: command envelope must include a non-empty "commands" array');let t=[];for(let n=0;n<r.commands.length;n+=1){let e=r.commands[n];if(!e||typeof e!="object"||Array.isArray(e))return a(`chat-store: command envelope entry ${n} must be an object`);let u={cardId:r.cardId,...e},c=i(u,`command envelope entry ${n}`);if(c.status!=="success")return c;t.push({index:n,command:String(u.command),data:c.data});}return o({results:t})}let s={append(r){try{let t=r.params?.cardId;if(!t)return a("append requires params.cardId");let n=r.body??{},e=typeof n.role=="string"?n.role:"",u=typeof n.text=="string"?n.text:"",c=Array.isArray(n.files)?n.files:[];if(!e)return a("append requires body.role");let l=d.append(t,e,u,c);return o({id:l})}catch(t){return m(t)}},readAll(r){try{let t=r.params?.cardId;return t?o({records:d.readAll(t)}):a("readAll requires params.cardId")}catch(t){return m(t)}},readAfter(r){try{let t=r.params?.cardId;if(!t)return a("readAfter requires params.cardId");let e=(r.body??{}).cursor??null;return o(d.readAfter(t,e))}catch(t){return m(t)}},clear(r){try{let t=r.params?.cardId;return t?(d.clear(t),o({ok:!0})):a("clear requires params.cardId")}catch(t){return m(t)}},setProcessing(r){try{let t=r.params?.cardId;if(!t)return a("setProcessing requires params.cardId");let n=r.body??{};return typeof n.active!="boolean"?a("setProcessing requires body.active (boolean)"):(d.setProcessing(t,n.active),o({ok:!0}))}catch(t){return m(t)}},isProcessing(r){try{let t=r.params?.cardId;return t?o({active:d.isProcessing(t)}):a("isProcessing requires params.cardId")}catch(t){return m(t)}},getConfig(r){try{let t=r.params?.cardId;return t?o({config:d.getConfig(t)}):a("getConfig requires params.cardId")}catch(t){return m(t)}},setConfig(r){try{let t=r.params?.cardId;if(!t)return a("setConfig requires params.cardId");let n=r.body??{};return d.setConfig(t,n),o({ok:!0})}catch(t){return m(t)}},run:i,runBatch:C};return s}export{f as createChatStorePublic};//# sourceMappingURL=chat-store-public.js.map
|
|
2
|
+
//# sourceMappingURL=chat-store-public.js.map
|
package/lib/execution-refs.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var s="b64:";function l(e){let
|
|
1
|
+
'use strict';var s="b64:";function l(e){let t=new TextEncoder().encode(e),r=globalThis.Buffer,n;if(r)n=r.from(t).toString("base64");else if(typeof btoa=="function"){let o="";for(let a of t)o+=String.fromCharCode(a);n=btoa(o);}else throw new Error("No base64 encoder available in this runtime");return n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function i(e){return `${s}${l(JSON.stringify(e))}`}function c(e,t){let r;return /\.m?js$/i.test(e)?r="local-node":/\.py$/i.test(e)?r="local-python":r="local-process",{meta:"task-executor",howToRun:r,whatToRun:i({kind:"fs-path",value:e}),...t?{extra:t}:{}}}function f(e){return JSON.stringify(e)}function d(e){let t;try{t=JSON.parse(e);}catch{throw new Error(`parseExecutionRef: invalid JSON \u2014 ${e}`)}if(typeof t!="object"||t===null||typeof t.howToRun!="string"||typeof t.whatToRun!="string")throw new Error(`parseExecutionRef: missing required fields howToRun/whatToRun \u2014 ${e}`);return t}
|
|
2
2
|
exports.executionRefFromScriptPath=c;exports.parseExecutionRef=d;exports.serializeExecutionRef=f;//# sourceMappingURL=execution-refs.cjs.map
|
|
3
3
|
//# sourceMappingURL=execution-refs.cjs.map
|
package/lib/execution-refs.d.cts
CHANGED
|
@@ -77,6 +77,13 @@
|
|
|
77
77
|
* whatToRun: 'b64:<base64url({"kind":"fs-path","value":"/path/to/my-executor.js"})>',
|
|
78
78
|
* };
|
|
79
79
|
*
|
|
80
|
+
* // Packaged yaml-flow CLI entrypoint resolved by the Node adapter:
|
|
81
|
+
* const yamlFlowCli: ExecutionRef = {
|
|
82
|
+
* meta: 'chat-handler',
|
|
83
|
+
* howToRun: 'local-node',
|
|
84
|
+
* whatToRun: 'b64:<base64url({"kind":"yaml-flow-cli","value":"chat-store-cli.js"})>',
|
|
85
|
+
* };
|
|
86
|
+
*
|
|
80
87
|
* // Azure Function task executor with custom arg mapping:
|
|
81
88
|
* const azureFn: ExecutionRef = {
|
|
82
89
|
* meta: 'task-executor',
|
|
@@ -204,7 +211,9 @@ interface ExecutionRef {
|
|
|
204
211
|
* Address of the artifact to run. Two valid forms:
|
|
205
212
|
* - string: must be KindValueRef wire form `b64:<base64url(json)>` (programmatically generated via serializeRef)
|
|
206
213
|
* - object: `{ kind: string; value: string }` plain object (human-authored flow files — normalized by the handler factory)
|
|
207
|
-
*
|
|
214
|
+
* Prefer `kind: 'yaml-flow-cli'` when targeting a packaged public yaml-flow CLI entrypoint.
|
|
215
|
+
* Use `kind: 'fs-path'` for external scripts or non-packaged local executables.
|
|
216
|
+
* @example 'b64:<base64url({"kind":"yaml-flow-cli","value":"chat-store-cli.js"})>'
|
|
208
217
|
* @example { kind: 'http-url', value: '/api/workiq/ask' }
|
|
209
218
|
* @example { kind: 'fs-path', value: './my-handler.js' }
|
|
210
219
|
*/
|
package/lib/execution-refs.d.ts
CHANGED
|
@@ -77,6 +77,13 @@
|
|
|
77
77
|
* whatToRun: 'b64:<base64url({"kind":"fs-path","value":"/path/to/my-executor.js"})>',
|
|
78
78
|
* };
|
|
79
79
|
*
|
|
80
|
+
* // Packaged yaml-flow CLI entrypoint resolved by the Node adapter:
|
|
81
|
+
* const yamlFlowCli: ExecutionRef = {
|
|
82
|
+
* meta: 'chat-handler',
|
|
83
|
+
* howToRun: 'local-node',
|
|
84
|
+
* whatToRun: 'b64:<base64url({"kind":"yaml-flow-cli","value":"chat-store-cli.js"})>',
|
|
85
|
+
* };
|
|
86
|
+
*
|
|
80
87
|
* // Azure Function task executor with custom arg mapping:
|
|
81
88
|
* const azureFn: ExecutionRef = {
|
|
82
89
|
* meta: 'task-executor',
|
|
@@ -204,7 +211,9 @@ interface ExecutionRef {
|
|
|
204
211
|
* Address of the artifact to run. Two valid forms:
|
|
205
212
|
* - string: must be KindValueRef wire form `b64:<base64url(json)>` (programmatically generated via serializeRef)
|
|
206
213
|
* - object: `{ kind: string; value: string }` plain object (human-authored flow files — normalized by the handler factory)
|
|
207
|
-
*
|
|
214
|
+
* Prefer `kind: 'yaml-flow-cli'` when targeting a packaged public yaml-flow CLI entrypoint.
|
|
215
|
+
* Use `kind: 'fs-path'` for external scripts or non-packaged local executables.
|
|
216
|
+
* @example 'b64:<base64url({"kind":"yaml-flow-cli","value":"chat-store-cli.js"})>'
|
|
208
217
|
* @example { kind: 'http-url', value: '/api/workiq/ask' }
|
|
209
218
|
* @example { kind: 'fs-path', value: './my-handler.js' }
|
|
210
219
|
*/
|
package/lib/execution-refs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var s="b64:";function l(e){let
|
|
1
|
+
var s="b64:";function l(e){let t=new TextEncoder().encode(e),r=globalThis.Buffer,n;if(r)n=r.from(t).toString("base64");else if(typeof btoa=="function"){let o="";for(let a of t)o+=String.fromCharCode(a);n=btoa(o);}else throw new Error("No base64 encoder available in this runtime");return n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function i(e){return `${s}${l(JSON.stringify(e))}`}function c(e,t){let r;return /\.m?js$/i.test(e)?r="local-node":/\.py$/i.test(e)?r="local-python":r="local-process",{meta:"task-executor",howToRun:r,whatToRun:i({kind:"fs-path",value:e}),...t?{extra:t}:{}}}function f(e){return JSON.stringify(e)}function d(e){let t;try{t=JSON.parse(e);}catch{throw new Error(`parseExecutionRef: invalid JSON \u2014 ${e}`)}if(typeof t!="object"||t===null||typeof t.howToRun!="string"||typeof t.whatToRun!="string")throw new Error(`parseExecutionRef: missing required fields howToRun/whatToRun \u2014 ${e}`);return t}
|
|
2
2
|
export{c as executionRefFromScriptPath,d as parseExecutionRef,f as serializeExecutionRef};//# sourceMappingURL=execution-refs.js.map
|
|
3
3
|
//# sourceMappingURL=execution-refs.js.map
|
package/lib/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ export { CommandSpec, GraphMutation, Journal, MemoryJournal, ProcessHandlerOptio
|
|
|
12
12
|
export { B as BlockedTask, D as DownstreamResult, L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, d as LiveGraph, e as LiveGraphHealth, f as LiveGraphSnapshot, N as NodeInfo, P as PendingTask, R as ReactiveGraph, g as ReactiveGraphOptions, S as ScheduleResult, T as TaskHandlerFn, h as TaskHandlerInput, i as TaskHandlerReturn, U as UnreachableNodesResult, j as UnreachableTokensResult, k as UnresolvedDependency, l as UpstreamResult, m as createReactiveGraph, n as liveCardsToReactiveGraph, s as schedule } from './live-cards-bridge-b25aAVvE.cjs';
|
|
13
13
|
export { BoardLiveGraphRuntime, BoardLiveGraphRuntimeOptions, BoardLiveGraphRuntimeUpdate, BoardRuntimeView, BoardTaskExecutor, BoardTaskExecutorContext, BrowserSourceAdapter, BrowserSourceAdapterContext, LiveCardRuntimeModel, createBoardLiveGraphRuntime } from './board-livegraph-runtime/index.cjs';
|
|
14
14
|
export { CardCompute, ComputeNode, ComputeStep, ValidationResult, validateLiveCard, validateLiveCardDefinition, validateLiveCardRuntimeExpressions, validateLiveCardSchema } from './card-compute/index.cjs';
|
|
15
|
-
import './storage-interface-
|
|
15
|
+
import './storage-interface-B-7pDHwD.cjs';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* schema-validator — Full JSON Schema validation for published runtime artifacts.
|
package/lib/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { CommandSpec, GraphMutation, Journal, MemoryJournal, ProcessHandlerOptio
|
|
|
12
12
|
export { B as BlockedTask, D as DownstreamResult, L as LiveBoard, a as LiveCard, b as LiveCardsToReactiveOptions, c as LiveCardsToReactiveResult, d as LiveGraph, e as LiveGraphHealth, f as LiveGraphSnapshot, N as NodeInfo, P as PendingTask, R as ReactiveGraph, g as ReactiveGraphOptions, S as ScheduleResult, T as TaskHandlerFn, h as TaskHandlerInput, i as TaskHandlerReturn, U as UnreachableNodesResult, j as UnreachableTokensResult, k as UnresolvedDependency, l as UpstreamResult, m as createReactiveGraph, n as liveCardsToReactiveGraph, s as schedule } from './live-cards-bridge-DC_ZU0eS.js';
|
|
13
13
|
export { BoardLiveGraphRuntime, BoardLiveGraphRuntimeOptions, BoardLiveGraphRuntimeUpdate, BoardRuntimeView, BoardTaskExecutor, BoardTaskExecutorContext, BrowserSourceAdapter, BrowserSourceAdapterContext, LiveCardRuntimeModel, createBoardLiveGraphRuntime } from './board-livegraph-runtime/index.js';
|
|
14
14
|
export { CardCompute, ComputeNode, ComputeStep, ValidationResult, validateLiveCard, validateLiveCardDefinition, validateLiveCardRuntimeExpressions, validateLiveCardSchema } from './card-compute/index.js';
|
|
15
|
-
import './storage-interface-
|
|
15
|
+
import './storage-interface-B-7pDHwD.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* schema-validator — Full JSON Schema validation for published runtime artifacts.
|