@agenticprimitives/context 0.0.0-alpha.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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -0
  3. package/dist/affiliations-read.d.ts +19 -0
  4. package/dist/affiliations-read.d.ts.map +1 -0
  5. package/dist/affiliations-read.js +74 -0
  6. package/dist/affiliations-read.js.map +1 -0
  7. package/dist/ask-discovery.d.ts +15 -0
  8. package/dist/ask-discovery.d.ts.map +1 -0
  9. package/dist/ask-discovery.js +88 -0
  10. package/dist/ask-discovery.js.map +1 -0
  11. package/dist/confirmation.d.ts +59 -0
  12. package/dist/confirmation.d.ts.map +1 -0
  13. package/dist/confirmation.js +52 -0
  14. package/dist/confirmation.js.map +1 -0
  15. package/dist/conversation.d.ts +61 -0
  16. package/dist/conversation.d.ts.map +1 -0
  17. package/dist/conversation.js +66 -0
  18. package/dist/conversation.js.map +1 -0
  19. package/dist/directory-rows.d.ts +41 -0
  20. package/dist/directory-rows.d.ts.map +1 -0
  21. package/dist/directory-rows.js +121 -0
  22. package/dist/directory-rows.js.map +1 -0
  23. package/dist/entities.d.ts +65 -0
  24. package/dist/entities.d.ts.map +1 -0
  25. package/dist/entities.js +56 -0
  26. package/dist/entities.js.map +1 -0
  27. package/dist/grounded-composition.d.ts +14 -0
  28. package/dist/grounded-composition.d.ts.map +1 -0
  29. package/dist/grounded-composition.js +89 -0
  30. package/dist/grounded-composition.js.map +1 -0
  31. package/dist/grounded-types.d.ts +11 -0
  32. package/dist/grounded-types.d.ts.map +1 -0
  33. package/dist/grounded-types.js +2 -0
  34. package/dist/grounded-types.js.map +1 -0
  35. package/dist/index.d.ts +32 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +31 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/instructions.d.ts +56 -0
  40. package/dist/instructions.d.ts.map +1 -0
  41. package/dist/instructions.js +61 -0
  42. package/dist/instructions.js.map +1 -0
  43. package/dist/invitations-read.d.ts +28 -0
  44. package/dist/invitations-read.d.ts.map +1 -0
  45. package/dist/invitations-read.js +93 -0
  46. package/dist/invitations-read.js.map +1 -0
  47. package/dist/kb-question.d.ts +24 -0
  48. package/dist/kb-question.d.ts.map +1 -0
  49. package/dist/kb-question.js +139 -0
  50. package/dist/kb-question.js.map +1 -0
  51. package/dist/membership-read.d.ts +37 -0
  52. package/dist/membership-read.d.ts.map +1 -0
  53. package/dist/membership-read.js +143 -0
  54. package/dist/membership-read.js.map +1 -0
  55. package/dist/memory.d.ts +49 -0
  56. package/dist/memory.d.ts.map +1 -0
  57. package/dist/memory.js +43 -0
  58. package/dist/memory.js.map +1 -0
  59. package/dist/name-match.d.ts +22 -0
  60. package/dist/name-match.d.ts.map +1 -0
  61. package/dist/name-match.js +109 -0
  62. package/dist/name-match.js.map +1 -0
  63. package/dist/party-resolution.d.ts +214 -0
  64. package/dist/party-resolution.d.ts.map +1 -0
  65. package/dist/party-resolution.js +687 -0
  66. package/dist/party-resolution.js.map +1 -0
  67. package/dist/private-context.d.ts +25 -0
  68. package/dist/private-context.d.ts.map +1 -0
  69. package/dist/private-context.js +134 -0
  70. package/dist/private-context.js.map +1 -0
  71. package/dist/provider.d.ts +45 -0
  72. package/dist/provider.d.ts.map +1 -0
  73. package/dist/provider.js +18 -0
  74. package/dist/provider.js.map +1 -0
  75. package/dist/relationship-rows.d.ts +14 -0
  76. package/dist/relationship-rows.d.ts.map +1 -0
  77. package/dist/relationship-rows.js +50 -0
  78. package/dist/relationship-rows.js.map +1 -0
  79. package/dist/self-only.d.ts +24 -0
  80. package/dist/self-only.d.ts.map +1 -0
  81. package/dist/self-only.js +48 -0
  82. package/dist/self-only.js.map +1 -0
  83. package/dist/standing.d.ts +75 -0
  84. package/dist/standing.d.ts.map +1 -0
  85. package/dist/standing.js +152 -0
  86. package/dist/standing.js.map +1 -0
  87. package/dist/structured-call.d.ts +16 -0
  88. package/dist/structured-call.d.ts.map +1 -0
  89. package/dist/structured-call.js +18 -0
  90. package/dist/structured-call.js.map +1 -0
  91. package/dist/tiers.d.ts +14 -0
  92. package/dist/tiers.d.ts.map +1 -0
  93. package/dist/tiers.js +2 -0
  94. package/dist/tiers.js.map +1 -0
  95. package/dist/vault-question.d.ts +75 -0
  96. package/dist/vault-question.d.ts.map +1 -0
  97. package/dist/vault-question.js +302 -0
  98. package/dist/vault-question.js.map +1 -0
  99. package/package.json +51 -0
  100. package/spec.md +20 -0
