hcifootprint 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +524 -0
- package/dist/atom/types.d.ts +618 -0
- package/dist/atom/types.d.ts.map +1 -0
- package/dist/atom/types.js +2 -0
- package/dist/atom/types.js.map +1 -0
- package/dist/graph/builder.d.ts +31 -0
- package/dist/graph/builder.d.ts.map +1 -0
- package/dist/graph/builder.js +165 -0
- package/dist/graph/builder.js.map +1 -0
- package/dist/graph/guards.d.ts +31 -0
- package/dist/graph/guards.d.ts.map +1 -0
- package/dist/graph/guards.js +94 -0
- package/dist/graph/guards.js.map +1 -0
- package/dist/graph/skill-deps.d.ts +20 -0
- package/dist/graph/skill-deps.d.ts.map +1 -0
- package/dist/graph/skill-deps.js +15 -0
- package/dist/graph/skill-deps.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +16 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +15 -0
- package/dist/mcp.js.map +1 -0
- package/dist/presence/presence.d.ts +50 -0
- package/dist/presence/presence.d.ts.map +1 -0
- package/dist/presence/presence.js +126 -0
- package/dist/presence/presence.js.map +1 -0
- package/dist/registry/registry.d.ts +53 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +76 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/serve/mcp-server.d.ts +40 -0
- package/dist/serve/mcp-server.d.ts.map +1 -0
- package/dist/serve/mcp-server.js +72 -0
- package/dist/serve/mcp-server.js.map +1 -0
- package/dist/serve/mcp.d.ts +12 -0
- package/dist/serve/mcp.d.ts.map +1 -0
- package/dist/serve/mcp.js +62 -0
- package/dist/serve/mcp.js.map +1 -0
- package/dist/serve/modes.d.ts +66 -0
- package/dist/serve/modes.d.ts.map +1 -0
- package/dist/serve/modes.js +347 -0
- package/dist/serve/modes.js.map +1 -0
- package/dist/testing/harness.d.ts +156 -0
- package/dist/testing/harness.d.ts.map +1 -0
- package/dist/testing/harness.js +416 -0
- package/dist/testing/harness.js.map +1 -0
- package/dist/testing/index.d.ts +35 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +32 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/lint.d.ts +20 -0
- package/dist/testing/lint.d.ts.map +1 -0
- package/dist/testing/lint.js +18 -0
- package/dist/testing/lint.js.map +1 -0
- package/dist/testing/model/check.d.ts +30 -0
- package/dist/testing/model/check.d.ts.map +1 -0
- package/dist/testing/model/check.js +89 -0
- package/dist/testing/model/check.js.map +1 -0
- package/dist/testing/model/lint.d.ts +54 -0
- package/dist/testing/model/lint.d.ts.map +1 -0
- package/dist/testing/model/lint.js +235 -0
- package/dist/testing/model/lint.js.map +1 -0
- package/dist/testing/model/satisfiable.d.ts +25 -0
- package/dist/testing/model/satisfiable.d.ts.map +1 -0
- package/dist/testing/model/satisfiable.js +101 -0
- package/dist/testing/model/satisfiable.js.map +1 -0
- package/dist/traverse/nav-session.d.ts +108 -0
- package/dist/traverse/nav-session.d.ts.map +1 -0
- package/dist/traverse/nav-session.js +637 -0
- package/dist/traverse/nav-session.js.map +1 -0
- package/dist/traverse/session.d.ts +239 -0
- package/dist/traverse/session.d.ts.map +1 -0
- package/dist/traverse/session.js +1305 -0
- package/dist/traverse/session.js.map +1 -0
- package/dist/tree/appmap.d.ts +8 -0
- package/dist/tree/appmap.d.ts.map +1 -0
- package/dist/tree/appmap.js +259 -0
- package/dist/tree/appmap.js.map +1 -0
- package/dist/tree/types.d.ts +151 -0
- package/dist/tree/types.d.ts.map +1 -0
- package/dist/tree/types.js +2 -0
- package/dist/tree/types.js.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,618 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hcifootprint — the domain atom and its supporting types.
|
|
3
|
+
*
|
|
4
|
+
* The atom (adjudicated against 8 real-world UI pattern families before any
|
|
5
|
+
* code was written — see the project's RESEARCH_STATE, hypothesis H1'):
|
|
6
|
+
*
|
|
7
|
+
* Affordance = binding × guard × effect × schema (the static capability)
|
|
8
|
+
* Transition = cause × payload × outcome (each occurrence)
|
|
9
|
+
*
|
|
10
|
+
* Design commitments this file encodes:
|
|
11
|
+
* - `guard` is a serializable footprintjs WhereFilter, evaluated OUTSIDE any
|
|
12
|
+
* engine run by the pure `evaluateFilter` — it filters what is OFFERED
|
|
13
|
+
* (footprint's decide() chooses one branch; hcifootprint's available()
|
|
14
|
+
* exposes every passing edge and waits for the world to pick).
|
|
15
|
+
* - `effect` is a CLAIM about the app's handler, not a truth. Every settled
|
|
16
|
+
* transition carries `effectVerified` — the honesty-marker pattern
|
|
17
|
+
* footprintjs uses for untracked reads, applied to writes.
|
|
18
|
+
* - `cause` replaces a bare user/agent enum: system-initiated motion
|
|
19
|
+
* (redirects, server pushes, timeouts) is recorded first-class as a
|
|
20
|
+
* `stimulus`, never silently patched over.
|
|
21
|
+
* - Provenance is accountability for COOPERATING agents, not a security
|
|
22
|
+
* boundary. An uncooperative driver is indistinguishable from a human at
|
|
23
|
+
* the DOM; enforcement belongs server-side.
|
|
24
|
+
*/
|
|
25
|
+
import type { WhereFilter } from 'footprintjs';
|
|
26
|
+
import type { FilterCondition } from 'footprintjs/advanced';
|
|
27
|
+
/** Who initiated a transition. Open beyond user/agent by design. */
|
|
28
|
+
export type Principal = 'user' | 'agent' | 'system' | 'unknown';
|
|
29
|
+
/** What kind of world-initiated motion a stimulus transition records. */
|
|
30
|
+
export type StimulusKind = 'navigation' | 'timeout' | 'push' | 'structure-swap' | 'unknown';
|
|
31
|
+
/**
|
|
32
|
+
* Why a transition exists.
|
|
33
|
+
* - `fired` — an affordance was fired through the driver (guard-checked).
|
|
34
|
+
* - `stimulus`— the world moved without an offered edge (back button, server
|
|
35
|
+
* push, session expiry). Recorded, never silent.
|
|
36
|
+
*/
|
|
37
|
+
export interface Cause {
|
|
38
|
+
kind: 'fired' | 'stimulus';
|
|
39
|
+
principal: Principal;
|
|
40
|
+
/** Set when kind === 'fired'. */
|
|
41
|
+
affordanceId?: string;
|
|
42
|
+
/** Set when kind === 'stimulus'. */
|
|
43
|
+
stimulus?: StimulusKind;
|
|
44
|
+
/**
|
|
45
|
+
* True when the attribution was GUESSED by effect-signature inference (an
|
|
46
|
+
* unattributed delta matched exactly one registered affordance's declared
|
|
47
|
+
* writes) rather than observed. Honesty marker — never laundered as fact.
|
|
48
|
+
*/
|
|
49
|
+
inferred?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Settlement of a transition's declared effect.
|
|
53
|
+
* fire() → 'pending' when the affordance declares writes; the app reports the
|
|
54
|
+
* real state delta via updateState() which settles to 'committed'. Async and
|
|
55
|
+
* optimistic UI reject/rollback/supersede instead of lying in the record.
|
|
56
|
+
*/
|
|
57
|
+
export type Settlement = 'pending' | 'committed' | 'rejected' | 'rolled-back' | 'superseded';
|
|
58
|
+
/** ARIA-first element locator: role + accessible name, never CSS classes. */
|
|
59
|
+
export interface ElementLocator {
|
|
60
|
+
role: string;
|
|
61
|
+
name: string;
|
|
62
|
+
}
|
|
63
|
+
export type Actuation = 'click' | 'type' | 'select' | 'hover' | 'drag' | 'press';
|
|
64
|
+
/**
|
|
65
|
+
* Activation descriptor. Generalized past "element selector" because keyboard
|
|
66
|
+
* shortcuts have no element and canvas surfaces have no ARIA — those bind via
|
|
67
|
+
* `keychord` and `programmatic` (the component publishes its own affordance).
|
|
68
|
+
*/
|
|
69
|
+
export type Binding = {
|
|
70
|
+
kind: 'element';
|
|
71
|
+
locator: ElementLocator;
|
|
72
|
+
actuation?: Actuation;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'keychord';
|
|
75
|
+
chord: string;
|
|
76
|
+
} | {
|
|
77
|
+
kind: 'programmatic';
|
|
78
|
+
provider: string;
|
|
79
|
+
};
|
|
80
|
+
export interface Effect {
|
|
81
|
+
/** State keys this affordance claims to change. Verified at settlement. */
|
|
82
|
+
writes?: string[];
|
|
83
|
+
/** Page this affordance claims to move to. Reconciled by sync(). */
|
|
84
|
+
navigatesTo?: string;
|
|
85
|
+
}
|
|
86
|
+
/** Derived when omitted: effect.navigatesTo → 'next', otherwise 'action'. */
|
|
87
|
+
export type CanonicalRole = 'next' | 'prev' | 'submit' | 'cancel' | 'back' | 'open' | 'close' | 'action';
|
|
88
|
+
export interface PageDef {
|
|
89
|
+
route?: string;
|
|
90
|
+
description?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface AffordanceDef {
|
|
93
|
+
/** Page id(s) where this affordance is offered. */
|
|
94
|
+
on: string | string[];
|
|
95
|
+
/**
|
|
96
|
+
* AUTHORED planner-facing text — the only string class ever served to an
|
|
97
|
+
* LLM as instruction/description. Runtime-resolved strings (labels, user
|
|
98
|
+
* content) are data, never description (prompt-injection firewall).
|
|
99
|
+
*/
|
|
100
|
+
description: string;
|
|
101
|
+
binding: Binding;
|
|
102
|
+
/**
|
|
103
|
+
* Serializable availability predicate over projected state. Omit for an
|
|
104
|
+
* always-offered affordance — `{}` is rejected at build() because
|
|
105
|
+
* footprint's evaluator deliberately never matches an empty filter.
|
|
106
|
+
*/
|
|
107
|
+
guard?: WhereFilter;
|
|
108
|
+
effect?: Effect;
|
|
109
|
+
/** Payload contract: Zod, JSON Schema, or any .safeParse/.parse validator. */
|
|
110
|
+
schema?: unknown;
|
|
111
|
+
/** Marks edges that need server-side step-up/confirmation. Advisory client-side. */
|
|
112
|
+
highEffect?: boolean;
|
|
113
|
+
role?: CanonicalRole;
|
|
114
|
+
}
|
|
115
|
+
export interface SkillDef {
|
|
116
|
+
/** AUTHORED planner-facing text (same string class as affordance descriptions). */
|
|
117
|
+
description: string;
|
|
118
|
+
/** Affordance ids, in canonical order. v0: linear; step-DAG is roadmap. */
|
|
119
|
+
steps: string[];
|
|
120
|
+
precondition?: WhereFilter;
|
|
121
|
+
}
|
|
122
|
+
export interface Page extends PageDef {
|
|
123
|
+
id: string;
|
|
124
|
+
}
|
|
125
|
+
export interface Affordance {
|
|
126
|
+
id: string;
|
|
127
|
+
on: string[];
|
|
128
|
+
description: string;
|
|
129
|
+
/**
|
|
130
|
+
* Optional since D18: a spine tool may exist with only its description
|
|
131
|
+
* (plannable/tour-able) and gain a binding or handler at mount time.
|
|
132
|
+
* The v1 fluent builder still requires it at authoring.
|
|
133
|
+
*/
|
|
134
|
+
binding?: Binding;
|
|
135
|
+
guard?: WhereFilter;
|
|
136
|
+
effect?: Effect;
|
|
137
|
+
schema?: unknown;
|
|
138
|
+
highEffect: boolean;
|
|
139
|
+
role: CanonicalRole;
|
|
140
|
+
/**
|
|
141
|
+
* Where the planner-facing description came from. Both classes are
|
|
142
|
+
* developer-AUTHORED source-code literals (the firewall holds either way);
|
|
143
|
+
* the marker keeps the origin auditable. Default 'declared'.
|
|
144
|
+
*/
|
|
145
|
+
descriptionSource?: 'declared' | 'registration';
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* How much evidence backs "this node is active" for a served edge (D18).
|
|
149
|
+
* 'synced' — the router confirmed this page (page-level tools).
|
|
150
|
+
* 'assumed' — declared subtree of the routed page, nothing registered there.
|
|
151
|
+
* 'registered' — a live mount handle exists on the node.
|
|
152
|
+
* 'shown' — an explicit visibility signal says it is visible.
|
|
153
|
+
* 'hidden' — an explicit visibility signal says it is NOT visible.
|
|
154
|
+
*/
|
|
155
|
+
export type ActivationLevel = 'synced' | 'assumed' | 'registered' | 'shown' | 'hidden';
|
|
156
|
+
export interface Skill extends SkillDef {
|
|
157
|
+
id: string;
|
|
158
|
+
}
|
|
159
|
+
export interface SkillGraphSpec {
|
|
160
|
+
id: string;
|
|
161
|
+
description?: string;
|
|
162
|
+
pages: Record<string, Page>;
|
|
163
|
+
affordances: Record<string, Affordance>;
|
|
164
|
+
skills: Record<string, Skill>;
|
|
165
|
+
}
|
|
166
|
+
export interface SessionOptions {
|
|
167
|
+
/** Starting page id. */
|
|
168
|
+
node: string;
|
|
169
|
+
/** Initial projected state (the lean snapshot guards read — not the whole app). */
|
|
170
|
+
state?: Record<string, unknown>;
|
|
171
|
+
/**
|
|
172
|
+
* Whether this session receives updateState() reports (a router/store tap).
|
|
173
|
+
* Default: true when `state` was provided, false otherwise. Without a tap,
|
|
174
|
+
* declared-writes fires settle on handler completion (or immediately when
|
|
175
|
+
* nothing executes) with effectVerified 'unobservable' — instead of staying
|
|
176
|
+
* pending forever (the D18 rung-killer fix).
|
|
177
|
+
*/
|
|
178
|
+
stateTap?: boolean;
|
|
179
|
+
/** Keys stored as 'REDACTED' in the commit log while live state keeps raw values. */
|
|
180
|
+
redactedKeys?: string[];
|
|
181
|
+
/** Commit-log value encoding (footprintjs dial). Default 'delta'. */
|
|
182
|
+
commitValues?: 'full' | 'delta';
|
|
183
|
+
/** Dev-warning sink (StrictMode re-registrations, handler errors). Default console.warn. */
|
|
184
|
+
onWarn?: (message: string) => void;
|
|
185
|
+
/**
|
|
186
|
+
* Capture each handler's RETURN value onto its transition (sanitized+capped)
|
|
187
|
+
* as the "act → get data back" channel — TransitionRecord.produced. Default
|
|
188
|
+
* true. Set false to opt a session out entirely (handlers whose returns are
|
|
189
|
+
* internal and should never reach the agent).
|
|
190
|
+
*/
|
|
191
|
+
captureProduced?: boolean;
|
|
192
|
+
}
|
|
193
|
+
export interface SessionEvents {
|
|
194
|
+
/** A new or newly-settled occurrence (a snapshot of the record). */
|
|
195
|
+
transition: TransitionRecord;
|
|
196
|
+
/** A committed state delta landed (the `state` version moved). */
|
|
197
|
+
state: {
|
|
198
|
+
version: number;
|
|
199
|
+
stateVersion: number;
|
|
200
|
+
};
|
|
201
|
+
/** The served tool-surface changed — frame open/close, or a mount/enable flip. */
|
|
202
|
+
structure: {
|
|
203
|
+
version: number;
|
|
204
|
+
structureVersion: number;
|
|
205
|
+
};
|
|
206
|
+
/** A new unmet-demand row was recorded (a deep copy). */
|
|
207
|
+
gap: GapRecord;
|
|
208
|
+
}
|
|
209
|
+
export type SessionEventName = keyof SessionEvents;
|
|
210
|
+
/**
|
|
211
|
+
* The handle returned by registerToolGroup — the group's IDENTITY. You never
|
|
212
|
+
* name a group with a string (two components would collide and you'd have to
|
|
213
|
+
* invent unique names); registration hands you this handle and you act through
|
|
214
|
+
* it. `id` is a generated opaque token, exposed only for telemetry/warnings.
|
|
215
|
+
*/
|
|
216
|
+
export interface ToolGroup {
|
|
217
|
+
/** Generated identity of this registration (for telemetry/debug — not caller-supplied). */
|
|
218
|
+
readonly id: string;
|
|
219
|
+
/** The node path this group is registered on (tree API); undefined for the flat API. */
|
|
220
|
+
readonly node?: string;
|
|
221
|
+
/** Grey out / re-enable one tool in this group (a disabled button). */
|
|
222
|
+
setEnabled(toolId: string, enabled: boolean): void;
|
|
223
|
+
/** Remove this group's registrations (call on unmount). Idempotent. */
|
|
224
|
+
unregister(): void;
|
|
225
|
+
}
|
|
226
|
+
/** The handle returned by registerTool — a single-tool ToolGroup. */
|
|
227
|
+
export interface ToolHandle {
|
|
228
|
+
readonly id: string;
|
|
229
|
+
readonly node?: string;
|
|
230
|
+
readonly toolId: string;
|
|
231
|
+
/** Grey out / re-enable this tool. */
|
|
232
|
+
setEnabled(enabled: boolean): void;
|
|
233
|
+
unregister(): void;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* One occurrence: a row in the interaction log. SETTLED (and stimulus/sync)
|
|
237
|
+
* transitions join 1:1 to a CommitBundle by `id`; pending and
|
|
238
|
+
* rejected/rolled-back rows exist only here — that asymmetry is deliberate
|
|
239
|
+
* (a rejected effect never touched state, so it has no commit).
|
|
240
|
+
*/
|
|
241
|
+
export interface TransitionRecord {
|
|
242
|
+
/** runtimeStageId — the join key into the footprintjs commit log. */
|
|
243
|
+
id: string;
|
|
244
|
+
cause: Cause;
|
|
245
|
+
/** Epoch milliseconds when the transition was created. */
|
|
246
|
+
timestamp: number;
|
|
247
|
+
payload?: unknown;
|
|
248
|
+
outcome: Settlement;
|
|
249
|
+
/**
|
|
250
|
+
* Whether every DECLARED write key was present in the settled delta.
|
|
251
|
+
* 'unobservable' when the affordance declared no writes. This checks key
|
|
252
|
+
* presence only — not values, extra writes, or navigation claims.
|
|
253
|
+
*/
|
|
254
|
+
effectVerified?: boolean | 'unobservable';
|
|
255
|
+
/** Guard evidence captured at fire time (why this edge was passable). */
|
|
256
|
+
evidence?: FilterCondition[];
|
|
257
|
+
fromNode: string;
|
|
258
|
+
toNode?: string;
|
|
259
|
+
/**
|
|
260
|
+
* True when toNode came from the affordance's declared navigatesTo — a
|
|
261
|
+
* CLAIM about the app, not an observation. sync() records observations.
|
|
262
|
+
*/
|
|
263
|
+
toNodeClaimed?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* True on sync()-recorded hops: the cursor moved without passing any guard.
|
|
266
|
+
* Backward slices must treat the hop as inferred, not authorized.
|
|
267
|
+
*/
|
|
268
|
+
unverifiedEdge?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Guard keys that could NOT be evaluated at fire time because the session's
|
|
271
|
+
* state view never contained them (L0/L1 — no state tap for those keys).
|
|
272
|
+
* The fire proceeded — the app remains the enforcer — but the record says
|
|
273
|
+
* honestly which conditions were taken on faith (D18 rung-killer fix).
|
|
274
|
+
*/
|
|
275
|
+
guardUnevaluated?: string[];
|
|
276
|
+
/**
|
|
277
|
+
* Data the fired handler RETURNED (search results, a looked-up record) —
|
|
278
|
+
* sanitized + capped. This is the "act → get data back" channel: an action
|
|
279
|
+
* that produces something the agent needs to pick from (a list of ids to
|
|
280
|
+
* open next) hands it back here. It rides the DATA channel, so untrusted
|
|
281
|
+
* content (user-generated names) is safe — it is never planner instructions.
|
|
282
|
+
* Populated once the handler resolves (await the settlement to read it).
|
|
283
|
+
*/
|
|
284
|
+
produced?: unknown;
|
|
285
|
+
/** Cursor version when the transition was created. */
|
|
286
|
+
cursorVersion: number;
|
|
287
|
+
}
|
|
288
|
+
export interface AvailableEdge {
|
|
289
|
+
affordanceId: string;
|
|
290
|
+
description: string;
|
|
291
|
+
role: CanonicalRole;
|
|
292
|
+
/**
|
|
293
|
+
* Present only when the session has live registrations: true = a handler is
|
|
294
|
+
* mounted right now (fireable-with-execution), false = declared here but
|
|
295
|
+
* nothing registered it (plannable; firing records but nothing executes —
|
|
296
|
+
* on the current page this doubles as live binding-drift telemetry).
|
|
297
|
+
*/
|
|
298
|
+
materialized?: boolean;
|
|
299
|
+
/** Per-condition guard evidence (key/op/threshold/actual) — why it is passable. */
|
|
300
|
+
evidence: FilterCondition[];
|
|
301
|
+
/**
|
|
302
|
+
* Guard keys absent from the session's state view (or holding undefined —
|
|
303
|
+
* a value guard like `ne ''` would match undefined, so an unset value is
|
|
304
|
+
* unevaluable, not passable) — the edge is served anyway, WITH this
|
|
305
|
+
* marker, instead of being silently hidden (D18 fix).
|
|
306
|
+
*/
|
|
307
|
+
guardUnevaluated?: string[];
|
|
308
|
+
schema?: unknown;
|
|
309
|
+
highEffect: boolean;
|
|
310
|
+
binding?: Binding;
|
|
311
|
+
/** See Affordance.descriptionSource. */
|
|
312
|
+
descriptionSource?: 'declared' | 'registration';
|
|
313
|
+
/** Owning node path in the navigation tree (e.g. 'catalog.filter-rail'). */
|
|
314
|
+
node?: string;
|
|
315
|
+
/** Evidence level behind "this node is active" (see ActivationLevel). */
|
|
316
|
+
activation?: ActivationLevel;
|
|
317
|
+
/**
|
|
318
|
+
* 'unknown' when several exclusive-tab siblings are mounted and no
|
|
319
|
+
* visibility wire exists — a flagged union, never a guessed winner.
|
|
320
|
+
*/
|
|
321
|
+
presence?: 'unknown';
|
|
322
|
+
/**
|
|
323
|
+
* False when the registration site said the control is currently DISABLED
|
|
324
|
+
* (a grey button: on screen, not clickable). Served honestly with the
|
|
325
|
+
* marker — like a human seeing it — and firing it is a typed TOOL_DISABLED
|
|
326
|
+
* rejection. Set via ToolGroup.setEnabled / the `enabled` registration field.
|
|
327
|
+
*/
|
|
328
|
+
enabled?: boolean;
|
|
329
|
+
/** Live instance keys for a repeats-container tool (runtime DATA, never schema). */
|
|
330
|
+
instances?: string[];
|
|
331
|
+
/**
|
|
332
|
+
* Where `instances` came from: 'selector' = the declared existence source
|
|
333
|
+
* (complete), 'mounted-window' = only what is mounted right now (partial —
|
|
334
|
+
* stated, not silently presented as complete).
|
|
335
|
+
*/
|
|
336
|
+
enumeration?: 'selector' | 'mounted-window';
|
|
337
|
+
}
|
|
338
|
+
export interface AvailableSlice {
|
|
339
|
+
version: number;
|
|
340
|
+
node: string;
|
|
341
|
+
edges: AvailableEdge[];
|
|
342
|
+
}
|
|
343
|
+
export interface AvailableSkill {
|
|
344
|
+
id: string;
|
|
345
|
+
description: string;
|
|
346
|
+
steps: string[];
|
|
347
|
+
preconditionPassed: boolean;
|
|
348
|
+
evidence: FilterCondition[];
|
|
349
|
+
/** Precondition keys absent from the state view — feasibility unknown, said so. */
|
|
350
|
+
preconditionUnevaluable?: string[];
|
|
351
|
+
/** Whether the skill's first step is available right now (on-node + guard). */
|
|
352
|
+
entryAvailable: boolean;
|
|
353
|
+
}
|
|
354
|
+
export interface Explanation {
|
|
355
|
+
affordanceId: string;
|
|
356
|
+
node: string;
|
|
357
|
+
offeredOnThisNode: boolean;
|
|
358
|
+
guardPassed: boolean;
|
|
359
|
+
available: boolean;
|
|
360
|
+
evidence: FilterCondition[];
|
|
361
|
+
/** Guard keys that could not be evaluated (absent from the state view, or holding undefined). */
|
|
362
|
+
guardUnevaluated?: string[];
|
|
363
|
+
}
|
|
364
|
+
export interface FireOptions {
|
|
365
|
+
source: Principal;
|
|
366
|
+
/**
|
|
367
|
+
* Optimistic-concurrency token from available().version. If supplied and
|
|
368
|
+
* stale, fire() rejects with STALE_CURSOR — the agent must replan on a
|
|
369
|
+
* fresh slice. Guards are ALSO re-evaluated at fire time regardless.
|
|
370
|
+
*/
|
|
371
|
+
expectedVersion?: number;
|
|
372
|
+
payload?: unknown;
|
|
373
|
+
/** Instance key for a tool on a repeats container (e.g. an order-card id). */
|
|
374
|
+
instance?: string;
|
|
375
|
+
/**
|
|
376
|
+
* Invoke the registered handler (default true when one exists). The DOM
|
|
377
|
+
* sensor passes false: the browser already runs the app's own onClick, so
|
|
378
|
+
* the sensor's fire() is record-only.
|
|
379
|
+
*/
|
|
380
|
+
invoke?: boolean;
|
|
381
|
+
}
|
|
382
|
+
export type FireResult = {
|
|
383
|
+
ok: true;
|
|
384
|
+
transition: TransitionRecord;
|
|
385
|
+
version: number;
|
|
386
|
+
settlement: 'settled' | 'awaiting-state';
|
|
387
|
+
} | {
|
|
388
|
+
ok: false;
|
|
389
|
+
reason: 'UNKNOWN_AFFORDANCE';
|
|
390
|
+
available: string[];
|
|
391
|
+
} | {
|
|
392
|
+
ok: false;
|
|
393
|
+
reason: 'STALE_CURSOR';
|
|
394
|
+
version: number;
|
|
395
|
+
} | {
|
|
396
|
+
ok: false;
|
|
397
|
+
reason: 'NOT_ON_NODE';
|
|
398
|
+
node: string;
|
|
399
|
+
} | {
|
|
400
|
+
ok: false;
|
|
401
|
+
reason: 'GUARD_FAILED';
|
|
402
|
+
evidence: FilterCondition[];
|
|
403
|
+
} | {
|
|
404
|
+
ok: false;
|
|
405
|
+
reason: 'PAYLOAD_INVALID';
|
|
406
|
+
issues: string;
|
|
407
|
+
}
|
|
408
|
+
/** A shown blocking modal masks this tool's node. Close the modal first. */
|
|
409
|
+
| {
|
|
410
|
+
ok: false;
|
|
411
|
+
reason: 'BLOCKED_BY_OVERLAY';
|
|
412
|
+
overlay: string;
|
|
413
|
+
}
|
|
414
|
+
/** The tool's node carries an explicit not-visible signal (hidden tab, closed modal). */
|
|
415
|
+
| {
|
|
416
|
+
ok: false;
|
|
417
|
+
reason: 'NODE_NOT_VISIBLE';
|
|
418
|
+
node: string;
|
|
419
|
+
}
|
|
420
|
+
/** RETRIABLE: the node's mounts have not arrived yet (mid-navigation / deep link). */
|
|
421
|
+
| {
|
|
422
|
+
ok: false;
|
|
423
|
+
reason: 'STILL_MOUNTING';
|
|
424
|
+
node: string;
|
|
425
|
+
} | {
|
|
426
|
+
ok: false;
|
|
427
|
+
reason: 'INSTANCE_REQUIRED';
|
|
428
|
+
instances: string[];
|
|
429
|
+
} | {
|
|
430
|
+
ok: false;
|
|
431
|
+
reason: 'INSTANCE_UNKNOWN';
|
|
432
|
+
instances: string[];
|
|
433
|
+
}
|
|
434
|
+
/** RETRIABLE: the control is registered but currently greyed out (disabled). */
|
|
435
|
+
| {
|
|
436
|
+
ok: false;
|
|
437
|
+
reason: 'TOOL_DISABLED';
|
|
438
|
+
affordanceId: string;
|
|
439
|
+
};
|
|
440
|
+
export interface UpdateOptions {
|
|
441
|
+
/** Settle THIS pending transition (precise attribution — preferred over FIFO). */
|
|
442
|
+
transitionId?: string;
|
|
443
|
+
/**
|
|
444
|
+
* Mark the delta as world-initiated. When set, the delta is NEVER
|
|
445
|
+
* attributed to a pending fired transition — explicit attribution wins.
|
|
446
|
+
*/
|
|
447
|
+
stimulus?: StimulusKind;
|
|
448
|
+
principal?: Principal;
|
|
449
|
+
}
|
|
450
|
+
export type UpdateResult = {
|
|
451
|
+
ok: true;
|
|
452
|
+
attributed: boolean;
|
|
453
|
+
transition: TransitionRecord;
|
|
454
|
+
version: number;
|
|
455
|
+
} | {
|
|
456
|
+
ok: false;
|
|
457
|
+
reason: 'UNCLONEABLE_DELTA';
|
|
458
|
+
issues: string;
|
|
459
|
+
} | {
|
|
460
|
+
ok: false;
|
|
461
|
+
reason: 'UNKNOWN_TRANSITION';
|
|
462
|
+
pending: string[];
|
|
463
|
+
};
|
|
464
|
+
export type SyncResult = {
|
|
465
|
+
changed: false;
|
|
466
|
+
node: string;
|
|
467
|
+
version: number;
|
|
468
|
+
} | {
|
|
469
|
+
changed: true;
|
|
470
|
+
transition: TransitionRecord;
|
|
471
|
+
node: string;
|
|
472
|
+
version: number;
|
|
473
|
+
/**
|
|
474
|
+
* True when the observed node is not an authored page. The cursor
|
|
475
|
+
* follows reality anyway (available() honestly serves zero edges there)
|
|
476
|
+
* — external motion is recorded, never dropped.
|
|
477
|
+
*/
|
|
478
|
+
offGraph?: boolean;
|
|
479
|
+
};
|
|
480
|
+
/** A fired transition still awaiting its state report. */
|
|
481
|
+
export interface PendingInfo {
|
|
482
|
+
id: string;
|
|
483
|
+
affordanceId: string;
|
|
484
|
+
firedAt: number;
|
|
485
|
+
}
|
|
486
|
+
export type GapReason = 'no-skill-matched' | 'guard-blocked' | 'needs-backend-data'
|
|
487
|
+
/** Sensor-health drift: e.g. a registration outside the router-confirmed page persisted past the grace window. */
|
|
488
|
+
| 'sensor-drift' | 'other';
|
|
489
|
+
/**
|
|
490
|
+
* One row of unmet demand. Two kinds:
|
|
491
|
+
* - 'fire-rejected' — an attempted action the session refused (unknown id,
|
|
492
|
+
* failed guard, wrong page, stale plan, bad payload). Recorded automatically.
|
|
493
|
+
* - 'reported' — an ask no available action or skill could serve,
|
|
494
|
+
* reported explicitly (typically by the agent's report_gap tool).
|
|
495
|
+
*
|
|
496
|
+
* Rows are deliberately TOKEN-LEAN and structured — the ask plus NAME lists,
|
|
497
|
+
* never descriptions or transcripts — so a consumer's batch triage LLM can
|
|
498
|
+
* cluster thousands of them cheaply to discover which skills/tools to build
|
|
499
|
+
* next. `request` is runtime data (user text): export it as data, never feed
|
|
500
|
+
* it to a planner as instructions.
|
|
501
|
+
*
|
|
502
|
+
* Triage notes: rows with rejectionReason 'STALE_CURSOR' are usually
|
|
503
|
+
* optimistic-concurrency retries that SUCCEEDED on replan — filter or
|
|
504
|
+
* down-weight them; they are cursor-protocol events, not missing capability.
|
|
505
|
+
* `availableActions` lists full capability at that position (not narrowed by
|
|
506
|
+
* any open skill frame). The ledger grows unbounded for the session's life —
|
|
507
|
+
* export via onGap and drain, like the transition log.
|
|
508
|
+
*/
|
|
509
|
+
export interface GapRecord {
|
|
510
|
+
kind: 'fire-rejected' | 'reported';
|
|
511
|
+
timestamp: number;
|
|
512
|
+
node: string;
|
|
513
|
+
version: number;
|
|
514
|
+
/** Names only — what existed at that moment (token-lean, injection-safe). */
|
|
515
|
+
availableActions: string[];
|
|
516
|
+
availableSkills: string[];
|
|
517
|
+
/** The id the caller ASKED for — kept even when unknown (that is the signal). */
|
|
518
|
+
affordanceId?: string;
|
|
519
|
+
rejectionReason?: 'UNKNOWN_AFFORDANCE' | 'STALE_CURSOR' | 'NOT_ON_NODE' | 'GUARD_FAILED' | 'PAYLOAD_INVALID' | 'BLOCKED_BY_OVERLAY' | 'NODE_NOT_VISIBLE' | 'STILL_MOUNTING' | 'INSTANCE_REQUIRED' | 'INSTANCE_UNKNOWN' | 'TOOL_DISABLED';
|
|
520
|
+
principal?: Principal;
|
|
521
|
+
evidence?: FilterCondition[];
|
|
522
|
+
/** The user's ask (runtime data; length-capped). */
|
|
523
|
+
request?: string;
|
|
524
|
+
reason?: GapReason;
|
|
525
|
+
note?: string;
|
|
526
|
+
}
|
|
527
|
+
export interface ReportGapOptions {
|
|
528
|
+
/** The ask that could not be served (length-capped to stay token-lean). */
|
|
529
|
+
request: string;
|
|
530
|
+
reason?: GapReason;
|
|
531
|
+
note?: string;
|
|
532
|
+
principal?: Principal;
|
|
533
|
+
}
|
|
534
|
+
export type StepStatus = 'done' | 'inferred-done' | 'ready' | 'blocked' | 'off-node';
|
|
535
|
+
/** B depends on A when A's declared writes overlap B's guard keys — DERIVED, never authored. */
|
|
536
|
+
export interface DependencyEdge {
|
|
537
|
+
affordanceId: string;
|
|
538
|
+
viaKeys: string[];
|
|
539
|
+
}
|
|
540
|
+
export interface SkillPlanStep {
|
|
541
|
+
affordanceId: string;
|
|
542
|
+
description: string;
|
|
543
|
+
/**
|
|
544
|
+
* 'done' = committed while the current frame was open; 'blocked' = guard
|
|
545
|
+
* fails (see blockedOn); 'ready' = fireable here and now; 'off-node' =
|
|
546
|
+
* guard passes but the step lives on another page (navigate first).
|
|
547
|
+
*/
|
|
548
|
+
status: StepStatus;
|
|
549
|
+
dependsOn: DependencyEdge[];
|
|
550
|
+
onNodes: string[];
|
|
551
|
+
blockedOn?: FilterCondition[];
|
|
552
|
+
/** Guard keys absent from the state view — the step shows 'ready', taken on faith. */
|
|
553
|
+
guardUnevaluated?: string[];
|
|
554
|
+
}
|
|
555
|
+
/** The derived intra-skill dependency DAG with live status. */
|
|
556
|
+
export interface SkillPlan {
|
|
557
|
+
skillId: string;
|
|
558
|
+
description: string;
|
|
559
|
+
steps: SkillPlanStep[];
|
|
560
|
+
}
|
|
561
|
+
export type FrameStatus = 'open' | 'completed' | 'cancelled' | 'demoted';
|
|
562
|
+
/** One committed pass at a skill. 'demoted' = the skill's precondition broke mid-flow. */
|
|
563
|
+
export interface SkillFrame {
|
|
564
|
+
skillId: string;
|
|
565
|
+
status: FrameStatus;
|
|
566
|
+
principal: Principal;
|
|
567
|
+
openedAt: number;
|
|
568
|
+
openedAtVersion: number;
|
|
569
|
+
/** Steps committed while this frame was open (observed fires). */
|
|
570
|
+
firedSteps: string[];
|
|
571
|
+
/**
|
|
572
|
+
* Steps attributed by effect-signature INFERENCE while this frame was open
|
|
573
|
+
* — guesses, kept separate from observed fires. skillPlan shows them as
|
|
574
|
+
* 'inferred-done' so an agent re-executes only as a visible choice.
|
|
575
|
+
*/
|
|
576
|
+
inferredSteps: string[];
|
|
577
|
+
closedAtVersion?: number;
|
|
578
|
+
}
|
|
579
|
+
export type CommitSkillResult = {
|
|
580
|
+
ok: true;
|
|
581
|
+
frame: SkillFrame;
|
|
582
|
+
plan: SkillPlan;
|
|
583
|
+
version: number;
|
|
584
|
+
} | {
|
|
585
|
+
ok: false;
|
|
586
|
+
reason: 'UNKNOWN_SKILL';
|
|
587
|
+
known: string[];
|
|
588
|
+
} | {
|
|
589
|
+
ok: false;
|
|
590
|
+
reason: 'STALE_CURSOR';
|
|
591
|
+
version: number;
|
|
592
|
+
} | {
|
|
593
|
+
ok: false;
|
|
594
|
+
reason: 'PRECONDITION_FAILED';
|
|
595
|
+
evidence: FilterCondition[];
|
|
596
|
+
} | {
|
|
597
|
+
ok: false;
|
|
598
|
+
reason: 'FRAME_ALREADY_OPEN';
|
|
599
|
+
skillId: string;
|
|
600
|
+
};
|
|
601
|
+
export interface ContextBriefOptions {
|
|
602
|
+
/** Only include transitions created at or after this cursor version (the "since your last turn" cursor). */
|
|
603
|
+
sinceVersion?: number;
|
|
604
|
+
/** Cap on rendered transitions (default 20); older ones collapse into an omitted count. */
|
|
605
|
+
maxTransitions?: number;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Token-lean, prompt-ready session context. `text` is built from AUTHORED
|
|
609
|
+
* strings and structural facts only — state values and payloads never enter
|
|
610
|
+
* it (the two-string-class invariant extends to history).
|
|
611
|
+
*/
|
|
612
|
+
export interface ContextBrief {
|
|
613
|
+
node: string;
|
|
614
|
+
version: number;
|
|
615
|
+
frame: SkillFrame | null;
|
|
616
|
+
text: string;
|
|
617
|
+
}
|
|
618
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/atom/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM5D,oEAAoE;AACpE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhE,yEAAyE;AACzE,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;AAE5F;;;;;GAKG;AACH,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,OAAO,GAAG,UAAU,CAAC;IAC3B,SAAS,EAAE,SAAS,CAAC;IACrB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;;;OAIG;IACH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;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,GACvD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAC;IAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;CAAE,GACzE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAMjE,MAAM,WAAW,mBAAmB;IAClC,4GAA4G;IAC5G,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/atom/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AffordanceDef, PageDef, SessionOptions, SkillDef, SkillGraphSpec } from '../atom/types.js';
|
|
2
|
+
import { Session } from '../traverse/session.js';
|
|
3
|
+
export { SkillGraphValidationError } from './guards.js';
|
|
4
|
+
export interface SkillGraph {
|
|
5
|
+
spec: SkillGraphSpec;
|
|
6
|
+
createSession(opts: SessionOptions): Session;
|
|
7
|
+
/**
|
|
8
|
+
* The sorted, deduped set of state keys every guard in this graph reads —
|
|
9
|
+
* across all affordance guards and skill preconditions, whether or not their
|
|
10
|
+
* tool is currently offered. Seed each of these in your state projector: a
|
|
11
|
+
* guard key ABSENT from projected state is NOT treated as false and hidden —
|
|
12
|
+
* it is served WITH the `guardUnevaluated` honesty marker (the edge is
|
|
13
|
+
* offered, the missing condition flagged as taken-on-faith), so an
|
|
14
|
+
* incompletely-seeded projector silently degrades honest availability into
|
|
15
|
+
* unevaluated-guess territory. A projection covering this whole set is what
|
|
16
|
+
* lets guards actually decide rather than defer.
|
|
17
|
+
*/
|
|
18
|
+
requiredStateKeys(): string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function skillGraph(id: string, opts?: {
|
|
21
|
+
description?: string;
|
|
22
|
+
}): SkillGraphBuilder;
|
|
23
|
+
export declare class SkillGraphBuilder {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(id: string, description?: string);
|
|
26
|
+
page(id: string, def?: PageDef): this;
|
|
27
|
+
affordance(id: string, def: AffordanceDef): this;
|
|
28
|
+
skill(id: string, def: SkillDef): this;
|
|
29
|
+
build(): SkillGraph;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/graph/builder.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,aAAa,EAGb,OAAO,EACP,cAAc,EAEd,QAAQ,EACR,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;IAC7C;;;;;;;;;;OAUG;IACH,iBAAiB,IAAI,MAAM,EAAE,CAAC;CAC/B;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAEzF;AAED,qBAAa,iBAAiB;;gBAOhB,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;IAM5C,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,GAAE,OAAY,GAAG,IAAI;IAMzC,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI;IAkChD,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI;IAoBtC,KAAK,IAAI,UAAU;CAiFpB"}
|