@chipschat/protocol 1.0.0 → 1.0.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.
Files changed (53) hide show
  1. package/package.json +2 -1
  2. package/dist/envelope.d.ts +0 -54
  3. package/dist/envelope.d.ts.map +0 -1
  4. package/dist/envelope.js +0 -48
  5. package/dist/envelope.js.map +0 -1
  6. package/dist/events/agent-to-chips.d.ts +0 -27
  7. package/dist/events/agent-to-chips.d.ts.map +0 -1
  8. package/dist/events/agent-to-chips.js +0 -392
  9. package/dist/events/agent-to-chips.js.map +0 -1
  10. package/dist/events/catalogue.d.ts +0 -48
  11. package/dist/events/catalogue.d.ts.map +0 -1
  12. package/dist/events/catalogue.js +0 -67
  13. package/dist/events/catalogue.js.map +0 -1
  14. package/dist/events/chips-to-agent.d.ts +0 -24
  15. package/dist/events/chips-to-agent.d.ts.map +0 -1
  16. package/dist/events/chips-to-agent.js +0 -324
  17. package/dist/events/chips-to-agent.js.map +0 -1
  18. package/dist/events/chips-to-harness.d.ts +0 -24
  19. package/dist/events/chips-to-harness.d.ts.map +0 -1
  20. package/dist/events/chips-to-harness.js +0 -324
  21. package/dist/events/chips-to-harness.js.map +0 -1
  22. package/dist/events/harness-to-chips.d.ts +0 -27
  23. package/dist/events/harness-to-chips.d.ts.map +0 -1
  24. package/dist/events/harness-to-chips.js +0 -390
  25. package/dist/events/harness-to-chips.js.map +0 -1
  26. package/dist/events/index.d.ts +0 -6
  27. package/dist/events/index.d.ts.map +0 -1
  28. package/dist/events/index.js +0 -5
  29. package/dist/events/index.js.map +0 -1
  30. package/dist/events/workspace.d.ts +0 -19
  31. package/dist/events/workspace.d.ts.map +0 -1
  32. package/dist/events/workspace.js +0 -79
  33. package/dist/events/workspace.js.map +0 -1
  34. package/dist/frames.d.ts +0 -175
  35. package/dist/frames.d.ts.map +0 -1
  36. package/dist/frames.js +0 -161
  37. package/dist/frames.js.map +0 -1
  38. package/dist/ids/index.d.ts +0 -3
  39. package/dist/ids/index.d.ts.map +0 -1
  40. package/dist/ids/index.js +0 -2
  41. package/dist/ids/index.js.map +0 -1
  42. package/dist/ids/ulid.d.ts +0 -83
  43. package/dist/ids/ulid.d.ts.map +0 -1
  44. package/dist/ids/ulid.js +0 -199
  45. package/dist/ids/ulid.js.map +0 -1
  46. package/dist/index.d.ts +0 -18
  47. package/dist/index.d.ts.map +0 -1
  48. package/dist/index.js +0 -13
  49. package/dist/index.js.map +0 -1
  50. package/dist/primitives.d.ts +0 -194
  51. package/dist/primitives.d.ts.map +0 -1
  52. package/dist/primitives.js +0 -193
  53. package/dist/primitives.js.map +0 -1