package/dist/memory.js ADDED
@@ -0,0 +1,43 @@
1
+ export const PREFERENCE_PREFIX = 'preference:';
2
+ /** The key is derived from the trigger, so telling the agent the same shorthand twice UPDATES rather than
3
+ * accumulates — a person does not hold two contradictory memories of what "alice" means. */
4
+ export const preferenceKey = (trigger) => `${PREFERENCE_PREFIX}${trigger.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 60)}`;
5
+ /** The owner's learned preferences, normalised. Absent dep ⇒ no memory, which narrows nothing. */
6
+ export async function learnedPreferences(deps, owner) {
7
+ if (!deps.readPreferences)
8
+ return [];
9
+ const rows = await deps.readPreferences(owner).catch(() => []);
10
+ return rows
11
+ .map((r) => r.data)
12
+ .filter((p) => !!p && p.type === 'ap.context.learned-preference.v1' && !!p.trigger);
13
+ }
14
+ /** Does a learned preference answer to these words? Exact-trigger only: memory disambiguates a shorthand
15
+ * the owner defined, it does not fuzzy-match the world (that is resolution's job, and a loose memory
16
+ * match would quietly override a real agent with a remembered one). */
17
+ export function preferenceFor(prefs, term) {
18
+ const t = term.trim().toLowerCase();
19
+ return prefs.find((p) => p.trigger.trim().toLowerCase() === t) ?? null;
20
+ }
21
+ /** Record a preference. The owner is fixed by the caller (their session); nothing here takes it from an
22
+ * argument, so a person can only teach their OWN agent about their OWN shorthand. */
23
+ export async function rememberPreference(deps, owner, input) {
24
+ if (!deps.writePreference)
25
+ return { ok: false, key: '', error: 'this agent cannot keep preferences' };
26
+ const key = preferenceKey(input.trigger);
27
+ const record = {
28
+ type: 'ap.context.learned-preference.v1',
29
+ trigger: input.trigger.trim(),
30
+ subject: input.subject,
31
+ ...(input.subjectLabel ? { subjectLabel: input.subjectLabel } : {}),
32
+ learnedAt: (input.now ?? (() => new Date().toISOString()))(),
33
+ ...(input.saidAs ? { saidAs: input.saidAs } : {}),
34
+ };
35
+ try {
36
+ await deps.writePreference(owner, key, record);
37
+ return { ok: true, key };
38
+ }
39
+ catch (e) {
40
+ return { ok: false, key, error: e instanceof Error ? e.message : String(e) };
41
+ }
42
+ }
43
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAkCA,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C;6FAC6F;AAC7F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAU,EAAE,CACvD,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AASzH,kGAAkG;AAClG,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAgB,EAAE,KAAa;IACtE,IAAI,CAAC,IAAI,CAAC,eAAe;QAAE,OAAO,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/D,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAkC,CAAC;SAChD,MAAM,CAAC,CAAC,CAAC,EAA4B,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KA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AI,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QAC/C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** Words that say what KIND of agent a name is, not which one: the typed suffixes and their long forms. */
2
+ export declare const KIND_WORDS: ReadonlySet<string>;
3
+ /** The words that NAME the thing: lowercased, split on anything that is not a letter or digit, a leading
4
+ * article dropped, and the kind words dropped — unless they are all there is ("the team" names nothing,
5
+ * but an org actually called "organization" keeps its word). A dotted name contributes its label only. */
6
+ export declare function nameWords(said: string): string[];
7
+ /** The kind word the person attached, if any ("missio nexus organization" → "organization"): a hint about
8
+ * which typed root they mean, for a resolver that can use it. */
9
+ export declare function saidKind(said: string): string | null;
10
+ /** Sørensen–Dice over character bigrams of the squashed words: 1 is identical, 0 shares nothing. */
11
+ export declare function nameSimilarity(said: string, name: string): number;
12
+ /** Close enough to be the one they meant when nothing matches exactly. */
13
+ export declare const CLOSE_THRESHOLD = 0.8;
14
+ /**
15
+ * How `said` meets a name. Exact grades first; then `close` when every word the person said begins a word
16
+ * of the name (a first name, "somali corridor" for "somali corridor team"), or the squashed forms are
17
+ * within the threshold (a transcription slip). `null` when it is not the name.
18
+ */
19
+ export declare function nameMatch(said: string, name: string, display?: string): 'exact-name' | 'label' | 'display-name' | 'close' | null;
20
+ /** The label forms a spoken name could be registered under: "missio nexus" → `missio-nexus`, `missionexus`. */
21
+ export declare function labelForms(said: string): string[];
22
+ //# sourceMappingURL=name-match.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-match.d.ts","sourceRoot":"","sources":["../src/name-match.ts"],"names":[],"mappings":"AAaA,2GAA2G;AAC3G,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,CAIzC,CAAC;AAIH;;2GAE2G;AAC3G,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAOhD;AAED;kEACkE;AAClE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIpD;AAID,oGAAoG;AACpG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAUjE;AAED,0EAA0E;AAC1E,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,OAAO,GAAG,cAAc,GAAG,OAAO,GAAG,IAAI,CAuBhI;AAED,+GAA+G;AAC/G,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAIjD"}
@@ -0,0 +1,109 @@
1
+ // HOW WORDS MEET A NAME — one matcher for every private-tier provider (spec 369 amendment, 2026-09-07).
2
+ //
3
+ // A person says "missio nexus organization", "the Somali corridor team", "Missio-Nexus". The agent is
4
+ // `missio-nexus.org`, listed as "Missio Nexus". Three things stand between the words and the name and none
5
+ // of them is which agent was meant: the KIND WORD (the typed suffix already says it — ADR-0061), spacing and
6
+ // case, and the small slips a transcription makes. So a match is decided on the words that name the thing,
7
+ // in three grades the resolver treats differently:
8
+ // exact-name / label / display-name — the words ARE the name: certain on their own.
9
+ // close — the words are near one name: taken when it is the only one, asked when there are several, and
10
+ // never preferred over an exact hit. A close match is shown back as "closest to what you said".
11
+ // No score is returned (entities.ts): a grade is evidence a surface can act on; a number is a ranking.
12
+ import { CLASS_FOR_SUFFIX } from '@agenticprimitives/ontology';
13
+ /** Words that say what KIND of agent a name is, not which one: the typed suffixes and their long forms. */
14
+ export const KIND_WORDS = new Set([
15
+ ...Object.keys(CLASS_FOR_SUFFIX),
16
+ 'organization', 'organisation', 'organizations', 'organisations', 'orgs', 'teams', 'workspaces', 'treasuries',
17
+ 'service', 'services', 'registries', 'churches', 'circles', 'households', 'agent', 'agents', 'account', 'accounts',
18
+ ]);
19
+ const LEADING = new Set(['the', 'a', 'an', 'my', 'our']);
20
+ /** The words that NAME the thing: lowercased, split on anything that is not a letter or digit, a leading
21
+ * article dropped, and the kind words dropped — unless they are all there is ("the team" names nothing,
22
+ * but an org actually called "organization" keeps its word). A dotted name contributes its label only. */
23
+ export function nameWords(said) {
24
+ const s = said.trim().toLowerCase().replace(/[’']/g, '');
25
+ const label = s.includes('.') && !/\s/.test(s) ? (s.split('.')[0] ?? s) : s;
26
+ const words = label.split(/[^a-z0-9]+/).filter(Boolean);
27
+ const body = words.filter((w, i) => !(i === 0 && LEADING.has(w)));
28
+ const named = body.filter((w) => !KIND_WORDS.has(w));
29
+ return named.length ? named : body;
30
+ }
31
+ /** The kind word the person attached, if any ("missio nexus organization" → "organization"): a hint about
32
+ * which typed root they mean, for a resolver that can use it. */
33
+ export function saidKind(said) {
34
+ const words = said.trim().toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
35
+ const kind = [...words].reverse().find((w) => KIND_WORDS.has(w)) ?? null;
36
+ return kind && nameWords(said).join('') !== kind ? kind : null;
37
+ }
38
+ const bigrams = (s) => { const out = []; for (let i = 0; i + 1 < s.length; i++)
39
+ out.push(s.slice(i, i + 2)); return out; };
40
+ /** Sørensen–Dice over character bigrams of the squashed words: 1 is identical, 0 shares nothing. */
41
+ export function nameSimilarity(said, name) {
42
+ const a = nameWords(said).join('');
43
+ const b = nameWords(name).join('');
44
+ if (!a || !b)
45
+ return 0;
46
+ if (a === b)
47
+ return 1;
48
+ const A = bigrams(a);
49
+ const B = new Map();
50
+ for (const g of bigrams(b))
51
+ B.set(g, (B.get(g) ?? 0) + 1);
52
+ let shared = 0;
53
+ for (const g of A) {
54
+ const n = B.get(g) ?? 0;
55
+ if (n > 0) {
56
+ shared++;
57
+ B.set(g, n - 1);
58
+ }
59
+ }
60
+ return (2 * shared) / (A.length + bigrams(b).length);
61
+ }
62
+ /** Close enough to be the one they meant when nothing matches exactly. */
63
+ export const CLOSE_THRESHOLD = 0.8;
64
+ /**
65
+ * How `said` meets a name. Exact grades first; then `close` when every word the person said begins a word
66
+ * of the name (a first name, "somali corridor" for "somali corridor team"), or the squashed forms are
67
+ * within the threshold (a transcription slip). `null` when it is not the name.
68
+ */
69
+ export function nameMatch(said, name, display) {
70
+ const t = said.trim().toLowerCase();
71
+ const n = name.trim().toLowerCase();
72
+ if (!t)
73
+ return null;
74
+ if (n && n === t)
75
+ return 'exact-name';
76
+ const label = n.split('.')[0] ?? '';
77
+ if (label && label === t)
78
+ return 'label';
79
+ const saidJoined = nameWords(t).join('');
80
+ if (!saidJoined)
81
+ return null;
82
+ if (label && nameWords(label).join('') === saidJoined)
83
+ return 'label';
84
+ const d = (display ?? '').trim().toLowerCase();
85
+ if (d) {
86
+ if (d === t)
87
+ return 'display-name';
88
+ if (d.split(/\s+/).includes(t))
89
+ return 'display-name';
90
+ if (nameWords(d).join('') === saidJoined)
91
+ return 'display-name';
92
+ }
93
+ const saidWords = nameWords(t);
94
+ for (const target of [label, d].filter(Boolean)) {
95
+ const targetWords = nameWords(target);
96
+ const every = saidWords.length > 0 && saidWords.every((w) => w.length >= 3 && targetWords.some((x) => x.startsWith(w)));
97
+ if (every || nameSimilarity(t, target) >= CLOSE_THRESHOLD)
98
+ return 'close';
99
+ }
100
+ return null;
101
+ }
102
+ /** The label forms a spoken name could be registered under: "missio nexus" → `missio-nexus`, `missionexus`. */
103
+ export function labelForms(said) {
104
+ const words = nameWords(said);
105
+ if (!words.length)
106
+ return [];
107
+ return [...new Set([words.join('-'), words.join('')])];
108
+ }
109
+ //# sour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M,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QAChD,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxH,IAAI,KAAK,IAAI,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,IAAI,eAAe;YAAE,OAAO,OAAO,CAAC;IAC5E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAC7B,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,214 @@
1
+ import { type RecentPartyV1 } from './conversation.js';
2
+ import { type EntityCandidate, type EntityProvider } from './entities.js';
3
+ import { type LearnedPreferenceV1 } from './memory.js';
4
+ import type { Address } from '@agenticprimitives/types';
5
+ /** The vault record type holding an asker's received resolution grants (spec 338). Declared HERE —
6
+ * the app's resolution-invitation module imports it back, so the key has one definition. */
7
+ export declare const RESOLUTION_GRANTS_RECORD = "resolution.grants";
8
+ /** The roots a bare label might live under, most-likely first. A person is the common case for "alice". */
9
+ export declare const PARTY_ROOTS: readonly ["me", "org", "team", "treasury", "workspace", "svc", "circle", "church", "registry"];
10
+ export interface PartyLookups {
11
+ /** Exact name → address, from the naming service on chain. */
12
+ resolveName?: (name: string) => Promise<string | null>;
13
+ /** Read one record from a subject's own vault — the private tier. */
14
+ readSubjectRecord?: (subject: string, recordType: string) => Promise<unknown>;
15
+ /** Told what a party's words RESOLVED TO, so a surface can show it back before anyone signs. The
16
+ * resolver is the only place that knows both halves — "nathan" and the address it became — and by the
17
+ * time an argument reaches a mandate the words are gone. Display only; it decides nothing. */
18
+ onResolved?: (r: ResolvedParty) => void;
19
+ /** The agents chartered under `owner` of a given type, read from the on-chain `ap:charteredUnder`
20
+ * edges (spec 355 W2). PUBLIC: this is the half that answers for someone else's agents. */
21
+ charteredAgents?: (owner: string, type: string) => Promise<Array<{
22
+ agent: string;
23
+ name?: string;
24
+ primary?: boolean;
25
+ roles?: readonly string[];
26
+ }>>;
27
+ /** The held grants this asker can actually use — signature checked against the issuer, bound to them,
28
+ * and pointed at the target they name (spec 338 §4). Absent ⇒ held grants are not used.
29
+ *
30
+ * A grant that is HELD but REFUSED comes back with `refusedBecause` rather than being dropped: the
31
+ * person is holding a way to reach somebody and being told "nothing called bob is a treasury", which
32
+ * is true, unhelpful, and hides the one fact that would let them fix it. */
33
+ verifyGrant?: (held: unknown, type: string, asker: string, session?: string) => Promise<Array<{
34
+ targetAgent?: string;
35
+ owner: string;
36
+ ownerName?: string;
37
+ label?: string;
38
+ refusedBecause?: string;
39
+ }>>;
40
+ /** The asker's session, carried so the resolver gate can check they are the grant's subject. */
41
+ session?: string;
42
+ /** Spec 321 W2 / one invite flow — the counterfactual agent a Home will deploy for an email, for a party
43
+ * role that `alsoAccepts` email. Deterministic; gated by the steward's session at the Home. */
44
+ predictAgentForEmail?: (input: {
45
+ org: Address;
46
+ email: string;
47
+ session: string;
48
+ }) => Promise<Address | null>;
49
+ /** Spec 358 W5 — the asker's own learned preferences (`preference:*`). A shorthand the owner DEFINED
50
+ * resolves to what they said it means, cited as memory. Absent ⇒ no memory, which narrows nothing. */
51
+ preferences?: () => Promise<LearnedPreferenceV1[]>;
52
+ /** Spec 370 P7 — what recent asks resolved (`conversation.recent`), newest first. A pronoun means the
53
+ * newest party that fits; a repeated name among several candidates means the one chosen before. */
54
+ recentParties?: () => Promise<ReadonlyArray<RecentPartyV1 & {
55
+ said?: string;
56
+ }>>;
57
+ /** Spec 385 — the person's DURABLE, scoped confirmation memory (`confirmation.preferences`): the agent they
58
+ * last confirmed for THIS word as THIS capability's THIS argument, IF it is still among the candidates found
59
+ * now (revalidated by the caller). Consulted before the rolling window, which decays; evidence, never a grant.
60
+ * Absent ⇒ no durable memory, which narrows nothing. */
61
+ preferredChoice?: (scope: {
62
+ word: string;
63
+ capability: string;
64
+ arg: string;
65
+ }, candidates: ReadonlyArray<{
66
+ agent: string;
67
+ }>) => Promise<{
68
+ agent: string;
69
+ label?: string;
70
+ } | null>;
71
+ /** Spec 394 — the person's STANDING INSTRUCTION for this capability's argument in this room (`standing.instructions`):
72
+ * the default they DECLARED ("from now on, pay from alice3.treasury"), read for the exact context then `any`.
73
+ * Fills an argument they did not speak, never one they did; the caller revalidates it; never a grant. */
74
+ standingInstruction?: (scope: {
75
+ capability: string;
76
+ arg: string;
77
+ context?: string;
78
+ }) => Promise<{
79
+ value: string;
80
+ label?: string;
81
+ saidAs?: string;
82
+ } | null>;
83
+ /** WHAT AN AGENT HOLDS of the value asset, for a person choosing between accounts. Eighteen treasuries
84
+ * listed as bare addresses is a question nobody can answer; the same eighteen with balances is a
85
+ * glance. It is EVIDENCE, not preference — the deployment's own token balance, read on chain — and it
86
+ * never picks: an empty account is still a legitimate choice its owner may have meant. Absent ⇒ the
87
+ * list is unranked and unannotated, exactly as before. */
88
+ valueHeld?: (agent: string) => Promise<{
89
+ amount: bigint;
90
+ display: string;
91
+ } | null>;
92
+ }
93
+ /** What one party's words became. `label` is absent when the person gave an address outright — there was
94
+ * nothing to resolve, and inventing a name for it would be the surface claiming knowledge it lacks. */
95
+ export interface ResolvedParty {
96
+ arg: string;
97
+ raw: string;
98
+ agent: string;
99
+ label?: string;
100
+ hint?: string;
101
+ /** Spec 363 — WHY this was decided rather than asked, in the words the rule carries ("you marked it as
102
+ * the account you pay from"). Present only when a DECISION POINT answered; absent when the person
103
+ * said it outright or picked it from a list. A decision that cannot say why is a guess. */
104
+ because?: string;
105
+ /** The DECISION POINT and the rule that answered, for the receipt — so a run can be audited for its
106
+ * decisions, not only its authority. Both, because a rule id alone does not say what question it was
107
+ * answering, and reconstructing that from the argument name is the improvised mapping this spec is
108
+ * written against. */
109
+ ruleId?: string;
110
+ pointId?: string;
111
+ /** WHOSE disclosure reached it — the owner, when this agent was found by following someone else's
112
+ * chartered edge or a grant they issued. Absent when the person named the agent outright: nobody
113
+ * disclosed anything, so there is nobody whose request this settles. Not authority, and not read by
114
+ * any gate — it is how a run can close the note that was waiting on exactly this. */
115
+ ownedBy?: string;
116
+ /** Spec 367 §3/§7 — HOW this party was bound when it was not resolved from the person's words: from the
117
+ * validated application context (the realm they stand in). A trace and a receipt show it as such. */
118
+ via?: 'context' | 'standing';
119
+ }
120
+ /** A candidate that is HELD BY somebody — what `ownedAgentsOfType` answers with. The owner is stated,
121
+ * because the question it answers ("what does THIS agent hold") has an owner in it. */
122
+ type OwnedCandidate = EntityCandidate & {
123
+ ownedBy?: string;
124
+ };
125
+ /** Arguments that move value — from the ontology binding (spec 355), where a party says whether getting
126
+ * it wrong can be undone. For these, settling for a different KIND of agent than the capability asked
127
+ * for is a question, not a resolution: a payment cannot be taken back. */
128
+ export declare const VALUE_ARGS: ReadonlySet<string>;
129
+ /** The providers a party lookup may consult, in order — private ones only. */
130
+ export declare function partyProviders(lookups: PartyLookups): EntityProvider[];
131
+ /** Every agent the asker could mean by these words. Exported for tests and for a surface that wants to
132
+ * show the same candidates the resolver saw. */
133
+ export declare function partyCandidates(raw: string, lookups: PartyLookups, subject?: string): Promise<EntityCandidate[]>;
134
+ /**
135
+ * THE ASKER'S OWN AGENT OF A GIVEN TYPE — "pay from my treasury", without them having to say it.
136
+ *
137
+ * A person standing in their own realm says "send alice 20 USDC" and means the thing of theirs that holds
138
+ * money. What arrives is their PERSON address, because that is the realm they are standing in, and a
139
+ * person SA holds no USDC — so the ask died on a balance check against an account that was never meant to
140
+ * pay. The typed suffix already says which of their agents is the payer; this is that lookup, over their
141
+ * own tree only.
142
+ *
143
+ * Their own tier, and no widening: this answers "which of YOUR agents", never "which agent anywhere".
144
+ */
145
+ export declare function ownAgentsOfType(subject: string, type: string, lookups: PartyLookups): Promise<EntityCandidate[]>;
146
+ /**
147
+ * THE AGENTS SOMEONE OWNS, of a given type — the relationship, not the name.
148
+ *
149
+ * "Send money to alice" means alice's TREASURY. Finding it by guessing the name `alice.treasury` was
150
+ * wrong in principle and wrong in fact: her treasury is called `alice2.treasury`, and a treasury's name
151
+ * has no obligation to resemble its owner's. What actually connects them is the OWNERSHIP relationship —
152
+ * resolve the person first, then ask what they hold.
153
+ *
154
+ * Read from the asker's own tree, where an agent records its parent. That covers everything they are
155
+ * linked to — their own treasuries, and those of the organizations they steward. It does NOT cover a
156
+ * stranger's: the link between alice.me and alice2.treasury lives in ALICE's private records
157
+ * (ADR-0025), and is in no public place today — not the relationship registry (no edges exist), not the
158
+ * directory (no owner field), not the naming service (whose "parent" is the TLD). Until a person's
159
+ * treasury is a public fact, nobody else can be routed to it, and the honest move is to ask.
160
+ */
161
+ export declare function ownedAgentsOfType(owner: string, type: string, lookups: PartyLookups, asker?: string): Promise<OwnedCandidate[]>;
162
+ interface HouseholdMember {
163
+ agent: string;
164
+ label?: string;
165
+ kin?: string;
166
+ kinLabel?: string;
167
+ role?: string;
168
+ kinWord?: string;
169
+ household?: string;
170
+ }
171
+ /**
172
+ * The people in the asker's own household record. PRIVATE TIER — their vault, their copy, never
173
+ * published (ADR-0040 keeps it out of the KB because it is not derivable from chain state).
174
+ */
175
+ export declare function householdMembers(subject: string, lookups: Pick<PartyLookups, 'readSubjectRecord'>): Promise<HouseholdMember[]>;
176
+ /**
177
+ * The choices a person is shown, richest first, each saying what it holds.
178
+ *
179
+ * ORDER IS NOT AN ANSWER. Ranking is a courtesy to the reader — the account that can actually pay is the
180
+ * one they are usually looking for — and the question is still asked, because spending from the fullest
181
+ * account is a guess about intent, not a fact about it. An account with nothing keeps its place in the
182
+ * list; it is merely last.
183
+ *
184
+ * Nothing here is fetched unless `valueHeld` is wired, and a lookup that fails annotates nothing rather
185
+ * than removing a candidate: a balance we could not read is not evidence the agent is not theirs.
186
+ */
187
+ export declare function choicesFor(candidates: EntityCandidate[], lookups: Pick<PartyLookups, 'valueHeld'>,
188
+ /** What the act NEEDS, when the amount is already known. An account that cannot cover it is still the
189
+ * person's own and still offered — they may mean to fund it — but it is marked and it goes last.
190
+ * Offering an account that will fail as an equal choice is offering a wrong answer politely. */
191
+ needs?: {
192
+ amount: bigint;
193
+ display: string;
194
+ }): Promise<Array<{
195
+ value: string;
196
+ label: string;
197
+ hint: string;
198
+ }>>;
199
+ export declare function candidateHint(c: EntityCandidate): string;
200
+ export declare function resolveParty(raw: unknown, lookups: PartyLookups, where: {
201
+ stepRef: string;
202
+ toolId: string;
203
+ argName: string;
204
+ what: string;
205
+ subject?: string;
206
+ capabilityId?: string;
207
+ types?: readonly string[];
208
+ pendingAmount?: string;
209
+ /** Spec 363 W5 — the decision points this capability consults. A point not named is not consulted:
210
+ * the resolver asks, which is what every capability did before the plane existed. */
211
+ consults?: readonly string[];
212
+ }): Promise<Address>;
213
+ export {};
214
+ //# sourceMappingURL=party-resolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"party-resolution.d.ts","sourceRoot":"","sources":["../src/party-resolution.ts"],"names":[],"mappings":"AAwBA,OAAO,EAA0C,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG/F,OAAO,EAAiB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,aAAa,C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