@agenticprimitives/fabric 0.0.0-alpha.3 → 0.0.0-alpha.5

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 (78) hide show
  1. package/CLAUDE.md +12 -2
  2. package/dist/cloudflare/index.d.ts +1 -0
  3. package/dist/cloudflare/index.d.ts.map +1 -1
  4. package/dist/cloudflare/index.js +4 -0
  5. package/dist/cloudflare/index.js.map +1 -1
  6. package/dist/cloudflare/interaction-store.d.ts +55 -0
  7. package/dist/cloudflare/interaction-store.d.ts.map +1 -0
  8. package/dist/cloudflare/interaction-store.js +230 -0
  9. package/dist/cloudflare/interaction-store.js.map +1 -0
  10. package/dist/cloudflare/principal-gateway-do.d.ts +118 -2
  11. package/dist/cloudflare/principal-gateway-do.d.ts.map +1 -1
  12. package/dist/cloudflare/principal-gateway-do.js +182 -7
  13. package/dist/cloudflare/principal-gateway-do.js.map +1 -1
  14. package/dist/communicative-act.d.ts +24 -1
  15. package/dist/communicative-act.d.ts.map +1 -1
  16. package/dist/communicative-act.js +28 -0
  17. package/dist/communicative-act.js.map +1 -1
  18. package/dist/delivery-envelope.d.ts.map +1 -1
  19. package/dist/delivery-envelope.js +0 -1
  20. package/dist/delivery-envelope.js.map +1 -1
  21. package/dist/enum-retirement.d.ts +34 -0
  22. package/dist/enum-retirement.d.ts.map +1 -0
  23. package/dist/enum-retirement.js +87 -0
  24. package/dist/enum-retirement.js.map +1 -0
  25. package/dist/exchange-record.d.ts +19 -3
  26. package/dist/exchange-record.d.ts.map +1 -1
  27. package/dist/exchange-record.js.map +1 -1
  28. package/dist/exchange-reducer.d.ts +33 -0
  29. package/dist/exchange-reducer.d.ts.map +1 -1
  30. package/dist/exchange-reducer.js +48 -0
  31. package/dist/exchange-reducer.js.map +1 -1
  32. package/dist/index.d.ts +14 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +23 -0
  35. package/dist/index.js.map +1 -1
  36. package/dist/interaction-machines.d.ts +136 -0
  37. package/dist/interaction-machines.d.ts.map +1 -0
  38. package/dist/interaction-machines.js +174 -0
  39. package/dist/interaction-machines.js.map +1 -0
  40. package/dist/interaction-profile.d.ts +126 -0
  41. package/dist/interaction-profile.d.ts.map +1 -0
  42. package/dist/interaction-profile.js +192 -0
  43. package/dist/interaction-profile.js.map +1 -0
  44. package/dist/interaction-record.d.ts +168 -0
  45. package/dist/interaction-record.d.ts.map +1 -0
  46. package/dist/interaction-record.js +108 -0
  47. package/dist/interaction-record.js.map +1 -0
  48. package/dist/messaging/conversation-interaction.d.ts +66 -0
  49. package/dist/messaging/conversation-interaction.d.ts.map +1 -0
  50. package/dist/messaging/conversation-interaction.js +139 -0
  51. package/dist/messaging/conversation-interaction.js.map +1 -0
  52. package/dist/messaging/inbox-assistant.d.ts +6 -3
  53. package/dist/messaging/inbox-assistant.d.ts.map +1 -1
  54. package/dist/messaging/inbox-assistant.js +23 -2
  55. package/dist/messaging/inbox-assistant.js.map +1 -1
  56. package/dist/messaging/index.d.ts +4 -1
  57. package/dist/messaging/index.d.ts.map +1 -1
  58. package/dist/messaging/index.js +4 -0
  59. package/dist/messaging/index.js.map +1 -1
  60. package/dist/messaging/rules.d.ts +9 -2
  61. package/dist/messaging/rules.d.ts.map +1 -1
  62. package/dist/messaging/rules.js +8 -1
  63. package/dist/messaging/rules.js.map +1 -1
  64. package/dist/messaging/store.d.ts.map +1 -1
  65. package/dist/messaging/store.js +5 -3
  66. package/dist/messaging/store.js.map +1 -1
  67. package/dist/messaging/types.d.ts +30 -0
  68. package/dist/messaging/types.d.ts.map +1 -1
  69. package/dist/messaging/types.js +3 -0
  70. package/dist/messaging/types.js.map +1 -1
  71. package/dist/protocol-binding.d.ts +71 -0
  72. package/dist/protocol-binding.d.ts.map +1 -0
  73. package/dist/protocol-binding.js +0 -0
  74. package/dist/protocol-binding.js.map +1 -0
  75. package/dist/record-catalog.d.ts.map +1 -1
  76. package/dist/record-catalog.js +7 -0
  77. package/dist/record-catalog.js.map +1 -1
  78. package/package.json +8 -8
@@ -2,6 +2,9 @@ import { admitDeliveryEnvelope, deliveryToExchangeRecord, } from '../delivery-en
2
2
  import { createDurableObjectSqlVault } from './sql-vault.js';
3
3
  import { createDurableObjectOutboxStore } from './outbox-store.js';
4
4
  import { createDurableObjectExchangeStore } from './exchange-store.js';
