@inixiative/signet 0.6.0 → 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.
- package/package.json +2 -2
- package/src/archive.ts +6 -1
- package/src/contracts.ts +1 -0
- package/src/threads.ts +33 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inixiative/signet",
|
|
3
|
-
"version": "0.
|
|
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.
|
|
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/archive.ts
CHANGED
|
@@ -73,7 +73,11 @@ export const archiveInputSchemas = {
|
|
|
73
73
|
projectId: z.string().min(1).max(256).optional(),
|
|
74
74
|
tag: z.string().min(1).max(120).optional(),
|
|
75
75
|
}),
|
|
76
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* An Archive snapshot (`@inixiative/archive`), parsed by Kingdom before it is stored. `restore`
|
|
78
|
+
* brings back a session deleted at the hosted Archive on purpose (a routed part sent back), which
|
|
79
|
+
* its tombstone otherwise refuses.
|
|
80
|
+
*/
|
|
77
81
|
'sessions.write': z.strictObject({
|
|
78
82
|
snapshot: z.record(z.string(), z.unknown()),
|
|
79
83
|
previousDigest: z
|
|
@@ -81,6 +85,7 @@ export const archiveInputSchemas = {
|
|
|
81
85
|
.regex(/^[a-f0-9]{64}$/)
|
|
82
86
|
.nullable()
|
|
83
87
|
.optional(),
|
|
88
|
+
restore: z.boolean().optional(),
|
|
84
89
|
}),
|
|
85
90
|
'sessions.delete': z.strictObject({ documentId: archiveDocumentIdSchema }),
|
|
86
91
|
} as const satisfies Record<ArchiveOperation, z.ZodObject>;
|
package/src/contracts.ts
CHANGED
|
@@ -399,6 +399,7 @@ export const accessInputSchema = z.strictObject({
|
|
|
399
399
|
.regex(/^[a-f0-9]{64}$/)
|
|
400
400
|
.nullable()
|
|
401
401
|
.optional(),
|
|
402
|
+
restore: z.boolean().optional(),
|
|
402
403
|
threadId: threadIdSchema.optional(),
|
|
403
404
|
postId: z.uuid().optional(),
|
|
404
405
|
text: z.string().min(1).max(threadTextLimit).optional(),
|
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
|
-
/**
|
|
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)
|
|
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>;
|