@agenticprimitives/fabric 0.0.0-alpha.1 → 0.0.0-alpha.10
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/CLAUDE.md +22 -2
- package/README.md +16 -16
- package/dist/case-emissions.d.ts +95 -0
- package/dist/case-emissions.d.ts.map +1 -0
- package/dist/case-emissions.js +208 -0
- package/dist/case-emissions.js.map +1 -0
- package/dist/case-machine.d.ts +28 -2
- package/dist/case-machine.d.ts.map +1 -1
- package/dist/case-machine.js +34 -7
- package/dist/case-machine.js.map +1 -1
- package/dist/cloudflare/index.d.ts +1 -0
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -0
- package/dist/cloudflare/index.js.map +1 -1
- package/dist/cloudflare/interaction-store.d.ts +55 -0
- package/dist/cloudflare/interaction-store.d.ts.map +1 -0
- package/dist/cloudflare/interaction-store.js +230 -0
- package/dist/cloudflare/interaction-store.js.map +1 -0
- package/dist/cloudflare/principal-gateway-do.d.ts +118 -2
- package/dist/cloudflare/principal-gateway-do.d.ts.map +1 -1
- package/dist/cloudflare/principal-gateway-do.js +182 -7
- package/dist/cloudflare/principal-gateway-do.js.map +1 -1
- package/dist/communicative-act.d.ts +24 -1
- package/dist/communicative-act.d.ts.map +1 -1
- package/dist/communicative-act.js +28 -0
- package/dist/communicative-act.js.map +1 -1
- package/dist/delivery-envelope.d.ts.map +1 -1
- package/dist/delivery-envelope.js +0 -1
- package/dist/delivery-envelope.js.map +1 -1
- package/dist/enum-retirement.d.ts +43 -0
- package/dist/enum-retirement.d.ts.map +1 -0
- package/dist/enum-retirement.js +93 -0
- package/dist/enum-retirement.js.map +1 -0
- package/dist/exchange-record.d.ts +35 -4
- package/dist/exchange-record.d.ts.map +1 -1
- package/dist/exchange-record.js.map +1 -1
- package/dist/exchange-reducer.d.ts +32 -4
- package/dist/exchange-reducer.d.ts.map +1 -1
- package/dist/exchange-reducer.js +75 -1
- package/dist/exchange-reducer.js.map +1 -1
- package/dist/exchange-state.d.ts +30 -8
- package/dist/exchange-state.d.ts.map +1 -1
- package/dist/exchange-state.js +12 -10
- package/dist/exchange-state.js.map +1 -1
- package/dist/inbox-doc.d.ts +2 -2
- package/dist/inbox-doc.d.ts.map +1 -1
- package/dist/inbox-doc.js.map +1 -1
- package/dist/inbox-projection.d.ts +2 -2
- package/dist/inbox-projection.d.ts.map +1 -1
- package/dist/inbox-projection.js.map +1 -1
- package/dist/inbox-revision.d.ts +42 -0
- package/dist/inbox-revision.d.ts.map +1 -0
- package/dist/inbox-revision.js +57 -0
- package/dist/inbox-revision.js.map +1 -0
- package/dist/index.d.ts +23 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/dist/interaction-machines.d.ts +136 -0
- package/dist/interaction-machines.d.ts.map +1 -0
- package/dist/interaction-machines.js +174 -0
- package/dist/interaction-machines.js.map +1 -0
- package/dist/interaction-profile.d.ts +126 -0
- package/dist/interaction-profile.d.ts.map +1 -0
- package/dist/interaction-profile.js +192 -0
- package/dist/interaction-profile.js.map +1 -0
- package/dist/interaction-record.d.ts +168 -0
- package/dist/interaction-record.d.ts.map +1 -0
- package/dist/interaction-record.js +108 -0
- package/dist/interaction-record.js.map +1 -0
- package/dist/interactions/machine.d.ts +2 -2
- package/dist/interactions/machine.d.ts.map +1 -1
- package/dist/interactions/machine.js +2 -2
- package/dist/interactions/machine.js.map +1 -1
- package/dist/interactions/store.d.ts +9 -0
- package/dist/interactions/store.d.ts.map +1 -1
- package/dist/interactions/store.js +57 -2
- package/dist/interactions/store.js.map +1 -1
- package/dist/messaging/board.d.ts +86 -6
- package/dist/messaging/board.d.ts.map +1 -1
- package/dist/messaging/board.js +100 -9
- package/dist/messaging/board.js.map +1 -1
- package/dist/messaging/consult-routing.d.ts +289 -0
- package/dist/messaging/consult-routing.d.ts.map +1 -0
- package/dist/messaging/consult-routing.js +455 -0
- package/dist/messaging/consult-routing.js.map +1 -0
- package/dist/messaging/consult.d.ts +158 -0
- package/dist/messaging/consult.d.ts.map +1 -0
- package/dist/messaging/consult.js +141 -0
- package/dist/messaging/consult.js.map +1 -0
- package/dist/messaging/conversation-interaction.d.ts +66 -0
- package/dist/messaging/conversation-interaction.d.ts.map +1 -0
- package/dist/messaging/conversation-interaction.js +139 -0
- package/dist/messaging/conversation-interaction.js.map +1 -0
- package/dist/messaging/delivery.d.ts +2 -2
- package/dist/messaging/delivery.d.ts.map +1 -1
- package/dist/messaging/delivery.js +8 -1
- package/dist/messaging/delivery.js.map +1 -1
- package/dist/messaging/directory.d.ts +16 -0
- package/dist/messaging/directory.d.ts.map +1 -1
- package/dist/messaging/directory.js.map +1 -1
- package/dist/messaging/envelope.d.ts +7 -3
- package/dist/messaging/envelope.d.ts.map +1 -1
- package/dist/messaging/envelope.js +18 -1
- package/dist/messaging/envelope.js.map +1 -1
- package/dist/messaging/hash.d.ts +8 -2
- package/dist/messaging/hash.d.ts.map +1 -1
- package/dist/messaging/hash.js +6 -0
- package/dist/messaging/hash.js.map +1 -1
- package/dist/messaging/inbox-assistant.d.ts +80 -0
- package/dist/messaging/inbox-assistant.d.ts.map +1 -0
- package/dist/messaging/inbox-assistant.js +125 -0
- package/dist/messaging/inbox-assistant.js.map +1 -0
- package/dist/messaging/index.d.ts +9 -3
- package/dist/messaging/index.d.ts.map +1 -1
- package/dist/messaging/index.js +17 -2
- package/dist/messaging/index.js.map +1 -1
- package/dist/messaging/projector.d.ts +3 -3
- package/dist/messaging/projector.d.ts.map +1 -1
- package/dist/messaging/projector.js.map +1 -1
- package/dist/messaging/receipts.d.ts +3 -3
- package/dist/messaging/receipts.d.ts.map +1 -1
- package/dist/messaging/receipts.js.map +1 -1
- package/dist/messaging/rules.d.ts +10 -3
- package/dist/messaging/rules.d.ts.map +1 -1
- package/dist/messaging/rules.js +8 -1
- package/dist/messaging/rules.js.map +1 -1
- package/dist/messaging/store.d.ts +4 -4
- package/dist/messaging/store.d.ts.map +1 -1
- package/dist/messaging/store.js +5 -3
- package/dist/messaging/store.js.map +1 -1
- package/dist/messaging/types.d.ts +52 -0
- package/dist/messaging/types.d.ts.map +1 -1
- package/dist/messaging/types.js +18 -1
- package/dist/messaging/types.js.map +1 -1
- package/dist/messaging/vault-store.d.ts +35 -2
- package/dist/messaging/vault-store.d.ts.map +1 -1
- package/dist/messaging/vault-store.js +53 -5
- package/dist/messaging/vault-store.js.map +1 -1
- package/dist/protocol-binding.d.ts +71 -0
- package/dist/protocol-binding.d.ts.map +1 -0
- package/dist/protocol-binding.js +0 -0
- package/dist/protocol-binding.js.map +1 -0
- package/dist/record-catalog.d.ts.map +1 -1
- package/dist/record-catalog.js +19 -0
- package/dist/record-catalog.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { consultGrantRecordKey, type ConsultAnswerV1, type ConsultProvenanceV1, type ConsultRequestV1, type ConsultationIntentV1 } from './consult.js';
|
|
2
|
+
import { type ChannelV1 } from './board.js';
|
|
3
|
+
/** Org-DO pending-consult ring key (spec 329 §4.1). */
|
|
4
|
+
export declare const routingPendingKey: (topicId: string, questionId: string) => string;
|
|
5
|
+
/** ConsultationIntent description-record key (spec 329 §5) — one per consulted member. */
|
|
6
|
+
export declare const consultationIntentKey: (questionId: string, memberSA: string) => string;
|
|
7
|
+
/** One row of the org's directory as the eligibility filter consumes it (already gate-verified by
|
|
8
|
+
* the execution point; `current` is the isListingCurrent verdict at read time). */
|
|
9
|
+
export interface ConsultRosterRowV1 {
|
|
10
|
+
/** Listing subject (CAIP-10 or 0x). */
|
|
11
|
+
subject: string;
|
|
12
|
+
displayName: string;
|
|
13
|
+
/** The aporg:consultable listing HINT (spec 329 §2.2). Absent ⇒ false. */
|
|
14
|
+
consultable?: boolean;
|
|
15
|
+
/** The member's self-asserted PRIMARY ROLE in THIS org (spec 329 §12), from their signed
|
|
16
|
+
* listing — e.g. 'tax advisor'. Absent ⇒ no role asserted (never inferred). */
|
|
17
|
+
orgRole?: string;
|
|
18
|
+
current: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface EligibleConsultMemberV1 {
|
|
21
|
+
/** Lowercased 0x member SA. */
|
|
22
|
+
memberSA: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
/** spec 329 §12 — the listing-sourced org role, carried through ranking to the candidate. */
|
|
25
|
+
orgRole?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* roster ∩ topic participants ∩ consultable-hinted ∩ grant-present. Fail-closed on consent from
|
|
29
|
+
* BOTH directions (spec 329 §2.2): flag without grant ⇒ excluded; grant without flag ⇒ excluded.
|
|
30
|
+
* Restricted topics consult `canSeeChannel` participants only (a member is never asked about a
|
|
31
|
+
* conversation they cannot see); the org itself is never a candidate (org agents are not
|
|
32
|
+
* consultable — §4 loop prevention).
|
|
33
|
+
*/
|
|
34
|
+
export declare function eligibleConsultMembers(args: {
|
|
35
|
+
roster: ConsultRosterRowV1[];
|
|
36
|
+
channel: Pick<ChannelV1, 'participationPolicy' | 'visibility' | 'members'>;
|
|
37
|
+
/** Member SAs (lowercased 0x) with a PRESENT consultability grant in the org's grant store. */
|
|
38
|
+
grantMembers: string[];
|
|
39
|
+
/** The org SA (0x) — excluded structurally. */
|
|
40
|
+
orgSA: string;
|
|
41
|
+
}): EligibleConsultMemberV1[];
|
|
42
|
+
/** The public discovery facets one candidate enriches with (ADR-0040 public tier only — the
|
|
43
|
+
* demo-discovery-mcp `/agent` projection). All optional; missing facets mean fewer signals. */
|
|
44
|
+
export interface ConsultCandidateFacetsV1 {
|
|
45
|
+
name?: string | null;
|
|
46
|
+
displayName?: string | null;
|
|
47
|
+
description?: string | null;
|
|
48
|
+
/** `atl:skills` public assertion (spec 282), comma-joined. Post-spec-331 this carries canonical
|
|
49
|
+
* CAPABILITY IDS, not free text. */
|
|
50
|
+
skills?: string | null;
|
|
51
|
+
/** Spec 331 — the capability ids parsed out of `skills` by discovery. `[]` = declared nothing
|
|
52
|
+
* structured; that is an answer, never a wildcard. */
|
|
53
|
+
capabilityIds?: string[];
|
|
54
|
+
/** Spec 331 — the three public facet predicates, comma-joined as published on chain.
|
|
55
|
+
* languages = BCP-47 lowercase; regions = ISO 3166 / GeoFeatureRegistry uppercase;
|
|
56
|
+
* focusAreas = open subject labels (soft boost ONLY, never a filter). */
|
|
57
|
+
languages?: string | null;
|
|
58
|
+
regions?: string | null;
|
|
59
|
+
focusAreas?: string | null;
|
|
60
|
+
facets?: string[];
|
|
61
|
+
shaclConforms?: boolean;
|
|
62
|
+
registered?: boolean;
|
|
63
|
+
/** Discovery agent kind, when known (e.g. 'person' | 'org'). Org-kind candidates are DROPPED —
|
|
64
|
+
* person agents only (spec 329 §4 depth-1 rule). */
|
|
65
|
+
kind?: string | null;
|
|
66
|
+
/** Claimed-capability tier (capability-architecture.md §2 `aps:claimsCapability`) — the capability ids
|
|
67
|
+
* this member is BOTH declared for AND INDEPENDENTLY endorsed for. The abuse rules (self-endorsement
|
|
68
|
+
* ignored, volume deduped by issuer, same-org discounted, staleness decayed) are ALREADY applied by the
|
|
69
|
+
* discovery transport that reads the raw attestations (demo-a2a discovery-facets), so this list is the
|
|
70
|
+
* clean, trustworthy signal: an id here means "an independent third party vouched, and the subject also
|
|
71
|
+
* claims it". The pure scorer never re-derives it — one policy, computed where the raw data lives. */
|
|
72
|
+
endorsedCapabilityIds?: string[];
|
|
73
|
+
/** DISTINCT non-self issuers of valid endorsements (self + volume already collapsed). Corroboration. */
|
|
74
|
+
independentEndorsers?: number;
|
|
75
|
+
}
|
|
76
|
+
/** One surfaced candidate (the apdisc:MatchCandidate shape, flattened): score + evidence path. */
|
|
77
|
+
export interface ConsultCandidateV1 {
|
|
78
|
+
memberSA: string;
|
|
79
|
+
displayName: string;
|
|
80
|
+
/** Discovery handle (the `name` facet, e.g. 'alice.impact'), when known. */
|
|
81
|
+
handle?: string;
|
|
82
|
+
/** spec 329 §12 — the member's self-asserted PRIMARY ROLE in this org, sourced from their SIGNED
|
|
83
|
+
* listing (NOT from discovery): a question addressing a role ("@ask tax advisor …") selects the
|
|
84
|
+
* candidate(s) holding it, ahead of a generic skill match. Absent ⇒ none asserted; the routed
|
|
85
|
+
* turn must then fall back to published skills (never invent a role). Survives degraded mode —
|
|
86
|
+
* it is roster-sourced, so discovery being unreachable does not erase it. */
|
|
87
|
+
orgRole?: string;
|
|
88
|
+
/** The candidate's PUBLISHED `atl:skills` labels (spec 282, parsed from the comma-joined public
|
|
89
|
+
* assertion). Empty ⇒ none published OR none readable — `enriched` says which (spec 329 §4:
|
|
90
|
+
* the routed turn matches the question's subject against THESE; an empty list must be stated
|
|
91
|
+
* explicitly so the model never hallucinates expertise). */
|
|
92
|
+
skills: string[];
|
|
93
|
+
/** 0..1 — `0.6·fit + 0.4·trust` (spec 281). 0 in degraded (un-enriched) mode. */
|
|
94
|
+
score: number;
|
|
95
|
+
/** Whether discovery facets informed this candidate (false ⇒ roster-only signals). */
|
|
96
|
+
enriched: boolean;
|
|
97
|
+
/** Human-readable evidence citations (audit + attribution basis). */
|
|
98
|
+
evidence: string[];
|
|
99
|
+
satisfiedMandates: string[];
|
|
100
|
+
/** Spec 331 — the capability ids this member declared (empty ⇒ none published/none readable). */
|
|
101
|
+
capabilityIds?: string[];
|
|
102
|
+
/** How many needed capability ids matched (exact + specialization). Tie-break + audit. */
|
|
103
|
+
capabilityHits?: number;
|
|
104
|
+
/** How many requested region codes matched. A BOOST and a tie-break — never a filter. */
|
|
105
|
+
regionHits?: number;
|
|
106
|
+
/** True ⇒ this candidate's fit rests on lexical matching alone, because the question resolved to
|
|
107
|
+
* no capability id. Surfaced so "it still passes for the old reason" is visible, not silent. */
|
|
108
|
+
lexicalOnly?: boolean;
|
|
109
|
+
/** Claimed-capability tier — the requested capability ids this member is both declared for AND
|
|
110
|
+
* independently endorsed for (the ones the endorsement boost fired on). Surfaced for the UI/evidence. */
|
|
111
|
+
endorsedCapabilityIds?: string[];
|
|
112
|
+
}
|
|
113
|
+
export interface ConsultRankingV1 {
|
|
114
|
+
/** False ⇔ discovery was unreachable — the un-enriched, un-ranked eligible set (spec 329 §4
|
|
115
|
+
* degraded mode: fail-open to fewer signals, NEVER to more candidates). */
|
|
116
|
+
enriched: boolean;
|
|
117
|
+
candidates: ConsultCandidateV1[];
|
|
118
|
+
droppedByMandates: number;
|
|
119
|
+
}
|
|
120
|
+
/** A question resolved into structured need (spec 331 §4.1). Every field optional: a caller with no
|
|
121
|
+
* catalog supplies none and the matcher degrades to the lexical fallback — VISIBLY, via evidence. */
|
|
122
|
+
export interface StructuredNeedV1 {
|
|
123
|
+
/** Canonical capability ids the question resolved to. */
|
|
124
|
+
capabilityIds?: string[];
|
|
125
|
+
/** Their descendants in the catalog DAG, pre-expanded by the caller (downward walk only). */
|
|
126
|
+
specializationIds?: string[];
|
|
127
|
+
/** Uppercase region codes the question named. */
|
|
128
|
+
regions?: string[];
|
|
129
|
+
/** BCP-47 tags the question named. */
|
|
130
|
+
languages?: string[];
|
|
131
|
+
/** Focus-area labels the question named. */
|
|
132
|
+
focusAreas?: string[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Rank the ELIGIBLE set (spec 281 verbatim: mandates filter, `0.6·fit + 0.4·trust` scores,
|
|
136
|
+
* top-`max` surfaced with evidence). `facets === null` ⇒ discovery unreachable ⇒ degraded mode:
|
|
137
|
+
* the eligible set passes through un-ranked with `enriched:false`. A candidate discovery does not
|
|
138
|
+
* know keeps its consent-derived seat (fewer signals, never fewer rights) but ranks below enriched
|
|
139
|
+
* peers and is exempt from skill mandates it cannot prove or disprove — eligibility (consent) was
|
|
140
|
+
* already settled structurally.
|
|
141
|
+
*/
|
|
142
|
+
export declare function rankConsultCandidates(args: {
|
|
143
|
+
eligible: EligibleConsultMemberV1[];
|
|
144
|
+
facets: Record<string, ConsultCandidateFacetsV1> | null;
|
|
145
|
+
need: string;
|
|
146
|
+
/** requireSkill mandates (spec 281 hard filters) — applied only to enriched candidates. */
|
|
147
|
+
skillHints?: string[];
|
|
148
|
+
/** Spec 331 — the question resolved into structured need. Omit it and ranking is exactly the
|
|
149
|
+
* pre-migration lexical behaviour, so adoption is incremental rather than a flag day. */
|
|
150
|
+
structured?: StructuredNeedV1;
|
|
151
|
+
max?: number;
|
|
152
|
+
}): ConsultRankingV1;
|
|
153
|
+
/**
|
|
154
|
+
* May THIS trigger offer the routing tools (find_members / ask_member)? False unless the topic's
|
|
155
|
+
* routing flag AND assistant are on, the org consult wire is custodied, and the triggering post is
|
|
156
|
+
* HUMAN-authored — an actor-marked (agent-authored) post can NEVER re-trigger routing, which with
|
|
157
|
+
* the consult handler's empty routing toolset makes consults depth-1 by construction.
|
|
158
|
+
*/
|
|
159
|
+
export declare function routingToolsAllowed(args: {
|
|
160
|
+
routing: unknown;
|
|
161
|
+
assistant: unknown;
|
|
162
|
+
wirePresent: boolean;
|
|
163
|
+
triggerActor?: string | null;
|
|
164
|
+
}): boolean;
|
|
165
|
+
/** How the routed turn actually ended (the harness's own counters — never planner claims). */
|
|
166
|
+
export interface RoutedTurnStateV1 {
|
|
167
|
+
/** Did post_topic_message commit a reply this dispatch? */
|
|
168
|
+
posted: boolean;
|
|
169
|
+
/** Consults actually submitted (ask_member successes). */
|
|
170
|
+
askedCount: number;
|
|
171
|
+
/** The run's terminal outcome ('failed' also covers a thrown routed attempt). */
|
|
172
|
+
outcome: 'completed' | 'failed';
|
|
173
|
+
error?: string;
|
|
174
|
+
}
|
|
175
|
+
export type RoutedTurnDegradeV1 =
|
|
176
|
+
/** Reply posted — nothing to repair (`cause` present iff routed residue failed after the post: audit-only). */
|
|
177
|
+
{
|
|
178
|
+
action: 'none';
|
|
179
|
+
cause?: string;
|
|
180
|
+
}
|
|
181
|
+
/** Consults ARE in flight but no reply landed ⇒ the harness posts the deterministic honest
|
|
182
|
+
* status itself (determinism by construction — turn 2 will follow up). */
|
|
183
|
+
| {
|
|
184
|
+
action: 'post-status';
|
|
185
|
+
cause: string;
|
|
186
|
+
}
|
|
187
|
+
/** Nothing posted, nothing asked ⇒ degrade to the plain spec-327 single-tool turn
|
|
188
|
+
* (routing inert for this dispatch, never a dead turn). */
|
|
189
|
+
| {
|
|
190
|
+
action: 'plain-turn';
|
|
191
|
+
cause: string;
|
|
192
|
+
};
|
|
193
|
+
/** The degrade verdict for a finished (or thrown) ROUTED turn. Fail-closed toward the member:
|
|
194
|
+
* every branch ends with a posted reply. */
|
|
195
|
+
export declare function routedTurnDegrade(s: RoutedTurnStateV1): RoutedTurnDegradeV1;
|
|
196
|
+
/** Build the ConsultRequestV1 the org puts on the task rail, clipping question + tail to the
|
|
197
|
+
* member-side parse bounds so what is sent IS what the member's gate accepts. */
|
|
198
|
+
export declare function buildConsultRequest(args: {
|
|
199
|
+
question: string;
|
|
200
|
+
orgSA: string;
|
|
201
|
+
topicId: string;
|
|
202
|
+
questionId: string;
|
|
203
|
+
topicTitle?: string;
|
|
204
|
+
tail?: Array<{
|
|
205
|
+
author: string;
|
|
206
|
+
bodyText: string;
|
|
207
|
+
}>;
|
|
208
|
+
}): ConsultRequestV1;
|
|
209
|
+
/** Build the drafted→expressed ConsultationIntent description record (spec 329 §5). */
|
|
210
|
+
export declare function buildConsultationIntentRecord(args: {
|
|
211
|
+
questionId: string;
|
|
212
|
+
orgSA: string;
|
|
213
|
+
memberSA: string;
|
|
214
|
+
topicId: string;
|
|
215
|
+
timeoutMs?: number;
|
|
216
|
+
now?: string;
|
|
217
|
+
}): ConsultationIntentV1;
|
|
218
|
+
export type ConsultOutcomeStatus = 'answered' | 'declined' | 'timedOut' | 'failed' | 'revoked';
|
|
219
|
+
/** One consulted member's terminal outcome, as the synthesis turn consumes it. */
|
|
220
|
+
export interface ConsultOutcomeV1 {
|
|
221
|
+
memberSA: string;
|
|
222
|
+
displayName: string;
|
|
223
|
+
status: ConsultOutcomeStatus;
|
|
224
|
+
/** Present iff status === 'answered' (the validated ConsultAnswer body). */
|
|
225
|
+
answer?: ConsultAnswerV1;
|
|
226
|
+
}
|
|
227
|
+
export interface ConsultAttributionV1 {
|
|
228
|
+
/** Everyone consulted (display names, ask order). */
|
|
229
|
+
consulted: string[];
|
|
230
|
+
/** Whose answers contributed to the synthesis. */
|
|
231
|
+
contributed: string[];
|
|
232
|
+
declined: string[];
|
|
233
|
+
timedOut: string[];
|
|
234
|
+
failed: string[];
|
|
235
|
+
/** Revoked mid-flight (spec 329 W4 rule: their answer is discarded, attribution says so). */
|
|
236
|
+
revoked: string[];
|
|
237
|
+
}
|
|
238
|
+
/** Deterministic attribution buckets — the synthesis post + audit derive from THIS, never from
|
|
239
|
+
* planner output (the LLM words the reply; the harness owns who-said-what). */
|
|
240
|
+
export declare function consultAttribution(outcomes: ConsultOutcomeV1[]): ConsultAttributionV1;
|
|
241
|
+
/** PROV fields for the synthesis post (spec 329 §6): every consulted agent, derived-from ONLY the
|
|
242
|
+
* contributing answers' ConsultationIntent record ids. */
|
|
243
|
+
export declare function buildConsultProvenance(questionId: string, outcomes: ConsultOutcomeV1[]): ConsultProvenanceV1;
|
|
244
|
+
/** The harness-read context block the synthesis goal embeds (answers quoted WITH names — the
|
|
245
|
+
* approved quoting decision; non-answers stated plainly so the model can attribute honestly). */
|
|
246
|
+
export declare function synthesisOutcomeLines(outcomes: ConsultOutcomeV1[]): string;
|
|
247
|
+
/** The deterministic (rule-based) synthesis body — exact attribution, no model required. */
|
|
248
|
+
export declare function deterministicSynthesisBody(question: string, outcomes: ConsultOutcomeV1[]): string;
|
|
249
|
+
/** The one-phrase SELECTION BASIS for a candidate (spec 329 §4 skill-based auto-selection):
|
|
250
|
+
* the turn-1 status post and the goal's candidate lines both state WHY a member is (or may be)
|
|
251
|
+
* consulted — published capabilities when they exist, and the honest lesser basis when they don't.
|
|
252
|
+
* Prose says CAPABILITY (capability-architecture.md §1); the `skills` field name is the legacy
|
|
253
|
+
* `atl:skills` projection key and is immutable. */
|
|
254
|
+
export declare function consultSelectionBasis(c: Pick<ConsultCandidateV1, 'skills' | 'enriched' | 'orgRole' | 'endorsedCapabilityIds'>, matchedRole?: boolean): string;
|
|
255
|
+
/** One compact goal line per candidate — published skills FIRST (the model matches the question's
|
|
256
|
+
* subject against these), an EXPLICIT no-skills marker (never hallucinated expertise), then the
|
|
257
|
+
* ranking-evidence hint. */
|
|
258
|
+
/**
|
|
259
|
+
* Render a published capability for a HUMAN: `adv:succession-plan-design` → "succession plan
|
|
260
|
+
* design". Presentation only — the id string is the identity and is never rewritten (ADR-0051's
|
|
261
|
+
* prose/key split: the prose says "capability", the key stays exactly as published).
|
|
262
|
+
*
|
|
263
|
+
* This is a pure transform on the CURIE, deliberately NOT a catalog lookup: the catalog is a
|
|
264
|
+
* downstream domain artifact and this package must not depend on one. A canonical prefLabel would
|
|
265
|
+
* read slightly better; a substrate dependency on an advisory vocabulary would cost much more than
|
|
266
|
+
* that is worth. A token that is not CURIE-shaped (a legacy free-text label) passes through
|
|
267
|
+
* untouched.
|
|
268
|
+
*/
|
|
269
|
+
export declare function humanizeCapability(id: string): string;
|
|
270
|
+
export declare function consultCandidateLine(c: ConsultCandidateV1): string;
|
|
271
|
+
/**
|
|
272
|
+
* Does the question ADDRESS this candidate's org role (spec 329 §12)? Pure, deterministic, and
|
|
273
|
+
* conservative: a normalized substring match of the asserted role phrase in the question
|
|
274
|
+
* ("@ask tax advisor …", "ask our tax advisor about …" both hit "tax advisor"). Used by the
|
|
275
|
+
* DETERMINISTIC (no-LLM) routed turn to state an honest basis; the LLM turn does its own matching
|
|
276
|
+
* under ROUTING_CONTRACT. No role asserted ⇒ false (a role is never inferred from skills).
|
|
277
|
+
*/
|
|
278
|
+
export declare function questionAddressesRole(question: string, orgRole: string | undefined): boolean;
|
|
279
|
+
/** The deterministic turn-1 status body — the honest "asking N members" post (spec 329 §4.1).
|
|
280
|
+
* Entries may carry a selection `basis` (see consultSelectionBasis), rendered in parentheses:
|
|
281
|
+
* "Asking 1 member's agent (alice (published skills: water systems)) — …". Plain strings keep
|
|
282
|
+
* the pre-329-§4 shape. */
|
|
283
|
+
export declare function deterministicStatusBody(members: Array<string | {
|
|
284
|
+
displayName: string;
|
|
285
|
+
basis?: string;
|
|
286
|
+
}>): string;
|
|
287
|
+
/** Re-export the grant-store key so execution points scanning eligibility import ONE name. */
|
|
288
|
+
export { consultGrantRecordKey };
|
|
289
|
+
//# sourceMappingURL=consult-routing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consult-routing.d.ts","sourceRoot":"","sources":["../../src/messaging/consult-routing.ts"],"names":[],"mappings":"AAOA,OAAO,EAKL,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAExE,uDAAuD;AACvD,eAAO,MAAM,iBAAiB,YAAa,MAAM,cAAc,MAAM,KAAG,MAC5B,CAAC;AAE7C,0FAA0F;AAC1F,eAAO,MAAM,qBAAqB,eAAgB,MAAM,YAAY,MAAM,KAAG,MAClB,CAAC;AAI5D;oFACoF;AACpF,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;oFACgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,qBAAqB,GA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