@byok-sdk/bot-collaboration 0.0.0-stage → 0.42.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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2058 -2
  3. package/dist/adapter-steps.d.ts +49 -0
  4. package/dist/channel.d.ts +111 -0
  5. package/dist/chunk-33YA66U7.js +7 -0
  6. package/dist/chunk-33YA66U7.js.map +1 -0
  7. package/dist/chunk-5J5SOWWI.js +12 -0
  8. package/dist/chunk-5J5SOWWI.js.map +1 -0
  9. package/dist/chunk-XTZUCECQ.js +12 -0
  10. package/dist/chunk-XTZUCECQ.js.map +1 -0
  11. package/dist/chunk-ZUFZCROA.js +27 -0
  12. package/dist/chunk-ZUFZCROA.js.map +1 -0
  13. package/dist/coalesce.d.ts +18 -0
  14. package/dist/commit-vectors.test-support.d.ts +173 -0
  15. package/dist/commit.d.ts +52 -0
  16. package/dist/compaction.d.ts +13 -0
  17. package/dist/delegation.d.ts +12 -0
  18. package/dist/delivery-routing.d.ts +63 -0
  19. package/dist/delivery-vectors.test-support.d.ts +78 -0
  20. package/dist/delivery.d.ts +20 -0
  21. package/dist/dream.d.ts +88 -0
  22. package/dist/home-projections.d.ts +5 -0
  23. package/dist/host-kit.d.ts +40 -0
  24. package/dist/host-kit.js +6 -0
  25. package/dist/host-kit.js.map +1 -0
  26. package/dist/host.d.ts +433 -0
  27. package/dist/inbound.d.ts +17 -0
  28. package/dist/index.d.ts +5 -0
  29. package/dist/index.js +16 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/k4-fixtures.test-support.d.ts +10 -0
  32. package/dist/l-test-host.test-support.d.ts +72 -0
  33. package/dist/migration.d.ts +251 -0
  34. package/dist/model.d.ts +83 -0
  35. package/dist/persona.d.ts +2 -0
  36. package/dist/retention-vectors.test-support.d.ts +17 -0
  37. package/dist/retention.d.ts +61 -0
  38. package/dist/rooms.d.ts +22 -0
  39. package/dist/routine-vectors.test-support.d.ts +81 -0
  40. package/dist/routines.d.ts +110 -0
  41. package/dist/rules/autonomy.d.ts +67 -0
  42. package/dist/rules/cards.d.ts +31 -0
  43. package/dist/rules/coalesce.d.ts +111 -0
  44. package/dist/rules/commands.d.ts +306 -0
  45. package/dist/rules/commit.d.ts +82 -0
  46. package/dist/rules/compaction.d.ts +33 -0
  47. package/dist/rules/context.d.ts +484 -0
  48. package/dist/rules/delegation.d.ts +353 -0
  49. package/dist/rules/due.d.ts +15 -0
  50. package/dist/rules/frame.d.ts +4 -0
  51. package/dist/rules/history.d.ts +34 -0
  52. package/dist/rules/inbound.d.ts +53 -0
  53. package/dist/rules/index.d.ts +13 -0
  54. package/dist/rules/index.js +4 -0
  55. package/dist/rules/index.js.map +1 -0
  56. package/dist/rules/message.d.ts +31 -0
  57. package/dist/rules/outcome.d.ts +45 -0
  58. package/dist/rules/priority.d.ts +52 -0
  59. package/dist/rules/rooms.d.ts +187 -0
  60. package/dist/rules/schema.d.ts +110 -0
  61. package/dist/rules/sync.d.ts +157 -0
  62. package/dist/rules/team.d.ts +119 -0
  63. package/dist/rules/turn.d.ts +129 -0
  64. package/dist/schema.d.ts +154 -0
  65. package/dist/switch.d.ts +53 -0
  66. package/dist/team-model.d.ts +54 -0
  67. package/dist/team.d.ts +56 -0
  68. package/dist/testing.d.ts +6 -0
  69. package/dist/testing.js +20 -0
  70. package/dist/testing.js.map +1 -0
  71. package/dist/toolset-policy.d.ts +2 -0
  72. package/dist/topology.d.ts +49 -0
  73. package/package.json +80 -4