5
+ import { createDurableObjectInteractionStore } from './interaction-store.js';
6
+ import { topicInteractionId, channelIdFromTopicInteraction } from '../protocol-binding.js';
7
+ import { TOPIC_PROFILE } from '../interaction-profile.js';
5
8
  import { createDurableObjectAuthorityVerdictCache, } from './authority-verdict-cache.js';
6
9
  import { createDurableObjectRequestIdLedger } from './request-id-ledger.js';
7
10
  import { createDurableObjectReceiptSigner, } from './receipt-signer.js';
@@ -18,6 +21,7 @@ export class PrincipalGatewayDO {
18
21
  deps;
19
22
  sql;
20
23
  exchanges;
24
+ interactionStore;
21
25
  verdicts;
22
26
  requestIds;
23
27
  receipts;
@@ -32,6 +36,7 @@ export class PrincipalGatewayDO {
32
36
  // Co-resident, DO-local: exchange stream + vault + T1 verdict cache + request-id ledger all share the
33
37
  // one SQLite trust domain (L2, §4.0). The receipt signer holds a DO-local software key in DO KV storage.
34
38
  this.exchanges = createDurableObjectExchangeStore(this.sql);
39
+ this.interactionStore = createDurableObjectInteractionStore(this.sql);
35
40
  this.verdicts = createDurableObjectAuthorityVerdictCache(this.sql);
36
41
  this.requestIds = createDurableObjectRequestIdLedger(this.sql);
37
42
  this.receipts = createDurableObjectReceiptSigner(state.storage);
@@ -43,9 +48,27 @@ export class PrincipalGatewayDO {
43
48
  // A channel is a shared context on this org's exchange stream; membership is the org's policy (projected
44
49
  // from the app directory listing, spec 313); posting is member-gated fail-closed. Roles = delegations
45
50
  // (C2) and token-gated join (C3) layer on top; the org agent acting in-channel is `orchestrate()` (§15).
46
- /** Create/rename a channel owned by this org gateway. */
51
+ /**
52
+ * Create/rename a channel owned by this org gateway, and open the Interaction it IS (spec 340 W11).
53
+ *
54
+ * A topic was already a governed situation in everything but name: the org owns the board, members
55
+ * join and leave, `facilitator`/`contributor` are its roles, and it opens and closes. Opening the
56
+ * Interaction alongside it names that rather than adding a parallel object — the id is DERIVED
57
+ * (`ixn_topic_<channelId>`), so the two cannot drift and no join table exists to go stale.
58
+ *
59
+ * `participationMode: 'derived'`. Membership belongs to the channel (and, for an open topic, to the
60
+ * organization behind it), so the Interaction stores NO member list. Copying one per topic is what
61
+ * `apmsg:openParticipation` forbids, and a stale copy is how a removed member keeps posting.
62
+ */
47
63
  async createChannel(channel) {
48
- return this.channels.createChannel(channel);
64
+ await this.channels.createChannel(channel);
65
+ // Idempotent on rename: the derived id is stable, so this refreshes rather than duplicates.
66
+ await this.openInteraction({
67
+ interactionId: topicInteractionId(channel.channelId),
68
+ profileVersion: TOPIC_PROFILE.profileVersion,
69
+ participationMode: 'derived',
70
+ at: channel.createdAt,
71
+ });
49
72
  }
50
73
  /**
51
74
  * Add a member with a role (spec 318 C2 — the role IS the projection of an org-SA delegation caveat).
@@ -119,11 +142,24 @@ export class PrincipalGatewayDO {
119
142
  async postToChannel(channelId, record) {
120
143
  const from = record.parties.from;
121
144
  // A poster is either a channel MEMBER (person/org, C1/C2) or an admitted channel BOT (Service SA, C4).
145
+ // Kept as an explicit pre-check so the caller-facing reason stays `not_a_member`: ingress would also
146
+ // refuse, but as `not-a-participant`, and a post rejection should say the thing the poster can act on.
122
147
  if (!(await this.channels.isMember(channelId, from)) && !(await this.channels.isBot(channelId, from))) {
123
148
  return { ok: false, reason: 'not_a_member' };
124
149
  }
125
- await this.deliver(record);
126
- await this.channels.addPost(channelId, String(record.exchangeId), record.updatedAt);
150
+ // The post now OCCURS IN the topic's Interaction (spec 340 W11) — pinned here rather than trusted
151
+ // from the caller, because a poster naming someone else's interaction would otherwise file into it.
152
+ const posted = {
153
+ ...record,
154
+ interactionId: topicInteractionId(channelId),
155
+ profileVersion: TOPIC_PROFILE.profileVersion,
156
+ };
157
+ // Threading the refusal rather than discarding it: a post naming an interaction this gateway does
158
+ // not hold must not be indexed into the channel as though it landed.
159
+ const delivered = await this.deliver(posted);
160
+ if (!delivered.ok)
161
+ return { ok: false, reason: delivered.reason };
162
+ await this.channels.addPost(channelId, String(posted.exchangeId), posted.updatedAt);
127
163
  return { ok: true };
128
164
  }
129
165
  // ─── C4: channel bots ARE Service Smart Agents (spec 318 §8) ─────────────────────────────────────────
@@ -195,7 +231,11 @@ export class PrincipalGatewayDO {
195
231
  if (!admission.ok)
196
232
  return admission;
197
233
  const rec = deliveryToExchangeRecord(delivery, { tier: opts.tier, at: opts.at });
198
- await this.deliver(rec);
234
+ // A peer naming an interaction we do not hold, or one it is not in, is refused BEFORE the receipt:
235
+ // signing a delivery receipt for an exchange we did not store would attest to something false.
236
+ const delivered = await this.deliver(rec);
237
+ if (!delivered.ok)
238
+ return { ok: false, reason: delivered.reason };
199
239
  await this.applyEvent(rec.exchangeId, {
200
240
  kind: 'message', seq: 0, at: opts.at, eventType: 'delivered', actor: delivery.envelope.from, messageId: delivery.envelope.id,
201
241
  });
@@ -260,15 +300,147 @@ export class PrincipalGatewayDO {
260
300
  * software key) is a W2 follow-step.
261
301
  */
262
302
  async deliver(record) {
303
+ const admission = await this.admitIntoInteraction(record);
304
+ if (!admission.ok)
305
+ return admission;
263
306
  await this.exchanges.put(record);
264
307
  // W5 — project the exchange into the PRIVATE provenance A-box (one trace, §15). Off the sender's hot path
265
308
  // conceptually, but co-located here (demo-scale); a public row is derived SEPARATELY via the S1 firewall.
266
309
  await this.provenance.put(String(record.exchangeId), projectExchangeProvenance(this.exchangeToProvenanceInput(record)), record.updatedAt);
310
+ return admission;
311
+ }
312
+ /**
313
+ * The interaction-aware half of ingress (spec 340 W7).
314
+ *
315
+ * THREE OUTCOMES, and which is which is the whole design:
316
+ *
317
+ * 1. NO `interactionId` → delivered, with an `unpinned-exchange` note. An Exchange without an
318
+ * Interaction is a MESSAGE (ADR-0058 §12) — a legitimate state, and the overwhelmingly common
319
+ * one. Auto-creating an interaction per message would make "a thread is a projection, not a
320
+ * container" false by turning every message into a container.
321
+ *
322
+ * 2. UNKNOWN `interactionId` → REFUSED. Interactions are opened by their custodian
323
+ * (`openInteraction`), never conjured by a sender. If ingress created one from a sender-supplied
324
+ * id, any peer could seed arbitrary interactions with arbitrary participations on someone else's
325
+ * gateway, then post into them — inventing a governed situation the owner never entered.
326
+ *
327
+ * 3. KNOWN `interactionId` → the sender must be a current participant. An exchange claiming to occur
328
+ * in an interaction whose membership does not include its sender is a record that misrepresents
329
+ * the situation. This is an integrity check on the record's shape, NOT authority: being a
330
+ * participant is not permission to do anything (ADR-0048 §4).
331
+ *
332
+ * Two conditions are NOTED rather than refused, because refusing them would lose true records:
333
+ * · a profile-version mismatch — a mid-flight profile bump is legal, and the per-exchange pin is
334
+ * the signal that survives, so this reports (spec 340 §6);
335
+ * · a pinned context digest we do not hold — normal for an INBOUND delivery, where the snapshot
336
+ * lives on the sender's gateway. Dropping the message would be fail-closed in the wrong place;
337
+ * the digest stays pinned and resolvable later. What we must not do is pretend it is replayable.
338
+ */
339
+ async admitIntoInteraction(record) {
340
+ if (!record.interactionId)
341
+ return { ok: true, notes: [{ kind: 'unpinned-exchange' }] };
342
+ const interaction = await this.interactionStore.getInteraction(record.interactionId);
343
+ if (!interaction)
344
+ return { ok: false, reason: 'unknown-interaction' };
345
+ // ONE membership question, answered by whichever source actually owns it (spec 340 W11). For an
346
+ // `asserted` interaction the record IS the membership. For a `derived` one — an open org topic —
347
+ // the organization owns it, and this asks the org's own projection rather than a per-topic copy
348
+ // that could disagree with it. A stale copy of a membership list is how a removed member keeps
349
+ // posting, so there is no copy.
350
+ const isParticipant = interaction.participationMode === 'derived'
351
+ ? await this.resolveDerivedParticipation(interaction.interactionId, record.parties.from)
352
+ : interaction.participations.some((p) => p.agent === record.parties.from && p.leftAt === undefined);
353
+ if (!isParticipant)
354
+ return { ok: false, reason: 'not-a-participant' };
355
+ const notes = [];
356
+ if (record.profileVersion && record.profileVersion !== interaction.profileVersion) {
357
+ notes.push({ kind: 'profile-downgrade', pinned: record.profileVersion, inForce: interaction.profileVersion });
358
+ }
359
+ if (record.contextDigest && !(await this.interactionStore.getContextSnapshot(record.contextDigest))) {
360
+ notes.push({ kind: 'context-unavailable', digest: record.contextDigest });
361
+ }
362
+ return { ok: true, interactionId: interaction.interactionId, notes };
363
+ }
364
+ /**
365
+ * Membership for a `derived` interaction.
366
+ *
367
+ * Topic interactions carry `ixn_topic_<channelId>`, so the channel is recoverable from the id and the
368
+ * answer comes from the channel store — the same member-or-bot test `postToChannel` already applies.
369
+ * That is the point of doing this: the gate stops being a second check that could drift from the
370
+ * first, and becomes the same check asked once.
371
+ *
372
+ * Fail-closed by construction: an id that names no known derivation source resolves to `false`, so a
373
+ * `derived` interaction with no resolver admits nobody rather than everybody.
374
+ */
375
+ async resolveDerivedParticipation(interactionId, agent) {
376
+ const channelId = channelIdFromTopicInteraction(interactionId);
377
+ if (!channelId)
378
+ return false;
379
+ return (await this.channels.isMember(channelId, agent)) || (await this.channels.isBot(channelId, agent));
380
+ }
381
+ /**
382
+ * Open a governed situation on this gateway. The custodian is always THIS principal — an interaction
383
+ * is custodied by the gateway that holds it, and accepting a caller-supplied principal would let a
384
+ * peer name someone else as custodian of a situation on our storage.
385
+ */
386
+ async openInteraction(input) {
387
+ const participationMode = input.participationMode ?? 'asserted';
388
+ if (participationMode === 'derived' && (input.participations?.length ?? 0) > 0) {
389
+ // Refused rather than silently dropped: a caller passing both has a mental model where the list
390
+ // matters, and letting the write succeed would leave them believing a stale copy is authoritative.
391
+ throw new Error('openInteraction: a derived interaction must not carry participations');
392
+ }
393
+ const record = {
394
+ version: 'ap.interaction.v1',
395
+ interactionId: input.interactionId,
396
+ profileVersion: input.profileVersion,
397
+ principal: this.requirePrincipal(),
398
+ lifecycleState: 'active',
399
+ participationMode,
400
+ participations: input.participations ?? [],
401
+ ...(input.protocolBindings ? { protocolBindings: input.protocolBindings } : {}),
402
+ createdAt: input.at,
403
+ updatedAt: input.at,
404
+ rev: 0,
405
+ };
406
+ await this.interactionStore.putInteraction(record);
407
+ return record;
267
408
  }
268
409
  /** Append one event to an existing exchange (case transitions / transport moves), reduced fail-closed. */
269
410
  async applyEvent(exchangeId, event) {
270
411
  return this.exchanges.append(exchangeId, event);
271
412
  }
413
+ // ─── The interaction spine (spec 340 W6) ────────────────────────────────────────────────────────────
414
+ // Exposed as ONE accessor rather than a dozen forwarding methods. The DO is already large, and each
415
+ // forwarder would be a place for the store's invariants to be quietly re-implemented — the point of
416
+ // routing every transition through its machine is undone by a wrapper that sets state itself.
417
+ //
418
+ // Persisting here confers nothing: an interaction record says a situation exists, a commitment record
419
+ // says an obligation was recorded. Neither authorizes anything (ADR-0041/0043).
420
+ /** Interactions, context snapshots, decisions, commitments, per-viewer inbox state. */
421
+ get interactions() {
422
+ return this.interactionStore;
423
+ }
424
+ /**
425
+ * Everything still owed on this gateway — the query the single `case` field could not answer.
426
+ *
427
+ * A case could be `denied` while an obligation stayed outstanding with nowhere to record it, because
428
+ * one field was serving three machines (spec 340 §R). Concluding an interaction deliberately does NOT
429
+ * appear here as a discharge: closing a conversation ends the conversation, never the promise made
430
+ * inside it.
431
+ */
432
+ async openCommitments() {
433
+ return this.interactionStore.listOpenCommitments();
434
+ }
435
+ /** The gateway's own SA. Throws rather than defaulting: a wrong custodian on a governed situation is
436
+ * worse than a refused write, and empty-string config is treated as unset (a wrangler `VAR = ""`
437
+ * binds an empty string, which `??` would happily accept). */
438
+ requirePrincipal() {
439
+ const sa = this.env.PRINCIPAL_SA?.trim();
440
+ if (!sa)
441
+ throw new Error('PrincipalGatewayDO: PRINCIPAL_SA is not configured; cannot custody an interaction');
442
+ return sa;
443
+ }
272
444
  requireDeps() {
273
445
  if (!this.deps)
274
446
  throw new Error('PrincipalGatewayDO: co-resident MCP deps not configured (verifyToken/wrapperFor/tools)');
@@ -332,8 +504,11 @@ export class PrincipalGatewayDO {
332
504
  const url = new URL(request.url);
333
505
  try {
334
506
  if (request.method === 'POST' && url.pathname === '/deliver') {
335
- await this.deliver((await request.json()));
336
- return json({ ok: true });
507
+ const outcome = await this.deliver((await request.json()));
508
+ // 409, not 400: the request is well-formed and the situation is what refuses it.
509
+ if (!outcome.ok)
510
+ return json({ ok: false, error: outcome.reason }, 409);
511
+ return json({ ok: true, interactionId: outcome.interactionId, notes: outcome.notes });
337
512
  }
338
513
  if (request.method === 'POST' && url.pathname === '/event') {
339
514
  const body = (await request.json());
@@ -1 +1 @@
1
- {"version":3,"file":"principal-gateway-do.js","sourceRoot":"","sources":["../../src/cloudflare/principal-gateway-do.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GAEzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAsC,MAAM,mBAAmB,CAAC;AACvG,OAAO,EAAE,gCAAgC,EAAsB,MAAM,qBAAqB,CAAC;AAC3F,OAAO,EACL,wCAAwC,GAIzC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kCAAkC,EAAwB,MAAM,wBAAwB,CAAC;AAClG,OAAO,EACL,gCAAgC,GAIjC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GAGrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kCAAkC,EAAwB,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,+BAA+B,EAAE,oBAAoB,EAAsE,MAAM,oBAAoB,CAAC;AA+B/J,SAAS,IAAI,CAAC,IAAa,EAAE,MAAM,GAAG,GAAG;IACvC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC;AACzG,C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AC9C,8FAA8F;YAC9F,2EAA2E;YAC3E,sGAAsG;YACtG,8CAA8C;YAC9C,gFAAgF;YAChF,OAAO,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,GAAG,CAAC,CAAC;QACtD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAED;;;;qDAIiD;IACjD,KAAK,CAAC,KAAK;QACT,0EAA0E;IAC5E,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import type { CanonicalAgentId } from '@agenticprimitives/types';
2
- import type { Hex32, MessageId, MessageKind } from './messaging/index.js';
2
+ import type { Hex32, MessageId, MessageKind, MessageEnvelopeV1, AnyMessageEnvelope } from './messaging/index.js';
3
3
  import type { VaultRef } from '@agenticprimitives/vault';
4
4
  export type Performative = 'INFORM' | 'QUERY' | 'REQUEST' | 'PROPOSE' | 'COUNTER' | 'ACCEPT' | 'REJECT' | 'NOTIFY' | 'ACKNOWLEDGE' | 'ISSUE' | 'RETRACT' | 'SUBSCRIBE' | 'UNSUBSCRIBE';
5
5
  /** A by-reference pointer at a piece of semantic content an act expresses or carries — a Situation, a
@@ -38,6 +38,29 @@ export interface CommunicativeActV1 {
38
38
  /** The message this act responds to, if any. */
39
39
  inRespondsTo?: MessageId;
40
40
  }
41
+ /**
42
+ * The performative of ANY envelope — the dual-read seam (spec 340 W9).
43
+ *
44
+ * V2 states it; V1 derives it. One mechanism per version, never a fallback chain: a V2 envelope is
45
+ * never re-derived from a kind it does not have, and a V1 envelope never invents a `performative`
46
+ * field (ADR-0013).
47
+ */
48
+ export declare function performativeOf(envelope: AnyMessageEnvelope, act?: CommunicativeActV1): Performative;
49
+ /**
50
+ * Is this an ORIGINAL message rather than a reply?
51
+ *
52
+ * THE READER THAT FOUND A LATENT BUG. The auto-reply gate was `kind !== 'plain'`, which excluded
53
+ * `response` — so the assistant never replied to a reply. Under V2 that exclusion evaporates, because
54
+ * `plain` and `response` BOTH map to `INFORM` and are indistinguishable by performative alone. A naive
55
+ * translation to `performative === 'INFORM'` would have made the assistant start answering replies,
56
+ * i.e. answering itself.
57
+ *
58
+ * The fix is not to keep the taxonomy. It is that `inReplyTo` — the causal edge — was always the thing
59
+ * that actually distinguished them, and the enum had been standing in for it. Expressing the rule as
60
+ * "an original message has no antecedent" is both correct under V1 and correct under V2, and it says
61
+ * what the rule means instead of naming a label that implied it.
62
+ */
63
+ export declare function isOriginalMessage(envelope: Pick<MessageEnvelopeV1, 'inReplyTo'>): boolean;
41
64
  /**
42
65
  * The TOTAL `MessageKind` → `Performative` derivation for V1 envelopes (spec 324 §9). Exhaustive: every
43
66
  * `MessageKind` maps. A `response` refines to the act's performative when it is one of the response family
@@ -1 +1 @@
1
- {"version":3,"file":"communicative-act.d.ts","sourceRoot":"","sources":["../src/communicative-act.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,MAAM,YAAY,GACpB,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAC5E,QAAQ,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,CAAC;AAEjF;iHACiH;AACjH,MAAM,WAAW,kBAAkB;IACjC,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E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,34 @@
8
8
  // V1 envelopes carry no native performative, so for legacy/communication envelopes the performative is DERIVED
9
9
  // from `MessageKind` via one TOTAL mapping (`performativeForKind`, golden-vectored). A future `ap.exchange.v2`
10
10
  // envelope carries `performative`/`actor`/`principal` natively.
11
+ import { isEnvelopeV2 } from './messaging/index.js';
12
+ /**
13
+ * The performative of ANY envelope — the dual-read seam (spec 340 W9).
14
+ *
15
+ * V2 states it; V1 derives it. One mechanism per version, never a fallback chain: a V2 envelope is
16
+ * never re-derived from a kind it does not have, and a V1 envelope never invents a `performative`
17
+ * field (ADR-0013).
18
+ */
19
+ export function performativeOf(envelope, act) {
20
+ return isEnvelopeV2(envelope) ? envelope.performative : performativeForKind(envelope.kind, act);
21
+ }
22
+ /**
23
+ * Is this an ORIGINAL message rather than a reply?
24
+ *
25
+ * THE READER THAT FOUND A LATENT BUG. The auto-reply gate was `kind !== 'plain'`, which excluded
26
+ * `response` — so the assistant never replied to a reply. Under V2 that exclusion evaporates, because
27
+ * `plain` and `response` BOTH map to `INFORM` and are indistinguishable by performative alone. A naive
28
+ * translation to `performative === 'INFORM'` would have made the assistant start answering replies,
29
+ * i.e. answering itself.
30
+ *
31
+ * The fix is not to keep the taxonomy. It is that `inReplyTo` — the causal edge — was always the thing
32
+ * that actually distinguished them, and the enum had been standing in for it. Expressing the rule as
33
+ * "an original message has no antecedent" is both correct under V1 and correct under V2, and it says
34
+ * what the rule means instead of naming a label that implied it.
35
+ */
36
+ export function isOriginalMessage(envelope) {
37
+ return envelope.inReplyTo === undefined;
38
+ }
11
39
  /**
12
40
  * The TOTAL `MessageKind` → `Performative` derivation for V1 envelopes (spec 324 §9). Exhaustive: every
13
41
  * `MessageKind` maps. A `response` refines to the act's performative when it is one of the response family
@@ -1 +1 @@
1
- {"version":3,"file":"communicative-act.js","sourceRoot":"","sources":["../src/communicative-act.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,4GAA4G;AAC5G,8GAA8G;AAC9G,4GAA4G;AAC5G,8GAA8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IACX,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG,kBAAkB,CAGpG;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,IAAI,EAAE;IAAE,SAAS,EAAE,gBAAgB,CAAA;CAAE,GACpC,iBAAiB,CAQnB;AAED;oEACoE;AACpE,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,kBAAkB,EAC5B,IAAI,EAAE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACxC,gBAAgB,CAclB"}
@@ -29,7 +29,6 @@ export function deliveryToExchangeRecord(delivery, opts) {
29
29
  return {
30
30
  version: 'ap.exchange.v1',
31
31
  exchangeId: delivery.exchangeId,
32
- kind: e.kind,
33
32
  tier: opts.tier,
34
33
  principal: delivery.toGateway,
35
34
  parties: { from: e.from, to: e.to },
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-envelope.js","sourceRoot":"","sources":["../src/delivery-envelope.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU,qBAAqB,CAAC,KAA0C;IAC9E,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAC7G,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,GAAG,KAAK,EAAE,CAAC;AAC1D,CAAC;AAID;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAA4B,EAC5B,IAAqC;IAErC,IAAI,QAAQ,CAAC,OAAO,K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AE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC;AAED;oEACoE;AACpE,MAAM,UAAU,wBAAwB,CACtC,QAA4B,EAC5B,IAAyC;IAEzC,MAAM,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAC5B,OAAO;QACL,OAAO,EAAE,gBAAgB;QACzB,UAAU,EAAE,QAAQ,CAAC,UAAwB;QAC7C,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE;QACnC,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,CAAC,CAAC,CAAC;QACd,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,CAAC;QACN,SAAS,EAAE,IAAI,CAAC,EAAE;KACnB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { MessageKind } from './messaging/index.js';
2
+ import type { CaseState } from './exchange-state.js';
3
+ import type { ProfileVersion } from './interaction-record.js';
4
+ /**
5
+ * Every `MessageKind` (still the ENVELOPE's, see the header), mapped to the profile that replaces it.
6
+ *
7
+ * `Record<MessageKind, …>` rather than a lookup function: adding a `MessageKind` without deciding its
8
+ * profile then fails the build, which is the only way a "total" mapping stays total.
9
+ *
10
+ * Three of the seven collapse onto `direct`, and that is the finding rather than laziness. `plain`,
11
+ * `system` and `tombstone` were never different KINDS of interaction — they are a message, a message
12
+ * from the substrate, and a deletion marker. They differed in rendering, not in what was permitted,
13
+ * which is exactly the kind of distinction an interaction-type enum should not have been carrying.
14
+ */
15
+ export declare const PROFILE_FOR_MESSAGE_KIND: Record<MessageKind, ProfileVersion>;
16
+ /** Which of the six machines each `CaseState` actually belongs to. */
17
+ export type OwningMachine = 'execution' | 'decision' | 'commitment';
18
+ /**
19
+ * Every `CaseState`, mapped to the machine that owns it.
20
+ *
21
+ * THE POINT OF THIS TABLE: the eleven states were never one machine's. `denied` is a DECISION,
22
+ * `completed` is an EXECUTION outcome, and `revoked` is what happens to a COMMITMENT — three
23
+ * different questions with three different signers, answered by one field. That is why a case could
24
+ * be `denied` and a commitment still outstanding with nowhere to say so.
25
+ *
26
+ * `issued` and `approved` are the two that look ambiguous and are not: approving is a decision,
27
+ * issuing is work performed under it. Reading `approved` as execution progress is precisely the
28
+ * "deciding is not doing" collapse.
29
+ */
30
+ export declare const MACHINE_FOR_CASE_STATE: Record<CaseState, OwningMachine>;
31
+ /** How many distinct machines the single `CaseState` field was standing in for. Asserted in tests so
32
+ * the claim in §W5 cannot drift away from the table above. */
33
+ export declare function machinesSpannedByCaseState(): number;
34
+ //# sourceMappingURL=enum-retirement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum-retirement.d.ts","sourceRoot":"","sources":["../src/enum-retirement.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,WAAW,EAAE,cAAc,CAcxE,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,SAAS,EAAE,aAAa,CAYnE,CAAC;AAEF;+DAC+D;AAC/D,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD"}
@@ -0,0 +1,87 @@
1
+ // The `MessageKind` / `CaseState` retirement path (spec 340 W5).
2
+ //
3
+ // THIS FILE IS TRANSITIONAL. It is separate from everything else so that deleting it is a visible,
4
+ // one-file event rather than an archaeology exercise.
5
+ //
6
+ // The two enums are frozen taxonomies: a new interaction type is a new `MessageKind` member and a
7
+ // schema change, which is the problem versioned profiles solve (spec 340 §6).
8
+ //
9
+ // WHAT W8 ACTUALLY REMOVED, AND WHAT IT COULD NOT. W5 recorded these as one job — "26 files,
10
+ // mechanical once the mapping is total". Doing it showed that was wrong in a way worth writing down,
11
+ // because the next person will assume the same thing (spec 340 §R.1):
12
+ //
13
+ // · `ExchangeRecordV1.kind` — REMOVED. Zero readers, a second copy of `envelope.kind`, and its own
14
+ // doc comment said the authority tier is classified from the skill selector and never from it.
15
+ // `profileVersion` carries interaction type now.
16
+ //
17
+ // · `MessageEnvelopeV1.kind` — KEPT, and this is not deferral. It sits INSIDE the signed wire hash
18
+ // (`hashMessageEnvelope` excludes only `signature`), so removing it changes every envelope digest
19
+ // and invalidates every existing signature and delivery receipt. It also has live readers: the
20
+ // auto-reply gate, folder routing, the inbox rule predicate, and the delivery envelope. Removing
21
+ // it is an `ap.message.v2` migration with re-signing, not a cleanup.
22
+ //
23
+ // · `CaseState` — KEPT. `MACHINE_FOR_CASE_STATE` below proves it spans three machines, and that
24
+ // analysis stands. But the decision and commitment machines W3 built are not yet populated by the
25
+ // live case flow, so deleting `CaseState` today would remove working behaviour and replace it with
26
+ // machines nothing writes to. That is a regression wearing the costume of a cleanup. It goes when
27
+ // the case flow emits decision and commitment records — a behaviour change, not a rename.
28
+ //
29
+ // The maps below stay because both remaining removals still need them.
30
+ import { DIRECT_PROFILE, NEGOTIATION_PROFILE, CONSULTATION_PROFILE } from './interaction-profile.js';
31
+ /**
32
+ * Every `MessageKind` (still the ENVELOPE's, see the header), mapped to the profile that replaces it.
33
+ *
34
+ * `Record<MessageKind, …>` rather than a lookup function: adding a `MessageKind` without deciding its
35
+ * profile then fails the build, which is the only way a "total" mapping stays total.
36
+ *
37
+ * Three of the seven collapse onto `direct`, and that is the finding rather than laziness. `plain`,
38
+ * `system` and `tombstone` were never different KINDS of interaction — they are a message, a message
39
+ * from the substrate, and a deletion marker. They differed in rendering, not in what was permitted,
40
+ * which is exactly the kind of distinction an interaction-type enum should not have been carrying.
41
+ */
42
+ export const PROFILE_FOR_MESSAGE_KIND = {
43
+ plain: DIRECT_PROFILE.profileVersion,
44
+ system: DIRECT_PROFILE.profileVersion,
45
+ tombstone: DIRECT_PROFILE.profileVersion,
46
+ // A request and its response are one interaction with two moves, not two kinds. Under a profile the
47
+ // difference is the act (`QUERY` then `INFORM`), where it belongs.
48
+ request: CONSULTATION_PROFILE.profileVersion,
49
+ response: CONSULTATION_PROFILE.profileVersion,
50
+ // Issuing a credential discharges something someone agreed to; `negotiation` is the profile in the
51
+ // starter library whose ACCEPT can create that obligation. A dedicated `issuance` profile is the
52
+ // right long-term home — noted rather than invented here, because inventing a profile to make a
53
+ // migration table look tidy is how the library fills with profiles nothing uses.
54
+ 'credential-delivery': NEGOTIATION_PROFILE.profileVersion,
55
+ receipt: DIRECT_PROFILE.profileVersion,
56
+ };
57
+ /**
58
+ * Every `CaseState`, mapped to the machine that owns it.
59
+ *
60
+ * THE POINT OF THIS TABLE: the eleven states were never one machine's. `denied` is a DECISION,
61
+ * `completed` is an EXECUTION outcome, and `revoked` is what happens to a COMMITMENT — three
62
+ * different questions with three different signers, answered by one field. That is why a case could
63
+ * be `denied` and a commitment still outstanding with nowhere to say so.
64
+ *
65
+ * `issued` and `approved` are the two that look ambiguous and are not: approving is a decision,
66
+ * issuing is work performed under it. Reading `approved` as execution progress is precisely the
67
+ * "deciding is not doing" collapse.
68
+ */
69
+ export const MACHINE_FOR_CASE_STATE = {
70
+ draft: 'execution',
71
+ submitted: 'execution',
72
+ triaged: 'execution',
73
+ 'needs-info': 'execution',
74
+ approved: 'decision',
75
+ denied: 'decision',
76
+ issued: 'execution',
77
+ completed: 'execution',
78
+ expired: 'decision',
79
+ revoked: 'commitment',
80
+ failed: 'execution',
81
+ };
82
+ /** How many distinct machines the single `CaseState` field was standing in for. Asserted in tests so
83
+ * the claim in §W5 cannot drift away from the table above. */
84
+ export function machinesSpannedByCaseState() {
85
+ return new Set(Object.values(MACHINE_FOR_CASE_STATE)).size;
86
+ }
87
+ //# sourceMappingURL=enum-retirement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum-retirement.js","sourceRoot":"","sources":["../src/enum-retirement.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,mGAAmG;AACnG,sDAAsD;AACtD,EAAE;AACF,kGAAkG;AAClG,8EAA8E;AAC9E,EAAE;AACF,6FAA6F;AAC7F,qGAAqG;AACrG,sEAAsE;AACtE,EAAE;AACF,qGAAqG;AACrG,mGAAmG;AACnG,qDAAqD;AACrD,EAAE;AACF,qGAAqG;AACrG,sGAAsG;AACtG,mGAAmG;AACnG,qGAAqG;AACrG,yEAAyE;AACzE,EAAE;AACF,kGAAkG;AAClG,sGAAsG;AACtG,uGAAuG;AACvG,sGAAsG;AACtG,8FAA8F;AAC9F,EAAE;AACF,uEAAuE;AAKvE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErG;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAwC;IAC3E,KAAK,EAAE,cAAc,CAAC,cAAc;IACpC,MAAM,EAAE,cAAc,CAAC,cAAc;IACrC,SAAS,EAAE,cAAc,CAAC,cAAc;IACxC,oGAAoG;IACpG,mEAAmE;IACnE,OAAO,EAAE,oBAAoB,CAAC,cAAc;IAC5C,QAAQ,EAAE,oBAAoB,CAAC,cAAc;IAC7C,mGAAmG;IACnG,iGAAiG;IACjG,gGAAgG;IAChG,iFAAiF;IACjF,qBAAqB,EAAE,mBAAmB,CAAC,cAAc;IACzD,OAAO,EAAE,cAAc,CAAC,cAAc;CACvC,CAAC;AAKF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAqC;IACtE,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,WAAW;IACpB,YAAY,EAAE,WAAW;IACzB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,WAAW;IACnB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF;+DAC+D;AAC/D,MAAM,UAAU,0BAA0B;IACxC,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7D,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { MessageEnvelopeV1, MessageKind, MessageEventType, MessageId, Hex32, ContextRefV1 } from './messaging/index.js';
1
+ import type { MessageEnvelopeV1, MessageEventType, MessageId, Hex32, ContextRefV1 } from './messaging/index.js';
2
2
  import { hashMessageEnvelope } from './messaging/index.js';
3
3
  import type { AuthorityRef } from './interactions/index.js';
4
4
  import type { AuthorityTier } from '@agenticprimitives/tool-policy';
@@ -6,6 +6,7 @@ import type { CanonicalAgentId } from '@agenticprimitives/types';
6
6
  import type { VaultRef } from '@agenticprimitives/vault';
7
7
  import type { ExecState, CaseState } from './exchange-state.js';
8
8
  import type { CaseTransition } from './case-machine.js';
9
+ import type { InteractionId, ProfileVersion, ContextDigest } from './interaction-record.js';
9
10
  /** The exchange spine id — replaces today's `taskId` / `int_`+`run_` / `conv_`+`msg_` id families. */
10
11
  export type ExchangeId = `xch_${string}`;
11
12
  /**
@@ -82,12 +83,16 @@ export type ExchangeEventV1 = (ExchangeEventBase & {
82
83
  * The ONE canonical exchange record (spec §b). Two-level FSM: `exec` (transport, always present) + `case`
83
84
  * (business substate, execution-tier only). Authority is referenced, never satisfied here — approving a case
84
85
  * advances `case`, it never unlocks a resource (ADR-0041).
86
+ *
87
+ * `kind: MessageKind` was REMOVED in spec 340 W8. It was a frozen taxonomy on the aggregate, it was a second
88
+ * copy of `envelope.kind`, and it had ZERO readers — the authority tier is server-classified from the skill
89
+ * selector, never from `kind`, and that comment was the only thing the field was doing. `profileVersion` is
90
+ * what carries interaction type now. `MessageEnvelopeV1.kind` is a DIFFERENT field and stays: it is inside
91
+ * the signed wire hash and has live readers (spec 340 §R.1).
85
92
  */
86
93
  export interface ExchangeRecordV1 {
87
94
  version: 'ap.exchange.v1';
88
95
  exchangeId: ExchangeId;
89
- /** Projection hint only — the authority TIER is server-classified from the skill selector, never `kind`. */
90
- kind: MessageKind;
91
96
  /** Server-classified ONCE at ingress (never client-asserted). */
92
97
  tier: AuthorityTier;
93
98
  /** The delegator / gateway owner SA — on whose behalf the exchange runs. Also the case RESPONDER by
@@ -120,6 +125,17 @@ export interface ExchangeRecordV1 {
120
125
  artifacts?: ArtifactRef[];
121
126
  /** Entities this exchange is ABOUT (spec 312) — carried through from the envelope. */
122
127
  contextRefs?: ContextRefV1[];
128
+ /** The governed situation this exchange occurs in. An Exchange without one is a message — a
129
+ * legitimate state, not an error, and the reason this is optional rather than required. */
130
+ interactionId?: InteractionId;
131
+ /** The EXACT profile version this exchange was made under, recorded HERE rather than read off the
132
+ * live interaction. Reading it off the interaction is what makes a downgrade invisible: an
133
+ * adversary edits one field and a Negotiation is reinterpreted as a Conversation, taking its
134
+ * acceptance semantics with it (spec 340 §6). */
135
+ profileVersion?: ProfileVersion;
136
+ /** Digest of the `ContextSnapshotV1` this exchange was evaluated against — by hash, never a pointer
137
+ * at live state. Supersedes `contextRefs` for authority-bearing context (spec 340 §7). */
138
+ contextDigest?: ContextDigest;
123
139
  /** Monotonic revision for the inbox-projection cursor. */
124
140
  rev: number;
125
141
  updatedAt: string;