@byok-sdk/bot-collaboration 0.43.0 → 0.44.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/README.md CHANGED
@@ -13,7 +13,7 @@ Each symbol has one entry (#1845). K4 needs Node 24.22.1 or later, because its l
13
13
 
14
14
  | Entry | Contents | Loads where |
15
15
  | --- | --- | --- |
16
- | `.` | `BotCollaboration` and its option types, `botCompactVeto`, `createBotPersonaProjection`, `teamSnapshot` and its errors | Node only. It loads the L Host and `@byok-sdk/client`. |
16
+ | `.` | `BotCollaboration` and its option types, `botLedgerOptions`, `botCompactVeto`, `createBotPersonaProjection`, `teamSnapshot` and its errors | Node only. It loads the L Host and `@byok-sdk/client`. |
17
17
  | `./host-kit` | The L modules a Host adapter composes: model, channel, delivery, routines, team, migration, retention, dreaming, adapter steps | Node or a Worker. It loads the K4 root entry, but not the L Host or `@byok-sdk/client`. The hosted Worker example bundles it. |
18
18
  | `./rules` | The pure rules that the two entries above do not export | Anywhere. It loads only `@byok-sdk/protocol` and `@byok-sdk/server/execution-core/canonical`, so no `node:sqlite`. |
19
19
  | `./testing` | The shared vectors, the L test Host, and the K4 test data `policy` and `template` | Tests on Node. It needs the optional peers `vitest` and `@hono/node-server`. |
@@ -35,9 +35,11 @@ bun run --cwd packages/bot-collaboration test
35
35
  ```
36
36
 
37
37
  `src/host.test.ts` shows the embedded setup. Create one `BotCollaboration`
38
- per tenant and ledger. Open that ledger with the K8 compact veto:
39
- `new HostLedger(file, tenant, { compactVeto: botCompactVeto })`. The
40
- constructor refuses a ledger without it ([Compaction](#compaction)). Give it a valid Agent execution template and a Host
38
+ per tenant and ledger. Open that ledger with the K8 ledger options:
39
+ `new HostLedger(file, tenant, botLedgerOptions)`, or
40
+ `{ ...botLedgerOptions, projectionOutboxLimits }` to add options. They register
41
+ the K8 compact veto ([Compaction](#compaction)) and the ledger's `k8` format row.
42
+ The constructor refuses a ledger opened without them. Give it a valid Agent execution template and a Host
41
43
  connector. Route the embedded server's `wake.consume` to `bot.consume`.
42
44
  Route its `agentMessage.consume` to `bot.consumeMessage`.
43
45
  Call `bot.recover()` after startup. Call `bot.close()` before closing the SDK
@@ -257,16 +259,8 @@ application rows, so `wouldDoRecords` lists only the rows of roots that are
257
259
  still in the state. A Host that keeps the would-do feed longer copies the rows
258
260
  before it acknowledges the root.
259
261
 
260
- A ledger written by an earlier version has rows without `turnId`. Run
261
- `migrateWouldDo(ledger)` from `./host-kit` once per ledger, before the new version
262
- serves. It fills `turnId` from the K4 task id of each live Turn intent, over
263
- every generation, and moves each row whose intent K4 already compacted, or
264
- whose Turn left the state, to the `wouldDo` application rows. It returns
265
- `{ backfilled, archived }`. `archived` counts rows that leave the feed early;
266
- they are history of settled Turns, so no Turn reads them. A second run returns
267
- zeros. A switch export or import refuses a would-do row without `turnId`, so
268
- migrate the source before a switch. For example, AiphaBee runs it on each
269
- device ledger in its runtime update.
262
+ A ledger with would-do rows that lack `turnId` is refused with
263
+ `would_do_unsupported_old`; the SDK does not modify it.
270
264
 
271
265
  ## Actions and context
272
266
 
@@ -462,9 +456,9 @@ command needs the Main Bot role and gets the K4 rows through the
462
456
 
463
457
  A sealed Bot routine (#953, #654 E3d-4) is a `bot-routine` whose Turn
464
458
  instruction only a member and the device can read. The owner's member endpoint
465
- seals the whole instruction once per routine version with K4
466
- `sealRoutineTemplate`. The instruction is `sealedRoutineInstruction(prompt)`:
467
- the K8 Turn frame with every action, `Request:` and the prompt, and no
459
+ seals the whole instruction once per routine version under K4's
460
+ `routineTemplateBinding`. The instruction contains the K8 Turn frame with every
461
+ action, `Request:` and the prompt, and no
468
462
  ContextPack, because v1 has no plaintext field for Host content next to a
469
463
  sealed instruction. The Turn's frozen outcome schema stays the authority on
470
464
  which actions the Bot may take.
@@ -580,7 +574,8 @@ new BotCollaboration(server, ledger, { ...options,
580
574
  of an upgraded ledger still go into its pack.
581
575
  - **Native sessions.** `dreaming.nativeSessions` defaults to `true` and requests
582
576
  native session input for the same window when the device advertises support.
583
- Set it to `false` to omit the request. The device switch is off by default;
577
+ Only a template whose `target` names Pi gets the request; any other template
578
+ dreams without it. Set it to `false` to omit the request. The device switch is off by default;
584
579
  see [Native session input](../../docs/security.md#native-session-input) for
585
580
  what it sends to the configured model provider.
586
581
  - **Queue.** A dream joins the Bot's FIFO behind the Turns of its sync, and user
@@ -670,7 +665,8 @@ does that on the Host's explicit acknowledgement. It never runs on its own.
670
665
  - An unknown root throws. A root that is already archived counts as
671
666
  `alreadyArchivedRoots`.
672
667
  - Each call also moves the command records of archived roots and the records
673
- with no root. They answer replays for at least `retentionMs`, which must be
668
+ with no root. A record's root is the root of the command's own Turn, not of
669
+ an input batch Turn that the command sealed ahead of it (#2254). They answer replays for at least `retentionMs`, which must be
674
670
  seven days or more; a later call removes them after that. A retry after the
675
671
  window decides again, and an archived Turn, input or round id makes the
676
672
  commit throw `RetiredIdentityError` and change nothing. A store makes that
@@ -708,12 +704,13 @@ After retention, a late message for an archived Turn gets `binding_mismatch`,
708
704
  and an echo can no longer match an archived delivery. Back up the whole SQLite
709
705
  database: a JSON-only restore loses the archived rows and tombstones.
710
706
 
711
- `CollaborationState.version` is 3. Version 1 kept the routines in K8 state.
712
- The Host refuses a version 1 ledger and changes nothing. Restore a ledger
713
- backup made before this change, or start a new ledger.
714
-
715
707
  The Host drains application commands until all new turns have a K4 intent.
716
708
  An immediate terminal cannot leave a continuation without a wake.
709
+ K4 also settles intents in drains that the Host did not start: a terminal
710
+ event, a cancel probe or a retry timer (#2244). Through `HostOptions.onSettled`,
711
+ each such settlement queues one coalesced pass behind the Host's serial calls,
712
+ so the Turn, its successors and its deliveries advance with no Host call.
713
+ A settlement that commits while the Host closes waits for `recover()`.
717
714
  K4 schedules and cancels routine wakes through its outbox. A resume of the
718
715
  same key replaces a pending cancel with the schedule, so the SDK holds one
719
716
  wake. A failed SDK wake call rejects the K4 drain, and the Host call that
@@ -731,10 +728,10 @@ let the accepted occurrence finish. Pause and resume retry the calendar.
731
728
 
732
729
  ## Boundaries
733
730
 
734
- The collaboration state has version 3. The Host rejects version 2, unsupported
735
- and unversioned stored state. It does not reset or migrate that state. A
736
- version 2 ledger cannot hold archived rows, so restore a ledger backup made
737
- before this change, or start a new ledger.
731
+ The ledger's `k8` row of `host_store_format` is the format of the collaboration
732
+ state, 3 in this build. `HostLedger` refuses an existing ledger whose `k8` row
733
+ differs or is missing with `HostStoreFormatError` before any write, and it does
734
+ not reset or migrate that state. Keep that file and open a new ledger.
738
735
 
739
736
  This example has one team and one owner per ledger. Paid Pi success-rate
740
737
  measurement belongs to [WO-10b](../../docs/submit-result-measurement.md); the method defines per-runtime/model/platform cells and does not supply live data. Retention of the
@@ -1104,7 +1101,8 @@ that froze before keeps the execution it froze with, also while it waits in
1104
1101
  the K4 FIFO. A template outside `readOnlyToolsets` refuses the call, which then
1105
1102
  changes nothing. A Bot whose model has no template keeps its stored template,
1106
1103
  and each of its Turns, a sealed routine Turn too, blocks with
1107
- `Unavailable model: <name>` before it freezes (`blocked:<turnId>`). It freezes
1104
+ `Unavailable model: <name>` before it freezes (a `blocked:` projection with
1105
+ code `unavailable_model`). It freezes
1108
1106
  once a later `setModels` or restart provides the template. No write entry
1109
1107
  refuses a missing template of an existing Bot: a snapshot or `update_bot` that
1110
1108
  names such a model stores the profile and keeps the stored template. A new Bot
@@ -1188,8 +1186,9 @@ drops oldest whole rows until that budget fits. `historyWindow.notice` reports
1188
1186
  omitted messages and refusals.
1189
1187
  History overflow does not block a seat. The frozen Request section keeps the
1190
1188
  complete accepted request. Only a Request that alone exceeds 32 KiB blocks
1191
- the turn. The seat reason and blocked projection report its byte count, the
1192
- limit, and a request to shorten the input.
1189
+ the turn. The seat reason and blocked projection (code
1190
+ `current_request_too_large`) report its byte count, the limit, and a request
1191
+ to shorten the input.
1193
1192
  For room_call seats, the visible caller post is the current request and its
1194
1193
  author id is retained. A pass inherits the earlier visible trigger. This
1195
1194
  request is preserved even if it has left the recent message window.
@@ -1228,6 +1227,19 @@ Rejected feedback is private to its Bot. The next frozen input reserves it.
1228
1227
  An execution that fails before it starts releases that reservation.
1229
1228
  A turn that cannot pass Request or schema admission has status `blocked` and
1230
1229
  `blockedReason`. It creates no intent. `cancelTurn` can cancel it before admission.
1230
+
1231
+ Each blocked reason publishes
1232
+ `blocked:<turnId>:<code>:<fingerprint>` with `{ owner, turnId, code, reason }`
1233
+ when the Turn's reason changes (#2245). `code` is `unavailable_model`,
1234
+ `schema_over_budget` or `current_request_too_large`; `reason` has the details,
1235
+ such as the model name or byte counts. The fingerprint is the first 12 hex
1236
+ digits of the SHA-256 of the canonical JSON of `{ code, reason }`, so a
1237
+ projection id never changes value. A Turn whose reason changes while it stays
1238
+ blocked gets one more `blocked:` id per reason, and a reason that comes back
1239
+ republishes the same id and value, which a receiver deduplicates by id. The
1240
+ byte count of `schema_over_budget` follows the team, so each team change can
1241
+ publish one more row while the Turn stays blocked. A Host routes these rows by
1242
+ the `blocked:` prefix and reads the turn id from the value.
1231
1243
  Other schema composition errors propagate as Host defects.
1232
1244
 
1233
1245
  Unmentioned messages are stored as background. They do not create a seat, but
@@ -1287,6 +1299,10 @@ true.
1287
1299
  own `triggerMessageId`, else the root). A Host tells a mentioned seat from a
1288
1300
  `room_call` seat by this field and does not derive it from the seat id. A
1289
1301
  seat opened before the release that added the field is not backfilled.
1302
+ A `cancelTurn` of a seat Turn that has no intent ends its seat `failed`
1303
+ with reason `cancelled` in the same commit, so the next seat queues at
1304
+ once; the seat deadline never changes the Turn's `cancelled` conclusion
1305
+ (#2247).
1290
1306
  - `room-root:<roomId>:<root>` with `{ roomId, root, seats }`, when every seat
1291
1307
  of every round of the root is terminal, the seats that a `room_call` added
1292
1308
  included. `seats` lists their ids in reservation order; each has its
@@ -1375,9 +1391,13 @@ chain Turn. That Turn then accepts no first message and applies no outcome.
1375
1391
  Without a K4 intent, the transaction closes the Turn and sets `cancelled`.
1376
1392
  It does not call `core.cancel`. With an intent, the Host calls `core.cancel`
1377
1393
  after the commit and then sets `delivered`. Each `process` pass delivers an
1378
- undelivered cancel to its frozen target, so a restart completes it. When
1379
- `core.cancel` fails, `cancelDelegation` rejects, but the cancel stays
1380
- committed and the timer delivers it. A repeat gives `cancel_pending` until the
1394
+ undelivered cancel to its frozen target, so a restart completes it. Each
1395
+ cancel is delivered on its own, so one failure does not hold back the others
1396
+ (#2253). When `core.cancel` fails before the K4 commit, `cancelDelegation`
1397
+ rejects, but the cancel stays committed and the timer delivers it. When the
1398
+ drain after the K4 commit fails, the cancel is delivered and the call rejects
1399
+ with that drain error once. A cancel whose target intent has concluded, or was
1400
+ compacted after concluding, is delivered with no `core.cancel` call. A repeat gives `cancel_pending` until the
1381
1401
  verdict and `already_settled` with the verdict after it; neither writes or calls
1382
1402
  `core.cancel` ([idempotent owner cancels](#idempotent-owner-cancels-1405)).
1383
1403
 
@@ -1559,10 +1579,8 @@ back to L by an import into a new L tenant (below).
1559
1579
 
1560
1580
  ### Owner switch on L (#975)
1561
1581
 
1562
- `src/switch.ts` reads an L ledger into the switch format and writes the format
1563
- into an L tenant. One function, `switchContent`, serves both the old owner's
1564
- export and the new owner's read-back, so one function states what an L ledger
1565
- holds. The whole coordination domain moves together.
1582
+ `src/switch.ts` reads an L ledger into the switch format. `switchContent`
1583
+ checks the old owner’s export. The whole coordination domain moves together.
1566
1584
 
1567
1585
  **Old owner (L → H).** `exportForSwitch(devices, exportedAt?)` runs in one
1568
1586
  synchronous step: it dumps the ledger (K4 `dumpForSwitch`), checks it, seals it
@@ -1611,31 +1629,8 @@ domain is never split between the owners. An abort of a device of the export
1611
1629
  ends the export, and the new owner discards its import; after the commit no
1612
1630
  device of it aborts.
1613
1631
 
1614
- **New owner (H → L).** On a new, empty ledger tenant (a switch back to L opens
1615
- a new tenant), and with no `BotCollaboration` on it:
1616
-
1617
- 1. `importForSwitch(ledger, document)` verifies the H export and writes it
1618
- with each device owned by H and an import record, in one transaction (K4
1619
- `loadForSwitch`). Before that transaction commits, K4 reads the tenant's
1620
- rows back, and they must seal to the document's digest under its header;
1621
- otherwise it throws `SwitchExportError` with `manifest` and writes nothing.
1622
- So an import is either verified or not there. It returns the receipt
1623
- `{ digest, devices }` that the old owner commits away on.
1624
- 2. After the old owner committed, `commitImport(ledger, digest)` gives L each
1625
- device of the import and deletes the import record.
1626
- 3. `discardImport(ledger)` deletes an import that is not to be committed (K4
1627
- `discard`). It first marks the import as being discarded, so a commit
1628
- refuses it from then on.
1629
-
1630
- A `BotCollaboration` refuses to open a ledger with an import record, and the
1631
- root entries (`commitInLedger`, `retainInLedger`, `callCardsInLedger`,
1632
- `syncTurnInLedger`) refuse it the same way before they run. So no work runs on
1633
- an import before its commit, and a committed tenant has no record to discard. The import writes each derived value from the format: `agent` for the
1634
- new tenant, the task ids and inputs of every generation, `applied`, slots, wake
1635
- keys, intent ids, `attempts` and the Host intent handlers. A concluded intent
1636
- gets K4's cursors of a new row (`phase: 'settled'`, `notBefore: 0`). Routines
1637
- and occurrences go in the order of their ordinals, which the format makes their
1638
- positions.
1632
+ **New owner (H → L).** The local Host does not provide switch import.
1633
+ Existing uncommitted import records remain fenced from normal work.
1639
1634
 
1640
1635
  **Ordering.** The receipt is the export's digest, and nothing between the two
1641
1636
  Hosts proves that the target imported it: there is no authentication between
@@ -1918,6 +1913,9 @@ coalescing off. This is the remaining interaction of #1229 item 1.
1918
1913
  Every inbound human message gets one deterministic destination, derived from
1919
1914
  the rows the Host already writes. There is no second disposition table:
1920
1915
  `inboundDispositions()` reads the inbound, input-batch and Turn rows.
1916
+ An admitted redelivery replaces an earlier filtered row for the same message,
1917
+ binding its root and reply route. Redelivery of an already admitted message
1918
+ keeps its original reply credential and expiry. The earlier refusal stays in audit.
1921
1919
 
1922
1920
  | Destination | Meaning |
1923
1921
  | --- | --- |
@@ -1925,12 +1923,17 @@ the rows the Host already writes. There is no second disposition table:
1925
1923
  | `coalesced(turnId)` | In the Turn `turnId`, including a merged input whose batch is still open. |
1926
1924
  | `answered(turnId)` | The Turn succeeded. |
1927
1925
  | `failed(turnId)` | The Turn failed, expired or was superseded. |
1928
- | `cancelled(turnId)` | The owner cancelled the Turn or its batch. |
1926
+ | `cancelled(turnId)` | The root Turn or its batch was cancelled, not merely a round seat. |
1929
1927
 
1930
1928
  A 1:1 input names the batch Turn that answers it. A room input names its round
1931
- id; the round's seat Turns decide the destination. A recorded message whose
1932
- Turn was retained away reads `failed`, never nothing, so the Host UI cannot
1933
- show a message with no destination.
1929
+ id. An existing root Turn decides first, including its explicit cancellation.
1930
+ Otherwise, the round reports whether the message got an answer: any seat that
1931
+ succeeded or delivered makes it `answered`, even if another seat later fails
1932
+ or is cancelled. With no successful seat, any failed or cancelled seat makes
1933
+ it `failed`; otherwise it stays `coalesced`. Cancelling every seat still means
1934
+ `failed`, not cancellation of the round root. A recorded message whose Turn
1935
+ was retained away reads `failed`, never nothing, so the Host UI cannot show a
1936
+ message with no destination.
1934
1937
 
1935
1938
  ```ts
1936
1939
  const rows = bot.inboundDispositions(); // oldest first, from the ledger
@@ -1969,9 +1972,12 @@ the order of the guide's §3. The first match wins.
1969
1972
  | Other human, 1:1 | `not_owner`. Audit only. |
1970
1973
  | Human, group | `room_input`. `roomInput` with the principal. Mention entities select seats. |
1971
1974
 
1972
- The input key is `inboundKey(message)`, the hash of channel, conversation id,
1973
- and platform message id. A redelivered event returns the same id. The Host
1974
- never scans text for mentions.
1975
+ The input key is `inboundKey(message)`, the hash of channel, conversation kind,
1976
+ conversation id and platform message id. A direct chat and a group with the
1977
+ same id have separate keys. A redelivered event returns the same id. The Host
1978
+ never scans text for mentions. Upgrading from the previous key format loses
1979
+ deduplication once for events already in flight; drain inbound delivery before
1980
+ upgrading or allow for those events to be admitted again.
1975
1981
 
1976
1982
  `BotOptions.owner` is the owner principal id. The default is `owner`. Only the
1977
1983
  human principal with this id passes the owner check. These owner APIs take an
@@ -2032,8 +2038,12 @@ A push target is a non-secret platform target, never a reply credential.
2032
2038
  Only the owner can enable, revoke or resend. As with the other owner APIs,
2033
2039
  an omitted principal means that the Host already authenticated the owner.
2034
2040
  A manual resend requires a usable reply route or an active push route. It
2035
- creates a new id and preserves the old unknown row. It can show a duplicate
2036
- message if the original send arrived.
2041
+ creates a new id and preserves the old row in `unknown` as history. That row
2042
+ cannot be resent again or read back, and does not reserve a reply token or
2043
+ block retention. Consumers counting unknown deliveries must use `resendOf`
2044
+ on the replacement rows to exclude their predecessors. A new unknown
2045
+ replacement can itself be resent. A resend can show a duplicate message if
2046
+ the original send arrived.
2037
2047
 
2038
2048
  `consumeMessage` records first acceptance and its pending Delivery in the
2039
2049
  same SQLite transaction. Exact redelivery creates no second row. Applied
@@ -2064,8 +2074,9 @@ from message text. A different bot, human, channel or conversation cannot
2064
2074
  confirm a delivery. Echoes can arrive while `send` is pending; they do not
2065
2075
  wait behind the send operation.
2066
2076
 
2067
- Reply tokens are removed at expiry. They are also removed after the root
2068
- has no open Turn or seat and no pending/sending delivery on that route.
2077
+ Reply tokens are removed at expiry. A non-seat blocked Turn remains open
2078
+ because it can resume. Tokens are also removed after the root has no open
2079
+ Turn or seat and no staged/pending/sending/unknown delivery on that route.
2069
2080
  Metadata and delivery audit remain. All delivery state is Host state; it
2070
2081
  does not change K4, K7, the SDK message disposition or wire messages.
2071
2082
 
@@ -0,0 +1,9 @@
1
+ import { json, addTurn, refuseUnmigratedWouldDo, contextPack, activeBot, admitBotToolsets, DEFAULT_AUTONOMY, requireMain, refuseExternalTeam, refuseExternalRooms, archiveBot, NEW_ROOMS, roomFields, roomVisibility, handoffFrameBytes, handoffTurn, profileProjection, NEW_BOTS, TEAM_BOT_LIMIT, DEFAULT_CONTEXT_TURN_LIMIT } from './chunk-BGGEZHPC.js';
2
+ import { hash, canonical, occurrenceIntentKey, occurrenceOfIntentKey, concludeOccurrence, time, MIN_TOMBSTONE_RETENTION_MS } from '@byok-sdk/server/execution-core';
3
+ import { nextRoutineOccurrence, checkRoutineSchedule, HostOfferSealedPayloadSchema, buildHandoffPack } from '@byok-sdk/protocol';
4
+
5
+ function emptyTeam(){return {bots:{},rooms:{},rounds:{},seats:{},roots:{},notes:[],homeOperations:[]}}function stateOf(application){if(application.collaboration===void 0)application.collaboration=json({team:emptyTeam(),turns:{},budgets:{},delegations:{},batches:{},units:{},replies:{},schemas:{},questions:{},cards:{},rejected:[],audit:[],sequence:0});return application.collaboration}function verified(sender){return typeof sender?.id==="string"&&sender.id.length>0&&(sender.kind==="human"||sender.kind==="bot")}function isOwner(principal,owner){return principal.kind==="human"&&principal.id===owner}function classifyInbound(message,owner,self){const sender=message.sender;if(!verified(sender))return "unverified_sender";const selfBots=self&&Object.hasOwn(self,message.channel)?self[message.channel]:void 0;if(sender.kind==="bot"&&selfBots?.includes(sender.id))return "echo";const direct=message.conversation.kind==="direct";if(sender.kind==="bot")return direct?"bot_audit":"bot_background";if(!direct)return "room_input";return isOwner(sender,owner)?"owner_input":"not_owner"}function inboundKey(message){return hash([message.channel,message.conversation.kind,message.conversation.id,message.platformMessageId])}function supersededDeliveryIds(deliveries){return new Set(Object.values(deliveries).flatMap(row=>row.resendOf===void 0?[]:[row.resendOf]))}var BOT_ROUTINE="bot-routine";var BOT_DREAM="bot-dream";var ROUTINE_WAIT_MS=3e5;var ROUTINE_LATE_AFTER_MS=6e4;var sealedOf=input=>"sealed"in input?input.sealed:void 0;var SealedRoutineVersionError=class extends Error{constructor(expected){super(`Seal the template for version ${expected}`);this.expected=expected;this.name="SealedRoutineVersionError";}expected;code="sealed_routine_version"};var SEALED_ROUTINE_CATEGORIES=["task-input"];var dreamTable=state=>state.dreams??={bots:{},open:{}};var routineCalendar=(definition2,after)=>{const schedule=definition2.rule;if(!schedule||typeof schedule!=="object"||Array.isArray(schedule)||schedule.tz!==definition2.timeZone){throw new Error("A routine rule is a RoutineSchedule in the definition time zone")}return nextRoutineOccurrence(schedule,after)};function fields(routine){const spec=routine.definition.hostOccurrence;return spec?.type===BOT_ROUTINE?spec.input:void 0}function definition(id,version,schedule,input){return {id,version,timeZone:schedule.tz,rule:json(schedule),waitMs:ROUTINE_WAIT_MS,lateAfterMs:ROUTINE_LATE_AFTER_MS,hostOccurrence:{type:BOT_ROUTINE,input:json(input)}}}function scheduled(schedule){const check=checkRoutineSchedule(schedule);if(!check.ok)throw new Error(`${check.code}: ${check.message}`);return schedule}function ownerRoutineUpdate(action){if(action.schedule===void 0&&action.prompt===void 0)throw new Error("An update must change schedule or prompt");if(action.schedule!==void 0)scheduled(action.schedule);return action}function botRoutines(routines){const views=[];for(const routine of routines){const input=fields(routine);if(!input)continue;const{id,version,rule}=routine.definition;views.push({id,owner:input.owner,current:version,pending:routine.pending?.version??null,lifecycle:routine.lifecycle,status:routine.status,definition:{version,schedule:rule,..."sealed"in input?{sealed:true}:{prompt:input.prompt},target:input.owner},...routine.calendarErrors?.length?{lastError:routine.calendarErrors.at(-1)}:{}});}return views}function createDefinition(routines,owner,taskId,index,action,authority){if(action.target!==void 0)throw new Error("An ordinary Bot cannot supply target");if(routines.filter(routine=>fields(routine)?.owner===owner&&routine.lifecycle!=="completed").length>=8)throw new Error("Routine limit is 8");return definition(hash([taskId,"create_routine",index]),1,action.schedule,{owner,authority,prompt:action.prompt})}function owned(routines,owner,id){const routine=routines.find(row=>row.definition.id===id);if(!routine||fields(routine)?.owner!==owner||routine.lifecycle==="completed")throw new Error("Routine is unavailable to this Bot");return routine}function endable(routines,id){const routine=routines.find(row=>row.definition.id===id);if(!routine||!fields(routine)||routine.lifecycle==="completed")throw new Error("No open Bot routine has this id");return routine}function updateDefinition(routines,owner,action){const routine=owned(routines,owner,action.routineId);const prior=routine.pending??routine.definition,input=prior.hostOccurrence.input;if("sealed"in input)throw new Error("A sealed routine changes only through resealRoutine");return definition(prior.id,prior.version+1,action.schedule??prior.rule,{...input,prompt:action.prompt??input.prompt})}function checkSealed(id,version,sealed,execution){if(canonical(sealed.sealing.categories)!==canonical(SEALED_ROUTINE_CATEGORIES))throw new Error("A sealed routine seals task-input only");const{agentRef}=execution.payload;if(canonical(sealed.agentRef)!==canonical({agentId:agentRef.agentId,profileRevision:agentRef.profileRevision})){throw new Error("The template is sealed for another Agent revision")}const{instruction:_,...plain}=execution.payload;const offer={...plain,sealing:sealed.sealing,sealed:sealed.template,routineRef:{routineId:id,definitionVersion:version,notAfter:sealed.notAfter}};if(!HostOfferSealedPayloadSchema.safeParse(offer).success)throw new Error("Supply a valid sealed template");if("ciphertextRef"in sealed.template)throw new Error("A sealed routine template must be inline")}function sealedDefinition(routines,owner,action,execution){if(action.definitionVersion!==1)throw new SealedRoutineVersionError(1);const next=definition(action.routineId,1,scheduled(action.schedule),{owner,authority:"owner",sealed:action.sealed});const existing=routines.find(routine=>routine.definition.id===action.routineId);if(existing){if(canonical(existing.definition)===canonical(next))return next;throw new Error("A routine already has this id")}if(routines.filter(routine=>fields(routine)?.owner===owner&&routine.lifecycle!=="completed").length>=8)throw new Error("Routine limit is 8");checkSealed(action.routineId,1,action.sealed,execution);return next}function resealDefinition(routines,owner,action,execution){const version=action.definitionVersion;const routine=owned(routines,owner,action.routineId);const prior=routine.pending??routine.definition,input=prior.hostOccurrence.input;if(!("sealed"in input))throw new Error("Only a sealed routine takes a new template");const next=definition(action.routineId,version,scheduled(action.schedule),{owner:input.owner,authority:input.authority,sealed:action.sealed});if([routine.definition,routine.pending].some(row=>canonical(row)===canonical(next)))return next;if(version!==prior.version+1)throw new SealedRoutineVersionError(prior.version+1);checkSealed(action.routineId,version,action.sealed,execution);return next}function sealedTemplate(routines,ref){for(const routine of routines){for(const row of [routine.definition,routine.pending]){if(row?.id===ref.routineId&&row.version===ref.definitionVersion){const input=fields({...routine,definition:row});return input&&sealedOf(input)}}}return void 0}function routineTurn(state,run){const input=run.input,id=occurrenceIntentKey(run.occurrenceKey);addTurn(state,{id,root:id,source:"routine",botId:input.owner,hop:0,authority:input.authority,..."sealed"in input?{request:"",sealedRoutine:{routineId:run.routineId,definitionVersion:run.definitionVersion}}:{request:input.prompt}});}function routineOccurrence(turn){const key=occurrenceOfIntentKey(turn.id);if(key===void 0)throw new Error(`Routine Turn ${turn.id} names no occurrence`);return key}function concludeRoutineTurn(s,turn){const key=routineOccurrence(turn),occurrence=s.occurrences[key];if(!occurrence?.hook||occurrence.intentId||occurrence.conclusion)return false;concludeOccurrence(s,key,"cancelled");return true}var RetentionRefused=class extends Error{constructor(code,root,reason,roundRoot){super(`Retention refused: ${reason}`);this.code=code;this.root=root;this.roundRoot=roundRoot;this.name="RetentionRefused";}code;root;roundRoot};var OPEN_DELIVERY=new Set(["staged","pending","sending","unknown"]);var values=rows=>Object.values(rows??{});var own=(rows,id)=>rows&&Object.hasOwn(rows,id)?rows[id]:void 0;function contextWindow(state,limit,handoff){const kept=new Set,byBot=new Map;const of=botId=>{let rows2=byBot.get(botId);if(!rows2)byBot.set(botId,rows2={turns:[],cards:[],questions:[]});return rows2};for(const turn of values(state.turns))if(turn.conclusion||turn.status==="processing")of(turn.botId).turns.push(turn);for(const card of values(state.cards)){const turn=own(state.turns,card.turnId);if(turn)of(turn.botId).cards.push(card.turnId);}for(const question of values(state.questions)){const turn=own(state.turns,question.turnId);if(turn)of(turn.botId).questions.push(question.turnId);}const rows=Math.min(limit,DEFAULT_CONTEXT_TURN_LIMIT);for(const bot of byBot.values()){const totalBytes=Math.max(handoff.totalBytes,handoff.recentBytes+handoff.earlyBytes+handoffFrameBytes(bot.turns.length));const pack=buildHandoffPack(bot.turns.map(handoffTurn),{...handoff,totalBytes});const oldest=pack.omittedTurns-(pack.recent.length?0:1);for(const turn of bot.turns.slice(oldest))kept.add(turn.id);for(const id of [...bot.cards.slice(-rows),...bot.questions.slice(-rows)])kept.add(id);}return kept}function members(state,root){const rounds=values(state.team.rounds).filter(round=>round.root===root);const seats=rounds.flatMap(round=>round.seats),roots=new Set([root,...seats]);const turns=values(state.turns).filter(turn=>roots.has(turn.root)),ids=new Set(turns.map(turn=>turn.id));const delegations=values(state.delegations).filter(d=>roots.has(d.root)).map(d=>d.id),chained=new Set(delegations);const replies=Object.entries(state.replies).filter(([,reply])=>ids.has(reply.turnId)).map(([taskId])=>taskId);const batch=own(state.inputBatches,root);return {turns,roots,delegations,replies,rounds:rounds.map(round=>round.id),seats,batches:values(state.batches).filter(row=>row.delegationIds.some(id=>chained.has(id))).map(row=>row.id),units:values(state.units).filter(unit=>roots.has(unit.root)).map(unit=>unit.id),cards:values(state.cards).filter(card=>ids.has(card.turnId)).map(card=>card.id),questions:values(state.questions).filter(question=>ids.has(question.turnId)).map(question=>question.id),...batch?{batch:batch.id}:{},inputs:batch?[...batch.inputIds]:[],inbounds:values(state.channel?.inbounds).filter(row=>row.root!==void 0&&roots.has(row.root)).map(row=>row.id),deliveries:values(state.channel?.deliveries).filter(row=>ids.has(row.turnId)).map(row=>row.id),wouldDo:values(state.wouldDo).filter(row=>ids.has(row.turnId)).map(row=>row.id)}}function protection(state,m,facts,window,superseded,now){for(const turn of m.turns){if(!turn.conclusion)return "A Turn of the root is not concluded";if(facts.hasIntent(turn.id)&&!turn.reported)return "A Turn of the root is not reported";if(turn.source==="routine"&&facts.occurrenceOpen(turn.id))return "A routine occurrence of the root is open"}for(const id of m.delegations){const d=state.delegations[id];if(!d.verdict||d.lateTurnId||d.cancel&&!d.cancel.delivered)return "A delegation of the root is unresolved"}if(m.batches.some(id=>!state.batches[id].released))return "A delegation batch of the root is not released";if(m.units.some(id=>state.units[id].state==="reserved"))return "A budget unit of the root is reserved";for(const id of m.cards){const card=state.cards[id];if(card.state==="pending"||card.state==="confirmed"&&card.result===void 0&&card.error===void 0||!card.decisionReported){return "A card of the root is not settled"}}if(m.questions.some(id=>state.questions[id].answer===void 0))return "A question of the root is unanswered";const batch=m.batch===void 0?void 0:state.inputBatches[m.batch];if(batch&&(batch.state==="open"||batch.revision!==2))return "The input batch of the root is not settled";if(m.rounds.some(id=>!state.team.rounds[id].closed))return "A round of the root is open";if(m.seats.some(id=>!state.team.seats[id]?.released))return "A room seat of the root is not released";if(m.deliveries.some(id=>!superseded.has(id)&&OPEN_DELIVERY.has(state.channel.deliveries[id].state)))return "A delivery of the root is not settled";if(m.inbounds.some(id=>{const reply=state.channel.inbounds[id].reply;return !!reply?.token&&reply.expiresAt>now})){return "An inbound reply route of the root is live"}if(m.turns.some(turn=>window.has(turn.id)))return "The root is in the ContextPack window of its Bot";return void 0}function move(store,namespace,rows,ids){if(!rows)return 0;for(const id of ids){store.put(namespace,id,rows[id]);delete rows[id];}return ids.length}var bytes=state=>Buffer.byteLength(JSON.stringify(state));function retainRoots(state,input,limits,facts,store){const now=time(input.now),retention=time(input.retentionMs);if(retention<MIN_TOMBSTONE_RETENTION_MS)throw new Error("Retention must be at least seven days");const expiresAt=time(now+retention);if(!Array.isArray(input.acknowledgedRoots))throw new Error("Acknowledged roots must be an array");const roots=[...new Set(input.acknowledgedRoots)];if(roots.some(root=>typeof root!=="string"||!root))throw new Error("Invalid acknowledged root");if(!Number.isSafeInteger(limits.contextTurnLimit)||limits.contextTurnLimit<1)throw new Error("Invalid ContextPack limits");refuseUnmigratedWouldDo(state);const result={archivedRoots:0,alreadyArchivedRoots:0,archivedRows:0,archivedCommands:0,expiredCommands:store.expire("commands",now),beforeBytes:bytes(state),afterBytes:0};const window=contextWindow(state,limits.contextTurnLimit,limits.handoff),selected=[];const superseded=supersededDeliveryIds(state.channel?.deliveries??{});for(const root of roots){const seat=own(state.team.seats,root);if(seat){const roundRoot=state.team.rounds[seat.roundId]?.root??seat.roundId;throw new RetentionRefused("seat_root",root,`The Turn is a room seat of root ${roundRoot}`,roundRoot)}const m=members(state,root);if(!m.turns.length&&!m.rounds.length&&m.batch===void 0&&!own(state.budgets,root)){if(!store.isRetired("root",root))throw new Error("Acknowledged root not found");result.alreadyArchivedRoots++;continue}const reason=protection(state,m,facts,window,superseded,now);if(reason)throw new RetentionRefused("protected_root",root,reason);selected.push(m);}for(const m of selected){const turnIds=m.turns.map(turn=>turn.id),consumed=new Set(turnIds);result.archivedRows+=move(store,"turns",state.turns,turnIds)+move(store,"schemas",state.schemas,turnIds.filter(id=>own(state.schemas,id)))+move(store,"budgets",state.budgets,[...m.roots].filter(id=>own(state.budgets,id)))+move(store,"delegations",state.delegations,m.delegations)+move(store,"batches",state.batches,m.batches)+move(store,"units",state.units,m.units)+move(store,"replies",state.replies,m.replies)+move(store,"cards",state.cards,m.cards)+move(store,"questions",state.questions,m.questions)+move(store,"inputs",state.inputs,m.inputs)+move(store,"inputBatches",state.inputBatches,m.batch===void 0?[]:[m.batch])+move(store,"rounds",state.team.rounds,m.rounds)+move(store,"seats",state.team.seats,m.seats)+move(store,"roots",state.team.roots,[...m.roots].filter(id=>own(state.team.roots,id)))+move(store,"inbounds",state.channel?.inbounds,m.inbounds)+move(store,"deliveries",state.channel?.deliveries,m.deliveries)+move(store,"wouldDo",state.wouldDo,m.wouldDo);const rejected=state.rejected.filter(row=>row.consumedBy!==void 0&&consumed.has(row.consumedBy));for(const row of rejected)store.put("rejected",hash(["rejected",row]),row);state.rejected=state.rejected.filter(row=>!rejected.includes(row));result.archivedRows+=rejected.length;for(const id of turnIds)store.retire("turn",id);for(const id of m.inputs)store.retire("input",id);for(const id of m.rounds)store.retire("round",id);for(const root of m.roots)store.retire("root",root);result.archivedRoots++;}result.archivedRows+=retainRoomMessages(state,store,limits.contextTurnLimit)+retainRootless(state,store);for(const[id,record]of Object.entries(state.commands??{})){if(record.root!==void 0&&!store.isRetired("root",record.root))continue;store.put("commands",id,record,expiresAt);delete state.commands[id];result.archivedCommands++;}result.afterBytes=bytes(state);return result}function retainRoomMessages(state,store,limit){let count=0;for(const room of values(state.team.rooms)){const window=room.messages.length-limit;const moved=room.messages.map((message,index)=>index<window&&!own(state.team.rounds,message.id)&&!own(state.team.seats,message.id));if(!moved.includes(true))continue;for(const[botId,from]of Object.entries(room.visibleFrom))room.visibleFrom[botId]=from-moved.slice(0,from).filter(Boolean).length;room.messages.forEach((message,index)=>{if(moved[index])store.put("roomMessages",message.id,message);});room.messages=room.messages.filter((_,index)=>!moved[index]);count+=moved.filter(Boolean).length;}return count}function retainRootless(state,store){let count=0;if(state.audit.length){store.put("audit",hash(["audit",state.revision??0,state.audit]),state.audit);count+=state.audit.length;state.audit=[];}const routes=state.channel?.pushRoutes??{},used=new Set(values(state.channel?.deliveries).map(row=>row.route.kind==="push"?row.route.pushRouteId:""));count+=move(store,"pushRoutes",routes,Object.keys(routes).filter(id=>routes[id].revokedAt!==void 0&&!used.has(id)));const newest=new Map;for(const op of state.team.homeOperations)if(op.status==="applied")newest.set(op.botId,Math.max(newest.get(op.botId)??0,op.sequence));const settled=state.team.homeOperations.filter(op=>op.status==="applied"?newest.get(op.botId)!==op.sequence:op.status==="failed"&&op.request.payload.agentRef.profileRevision!==state.team.bots[op.botId]?.revision);for(const op of settled)store.put("homeOperations",String(op.sequence),op);state.team.homeOperations=state.team.homeOperations.filter(op=>!settled.includes(op));return count+settled.length}function ledgerHistory(state){return {turns:Object.values(state.turns),cards:Object.values(state.cards),questions:Object.values(state.questions),rejected:state.rejected}}function contextPack2(state,turnLimit,currentTurnId,maxBytes,separateRequest,shared,fit,routines=[],handoff){return contextPack(ledgerHistory(state),turnLimit,currentTurnId,maxBytes,separateRequest,shared,fit,routines,handoff)}var TEAM_NOTE_LIMIT=20;function projectionRequestId(value){const digest=hash(value);return `${digest.slice(0,8)}-${digest.slice(8,12)}-4${digest.slice(13,16)}-a${digest.slice(17,20)}-${digest.slice(20,32)}`}function homeHead(team,sequence,busy){const op=team.homeOperations.find(row=>row.sequence===sequence);if(!op||op.status!=="pending")return void 0;const oldest=team.homeOperations.filter(row=>row.botId===op.botId&&row.status==="pending").reduce((a,b)=>a.sequence<=b.sequence?a:b);return oldest===op&&!busy(op.botId)?op:void 0}var homeRequests=op=>[op.request,...op.retries];function checkHomeReadback(request,read){if(!read)return void 0;const payload=request.payload;if(read.deviceId!==request.deviceId||!same(read.agentRef,payload.agentRef)||read.requestId!==payload.requestId||read.projectionHash!==payload.projectionHash)throw new Error("Home readback identity conflict");return read.status!=="pending"?read:void 0}function planHomeRetry(op,now){if(op.retryAt!==void 0&&now>=op.retryAt){const retry=structuredClone(op.request);retry.payload.requestId=projectionRequestId([op.request.payload.requestId,op.retries.length+1]);op.retries.push(retry);op.retryAt=now+Math.min(6e4,1e3*2**Math.min(op.retries.length,6));}return op.retries.at(-1)??op.request}function homeEnqueued(op,now){op.retryAt??=now+1e3;}function applyHomeTerminal(state,op,terminal,publish){if(terminal.status==="applied"||terminal.status==="idempotent"){op.status="applied";const bot=state.team.bots[op.botId];if(bot.revision===op.request.payload.agentRef.profileRevision)bot.readyRevision=bot.revision;}else {op.status="failed";op.error=terminal.status;publish(`persona-failed:${op.sequence}`,json({owner:op.botId,revision:op.request.payload.agentRef.profileRevision,reason:op.error,recoverable:true}));}}function failHomeFlush(op,error){op.error=String(error instanceof Error?error.message:error);}function projection(state,bot){const value=profileProjection(bot);const requestId=projectionRequestId([bot.id,bot.revision]);state.team.homeOperations.push({sequence:++state.sequence,botId:bot.id,status:"pending",retries:[],request:{deviceId:bot.execution.deviceId,payload:{requestId,agentRef:{agentId:bot.id,profileRevision:bot.revision},projectionHash:`sha256:${hash(value)}`,projection:value}}});}function createBot(state,taskId,action,models,readOnlyToolsets=[]){if(!NEW_BOTS.includes(action.localId))throw new Error("Unknown local Bot slot");if(Object.values(state.team.bots).filter(b=>!b.archived).length>=TEAM_BOT_LIMIT)throw new Error(`Team Bot limit is ${TEAM_BOT_LIMIT}`);const base=models[action.model];if(!base)throw new Error("Unavailable model");admitBotToolsets(base,readOnlyToolsets);const id=hash([taskId,action.localId]);const execution=structuredClone(base);execution.payload.agentRef={agentId:id,profileRevision:"1"};const bot={id,name:action.name,role:action.role,persona:action.persona,model:action.model,mainBot:false,archived:false,revision:"1",readyRevision:null,autonomy:DEFAULT_AUTONOMY,execution};state.team.bots[id]=bot;projection(state,bot);return bot}function updateBot(state,action,models,readOnlyToolsets=[]){const bot=activeBot(state.team,action.botId);const model=action.model??bot.model,base=models[model];if(base)admitBotToolsets(base,readOnlyToolsets);const revision=(BigInt(bot.revision)+1n).toString();if(BigInt(revision)>9223372036854775807n)throw new Error("Profile revision limit");const execution=structuredClone(base??bot.execution);execution.deviceId=bot.execution.deviceId;execution.payload.agentRef={agentId:bot.id,profileRevision:revision};Object.assign(bot,{name:action.name??bot.name,role:action.role??bot.role,persona:action.persona??bot.persona,model,revision,readyRevision:null,execution});projection(state,bot);}function writeSnapshotBot(state,row,models,readOnlyToolsets=[]){const bot=state.team.bots[row.id];if(state.team.external?.persona){writeHostProfile(state,bot,row,models,readOnlyToolsets);return}if(bot){if(bot.name!==row.name||bot.role!==row.role||bot.persona!==row.persona||bot.model!==row.model){updateBot(state,{botId:row.id,name:row.name,role:row.role,persona:row.persona,model:row.model},models,readOnlyToolsets);}return}const base=models[row.model];if(!base)throw new Error("Unavailable model");admitBotToolsets(base,readOnlyToolsets);const execution=structuredClone(base);execution.payload.agentRef={agentId:row.id,profileRevision:"1"};const created={id:row.id,name:row.name,role:row.role,persona:row.persona,model:row.model,mainBot:false,archived:false,revision:"1",readyRevision:null,autonomy:DEFAULT_AUTONOMY,execution};state.team.bots[row.id]=created;projection(state,created);}function applyModels(state,models,readOnlyToolsets){for(const model of Object.values(models))admitBotToolsets(model,readOnlyToolsets);for(const bot of Object.values(state.team.bots)){const base=models[bot.model];if(bot.archived||!base)continue;const execution=structuredClone(base);execution.deviceId=bot.execution.deviceId;execution.payload.agentRef={agentId:bot.id,profileRevision:bot.revision};bot.execution=execution;}}function writeHostProfile(state,bot,row,models,readOnlyToolsets){const revision=row.profileRevision;if(bot){const changed=bot.name!==row.name||bot.role!==row.role||bot.persona!==row.persona||bot.model!==row.model;if(BigInt(revision)<BigInt(bot.revision))throw new Error(`Profile revision ${revision} of ${row.id} is older than ${bot.revision}`);if(revision===bot.revision){if(changed)throw new Error(`A profile change of ${row.id} needs a newer profile revision`);return}}const base=models[row.model];if(base)admitBotToolsets(base,readOnlyToolsets);else if(!bot)throw new Error("Unavailable model");const execution=structuredClone(base??bot.execution);if(bot)execution.deviceId=bot.execution.deviceId;execution.payload.agentRef={agentId:row.id,profileRevision:revision};const fields2={name:row.name,role:row.role,persona:row.persona,model:row.model,revision,execution};if(bot)Object.assign(bot,fields2);else state.team.bots[row.id]={id:row.id,...fields2,mainBot:false,archived:false,readyRevision:null,autonomy:DEFAULT_AUTONOMY};}function applyManagement(state,actor,taskId,outcome,models,accept,readOnlyToolsets=[]){const team=state.team,local={};const managed=(kind,work)=>accept(kind,()=>{requireMain(team,actor);work();});const bots=(kind,work)=>managed(kind,()=>{refuseExternalTeam(team,kind);work();});const rooms=(kind,work)=>managed(kind,()=>{refuseExternalRooms(team,kind);work();});outcome.create_bot?.forEach(action=>bots("create_bot",()=>{local[action.localId]=createBot(state,taskId,action,models,readOnlyToolsets).id;}));outcome.update_bot?.forEach(action=>bots("update_bot",()=>updateBot(state,action,models,readOnlyToolsets)));outcome.delete_bot?.forEach(action=>bots("delete_bot",()=>archiveBot(team,action.botId)));const resolve=fields2=>({...fields2,...fields2.members?{members:fields2.members.map(id=>local[id]??id)}:{},...fields2.admin?{admin:local[fields2.admin]??fields2.admin}:{}});outcome.create_room?.forEach(action=>rooms("create_room",()=>{if(!NEW_ROOMS.includes(action.localId))throw new Error("Unknown local room slot");const id=hash([taskId,action.localId]);if(team.rooms[id])throw new Error("Duplicate local room slot");team.rooms[id]={id,...roomFields(team,resolve(action)),messages:[]};}));outcome.update_room?.forEach(action=>rooms("update_room",()=>{const room=team.rooms[action.roomId];if(!room)throw new Error("Room not found");const fields2={...room,...resolve(action)};if(!action.admin&&!fields2.members.includes(fields2.admin??""))delete fields2.admin;const next=roomFields(team,fields2);next.visibleFrom=roomVisibility(room,next.members);Object.assign(room,next);if(!next.admin)delete room.admin;}));if(outcome.team_note)managed("team_note",()=>{if(team.notes.length>=TEAM_NOTE_LIMIT)throw new Error("Team note limit is 20");team.notes.push({id:hash([taskId,"team_note"]),text:outcome.team_note.text});});}function same(value,other){return canonical(value)===canonical(other)}
6
+
7
+ export { BOT_DREAM, BOT_ROUTINE, ROUTINE_LATE_AFTER_MS, ROUTINE_WAIT_MS, RetentionRefused, SealedRoutineVersionError, TEAM_NOTE_LIMIT, applyHomeTerminal, applyManagement, applyModels, botRoutines, checkHomeReadback, classifyInbound, concludeRoutineTurn, contextPack2 as contextPack, createDefinition, dreamTable, endable, failHomeFlush, homeEnqueued, homeHead, homeRequests, inboundKey, isOwner, owned, ownerRoutineUpdate, planHomeRetry, projectionRequestId, resealDefinition, retainRoots, routineCalendar, routineOccurrence, routineTurn, sealedDefinition, sealedTemplate, stateOf, supersededDeliveryIds, updateBot, updateDefinition, verified, writeSnapshotBot };
8
+ //# sourceMappingURL=chunk-6X7ARUDF.js.map
9
+ //# sourceMappingURL=chunk-6X7ARUDF.js.map