package/dist/frames.d.ts DELETED
@@ -1,175 +0,0 @@
1
- /**
2
- * The WebSocket frames of Appendix B. Frames are the envelope around events on `/v1/ws`:
3
- * they carry the handshake, subscription, acknowledgement and liveness that the event
4
- * vocabulary itself does not.
5
- *
6
- * One endpoint serves people and agents (decision 5). Every client-originated `event` frame
7
- * carries an idempotency key and is answered with `ack {key, seq}`, which is what makes a
8
- * reconnect safe: replaying a frame the server already applied changes nothing.
9
- */
10
- import { z } from "zod";
11
- /** The client's half of the handshake. The server answers with a `hello` event. */
12
- export declare const clientHelloFrame: z.ZodObject<{
13
- frame: z.ZodLiteral<"hello">;
14
- protocol: z.ZodObject<{
15
- min: z.ZodInt;
16
- max: z.ZodInt;
17
- }, z.core.$strip>;
18
- client: z.ZodObject<{
19
- name: z.ZodString;
20
- version: z.ZodString;
21
- }, z.core.$strip>;
22
- agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
23
- agent_id: z.ZodString;
24
- autonomy: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
25
- }, z.core.$strip>>>;
26
- since: z.ZodOptional<z.ZodInt>;
27
- }, z.core.$strip>;
28
- export declare const subscribeFrame: z.ZodObject<{
29
- frame: z.ZodLiteral<"subscribe">;
30
- workspace_id: z.ZodString;
31
- conversation_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
- since: z.ZodOptional<z.ZodInt>;
33
- }, z.core.$strip>;
34
- export declare const eventFrame: z.ZodObject<{
35
- frame: z.ZodLiteral<"event">;
36
- event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
37
- }, z.core.$strip>;
38
- export declare const ackFrame: z.ZodObject<{
39
- frame: z.ZodLiteral<"ack">;
40
- idempotency_key: z.ZodString;
41
- seq: z.ZodInt;
42
- duplicate: z.ZodDefault<z.ZodBoolean>;
43
- }, z.core.$strip>;
44
- export declare const receiptFrame: z.ZodObject<{
45
- frame: z.ZodLiteral<"receipt">;
46
- idempotency_key: z.ZodString;
47
- disposition: z.ZodEnum<{
48
- queued: "queued";
49
- steered: "steered";
50
- }>;
51
- }, z.core.$strip>;
52
- export declare const pingFrame: z.ZodObject<{
53
- frame: z.ZodLiteral<"ping">;
54
- ts: z.ZodInt;
55
- }, z.core.$strip>;
56
- export declare const pongFrame: z.ZodObject<{
57
- frame: z.ZodLiteral<"pong">;
58
- ts: z.ZodInt;
59
- }, z.core.$strip>;
60
- /** Error codes are a closed set so a client can branch on them without parsing prose. */
61
- export declare const errorCode: z.ZodEnum<{
62
- internal: "internal";
63
- protocol_unsupported: "protocol_unsupported";
64
- unauthorized: "unauthorized";
65
- forbidden: "forbidden";
66
- not_found: "not_found";
67
- invalid_event: "invalid_event";
68
- invalid_frame: "invalid_frame";
69
- rate_limited: "rate_limited";
70
- too_far_behind: "too_far_behind";
71
- budget_exhausted: "budget_exhausted";
72
- }>;
73
- export type ErrorCode = z.infer<typeof errorCode>;
74
- export declare const errorFrame: z.ZodObject<{
75
- frame: z.ZodLiteral<"error">;
76
- code: z.ZodEnum<{
77
- internal: "internal";
78
- protocol_unsupported: "protocol_unsupported";
79
- unauthorized: "unauthorized";
80
- forbidden: "forbidden";
81
- not_found: "not_found";
82
- invalid_event: "invalid_event";
83
- invalid_frame: "invalid_frame";
84
- rate_limited: "rate_limited";
85
- too_far_behind: "too_far_behind";
86
- budget_exhausted: "budget_exhausted";
87
- }>;
88
- message: z.ZodString;
89
- idempotency_key: z.ZodOptional<z.ZodString>;
90
- retry_after_seconds: z.ZodOptional<z.ZodInt>;
91
- }, z.core.$strip>;
92
- export declare const clientFrame: z.ZodDiscriminatedUnion<[z.ZodObject<{
93
- frame: z.ZodLiteral<"hello">;
94
- protocol: z.ZodObject<{
95
- min: z.ZodInt;
96
- max: z.ZodInt;
97
- }, z.core.$strip>;
98
- client: z.ZodObject<{
99
- name: z.ZodString;
100
- version: z.ZodString;
101
- }, z.core.$strip>;
102
- agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
103
- agent_id: z.ZodString;
104
- autonomy: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>>;
105
- }, z.core.$strip>>>;
106
- since: z.ZodOptional<z.ZodInt>;
107
- }, z.core.$strip>, z.ZodObject<{
108
- frame: z.ZodLiteral<"subscribe">;
109
- workspace_id: z.ZodString;
110
- conversation_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
- since: z.ZodOptional<z.ZodInt>;
112
- }, z.core.$strip>, z.ZodObject<{
113
- frame: z.ZodLiteral<"event">;
114
- event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
115
- }, z.core.$strip>, z.ZodObject<{
116
- frame: z.ZodLiteral<"ping">;
117
- ts: z.ZodInt;
118
- }, z.core.$strip>, z.ZodObject<{
119
- frame: z.ZodLiteral<"pong">;
120
- ts: z.ZodInt;
121
- }, z.core.$strip>], "frame">;
122
- export type ClientFrame = z.infer<typeof clientFrame>;
123
- export declare const serverFrame: z.ZodDiscriminatedUnion<[z.ZodObject<{
124
- frame: z.ZodLiteral<"event">;
125
- event: z.ZodRecord<z.ZodString, z.ZodUnknown>;
126
- }, z.core.$strip>, z.ZodObject<{
127
- frame: z.ZodLiteral<"ack">;
128
- idempotency_key: z.ZodString;
129
- seq: z.ZodInt;
130
- duplicate: z.ZodDefault<z.ZodBoolean>;
131
- }, z.core.$strip>, z.ZodObject<{
132
- frame: z.ZodLiteral<"receipt">;
133
- idempotency_key: z.ZodString;
134
- disposition: z.ZodEnum<{
135
- queued: "queued";
136
- steered: "steered";
137
- }>;
138
- }, z.core.$strip>, z.ZodObject<{
139
- frame: z.ZodLiteral<"ping">;
140
- ts: z.ZodInt;
141
- }, z.core.$strip>, z.ZodObject<{
142
- frame: z.ZodLiteral<"pong">;
143
- ts: z.ZodInt;
144
- }, z.core.$strip>, z.ZodObject<{
145
- frame: z.ZodLiteral<"error">;
146
- code: z.ZodEnum<{
147
- internal: "internal";
148
- protocol_unsupported: "protocol_unsupported";
149
- unauthorized: "unauthorized";
150
- forbidden: "forbidden";
151
- not_found: "not_found";
152
- invalid_event: "invalid_event";
153
- invalid_frame: "invalid_frame";
154
- rate_limited: "rate_limited";
155
- too_far_behind: "too_far_behind";
156
- budget_exhausted: "budget_exhausted";
157
- }>;
158
- message: z.ZodString;
159
- idempotency_key: z.ZodOptional<z.ZodString>;
160
- retry_after_seconds: z.ZodOptional<z.ZodInt>;
161
- }, z.core.$strip>], "frame">;
162
- export type ServerFrame = z.infer<typeof serverFrame>;
163
- export declare const FRAME_NAMES: readonly ["hello", "subscribe", "event", "ack", "receipt", "ping", "pong", "error"];
164
- /**
165
- * Pick the version both sides speak, or nothing when the ranges do not overlap.
166
- * `hello` negotiates `{min, max}` (decision 7).
167
- */
168
- export declare function negotiateProtocol(client: {
169
- min: number;
170
- max: number;
171
- }, server?: {
172
- min: number;
173
- max: number;
174
- }): number | undefined;
175
- //# sourceMappingURL=frames.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../src/frames.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,mFAAmF;AACnF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;iBA+BiB,CAAC;AAE/C,eAAO,MAAM,cAAc;;;;;iBAe4D,CAAC;AAExF,eAAO,MAAM,UAAU;;;iBAM8B,CAAC;AAEtD,eAAO,MAAM,QAAQ;;;;;iBAc2C,CAAC;AAEjE,eAAO,MAAM,YAAY;;;;;;;iBAQyD,CAAC;AAEnF,eAAO,MAAM,SAAS;;;iBAQ6D,CAAC;AAEpF,eAAO,MAAM,SAAS;;;iBAEqC,CAAC;AAE5D,yFAAyF;AACzF,eAAO,MAAM,SAAS;;;;;;;;;;;EAWpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;iBAYyD,CAAC;AAEjF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAEkB,CAAC;AAC3C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BASoB,CAAC;AAC7C,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,WAAW,qFASd,CAAC;AAEX;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACpC,MAAM,GAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAqD,GACtF,MAAM,GAAG,SAAS,CAIpB"}
package/dist/frames.js DELETED
@@ -1,161 +0,0 @@
1
- /**
2
- * The WebSocket frames of Appendix B. Frames are the envelope around events on `/v1/ws`:
3
- * they carry the handshake, subscription, acknowledgement and liveness that the event
4
- * vocabulary itself does not.
5
- *
6
- * One endpoint serves people and agents (decision 5). Every client-originated `event` frame
7
- * carries an idempotency key and is answered with `ack {key, seq}`, which is what makes a
8
- * reconnect safe: replaying a frame the server already applied changes nothing.
9
- */
10
- import { z } from "zod";
11
- import { PROTOCOL_VERSION } from "./envelope.js";
12
- import { autonomyLevel, id } from "./primitives.js";
13
- /** The client's half of the handshake. The server answers with a `hello` event. */
14
- export const clientHelloFrame = z
15
- .object({
16
- frame: z.literal("hello"),
17
- protocol: z
18
- .object({
19
- min: z.int().positive().describe("Oldest major version the client accepts."),
20
- max: z.int().positive().describe("Newest major version the client speaks."),
21
- })
22
- .describe("The client's range. The server picks the highest version both sides support."),
23
- client: z
24
- .object({
25
- name: z.string().min(1).max(120).describe("The harness or app name."),
26
- version: z.string().min(1).max(60),
27
- })
28
- .describe("Who is connecting, for the connection list and for support."),
29
- agents: z
30
- .array(z.object({
31
- agent_id: id("agent"),
32
- autonomy: autonomyLevel.optional().describe("The level the harness believes it has."),
33
- }))
34
- .max(64)
35
- .optional()
36
- .describe("One connection can present many agents. Absent for a person's client."),
37
- since: z
38
- .int()
39
- .nonnegative()
40
- .optional()
41
- .describe("Resume from this `seq`. Absent means start from now."),
42
- })
43
- .describe("The first frame a client sends.");
44
- export const subscribeFrame = z
45
- .object({
46
- frame: z.literal("subscribe"),
47
- workspace_id: id("workspace"),
48
- conversation_ids: z
49
- .array(id("conversation"))
50
- .max(200)
51
- .optional()
52
- .describe("Narrow to these conversations. Absent means the whole workspace."),
53
- since: z
54
- .int()
55
- .nonnegative()
56
- .optional()
57
- .describe("Replay from this `seq` before streaming live."),
58
- })
59
- .describe("Ask for a stream. Subscriptions are keyed by workspace and conversation.");
60
- export const eventFrame = z
61
- .object({
62
- frame: z.literal("event"),
63
- /** Validated against the catalogue, not here: the frame layer only routes. */
64
- event: z.record(z.string(), z.unknown()).describe("Any Agent Connect event."),
65
- })
66
- .describe("Carries one event in either direction.");
67
- export const ackFrame = z
68
- .object({
69
- frame: z.literal("ack"),
70
- idempotency_key: z
71
- .string()
72
- .min(1)
73
- .max(200)
74
- .describe("The key from the frame being acknowledged."),
75
- seq: z.int().positive().describe("The sequence number the event was appended at."),
76
- duplicate: z
77
- .boolean()
78
- .default(false)
79
- .describe("True when this key had already been applied, so nothing changed."),
80
- })
81
- .describe("The server's answer to a client-originated event.");
82
- export const receiptFrame = z
83
- .object({
84
- frame: z.literal("receipt"),
85
- idempotency_key: z.string().min(1).max(200),
86
- disposition: z
87
- .enum(["queued", "steered"])
88
- .describe("What Chips did with a message sent mid-run."),
89
- })
90
- .describe("Tells a sender whether their mid-run message was queued or steered.");
91
- export const pingFrame = z
92
- .object({
93
- frame: z.literal("ping"),
94
- ts: z
95
- .int()
96
- .nonnegative()
97
- .describe("Sender's clock, in milliseconds, for a round-trip estimate."),
98
- })
99
- .describe("Heartbeat. Every twenty seconds; a silent socket is closed at sixty.");
100
- export const pongFrame = z
101
- .object({ frame: z.literal("pong"), ts: z.int().nonnegative() })
102
- .describe("The answer to a ping, echoing its timestamp.");
103
- /** Error codes are a closed set so a client can branch on them without parsing prose. */
104
- export const errorCode = z.enum([
105
- "protocol_unsupported",
106
- "unauthorized",
107
- "forbidden",
108
- "not_found",
109
- "invalid_event",
110
- "invalid_frame",
111
- "rate_limited",
112
- "too_far_behind",
113
- "budget_exhausted",
114
- "internal",
115
- ]);
116
- export const errorFrame = z
117
- .object({
118
- frame: z.literal("error"),
119
- code: errorCode,
120
- message: z.string().min(1).max(2000).describe("What went wrong, in the product voice."),
121
- idempotency_key: z
122
- .string()
123
- .max(200)
124
- .optional()
125
- .describe("The frame at fault, when there was one."),
126
- retry_after_seconds: z.int().nonnegative().optional().describe("When rate limited."),
127
- })
128
- .describe("Something went wrong. `too_far_behind` means resume with `since`.");
129
- export const clientFrame = z
130
- .discriminatedUnion("frame", [clientHelloFrame, subscribeFrame, eventFrame, pingFrame, pongFrame])
131
- .describe("Anything a client may send.");
132
- export const serverFrame = z
133
- .discriminatedUnion("frame", [
134
- eventFrame,
135
- ackFrame,
136
- receiptFrame,
137
- pingFrame,
138
- pongFrame,
139
- errorFrame,
140
- ])
141
- .describe("Anything the server may send.");
142
- export const FRAME_NAMES = [
143
- "hello",
144
- "subscribe",
145
- "event",
146
- "ack",
147
- "receipt",
148
- "ping",
149
- "pong",
150
- "error",
151
- ];
152
- /**
153
- * Pick the version both sides speak, or nothing when the ranges do not overlap.
154
- * `hello` negotiates `{min, max}` (decision 7).
155
- */
156
- export function negotiateProtocol(client, server = { min: PROTOCOL_VERSION, max: PROTOCOL_VERSION }) {
157
- const highest = Math.min(client.max, server.max);
158
- const lowest = Math.max(client.min, server.min);
159
- return highest >= lowest ? highest : undefined;
160
- }
161
- //# sourceMappingURL=frames.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"frames.js","sourceRoot":"","sources":["../src/frames.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAEpD,mFAAmF;AACnF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACzB,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;QAC5E,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;KAC5E,CAAC;SACD,QAAQ,CAAC,8EAA8E,CAAC;IAC3F,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAA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E,SAAS,EAAE,SAAS,CAAC,CAAC;KACjG,QAAQ,CAAC,6BAA6B,CAAC,CAAC;AAG3C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,kBAAkB,CAAC,OAAO,EAAE;IAC3B,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,SAAS;IACT,UAAU;CACX,CAAC;KACD,QAAQ,CAAC,+BAA+B,CAAC,CAAC;AAG7C,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO;IACP,WAAW;IACX,OAAO;IACP,KAAK;IACL,SAAS;IACT,MAAM;IACN,MAAM;IACN,OAAO;CACC,CAAC;AAEX;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAoC,EACpC,SAAuC,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,EAAE;IAEvF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAChD,OAAO,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC"}
@@ -1,3 +0,0 @@
1
- export type { Id, IdGenerator, IdGeneratorOptions, IdKind, IdPrefix } from "./ulid.js";
2
- export { createIdGenerator, defaultIdGenerator, eventIdOfMessage, ID_PREFIXES, InvalidIdError, isId, messageIdOf, newId, parseId, timestampOf, } from "./ulid.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ids/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACvF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,WAAW,GACZ,MAAM,WAAW,CAAC"}
package/dist/ids/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { createIdGenerator, defaultIdGenerator, eventIdOfMessage, ID_PREFIXES, InvalidIdError, isId, messageIdOf, newId, parseId, timestampOf, } from "./ulid.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ids/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,IAAI,EACJ,WAAW,EACX,KAAK,EACL,OAAO,EACP,WAAW,GACZ,MAAM,WAAW,CAAC"}
@@ -1,83 +0,0 @@
1
- /**
2
- * Identifiers are ULIDs with a type prefix (technical-plan decision 11). Always strings,
3
- * always sortable by creation time, and self-describing: `run_01JB...` can only ever be a
4
- * run. Generation goes through a port so tests are deterministic (6.1).
5
- *
6
- * This lives in `packages/protocol` rather than `packages/platform` because an id is part of
7
- * the wire format: every envelope carries three of them. Keeping it here means `@chips/agent`
8
- * can validate ids without pulling a logger and a metrics API into an SDK.
9
- *
10
- * The encoding is the ULID spec: 48 bits of millisecond timestamp in ten Crockford base32
11
- * characters, then 80 bits of randomness in sixteen. Ids minted in the same millisecond are
12
- * made strictly increasing by incrementing the random component, so `seq` is not the only
13
- * thing that orders a workspace's history.
14
- */
15
- /**
16
- * The prefix for each kind of thing Chips names.
17
- *
18
- * The first eleven are decision 11's list. The last three extend it: an event needs an id
19
- * of its own to be idempotent across a reconnect, and devices and agent tokens are rows in
20
- * the schema M0.3 creates. The extension is recorded in STATUS.md.
21
- */
22
- export declare const ID_PREFIXES: {
23
- readonly workspace: "ws";
24
- readonly person: "usr";
25
- readonly agent: "agt";
26
- readonly conversation: "conv";
27
- readonly message: "msg";
28
- readonly run: "run";
29
- readonly step: "stp";
30
- readonly approval: "apr";
31
- readonly question: "qst";
32
- readonly lane: "lane";
33
- readonly attachment: "att";
34
- readonly event: "evt";
35
- readonly device: "dev";
36
- readonly token: "tok";
37
- };
38
- export type IdKind = keyof typeof ID_PREFIXES;
39
- export type IdPrefix = (typeof ID_PREFIXES)[IdKind];
40
- export type Id<K extends IdKind = IdKind> = `${(typeof ID_PREFIXES)[K]}_${string}`;
41
- /** Thrown when a string that should be an id is not one. */
42
- export declare class InvalidIdError extends Error {
43
- readonly value: string;
44
- readonly name = "InvalidIdError";
45
- constructor(value: string, reason: string);
46
- }
47
- export interface IdGenerator {
48
- /** Mint a new id of the given kind. */
49
- next: <K extends IdKind>(kind: K) => Id<K>;
50
- }
51
- export interface IdGeneratorOptions {
52
- /** Milliseconds since the epoch. Defaults to the system clock. */
53
- now?: () => number;
54
- /** Fills the supplied buffer with randomness. Defaults to `crypto.getRandomValues`. */
55
- randomFill?: (into: Uint8Array) => void;
56
- }
57
- /**
58
- * A generator that is monotonic within a millisecond. Two generators are independent; a
59
- * process that needs strictly ordered ids uses one.
60
- */
61
- export declare function createIdGenerator(options?: IdGeneratorOptions): IdGenerator;
62
- /** The process-wide generator. Code that can inject a generator should do that instead. */
63
- export declare const defaultIdGenerator: IdGenerator;
64
- /** Mint an id with the process-wide generator. */
65
- export declare function newId<K extends IdKind>(kind: K): Id<K>;
66
- /** True when `value` is an id of the given kind. */
67
- export declare function isId<K extends IdKind>(kind: K, value: unknown): value is Id<K>;
68
- /** Split an id into its kind and ULID, or throw if it is not an id. */
69
- export declare function parseId(value: string): {
70
- kind: IdKind;
71
- ulid: string;
72
- };
73
- /** The instant an id was minted. */
74
- export declare function timestampOf(value: string): number;
75
- /**
76
- * The id a message has on the wire. A message is its event: the row and the reference both
77
- * carry the event's ULID, and `message.new` names it with the message prefix so a `reply_to`
78
- * is a message id and not an event id. Pure, and the same in both directions.
79
- */
80
- export declare function messageIdOf(eventId: string): Id<"message">;
81
- /** The event an on-the-wire message id names. */
82
- export declare function eventIdOfMessage(messageId: string): Id<"event">;
83
- //# sourceMappingURL=ulid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ulid.d.ts","sourceRoot":"","sources":["../../src/ids/ulid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;CAed,CAAC;AAEX,MAAM,MAAM,MAAM,GAAG,MAAM,OAAO,WAAW,CAAC;AAC9C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACpD,MAAM,MAAM,EAAE,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;AAanF,4DAA4D;AAC5D,qBAAa,cAAe,SAAQ,KAAK;IAGrC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAFxB,SAAkB,IAAI,oBAAoB;gBAE/B,KAAK,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM;CAIjB;AAED,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,IAAI,EAAE,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,uFAAuF;IACvF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;CACzC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAc/E;AAkCD,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,EAAE,WAAiC,CAAC;AAEnE,kDAAkD;AAClD,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAEtD;AAED,oDAAoD;AACpD,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAI9E;AAED,uEAAuE;AACvE,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAMrE;AAED,oCAAoC;AACpC,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAwED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC,SAAS,CAAC,CAE1D;AAED,iDAAiD;AACjD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,CAE/D"}
package/dist/ids/ulid.js DELETED
@@ -1,199 +0,0 @@
1
- /**
2
- * Identifiers are ULIDs with a type prefix (technical-plan decision 11). Always strings,
3
- * always sortable by creation time, and self-describing: `run_01JB...` can only ever be a
4
- * run. Generation goes through a port so tests are deterministic (6.1).
5
- *
6
- * This lives in `packages/protocol` rather than `packages/platform` because an id is part of
7
- * the wire format: every envelope carries three of them. Keeping it here means `@chips/agent`
8
- * can validate ids without pulling a logger and a metrics API into an SDK.
9
- *
10
- * The encoding is the ULID spec: 48 bits of millisecond timestamp in ten Crockford base32
11
- * characters, then 80 bits of randomness in sixteen. Ids minted in the same millisecond are
12
- * made strictly increasing by incrementing the random component, so `seq` is not the only
13
- * thing that orders a workspace's history.
14
- */
15
- /**
16
- * The prefix for each kind of thing Chips names.
17
- *
18
- * The first eleven are decision 11's list. The last three extend it: an event needs an id
19
- * of its own to be idempotent across a reconnect, and devices and agent tokens are rows in
20
- * the schema M0.3 creates. The extension is recorded in STATUS.md.
21
- */
22
- export const ID_PREFIXES = {
23
- workspace: "ws",
24
- person: "usr",
25
- agent: "agt",
26
- conversation: "conv",
27
- message: "msg",
28
- run: "run",
29
- step: "stp",
30
- approval: "apr",
31
- question: "qst",
32
- lane: "lane",
33
- attachment: "att",
34
- event: "evt",
35
- device: "dev",
36
- token: "tok",
37
- };
38
- const ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
39
- const TIME_CHARS = 10;
40
- const RANDOM_CHARS = 16;
41
- const RANDOM_BYTES = 10;
42
- const ULID_CHARS = TIME_CHARS + RANDOM_CHARS;
43
- const MAX_TIME_MS = 281_474_976_710_655; // 2^48 - 1
44
- const PREFIX_TO_KIND = new Map(Object.entries(ID_PREFIXES).map(([kind, prefix]) => [prefix, kind]));
45
- /** Thrown when a string that should be an id is not one. */
46
- export class InvalidIdError extends Error {
47
- value;
48
- name = "InvalidIdError";
49
- constructor(value, reason) {
50
- super(`invalid id ${JSON.stringify(value)}: ${reason}`);
51
- this.value = value;
52
- }
53
- }
54
- /**
55
- * A generator that is monotonic within a millisecond. Two generators are independent; a
56
- * process that needs strictly ordered ids uses one.
57
- */
58
- export function createIdGenerator(options = {}) {
59
- const now = options.now ?? Date.now;
60
- const randomFill = options.randomFill ?? defaultRandomFill;
61
- const cursor = { time: -1, random: new Uint8Array(RANDOM_BYTES) };
62
- return {
63
- next(kind) {
64
- const prefix = ID_PREFIXES[kind];
65
- if (prefix === undefined)
66
- throw new InvalidIdError(String(kind), "unknown id kind");
67
- advance(cursor, requireTimestamp(now()), randomFill);
68
- return `${prefix}_${encodeTime(cursor.time)}${encodeRandom(cursor.random)}`;
69
- },
70
- };
71
- }
72
- /**
73
- * Move the cursor to the next id position. A later millisecond starts fresh. The same
74
- * millisecond, or a clock that has moved backwards, steps the randomness instead, so the
75
- * id still sorts after its predecessor; when the randomness is exhausted it borrows the
76
- * next millisecond rather than colliding.
77
- */
78
- function advance(cursor, nowMs, randomFill) {
79
- if (nowMs > cursor.time) {
80
- cursor.time = nowMs;
81
- cursor.random = freshRandom(randomFill);
82
- return;
83
- }
84
- if (!incrementInPlace(cursor.random)) {
85
- cursor.time += 1;
86
- cursor.random = freshRandom(randomFill);
87
- }
88
- }
89
- function requireTimestamp(value) {
90
- const time = Math.floor(value);
91
- if (!Number.isFinite(time) || time < 0 || time > MAX_TIME_MS) {
92
- throw new RangeError(`timestamp ${value} is outside the range a ULID can hold`);
93
- }
94
- return time;
95
- }
96
- /** The process-wide generator. Code that can inject a generator should do that instead. */
97
- export const defaultIdGenerator = createIdGenerator();
98
- /** Mint an id with the process-wide generator. */
99
- export function newId(kind) {
100
- return defaultIdGenerator.next(kind);
101
- }
102
- /** True when `value` is an id of the given kind. */
103
- export function isId(kind, value) {
104
- if (typeof value !== "string")
105
- return false;
106
- const parsed = tryParseId(value);
107
- return parsed !== undefined && parsed.kind === kind;
108
- }
109
- /** Split an id into its kind and ULID, or throw if it is not an id. */
110
- export function parseId(value) {
111
- const parsed = tryParseId(value);
112
- if (parsed === undefined) {
113
- throw new InvalidIdError(value, "expected <prefix>_<26 character ULID>");
114
- }
115
- return parsed;
116
- }
117
- /** The instant an id was minted. */
118
- export function timestampOf(value) {
119
- return decodeTime(parseId(value).ulid);
120
- }
121
- function tryParseId(value) {
122
- const underscore = value.indexOf("_");
123
- if (underscore <= 0)
124
- return undefined;
125
- const kind = PREFIX_TO_KIND.get(value.slice(0, underscore));
126
- if (kind === undefined)
127
- return undefined;
128
- const ulid = value.slice(underscore + 1);
129
- if (ulid.length !== ULID_CHARS)
130
- return undefined;
131
- for (let i = 0; i < ULID_CHARS; i += 1) {
132
- if (ALPHABET.indexOf(ulid.charAt(i)) < 0)
133
- return undefined;
134
- }
135
- // Ten base32 characters hold fifty bits; a timestamp holds forty-eight.
136
- if (ALPHABET.indexOf(ulid.charAt(0)) > 7)
137
- return undefined;
138
- return { kind, ulid };
139
- }
140
- function encodeTime(timeMs) {
141
- let remaining = timeMs;
142
- let out = "";
143
- for (let i = 0; i < TIME_CHARS; i += 1) {
144
- out = ALPHABET.charAt(remaining % 32) + out;
145
- remaining = Math.floor(remaining / 32);
146
- }
147
- return out;
148
- }
149
- function decodeTime(ulid) {
150
- let time = 0;
151
- for (let i = 0; i < TIME_CHARS; i += 1) {
152
- time = time * 32 + ALPHABET.indexOf(ulid.charAt(i));
153
- }
154
- return time;
155
- }
156
- function encodeRandom(bytes) {
157
- let value = 0n;
158
- for (const byte of bytes)
159
- value = (value << 8n) | BigInt(byte);
160
- let out = "";
161
- for (let i = 0; i < RANDOM_CHARS; i += 1) {
162
- out = ALPHABET.charAt(Number(value & 31n)) + out;
163
- value >>= 5n;
164
- }
165
- return out;
166
- }
167
- function freshRandom(randomFill) {
168
- const bytes = new Uint8Array(RANDOM_BYTES);
169
- randomFill(bytes);
170
- return bytes;
171
- }
172
- /** Adds one to a big-endian byte array. Returns false when it would overflow. */
173
- function incrementInPlace(bytes) {
174
- for (let i = bytes.length - 1; i >= 0; i -= 1) {
175
- const byte = bytes[i] ?? 0;
176
- if (byte < 0xff) {
177
- bytes[i] = byte + 1;
178
- return true;
179
- }
180
- bytes[i] = 0;
181
- }
182
- return false;
183
- }
184
- function defaultRandomFill(into) {
185
- globalThis.crypto.getRandomValues(into);
186
- }
187
- /**
188
- * The id a message has on the wire. A message is its event: the row and the reference both
189
- * carry the event's ULID, and `message.new` names it with the message prefix so a `reply_to`
190
- * is a message id and not an event id. Pure, and the same in both directions.
191
- */
192
- export function messageIdOf(eventId) {
193
- return `${ID_PREFIXES.message}_${parseId(eventId).ulid}`;
194
- }
195
- /** The event an on-the-wire message id names. */
196
- export function eventIdOfMessage(messageId) {
197
- return `${ID_PREFIXES.event}_${parseId(messageId).ulid}`;
198
- }
199
- //# sourceMappingURL=ulid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ulid.js","sourceRoot":"","sources":["../../src/ids/ulid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;G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