@@ -0,0 +1,2 @@
1
+ /** Host declaration, not a proof about the tools' behavior. Never accept model annotations here. */
2
+ export declare function ownReadOnlyToolsets(ids?: readonly string[]): readonly string[];
@@ -0,0 +1,49 @@
1
+ import { type LedgerState } from '@byok-sdk/server/execution-core';
2
+ import { type CollaborationState } from './model.js';
3
+ import type { HomeOperation } from './team-model.js';
4
+ import { type SyncRefusal } from './rules/commands.js';
5
+ /** The L owner record of one device. A device with no row is `{ mode: 'L', revision: 0 }`: a device defaults to L. */
6
+ export interface DeviceTopology {
7
+ mode: 'L' | 'H';
8
+ revision: number;
9
+ switching?: 'H';
10
+ }
11
+ /** The device's open work that a switch must drain before it commits. */
12
+ export interface SwitchWork {
13
+ /** Open K4 intents whose execution names the device: Bot Turns, routine occurrences and Host intents. */
14
+ intents: string[];
15
+ /** Turns of the device's Bots with no conclusion and no intent. */
16
+ turns: string[];
17
+ /** Open input batches of the device's Bots. Each becomes a Turn when it seals. */
18
+ batches: string[];
19
+ /** Agent home writes of the device's Bots that were sent and have no terminal readback yet. */
20
+ homeOperations: number[];
21
+ }
22
+ /** The device's owner is now H. L never creates work on it again. Same code and reason as H's `DeviceBindingError`. */
23
+ export declare class DeviceModeError extends Error {
24
+ readonly deviceId: string;
25
+ readonly mode: 'H';
26
+ readonly revision: number;
27
+ readonly code = "device_not_bound";
28
+ readonly reason: 'mode';
29
+ constructor(deviceId: string, mode: 'H', revision: number);
30
+ }
31
+ export declare function deviceTopology(state: CollaborationState, deviceId: string): DeviceTopology;
32
+ /** The sync refusal of the device (#956 `deviceRefusal`), or undefined when L may create work on it. */
33
+ export declare function deviceRefusal(state: CollaborationState, deviceId: string): Extract<SyncRefusal, 'mode' | 'switching'> | undefined;
34
+ export declare function botDeviceRefusal(state: CollaborationState, botId: string): ReturnType<typeof deviceRefusal>;
35
+ /** Throws the typed refusal when L must not create work on the device. */
36
+ export declare function admitDevice(state: CollaborationState, deviceId: string): void;
37
+ /** An unknown Bot or room is left to the command, which refuses it. */
38
+ export declare function admitBot(state: CollaborationState, botId: string): void;
39
+ export declare function switchWork(s: LedgerState, deviceId: string): SwitchWork;
40
+ /** A home write that may have reached the server: marked before its first send. */
41
+ export declare function homeSent(op: HomeOperation): boolean;
42
+ export declare function switchDrained(work: SwitchWork): boolean;
43
+ /**
44
+ * One switch step on the expected revision. Each step raises the revision, so every later step names the one it expects.
45
+ * `freeze`: an L device that is not switching. `commit` and `abort`: a frozen device. A stale revision is a `CommitConflict`.
46
+ */
47
+ export declare function switchStep(s: LedgerState, deviceId: string, expectedRevision: number, step: 'freeze' | 'commit' | 'abort'): DeviceTopology;
48
+ /** A restart reads every row before any pass. A malformed row fails closed. */
49
+ export declare function checkTopology(state: CollaborationState): void;
package/package.json CHANGED
@@ -1,6 +1,82 @@
1
1
  {
2
2
  "name": "@byok-sdk/bot-collaboration",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.42.0",
4
+ "description": "K8 Bot collaboration for BYOK Hosts: the local Host, the modules a Host composes, the pure rules and shared test vectors, on the K4 execution core.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Ancienttwo/byok-sdk.git",
10
+ "directory": "packages/bot-collaboration"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/Ancienttwo/byok-sdk/issues"
14
+ },
15
+ "homepage": "https://github.com/Ancienttwo/byok-sdk#readme",
16
+ "engines": {
17
+ "node": ">=24.22.1"
18
+ },
19
+ "sideEffects": false,
20
+ "main": "./dist/index.js",
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js"
27
+ },
28
+ "./host-kit": {
29
+ "types": "./dist/host-kit.d.ts",
30
+ "import": "./dist/host-kit.js"
31
+ },
32
+ "./rules": {
33
+ "types": "./dist/rules/index.d.ts",
34
+ "import": "./dist/rules/index.js"
35
+ },
36
+ "./testing": {
37
+ "types": "./dist/testing.d.ts",
38
+ "import": "./dist/testing.js"
39
+ },
40
+ "./package.json": "./package.json"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "scripts": {
51
+ "build": "tsup && tsc -p tsconfig.build.json",
52
+ "typecheck": "tsc --noEmit",
53
+ "test": "vitest run",
54
+ "clean": "rm -rf dist"
55
+ },
56
+ "dependencies": {
57
+ "@byok-sdk/client": "0.42.0",
58
+ "@byok-sdk/protocol": "0.42.0",
59
+ "@byok-sdk/server": "0.42.0"
60
+ },
61
+ "peerDependencies": {
62
+ "@hono/node-server": "^2.1.3",
63
+ "vitest": "^5.1.0"
64
+ },
65
+ "peerDependenciesMeta": {
66
+ "@hono/node-server": {
67
+ "optional": true
68
+ },
69
+ "vitest": {
70
+ "optional": true
71
+ }
72
+ },
73
+ "devDependencies": {
74
+ "@byok-sdk/cloud": "0.42.0",
75
+ "@byok-sdk/core": "0.42.0",
76
+ "@byok-sdk/example-host-execution-core": "0.0.1",
77
+ "@hono/node-server": "^2.1.3",
78
+ "@types/node": "^24",
79
+ "typescript": "^7.0.2",
80
+ "vitest": "^5.1.0"
81
+ }
82
+ }