@byok-sdk/bot-collaboration 0.43.0 → 0.44.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 +84 -73
- package/dist/chunk-6X7ARUDF.js +9 -0
- package/dist/chunk-6X7ARUDF.js.map +1 -0
- package/dist/chunk-BGGEZHPC.js +27 -0
- package/dist/chunk-BGGEZHPC.js.map +1 -0
- package/dist/chunk-UXEHG75I.js +11 -0
- package/dist/chunk-UXEHG75I.js.map +1 -0
- package/dist/commit.d.ts +0 -13
- package/dist/compaction.d.ts +9 -2
- package/dist/delivery-routing.d.ts +1 -1
- package/dist/delivery-superseded.d.ts +3 -0
- package/dist/delivery.d.ts +1 -1
- package/dist/dream.d.ts +18 -4
- package/dist/host-kit.d.ts +5 -6
- package/dist/host-kit.js +4 -5
- package/dist/host-kit.js.map +1 -1
- package/dist/host.d.ts +11 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/dist/ledger-compatibility.d.ts +4 -0
- package/dist/migration.d.ts +1 -1
- package/dist/model.d.ts +5 -9
- package/dist/routines.d.ts +0 -6
- package/dist/rules/autonomy.d.ts +1 -4
- package/dist/rules/index.js +1 -2
- package/dist/rules/priority.d.ts +2 -0
- package/dist/rules/sync.d.ts +6 -0
- package/dist/switch.d.ts +2 -30
- package/dist/testing.js +3 -3
- package/dist/testing.js.map +1 -1
- package/package.json +6 -6
- package/dist/chunk-33YA66U7.js +0 -7
- package/dist/chunk-33YA66U7.js.map +0 -1
- package/dist/chunk-6Y2B2XCP.js +0 -12
- package/dist/chunk-6Y2B2XCP.js.map +0 -1
- package/dist/chunk-QZRWFFHM.js +0 -12
- package/dist/chunk-QZRWFFHM.js.map +0 -1
- package/dist/chunk-ZX6C5U2S.js +0 -27
- package/dist/chunk-ZX6C5U2S.js.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HostLedger } from '@byok-sdk/server/execution-core';
|
|
2
|
+
import { type AutonomyState } from './rules/autonomy.js';
|
|
3
|
+
export declare function checkLedgerWouldDo(ledger: Pick<HostLedger, 'transaction'>, state: AutonomyState): void;
|
|
4
|
+
export declare function admitLedgerWouldDo(ledger: Pick<HostLedger, 'transaction'>, state: AutonomyState): void;
|
package/dist/migration.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ import type { CollaborationState } from './model.js';
|
|
|
39
39
|
* does not record whether a pending projection was sent (H does: it raises `tries` before the send), so the source
|
|
40
40
|
* flushes its projections before the export.
|
|
41
41
|
*/
|
|
42
|
-
export declare const SWITCH_EXPORT_VERSION =
|
|
42
|
+
export declare const SWITCH_EXPORT_VERSION = 2;
|
|
43
43
|
export declare const SWITCH_SECTIONS: readonly ['collaboration', 'archived', 'intents', 'routines', 'occurrences', 'outbox', 'tombstones'];
|
|
44
44
|
export type SwitchSection = typeof SWITCH_SECTIONS[number];
|
|
45
45
|
/** A device of the domain and its revision on the source Host, frozen by the source's open switch. */
|
package/dist/model.d.ts
CHANGED
|
@@ -16,11 +16,12 @@ export { addBatchTurns, addTurn, json } from './rules/turn.js';
|
|
|
16
16
|
export type { Budget, Card, Question, Rejection, ReplyEntry, Turn, TurnFields, Verdict } from './rules/turn.js';
|
|
17
17
|
export type { AcceptedReply, Batch, Delegation, DelegationCancel, Unit } from './rules/delegation.js';
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* The K8 state. A Host ledger keeps it in its application body, and the ledger's `k8` format row (`botLedgerOptions`) is
|
|
20
|
+
* its format.
|
|
21
|
+
* Retention keeps settled rows in K4 application rows (#798). Bot routines are K4 routines with the `bot-routine`
|
|
22
|
+
* occurrence hook.
|
|
21
23
|
*/
|
|
22
24
|
export interface CollaborationState extends AutonomyState {
|
|
23
|
-
version: 3;
|
|
24
25
|
team: TeamState;
|
|
25
26
|
turns: Record<string, Turn>;
|
|
26
27
|
budgets: Record<string, Budget>;
|
|
@@ -80,10 +81,5 @@ export interface CollaborationState extends AutonomyState {
|
|
|
80
81
|
*/
|
|
81
82
|
dreams?: DreamState;
|
|
82
83
|
}
|
|
83
|
-
/**
|
|
84
|
-
export declare class OldCollaborationStateError extends Error {
|
|
85
|
-
readonly foundVersion: 1 | 2;
|
|
86
|
-
readonly code: 'collaboration_state_unsupported_old';
|
|
87
|
-
constructor(foundVersion: 1 | 2, message: string);
|
|
88
|
-
}
|
|
84
|
+
/** The K8 state of an application body, created empty at its first use. */
|
|
89
85
|
export declare function stateOf(application: Record<string, Json>): CollaborationState;
|
package/dist/routines.d.ts
CHANGED
|
@@ -78,12 +78,6 @@ export declare function owned(routines: readonly Routine[], owner: string, id: s
|
|
|
78
78
|
export declare function endable(routines: readonly Routine[], id: string): Routine;
|
|
79
79
|
/** The next version for `RoutineCommands.update`. It builds on `pending` when one is staged. */
|
|
80
80
|
export declare function updateDefinition(routines: readonly Routine[], owner: string, action: UpdateRoutineAction): HostOccurrenceRoutineDefinition;
|
|
81
|
-
/**
|
|
82
|
-
* The member side of a sealed Bot routine: the whole Turn instruction it seals. It is the K8 Bot Turn frame with every
|
|
83
|
-
* action and no ContextPack, because v1 has no plaintext field for Host content next to a sealed instruction. The Turn's
|
|
84
|
-
* frozen outcome schema stays the authority on which actions the Bot may take.
|
|
85
|
-
*/
|
|
86
|
-
export declare function sealedRoutineInstruction(prompt: string): string;
|
|
87
81
|
/**
|
|
88
82
|
* The definition of a new sealed routine. The member picks `routineId` (a fresh UUID), because the template binds it, and
|
|
89
83
|
* seals version 1. An id that any routine row already has is refused, whatever its lifecycle, except an exact retry: the
|
package/dist/rules/autonomy.d.ts
CHANGED
|
@@ -37,10 +37,7 @@ export declare function autonomyOf(bot: {
|
|
|
37
37
|
export declare function wouldDoId(taskId: string, action: WouldDoAction, index: number): string;
|
|
38
38
|
/** Records one would-do row. Returns the new row, or `undefined` when the same outcome already recorded it. */
|
|
39
39
|
export declare function recordWouldDo(state: AutonomyState, row: Omit<WouldDo, 'id'>): WouldDo | undefined;
|
|
40
|
-
/**
|
|
41
|
-
* Refuses a state that still holds a would-do row from before #1756, which has no `turnId`. Only the one-shot migration
|
|
42
|
-
* links such a row to its Turn, so a store that skipped it fails here instead of keeping the row forever.
|
|
43
|
-
*/
|
|
40
|
+
/** Refuse would-do rows written before turn identities were required. */
|
|
44
41
|
export declare function refuseUnmigratedWouldDo(state: AutonomyState): void;
|
|
45
42
|
/** The would-do rows of one Bot, or of every Bot, oldest first. A row of the same instant keeps a stable id order. */
|
|
46
43
|
export declare function wouldDoRows(state: AutonomyState, botId?: string): WouldDo[];
|
package/dist/rules/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { admitDeviceSlot, autonomousIntentIds, userFirst } from '../chunk-
|
|
2
|
-
export { COALESCE_DEFAULTS, CONNECTOR_OUTCOME_UNKNOWN, DEVICE_NOT_BOUND, DEVICE_SWITCHING, OFFER_WAIT_MS, addTurn, admitBotToolsets, advanceRoomSeats, cardCallDue, checkReply, coalescePolicy, collaborationDue, commandBots, commitCommand, compactVeto, delegationCancelAnswer, hostIntentCancelAnswer, hostMessageDisposition, inactive, observeDevices, replyCheckDue, reportCardDecisions, requireMain, seatTurn, settleCardCall, settleDelegations, syncTurn, turnCancelAnswer } from '../chunk-ZX6C5U2S.js';
|
|
1
|
+
export { COALESCE_DEFAULTS, CONNECTOR_OUTCOME_UNKNOWN, DEVICE_NOT_BOUND, DEVICE_SWITCHING, OFFER_WAIT_MS, addTurn, admitBotToolsets, admitDeviceSlot, advanceRoomSeats, autonomousIntentIds, cardCallDue, checkReply, coalescePolicy, collaborationDue, commandBots, commitCommand, compactVeto, delegationCancelAnswer, hostIntentCancelAnswer, hostMessageDisposition, inactive, observeDevices, replyCheckDue, reportCardDecisions, requireMain, seatTurn, settleCardCall, settleDelegations, syncTurn, turnCancelAnswer, userFirst } from '../chunk-BGGEZHPC.js';
|
|
3
2
|
//# sourceMappingURL=index.js.map
|
|
4
3
|
//# sourceMappingURL=index.js.map
|
package/dist/rules/priority.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Turn } from './turn.js';
|
|
2
|
+
/** Background work that user input goes ahead of: a routine Turn, or another Bot's request. */
|
|
3
|
+
export declare function isAutonomous(turn: Pick<Turn, 'source'>): boolean;
|
|
2
4
|
/** The background intents that user input overtakes; dream ids already use the ledger's hashed identity. */
|
|
3
5
|
export declare function autonomousIntentIds(turns: readonly Pick<Turn, 'id' | 'source'>[], dreams: readonly string[]): Set<string>;
|
|
4
6
|
/**
|
package/dist/rules/sync.d.ts
CHANGED
|
@@ -100,6 +100,12 @@ export interface SyncFacts extends Pick<IntentFacts, 'intent'> {
|
|
|
100
100
|
* A refusal holds that Bot's Turns that have no intent, and the rest of the scope syncs. Absent: no check.
|
|
101
101
|
*/
|
|
102
102
|
deviceRefusal?(botId: string): SyncRefusal | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* The `limits.maxDurationMs` of the offer of the Bot's submitted dream (#2334), or `undefined` when the Bot has none. A
|
|
105
|
+
* claimed dream is not interrupted, so a Turn that is not autonomous and freezes behind it waits that much longer.
|
|
106
|
+
* Absent: no Bot has a submitted dream.
|
|
107
|
+
*/
|
|
108
|
+
dreamHold?(botId: string): number | undefined;
|
|
103
109
|
}
|
|
104
110
|
export interface SyncOptions<R extends ContextRoutine> {
|
|
105
111
|
now: number;
|
package/dist/switch.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HostLedger, type LedgerDump } from '@byok-sdk/server/execution-core';
|
|
2
2
|
import { type CollaborationState } from './model.js';
|
|
3
|
-
import { type SwitchContent, type SwitchExport, type SwitchHeader
|
|
3
|
+
import { type SwitchContent, type SwitchExport, type SwitchHeader } from './migration.js';
|
|
4
4
|
/** The import record of a new L owner: from the load until the commit toward L. */
|
|
5
5
|
export interface SwitchImport {
|
|
6
6
|
digest: string;
|
|
@@ -9,10 +9,7 @@ export interface SwitchImport {
|
|
|
9
9
|
}
|
|
10
10
|
/** Throws while the domain has an export mark. Each L write calls it after its own refusals, so those come first. */
|
|
11
11
|
export declare function refuseExported(state: CollaborationState): void;
|
|
12
|
-
/**
|
|
13
|
-
* Throws while the ledger holds a switch import, which is not committed toward L yet: no K8 work runs on it. The switch
|
|
14
|
-
* steps `commitImport` and `discardImport` write it themselves.
|
|
15
|
-
*/
|
|
12
|
+
/** Refuse work on a ledger that still holds an uncommitted switch import. */
|
|
16
13
|
export declare function refuseImported(state: CollaborationState): void;
|
|
17
14
|
/**
|
|
18
15
|
* A restart reads the switch records before any write. A ledger with an import is not committed toward L yet, so no
|
|
@@ -24,30 +21,5 @@ export declare function checkSwitchRecords(state: CollaborationState): void;
|
|
|
24
21
|
* (#975 "Export builder must check"). `tenant` names the ledger (its `agent` keys); `header` is the document's.
|
|
25
22
|
*/
|
|
26
23
|
export declare function switchContent(dump: LedgerDump, tenant: string, header: SwitchHeader): SwitchContent;
|
|
27
|
-
/**
|
|
28
|
-
* Writes the neutral form into a K4 dump bound to `tenant`. The K8 owner records the target needs are passed in `owner`.
|
|
29
|
-
* A concluded row gets K4's values of a new row for its scheduler cursors (#975 D6): `phase: 'settled'`, `notBefore: 0`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function switchDump(content: SwitchContent, tenant: string, owner: Pick<CollaborationState, 'topology' | 'switchImport'>): LedgerDump;
|
|
32
24
|
/** Seals the content that a ledger holds now, under a given header. */
|
|
33
25
|
export declare function sealLedger(ledger: HostLedger, header: SwitchHeader): SwitchExport;
|
|
34
|
-
/**
|
|
35
|
-
* Step 2 of a switch to L (#975): writes an H export into an empty L ledger tenant and verifies it in the same transaction.
|
|
36
|
-
* The document must verify. Each of its devices is recorded as owned by H, with the import record, until `commitImport`.
|
|
37
|
-
* Before the load commits, K4 reads the tenant's rows back, and they must give the document's digest under its header;
|
|
38
|
-
* otherwise nothing is written. Returns the receipt the old owner commits away on. A `BotCollaboration` refuses a ledger
|
|
39
|
-
* with an import, so no work runs on it before the commit.
|
|
40
|
-
*/
|
|
41
|
-
export declare function importForSwitch(ledger: HostLedger, document: SwitchExport): SwitchReceipt;
|
|
42
|
-
/**
|
|
43
|
-
* Step 4 of a switch to L, after the old owner committed away on the receipt: L owns each device of the import. Only the
|
|
44
|
-
* import of this digest that is not being discarded commits. Then a `BotCollaboration` can open the ledger.
|
|
45
|
-
*/
|
|
46
|
-
export declare function commitImport(ledger: HostLedger, digest: string): void;
|
|
47
|
-
/**
|
|
48
|
-
* Deletes an import that was not committed, when the switch does not go ahead: the old owner aborts, or the product
|
|
49
|
-
* decides against it. It first records
|
|
50
|
-
* that the import is being discarded, so `commitImport` refuses it from then on, then deletes the tenant (K4 `discard`).
|
|
51
|
-
* A committed tenant has no import record, so it is refused; no `BotCollaboration` ran work on an uncommitted one.
|
|
52
|
-
*/
|
|
53
|
-
export declare function discardImport(ledger: HostLedger): void;
|