@inixiative/signet 0.6.1 → 0.7.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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/threads.ts +33 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inixiative/signet",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "Present Kingdom Signets: the wire contracts, DPoP proofs, device pairing and a renewing client shared by Kingdom, Archive, Foundry and Oracle.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -35,7 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@asteasolutions/zod-to-openapi": "^9.1.0",
37
37
  "@biomejs/biome": "2.5.2",
38
- "@inixiative/config": "^0.5.157",
38
+ "@inixiative/config": "^0.5.158",
39
39
  "@types/bun": "1.4.4",
40
40
  "lefthook": "2.1.9",
41
41
  "typescript": "6.0.3",
package/src/threads.ts CHANGED
@@ -48,6 +48,13 @@ export const threadViewSchema = z.enum(['own', 'thread']);
48
48
  export const threadDeliverySchema = z.enum(['note', 'turn']);
49
49
  /** `review`: the host's sends to this member wait for the owner. `auto`: they leave at once. */
50
50
  export const threadOutboundSchema = z.enum(['review', 'auto']);
51
+ /**
52
+ * The member's own floor rights. `mayTake`: it may take the conch without being given it (a senior
53
+ * pairing with a junior). A role changes by revising the Signet, never in a separate table (Aron,
54
+ * 2026-11-01: "You join with a certain thing... and then you can have it changed or granted or
55
+ * ungranted").
56
+ */
57
+ export const threadFloorTermsSchema = z.strictObject({ mayTake: z.boolean().default(false) });
51
58
 
52
59
  /**
53
60
  * A member's terms on a `threads` resource. Every term but the selector defaults to its narrowest
@@ -59,6 +66,7 @@ export const threadsLensSchema = z.strictObject({
59
66
  view: threadViewSchema.default('own'),
60
67
  delivery: threadDeliverySchema.default('note'),
61
68
  outbound: threadOutboundSchema.default('review'),
69
+ floor: threadFloorTermsSchema.default({ mayTake: false }),
62
70
  });
63
71
  export type ThreadsLens = z.infer<typeof threadsLensSchema>;
64
72
 
@@ -90,12 +98,16 @@ const narrowsView = order(threadViewSchema.options);
90
98
  const narrowsDelivery = order(threadDeliverySchema.options);
91
99
  const narrowsOutbound = order(threadOutboundSchema.options);
92
100
 
93
- /** Approving a request may only narrow (`own` < `thread`, `note` < `turn`, `review` < `auto`). */
101
+ /**
102
+ * Approving a request may only narrow (`own` < `thread`, `note` < `turn`, `review` < `auto`, and
103
+ * `floor.mayTake` only where it was asked for).
104
+ */
94
105
  export const narrowsThreadsLens = (granted: ThreadsLens, requested: ThreadsLens): boolean =>
95
106
  narrowsThreadSelector(granted.threads, requested.threads) &&
96
107
  narrowsView(granted.view, requested.view) &&
97
108
  narrowsDelivery(granted.delivery, requested.delivery) &&
98
- narrowsOutbound(granted.outbound, requested.outbound);
109
+ narrowsOutbound(granted.outbound, requested.outbound) &&
110
+ (!granted.floor.mayTake || requested.floor.mayTake);
99
111
 
100
112
  /** The operations a `threads` resource carries. `prompt.resolve` is for owner recipients only. */
101
113
  export const threadOperationSchema = z.enum([
@@ -131,6 +143,8 @@ export const threadTextLimit = 16_000;
131
143
 
132
144
  export const threadFloorActionSchema = z.discriminatedUnion('action', [
133
145
  z.strictObject({ action: z.literal('request') }),
146
+ /** Take the conch without being given it: only under `floor.mayTake`. */
147
+ z.strictObject({ action: z.literal('take') }),
134
148
  z.strictObject({ action: z.literal('release') }),
135
149
  z.strictObject({ action: z.literal('pass'), to: conversationMemberSchema }),
136
150
  ]);
@@ -164,15 +178,30 @@ export const threadInputSchemas = {
164
178
  }),
165
179
  } as const satisfies Record<ThreadOperation, z.ZodObject>;
166
180
 
181
+ /**
182
+ * A commissioned task (Aron, 2026-11-01): a send that asks a member's agent for work. `report`
183
+ * is fixed by the caller's person when the send is released: `post` lets the report enter the
184
+ * thread against this commission, `notify` tells only the caller.
185
+ */
186
+ export const threadCommissionSchema = z.strictObject({
187
+ report: z.enum(['post', 'notify']),
188
+ expiresAt: z.iso.datetime(),
189
+ });
190
+ export type ThreadCommission = z.infer<typeof threadCommissionSchema>;
191
+
167
192
  /**
168
193
  * One entry of the main thread's journal as a member sees it: an owner message, a main-agent
169
- * message, a member's post (`member` = its author) or a released send (`member` = the addressee).
194
+ * message, a member's post (`member` = its author), a released send (`member` = the addressee;
195
+ * `commission` when it asks for work), or an aside: person to person, out of the thread's log
196
+ * (`member` = its author, `to` = the one person it is for; never shown to an agent).
170
197
  */
171
198
  export const threadEntrySchema = z.object({
172
199
  journalSeq: z.number().int().min(0),
173
200
  at: z.iso.datetime(),
174
- kind: z.enum(['owner', 'agent', 'post', 'send']),
201
+ kind: z.enum(['owner', 'agent', 'post', 'send', 'aside']),
175
202
  member: conversationMemberSchema.nullable(),
203
+ to: conversationMemberSchema.optional(),
204
+ commission: threadCommissionSchema.optional(),
176
205
  text: z.string().max(threadTextLimit),
177
206
  });
178
207
  export type ThreadEntry = z.infer<typeof threadEntrySchema>;