@ai-matrx/agents 0.8.0 → 0.9.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/CHANGELOG.md +135 -0
- package/dist/catalog/index.cjs +50 -3
- package/dist/catalog/index.cjs.map +1 -1
- package/dist/catalog/index.d.cts +11 -615
- package/dist/catalog/index.d.ts +11 -615
- package/dist/catalog/index.js +50 -3
- package/dist/catalog/index.js.map +1 -1
- package/dist/catalog/native/index.cjs +2806 -0
- package/dist/catalog/native/index.cjs.map +1 -0
- package/dist/catalog/native/index.d.cts +655 -0
- package/dist/catalog/native/index.d.ts +655 -0
- package/dist/catalog/native/index.js +2802 -0
- package/dist/catalog/native/index.js.map +1 -0
- package/dist/catalog/react/index.cjs +470 -394
- package/dist/catalog/react/index.cjs.map +1 -1
- package/dist/catalog/react/index.d.cts +64 -26
- package/dist/catalog/react/index.d.ts +64 -26
- package/dist/catalog/react/index.js +354 -278
- package/dist/catalog/react/index.js.map +1 -1
- package/dist/orchestra-BWJM2MWP.d.cts +643 -0
- package/dist/orchestra-BWJM2MWP.d.ts +643 -0
- package/package.json +22 -2
package/dist/catalog/index.d.ts
CHANGED
|
@@ -1,587 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* `AgentSummary` is the 19-column row `agx_get_list_full()` returns, camelCased.
|
|
5
|
-
* It is deliberately NOT the editable agent record: dirty tracking, undo,
|
|
6
|
-
* messages, tools and `_fetchStatus` stay in whichever host owns the editor.
|
|
7
|
-
* A list row is a list row.
|
|
8
|
-
*
|
|
9
|
-
* The view-state types are a VERBATIM port of matrx-frontend
|
|
10
|
-
* `features/agents/redux/agent-consumers/slice.ts` — only the coupling seam
|
|
11
|
-
* inverts (Redux reducers become store actions in `./store`).
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* A branded agent id. Every id that reaches `onSelect` is one of these:
|
|
15
|
-
* either a `agent.definition` UUID, or the `mandate:<key>` reference a
|
|
16
|
-
* default row carries (byte-identical to the ref shape matrx-extend
|
|
17
|
-
* `src/lib/mandates.ts` and matrx-local `desktop/src/lib/mandates.ts`
|
|
18
|
-
* already hand back to their hosts).
|
|
19
|
-
*
|
|
20
|
-
* 🚨 The brand is a STRING LITERAL, never `unique symbol`. This package emits
|
|
21
|
-
* `./catalog` and `./catalog/react` as two separate bundles, so each `.d.ts`
|
|
22
|
-
* carries its own copy of these declarations. A `unique symbol` brand is
|
|
23
|
-
* NOMINAL: two copies of it are unrelated types, so `createAgentCatalog()`
|
|
24
|
-
* from `./catalog` was not assignable to `<AgentCatalogProvider catalog=…>`
|
|
25
|
-
* from `./catalog/react` — the exact two-import wiring the README, the
|
|
26
|
-
* CHANGELOG and every consumer use. A literal brand is structural, so the two
|
|
27
|
-
* copies unify, while a bare `string` still cannot be passed where an
|
|
28
|
-
* `AgentId` is required (which is the whole point of branding). Any future
|
|
29
|
-
* brand in this package follows the same rule.
|
|
30
|
-
*/
|
|
31
|
-
type AgentId = string & {
|
|
32
|
-
readonly __agentId: "ai-matrx.agent-id";
|
|
33
|
-
};
|
|
34
|
-
/** Brand a raw string as an `AgentId`. */
|
|
35
|
-
declare function asAgentId(value: string): AgentId;
|
|
36
|
-
/** The `mandate:<key>` ref shape every client already speaks. */
|
|
37
|
-
declare function mandateAgentId(mandateKey: string): AgentId;
|
|
38
|
-
/** True when an id is a mandate default row rather than a stored agent. */
|
|
39
|
-
declare function isMandateAgentId(id: string): boolean;
|
|
40
|
-
/** `agent_type` verbatim. Only `builtin` changes how a row is grouped. */
|
|
41
|
-
type AgentCatalogAgentType = "user" | "builtin";
|
|
42
|
-
/**
|
|
43
|
-
* `access_level` verbatim from `agx_get_list_full`. Widened over the raw
|
|
44
|
-
* string because it is a DB-owned vocabulary: an unknown level renders as
|
|
45
|
-
* itself rather than being coerced into a wrong one.
|
|
46
|
-
*/
|
|
47
|
-
type AgentAccessLevel = "owner" | "admin" | "editor" | "viewer" | "system" | (string & {});
|
|
48
|
-
/**
|
|
49
|
-
* Present on a catalog row ONLY when that agent is an **Orchestra** — a
|
|
50
|
-
* conductor that delegates to member agents at run time. Choosing one for a
|
|
51
|
-
* step, a chat or a workflow node runs the whole ensemble, so a person has to
|
|
52
|
-
* be able to SEE that before choosing, not discover it from the run.
|
|
53
|
-
*
|
|
54
|
-
* The DB decides. `agx_get_list_full` / `agx_get_list` / `agx_search` build
|
|
55
|
-
* this from `platform.associations` (the conductor self-edge plus its member
|
|
56
|
-
* edges) in one `agx_orchestra_badges()` join — never a second fetch, and
|
|
57
|
-
* never a per-row read. `null` for every ordinary agent.
|
|
58
|
-
*
|
|
59
|
-
* History: the badge lived only in the Python `GET /agents` route, so every
|
|
60
|
-
* client lost it when the pickers moved to the RPC. It is a ROW FIELD now, in
|
|
61
|
-
* the one read every client shares.
|
|
62
|
-
*/
|
|
63
|
-
interface OrchestraBadge {
|
|
64
|
-
/** How the ensemble runs: `supervisor` | `sequential` | `parallel` | `dag`, or a future mode verbatim. */
|
|
65
|
-
mode: string;
|
|
66
|
-
/** The composition's one-line description, when its author wrote one. */
|
|
67
|
-
tagline: string | null;
|
|
68
|
-
/**
|
|
69
|
-
* The per-composition delegation-depth budget AS DECLARED, or `null` when
|
|
70
|
-
* the composition declares none. Deliberately NOT defaulted here: the
|
|
71
|
-
* platform's fallback ceiling is enforced by the server that runs the
|
|
72
|
-
* ensemble, and a badge that invented a number would be reporting a promise
|
|
73
|
-
* nobody made.
|
|
74
|
-
*/
|
|
75
|
-
depthBudget: number | null;
|
|
76
|
-
/** Member edges. From the ROW count, so an unlabelled ensemble still counts. */
|
|
77
|
-
memberCount: number;
|
|
78
|
-
/** Only REAL role titles — an ensemble with unlabelled edges yields `[]`. */
|
|
79
|
-
memberTitles: string[];
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* One `agx_get_list_full()` row, camelCased. Nineteen columns, no more:
|
|
83
|
-
* anything richer needs a different read and is a different type.
|
|
84
|
-
*/
|
|
85
|
-
interface AgentSummary {
|
|
86
|
-
id: AgentId;
|
|
87
|
-
name: string | null;
|
|
88
|
-
description: string | null;
|
|
89
|
-
category: string | null;
|
|
90
|
-
tags: string[];
|
|
91
|
-
agentType: AgentCatalogAgentType;
|
|
92
|
-
modelId: string | null;
|
|
93
|
-
isActive: boolean;
|
|
94
|
-
isArchived: boolean;
|
|
95
|
-
isFavorite: boolean;
|
|
96
|
-
createdBy: string | null;
|
|
97
|
-
organizationId: string | null;
|
|
98
|
-
taskId: string | null;
|
|
99
|
-
sourceAgentId: string | null;
|
|
100
|
-
createdAt: string | null;
|
|
101
|
-
updatedAt: string | null;
|
|
102
|
-
isOwner: boolean | null;
|
|
103
|
-
accessLevel: AgentAccessLevel | null;
|
|
104
|
-
sharedByEmail: string | null;
|
|
105
|
-
/**
|
|
106
|
-
* The Orchestra badge, or `null` for an ordinary agent. Strict: every row
|
|
107
|
-
* carries the key, so a surface reads `agent.orchestra` and never has to ask
|
|
108
|
-
* whether the column existed.
|
|
109
|
-
*/
|
|
110
|
-
orchestra: OrchestraBadge | null;
|
|
111
|
-
/**
|
|
112
|
-
* Set only on a mandate default row — the key it resolved through, so a
|
|
113
|
-
* host can tell "the default" from a stored agent without parsing the id.
|
|
114
|
-
*/
|
|
115
|
-
mandateKey?: string;
|
|
116
|
-
}
|
|
117
|
-
type AgentSortOption = "updated-desc" | "created-desc" | "name-asc" | "name-desc" | "category-asc";
|
|
118
|
-
/**
|
|
119
|
-
* The sort choices a picker offers, in order. PURE DATA, so it lives in the
|
|
120
|
-
* pure entry: a server-reachable manifest reads it at module scope, and
|
|
121
|
-
* importing it from the client-stamped `./catalog/react` bundle dragged React
|
|
122
|
-
* into a server graph for the sake of five string pairs. `./catalog/react`
|
|
123
|
-
* re-exports it unchanged, so no consumer has to move.
|
|
124
|
-
*
|
|
125
|
-
* (Written "client-stamped", never with the literal directive: this comment is
|
|
126
|
-
* emitted into `dist/catalog/index.d.ts`, and the tarball canary rightly
|
|
127
|
-
* refuses that directive anywhere in a PURE entry.)
|
|
128
|
-
*/
|
|
129
|
-
declare const SORT_OPTIONS: {
|
|
130
|
-
value: AgentSortOption;
|
|
131
|
-
label: string;
|
|
132
|
-
}[];
|
|
133
|
-
/** Which ownership tab is active in the agent list. */
|
|
134
|
-
type AgentTab = "mine" | "shared" | "all" | "system";
|
|
135
|
-
/** Favorite filter. */
|
|
136
|
-
type AgentFavFilter = "all" | "yes" | "no";
|
|
137
|
-
/** Archive filter. */
|
|
138
|
-
type AgentArchFilter = "active" | "archived" | "both";
|
|
139
|
-
/**
|
|
140
|
-
* Access level filter.
|
|
141
|
-
* 'any' = no restriction (default).
|
|
142
|
-
* 'owned' = only agents the user owns (isOwner = true).
|
|
143
|
-
* 'shared' = only agents shared with the user (isOwner = false).
|
|
144
|
-
* 'editable' = owner + admin + editor.
|
|
145
|
-
*/
|
|
146
|
-
type AgentAccessFilter = "any" | "owned" | "shared" | "editable";
|
|
147
|
-
/** Sentinel meaning "include uncategorized / untagged" items. */
|
|
148
|
-
declare const AGENT_NONE_SENTINEL = "__none__";
|
|
149
|
-
interface AgentConsumerState {
|
|
150
|
-
tab: AgentTab;
|
|
151
|
-
sortBy: AgentSortOption;
|
|
152
|
-
searchTerm: string;
|
|
153
|
-
/** INCLUSION model: empty = show all; non-empty = only matching. */
|
|
154
|
-
includedCats: string[];
|
|
155
|
-
/** INCLUSION model: empty = show all; non-empty = only matching. */
|
|
156
|
-
includedTags: string[];
|
|
157
|
-
favFilter: AgentFavFilter;
|
|
158
|
-
archFilter: AgentArchFilter;
|
|
159
|
-
accessFilter: AgentAccessFilter;
|
|
160
|
-
favoritesFirst: boolean;
|
|
161
|
-
/** Current page for owned-agent list items (after the card section). */
|
|
162
|
-
listPage: number;
|
|
163
|
-
/** Current page for shared-agent list items. */
|
|
164
|
-
sharedPage: number;
|
|
165
|
-
/**
|
|
166
|
-
* Ids returned by the last server-side search (`agx_search`), in server rank
|
|
167
|
-
* order. Additive: an agent in this list survives the search filter even
|
|
168
|
-
* when the local scorer gives it 0.
|
|
169
|
-
*
|
|
170
|
-
* That is load-bearing for tier 2. A deep search matches an agent's prompt
|
|
171
|
-
* content, which the client never loads — so the local scorer cannot see it.
|
|
172
|
-
* Without this list the server would return prompt matches and the UI would
|
|
173
|
-
* immediately filter them back out.
|
|
174
|
-
*
|
|
175
|
-
* Server-only matches sort BELOW every locally-scored match, in server rank
|
|
176
|
-
* order, so obvious matches always come first.
|
|
177
|
-
*/
|
|
178
|
-
serverMatchedIds: string[];
|
|
179
|
-
/** True while a server search is in flight — drives the search spinner. */
|
|
180
|
-
isServerSearching: boolean;
|
|
181
|
-
/** Tier 2: also search agent prompt content. Opt-in, per consumer. */
|
|
182
|
-
deepSearch: boolean;
|
|
183
|
-
}
|
|
184
|
-
declare const DEFAULT_AGENT_CONSUMER_STATE: AgentConsumerState;
|
|
185
|
-
/** The subset of consumer state a caller may patch (paging is derived). */
|
|
186
|
-
type AgentConsumerPatch = Partial<Omit<AgentConsumerState, "listPage" | "sharedPage">>;
|
|
187
|
-
/**
|
|
188
|
-
* Thrown by `createAgentCatalog` when a REQUIRED port is missing or an
|
|
189
|
-
* optional feature was asked for without the port it needs. Never a warning,
|
|
190
|
-
* never a degraded catalog: a picker that cannot read is not a picker.
|
|
191
|
-
*/
|
|
192
|
-
declare class AgentCatalogConfigError extends Error {
|
|
193
|
-
readonly name = "AgentCatalogConfigError";
|
|
194
|
-
/** Machine code, for a host that routes config failures. */
|
|
195
|
-
readonly code: string;
|
|
196
|
-
/** What the host must do, in a sentence a person can act on. */
|
|
197
|
-
readonly remedy: string;
|
|
198
|
-
constructor(args: {
|
|
199
|
-
code: string;
|
|
200
|
-
message: string;
|
|
201
|
-
remedy: string;
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* `@ai-matrx/agents/catalog` — THE PORTS.
|
|
207
|
-
*
|
|
208
|
-
* Two are required (`client`, `identity`); every other one ships a working
|
|
209
|
-
* default with a DOCUMENTED degradation, per THE ALL-INCLUSIVE LAW. A host
|
|
210
|
-
* injects identity and a Supabase client and nothing else; the picker's only
|
|
211
|
-
* contract back to the host is `onSelect(agentId)`.
|
|
212
|
-
*
|
|
213
|
-
* React appears nowhere in this file — it is import-inert and legal in any
|
|
214
|
-
* graph, server components included.
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
/** A PostgREST error, structurally. */
|
|
218
|
-
interface PgErrorLike {
|
|
219
|
-
message: string;
|
|
220
|
-
code?: string;
|
|
221
|
-
details?: string | null;
|
|
222
|
-
hint?: string | null;
|
|
223
|
-
}
|
|
224
|
-
/** What every supabase-js call resolves to, structurally. */
|
|
225
|
-
interface PgResultLike {
|
|
226
|
-
data: unknown;
|
|
227
|
-
error: PgErrorLike | null;
|
|
228
|
-
count?: number | null;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* The thenable builder supabase-js returns from `.rpc()`. `range` is what
|
|
232
|
-
* makes a COMPLETE list read possible (`readAllRows`); `order` is what makes
|
|
233
|
-
* that paging stable. Both are the real builder's own methods — this is a
|
|
234
|
-
* structural subset, never a re-implementation.
|
|
235
|
-
*/
|
|
236
|
-
interface AgentCatalogRpcCall extends PromiseLike<PgResultLike> {
|
|
237
|
-
range(from: number, to: number): PromiseLike<PgResultLike>;
|
|
238
|
-
order(column: string, options?: {
|
|
239
|
-
ascending?: boolean;
|
|
240
|
-
}): AgentCatalogRpcCall;
|
|
241
|
-
}
|
|
242
|
-
/** The one write this package performs: `agent.definition.is_favorite`. */
|
|
243
|
-
interface AgentCatalogTableQuery {
|
|
244
|
-
update(patch: Record<string, unknown>): {
|
|
245
|
-
eq(column: string, value: string): PromiseLike<{
|
|
246
|
-
data?: unknown;
|
|
247
|
-
error: PgErrorLike | null;
|
|
248
|
-
}>;
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* REQUIRED. A structural subset of `SupabaseClient` — anything that can answer
|
|
253
|
-
* `agx_get_list_full`, `agx_search`, `agx_resolve_agent_address` and write one
|
|
254
|
-
* column on `agent.definition`. A real supabase-js client satisfies it as-is.
|
|
255
|
-
*
|
|
256
|
-
* Absent → `createAgentCatalog` throws `AgentCatalogConfigError`. There is no
|
|
257
|
-
* degraded mode: the package IS the catalogue read.
|
|
258
|
-
*/
|
|
259
|
-
interface AgentCatalogClient {
|
|
260
|
-
rpc(fn: string, args?: Record<string, unknown>, options?: {
|
|
261
|
-
count?: "exact" | "planned" | "estimated";
|
|
262
|
-
}): AgentCatalogRpcCall;
|
|
263
|
-
schema(name: string): {
|
|
264
|
-
from(table: string): AgentCatalogTableQuery;
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* REQUIRED. Who is asking. Needed for the "zero owned agents → open on the
|
|
269
|
-
* public tab" heuristic and for the favorite write.
|
|
270
|
-
*
|
|
271
|
-
* `requireUserId` THROWS when there is no session — never a silent anonymous
|
|
272
|
-
* read. The catalog catches that throw in exactly ONE place (the tab-default
|
|
273
|
-
* heuristic, where a signed-out visitor legitimately lands on the public
|
|
274
|
-
* catalogue) and reports it to the `errorSink` the first time; every other
|
|
275
|
-
* caller lets it propagate.
|
|
276
|
-
*/
|
|
277
|
-
interface AgentCatalogIdentity {
|
|
278
|
-
requireUserId(): string;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Every degraded path, every failed read, every drift detection reports here.
|
|
282
|
-
* DEFAULT: a tagged `console.error` that announces ONCE that no sink is bound
|
|
283
|
-
* and names the remedy.
|
|
284
|
-
*/
|
|
285
|
-
type AgentCatalogErrorSink = (event: {
|
|
286
|
-
code: string;
|
|
287
|
-
message: string;
|
|
288
|
-
context?: object;
|
|
289
|
-
}) => void;
|
|
290
|
-
/**
|
|
291
|
-
* The drift scream's second channel. DEFAULT: none — and that is safe
|
|
292
|
-
* ONLY because the in-picker persistent banner is the primary scream and
|
|
293
|
-
* always renders. A drift is never console-only.
|
|
294
|
-
*/
|
|
295
|
-
type AgentCatalogNotifier = (event: {
|
|
296
|
-
level: "warning" | "error";
|
|
297
|
-
title: string;
|
|
298
|
-
message: string;
|
|
299
|
-
}) => void;
|
|
300
|
-
/**
|
|
301
|
-
* First-paint cache for resolved default rows. DEFAULT: `localStorage` when
|
|
302
|
-
* present, else an in-memory map (so SSR and a Chrome service worker both
|
|
303
|
-
* work). Absent storage degrades to "no first paint of the default row until
|
|
304
|
-
* the mandate resolves" — never a wrong name on screen.
|
|
305
|
-
*/
|
|
306
|
-
interface AgentCatalogStorage {
|
|
307
|
-
getItem(key: string): string | null;
|
|
308
|
-
setItem(key: string, value: string): void;
|
|
309
|
-
removeItem(key: string): void;
|
|
310
|
-
}
|
|
311
|
-
/** Every user-visible string the picker renders, overridable per host. */
|
|
312
|
-
interface AgentCatalogLabels {
|
|
313
|
-
/** User-facing label for the `system` ownership tab. */
|
|
314
|
-
publicTab: string;
|
|
315
|
-
/**
|
|
316
|
-
* Badge label on a builtin row. Default `"system"` — the string
|
|
317
|
-
* `AgentRow` actually rendered in matrx-frontend. (The frontend also
|
|
318
|
-
* declared `AGENT_PUBLIC_BADGE_LABEL = "Public"` for this badge and NOTHING
|
|
319
|
-
* ever read it — a constant that named the badge without being the badge.
|
|
320
|
-
* Recorded in the CHANGELOG and dropped rather than ported.)
|
|
321
|
-
*/
|
|
322
|
-
systemBadge: string;
|
|
323
|
-
searchPlaceholder: string;
|
|
324
|
-
currentAgentHeading: string;
|
|
325
|
-
emptyDefault: string;
|
|
326
|
-
emptyShared: string;
|
|
327
|
-
emptySystem: string;
|
|
328
|
-
loading: string;
|
|
329
|
-
triggerFallback: string;
|
|
330
|
-
triggerResolving: string;
|
|
331
|
-
triggerUnnameable: string;
|
|
332
|
-
hoverHint: string;
|
|
333
|
-
}
|
|
334
|
-
declare const DEFAULT_AGENT_CATALOG_LABELS: AgentCatalogLabels;
|
|
335
|
-
interface AgentCatalogConfig {
|
|
336
|
-
/** REQUIRED — the Supabase client. */
|
|
337
|
-
client: AgentCatalogClient;
|
|
338
|
-
/** REQUIRED — who is asking. */
|
|
339
|
-
identity: AgentCatalogIdentity;
|
|
340
|
-
/**
|
|
341
|
-
* The catalog's registry key on `globalThis`. Two `createAgentCatalog`
|
|
342
|
-
* calls with the same id are the same catalog (and the second one screams
|
|
343
|
-
* through the errorSink before replacing the first). Default `"default"`.
|
|
344
|
-
*/
|
|
345
|
-
catalogId?: string;
|
|
346
|
-
/** OPTIONAL — see `AgentCatalogErrorSink`. */
|
|
347
|
-
errorSink?: AgentCatalogErrorSink;
|
|
348
|
-
/** OPTIONAL — see `AgentCatalogNotifier`. */
|
|
349
|
-
notifier?: AgentCatalogNotifier;
|
|
350
|
-
/** OPTIONAL — see `AgentCatalogStorage`. */
|
|
351
|
-
storage?: AgentCatalogStorage;
|
|
352
|
-
/**
|
|
353
|
-
* OPTIONAL — the package's own `MatrxTransport` (`createMatrxTransport`
|
|
354
|
-
* from `@ai-matrx/agents/matrx`). REQUIRED the moment any picker instance
|
|
355
|
-
* passes a `defaultMandateKey`: THE PLATFORM RULE D-R1 says clients never
|
|
356
|
-
* walk the mandate ladder, so the default row can only be resolved through
|
|
357
|
-
* the aidream door `GET /mandates/{mandate_key}/resolution`. A
|
|
358
|
-
* `defaultMandateKey` with no transport throws `AgentCatalogConfigError`.
|
|
359
|
-
*/
|
|
360
|
-
transport?: AgentCatalogTransport;
|
|
361
|
-
/** OPTIONAL — label overrides. */
|
|
362
|
-
labels?: Partial<AgentCatalogLabels>;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* The transport seam, structurally identical to `MatrxTransport` from
|
|
366
|
-
* `@ai-matrx/agents/matrx` (declared structurally so `./catalog` never
|
|
367
|
-
* imports the transport module and stays import-inert).
|
|
368
|
-
*/
|
|
369
|
-
interface AgentCatalogTransport {
|
|
370
|
-
fetch(path: string, init: {
|
|
371
|
-
method: "GET" | "POST";
|
|
372
|
-
headers: Record<string, string>;
|
|
373
|
-
body?: string;
|
|
374
|
-
signal?: AbortSignal;
|
|
375
|
-
}): Promise<Response>;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Where a row's href goes when someone cmd-clicks it, and where `navigateTo`
|
|
379
|
-
* lands. DEFAULT: `window.location.assign` (so cmd-click and ordinary
|
|
380
|
-
* navigation both work with no host wiring at all).
|
|
381
|
-
*/
|
|
382
|
-
type AgentCatalogNavigate = (href: string) => void;
|
|
383
|
-
/** Resolve a per-row href. DEFAULT: `/agents/go/<id>` — the always-valid door. */
|
|
384
|
-
type AgentCatalogResolveHref = (agent: AgentSummary) => string;
|
|
385
|
-
/**
|
|
386
|
-
* The sneak-peek affordance. Absent → the affordance is HIDDEN, never a dead
|
|
387
|
-
* button (nothing fails silently, and nothing looks alive when it is not).
|
|
388
|
-
*/
|
|
389
|
-
type AgentCatalogOpenPeek = (agent: AgentSummary) => void;
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* catalog/default-row-types.ts — @ai-matrx/agents/catalog
|
|
393
|
-
*
|
|
394
|
-
* Split out of `default-row.ts` so `global-state.ts` can name the cached
|
|
395
|
-
* shape without importing the resolver (and its transport work) — the same
|
|
396
|
-
* split-out reflex C8 asks for, at module scale.
|
|
397
|
-
*/
|
|
398
|
-
|
|
399
|
-
/** The wire shape of `GET /mandates/{mandate_key}/resolution`, narrowed. */
|
|
400
|
-
interface MandateResolutionVerdict {
|
|
401
|
-
mandateKey: string;
|
|
402
|
-
holderType: string;
|
|
403
|
-
/** The executable id. `null` for a workflow Holder — a picker cannot run one. */
|
|
404
|
-
agentId: string | null;
|
|
405
|
-
isVersion: boolean;
|
|
406
|
-
/** Always the `agent.definition` id, even when `agentId` is a version. */
|
|
407
|
-
definitionAgentId: string | null;
|
|
408
|
-
/** Which precedence layer answered. Shown so a person can see WHY. */
|
|
409
|
-
provenance: string;
|
|
410
|
-
}
|
|
411
|
-
/** A resolved default row, cached for first paint and compared for drift. */
|
|
412
|
-
interface ResolvedDefaultRow {
|
|
413
|
-
mandateKey: string;
|
|
414
|
-
/** The `agent.definition` id the mandate resolved to. */
|
|
415
|
-
holderId: string;
|
|
416
|
-
/** The holder's REAL name, read from the catalogue — never hardcoded. */
|
|
417
|
-
holderName: string;
|
|
418
|
-
holderDescription: string | null;
|
|
419
|
-
provenance: string;
|
|
420
|
-
/** Epoch ms of this resolution. */
|
|
421
|
-
at: number;
|
|
422
|
-
}
|
|
423
|
-
/** What the picker renders and what it screams, together. */
|
|
424
|
-
interface DefaultRowState {
|
|
425
|
-
mandateKey: string;
|
|
426
|
-
/** The row to render at the top of the list. `null` until resolved. */
|
|
427
|
-
row: AgentSummary | null;
|
|
428
|
-
/** The last live resolution, or the cached one before the live answer lands. */
|
|
429
|
-
resolved: ResolvedDefaultRow | null;
|
|
430
|
-
/** True while the resolution is in flight. */
|
|
431
|
-
loading: boolean;
|
|
432
|
-
/**
|
|
433
|
-
* 🚨 THE DRIFT SCREAM. Set when the cached first-paint row and the LIVE
|
|
434
|
-
* resolution disagree on holder id or holder name. Rendered as a persistent
|
|
435
|
-
* in-picker banner AND sent to the `notifier` port — never console-only.
|
|
436
|
-
*/
|
|
437
|
-
drift: string | null;
|
|
438
|
-
/** Set when the mandate could not be resolved at all. Loud, with a remedy. */
|
|
439
|
-
error: string | null;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* catalog/schema.ts — @ai-matrx/agents/catalog
|
|
444
|
-
*
|
|
445
|
-
* THE DEMANDED SCHEMA PROBE (the `@ai-matrx/associations` `assertDemandedSchema`
|
|
446
|
-
* precedent). It proves that the database a host pointed this catalog at can
|
|
447
|
-
* actually answer the three functions the picker demands.
|
|
448
|
-
*
|
|
449
|
-
* 🚨 IT MUST BE ABLE TO FAIL. A probe whose green result is unconditional
|
|
450
|
-
* proves nothing, so `selfTest: true` also probes a fabricated function name
|
|
451
|
-
* and REQUIRES it to come back missing. `catalog/__tests__/schema.test.ts`
|
|
452
|
-
* runs the whole probe against a client whose `rpc` answers PostgreSQL 42883
|
|
453
|
-
* (`undefined_function`, which PostgREST surfaces as PGRST202) and asserts the
|
|
454
|
-
* loud error.
|
|
455
|
-
*/
|
|
456
|
-
|
|
457
|
-
interface AgentCatalogSchemaReport {
|
|
458
|
-
ok: boolean;
|
|
459
|
-
/** Demanded functions the database cannot answer. */
|
|
460
|
-
missing: string[];
|
|
461
|
-
/** Functions the probe could not reach (transport/unknown failure). */
|
|
462
|
-
unreachable: {
|
|
463
|
-
fn: string;
|
|
464
|
-
error: unknown;
|
|
465
|
-
}[];
|
|
466
|
-
/** Functions that answered (success or any non-missing refusal). */
|
|
467
|
-
answered: string[];
|
|
468
|
-
/** True when `agent.definition.is_favorite` is writable by this caller. */
|
|
469
|
-
favoriteWritable: boolean | null;
|
|
470
|
-
/**
|
|
471
|
-
* Whether `agx_get_list_full` carries the `orchestra` badge column (added to
|
|
472
|
-
* the platform 2026-09-08).
|
|
473
|
-
*
|
|
474
|
-
* NOT a violation when absent — the picker degrades to no conductor marker,
|
|
475
|
-
* which is honest — but it is never SILENT either: a `false` here is the one
|
|
476
|
-
* signal that tells a host "this database predates the badge" instead of
|
|
477
|
-
* leaving someone to wonder why their Orchestra looks like a plain agent.
|
|
478
|
-
* `null` means the probe could not tell (the caller can see no agents at
|
|
479
|
-
* all), never "fine".
|
|
480
|
-
*/
|
|
481
|
-
orchestraColumn: boolean | null;
|
|
482
|
-
}
|
|
483
|
-
interface AssertAgentCatalogSchemaOptions {
|
|
484
|
-
/**
|
|
485
|
-
* Also probe a fabricated function name and REQUIRE it to come back
|
|
486
|
-
* missing — proves this probe can fail.
|
|
487
|
-
*/
|
|
488
|
-
selfTest?: boolean;
|
|
489
|
-
/** Return the report instead of throwing. The self-test failure ALWAYS throws. */
|
|
490
|
-
throwOnViolation?: boolean;
|
|
491
|
-
/**
|
|
492
|
-
* Also probe the ONE write (`agent.definition.is_favorite`) against an
|
|
493
|
-
* impossible id, so a 42501/permission refusal is seen at boot rather than
|
|
494
|
-
* on a user's first click. Default: on.
|
|
495
|
-
*/
|
|
496
|
-
probeWrite?: boolean;
|
|
497
|
-
}
|
|
498
|
-
/**
|
|
499
|
-
* Probe every demanded function. Throws an `Error` naming each missing one
|
|
500
|
-
* (unless `throwOnViolation: false`), and ALWAYS throws when the probe itself
|
|
501
|
-
* cannot be trusted (unreachable database, failed self-test).
|
|
502
|
-
*/
|
|
503
|
-
declare function assertAgentCatalogSchema(client: AgentCatalogClient, options?: AssertAgentCatalogSchemaOptions): Promise<AgentCatalogSchemaReport>;
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* catalog/store.ts — @ai-matrx/agents/catalog
|
|
507
|
-
*
|
|
508
|
-
* `createAgentCatalog(config)` — the headless kernel. Everything the picker
|
|
509
|
-
* knows lives here: the row registry, the complete-list read with its
|
|
510
|
-
* session-shared in-flight dedupe and freshness window, the tier-2 server
|
|
511
|
-
* search, the per-consumer view state, the ONE write, and the mandate default
|
|
512
|
-
* row with its drift screamer.
|
|
513
|
-
*
|
|
514
|
-
* The host injects a Supabase client and who the user is. Nothing else.
|
|
515
|
-
*
|
|
516
|
-
* The consumer reducers below are a VERBATIM port of matrx-frontend
|
|
517
|
-
* `features/agents/redux/agent-consumers/slice.ts`; only the seam inverts
|
|
518
|
-
* (a Redux reducer becomes a store method, and Immer's draft mutation becomes
|
|
519
|
-
* an explicit copy so the store can publish a new reference).
|
|
520
|
-
*/
|
|
521
|
-
|
|
522
|
-
type AgentCatalogStatus = "idle" | "loading" | "succeeded" | "failed";
|
|
523
|
-
interface AgentCatalogState {
|
|
524
|
-
/** Every row, one stable array reference per change (memoization depends on it). */
|
|
525
|
-
rows: AgentSummary[];
|
|
526
|
-
byId: Record<string, AgentSummary>;
|
|
527
|
-
status: AgentCatalogStatus;
|
|
528
|
-
error: string | null;
|
|
529
|
-
consumers: Record<string, AgentConsumerState>;
|
|
530
|
-
/** Keyed by mandate key. */
|
|
531
|
-
defaultRows: Record<string, DefaultRowState>;
|
|
532
|
-
}
|
|
533
|
-
interface AgentCatalog {
|
|
534
|
-
readonly catalogId: string;
|
|
535
|
-
readonly labels: AgentCatalogLabels;
|
|
536
|
-
readonly errorSink: AgentCatalogErrorSink;
|
|
537
|
-
readonly notifier: AgentCatalogNotifier | undefined;
|
|
538
|
-
/** True when this catalog was given a transport and can resolve mandates. */
|
|
539
|
-
readonly canResolveMandates: boolean;
|
|
540
|
-
getState(): AgentCatalogState;
|
|
541
|
-
subscribe(listener: () => void): () => void;
|
|
542
|
-
getAgent(agentId: string): AgentSummary | undefined;
|
|
543
|
-
/**
|
|
544
|
-
* The signed-in user id, or `null` when there is no session. The ONE place
|
|
545
|
-
* `identity.requireUserId()`'s throw is caught — a signed-out visitor
|
|
546
|
-
* legitimately lands on the public catalogue — and it is reported to the
|
|
547
|
-
* errorSink the first time so it is never silent.
|
|
548
|
-
*/
|
|
549
|
-
getUserIdOrNull(): string | null;
|
|
550
|
-
/** Load the catalogue if it is not fresh. Safe to call on every mount. */
|
|
551
|
-
ensureLoaded(options?: {
|
|
552
|
-
force?: boolean;
|
|
553
|
-
}): Promise<void>;
|
|
554
|
-
/** True when the last load is inside the 15-minute TTL. */
|
|
555
|
-
isFresh(): boolean;
|
|
556
|
-
/** True when the last load is older than 4 hours (tab-restore threshold). */
|
|
557
|
-
isStale(): boolean;
|
|
558
|
-
getConsumer(consumerId: string): AgentConsumerState;
|
|
559
|
-
registerConsumer(consumerId: string, initial?: AgentConsumerPatch): void;
|
|
560
|
-
unregisterConsumer(consumerId: string): void;
|
|
561
|
-
setConsumerFilter(consumerId: string, patch: AgentConsumerPatch): void;
|
|
562
|
-
setConsumerPage(consumerId: string, which: "list" | "shared", page: number): void;
|
|
563
|
-
setConsumerServerSearch(consumerId: string, args: {
|
|
564
|
-
matchedIds?: string[];
|
|
565
|
-
isSearching?: boolean;
|
|
566
|
-
}): void;
|
|
567
|
-
resetConsumerFilters(consumerId: string): void;
|
|
568
|
-
/** Tier-2 search. Purely additive; merges rows into the registry. */
|
|
569
|
-
searchServer(query: string, deep?: boolean): Promise<string[]>;
|
|
570
|
-
/** THE ONE WRITE. Optimistic, rolled back on failure, loud either way. */
|
|
571
|
-
setFavorite(agentId: string, isFavorite: boolean): Promise<void>;
|
|
572
|
-
/** Resolve (once) the default row for a mandate key. Idempotent. */
|
|
573
|
-
ensureDefaultRow(mandateKey: string): void;
|
|
574
|
-
getDefaultRow(mandateKey: string): DefaultRowState | undefined;
|
|
575
|
-
/** A person acknowledged the drift banner. The notifier already fired. */
|
|
576
|
-
dismissDefaultRowDrift(mandateKey: string): void;
|
|
577
|
-
assertSchema(options?: AssertAgentCatalogSchemaOptions): Promise<AgentCatalogSchemaReport>;
|
|
578
|
-
}
|
|
579
|
-
declare function createAgentCatalog(config: AgentCatalogConfig): AgentCatalog;
|
|
580
|
-
/**
|
|
581
|
-
* The catalog registered under `catalogId`, across loader graphs. Returns
|
|
582
|
-
* `undefined` when none has been created yet — never a silent stub.
|
|
583
|
-
*/
|
|
584
|
-
declare function getRegisteredAgentCatalog(catalogId?: string): AgentCatalog | undefined;
|
|
1
|
+
import { A as AgentSummary, a as AgentCatalogClient, b as AgentCatalogTransport, c as AgentCatalogStorageLike, d as AgentCatalogErrorSink, R as ResolvedDefaultRow, e as AgentCatalogStorage, M as MandateResolutionVerdict, f as AgentTab, g as AgentCatalogLabels, h as AgentConsumerState, i as AgentSortOption } from '../orchestra-BWJM2MWP.js';
|
|
2
|
+
export { j as AGENT_NONE_SENTINEL, k as AgentAccessFilter, l as AgentAccessLevel, m as AgentArchFilter, n as AgentCatalog, o as AgentCatalogAgentType, p as AgentCatalogAsyncStorage, q as AgentCatalogConfig, r as AgentCatalogConfigError, s as AgentCatalogIdentity, t as AgentCatalogNavigate, u as AgentCatalogNotifier, v as AgentCatalogOpenPeek, w as AgentCatalogResolveHref, x as AgentCatalogRpcCall, y as AgentCatalogSchemaReport, z as AgentCatalogState, B as AgentCatalogStatus, C as AgentCatalogTableQuery, D as AgentConsumerPatch, E as AgentFavFilter, F as AgentId, G as AssertAgentCatalogSchemaOptions, H as DEFAULT_AGENT_CATALOG_LABELS, I as DEFAULT_AGENT_CONSUMER_STATE, J as DefaultRowState, O as OrchestraBadge, P as PgErrorLike, K as PgResultLike, S as SORT_OPTIONS, L as asAgentId, N as assertAgentCatalogSchema, Q as createAgentCatalog, T as getRegisteredAgentCatalog, U as isMandateAgentId, V as mandateAgentId, W as orchestraDelegatesLine, X as orchestraDepthLine, Y as orchestraLabel, Z as orchestraModeLabel } from '../orchestra-BWJM2MWP.js';
|
|
585
3
|
|
|
586
4
|
/**
|
|
587
5
|
* catalog/data.ts — @ai-matrx/agents/catalog
|
|
@@ -680,35 +98,6 @@ declare function writeAgentFavorite(client: AgentCatalogClient, agentId: string,
|
|
|
680
98
|
*/
|
|
681
99
|
declare function toAgentSummary(raw: unknown): AgentSummary | null;
|
|
682
100
|
|
|
683
|
-
/**
|
|
684
|
-
* catalog/orchestra.ts — @ai-matrx/agents/catalog
|
|
685
|
-
*
|
|
686
|
-
* Creator words for an Orchestra badge. A VERBATIM port of the helpers the
|
|
687
|
-
* Workflow Studio's hand-rolled picker carried (`apps/workflow-studio/src/
|
|
688
|
-
* hooks/use-agents.ts` before `c0f958b43`), lifted here so every client says
|
|
689
|
-
* the same sentence about the same ensemble.
|
|
690
|
-
*
|
|
691
|
-
* Pure — no React, no DOM. The row shape is `OrchestraBadge` in `./types`.
|
|
692
|
-
*/
|
|
693
|
-
|
|
694
|
-
declare function orchestraModeLabel(mode: string): string;
|
|
695
|
-
/** Human label for a badge: "Orchestra · supervisor · 3 members" (singular-safe). */
|
|
696
|
-
declare function orchestraLabel(badge: OrchestraBadge): string;
|
|
697
|
-
/**
|
|
698
|
-
* The member-call ceiling in Creator language ("Team members can call helpers
|
|
699
|
-
* up to 2 levels deep"), or `null` when the composition declared none. A badge
|
|
700
|
-
* never invents the platform default: the server that runs the ensemble owns
|
|
701
|
-
* that number, and printing a promise nobody made is worse than printing
|
|
702
|
-
* nothing.
|
|
703
|
-
*/
|
|
704
|
-
declare function orchestraDepthLine(badge: OrchestraBadge): string | null;
|
|
705
|
-
/**
|
|
706
|
-
* One visible line naming who the Orchestra delegates to, collapsing past
|
|
707
|
-
* `limit` into "+N more". `null` when no member carries a real role title —
|
|
708
|
-
* "Member, Member, Member" is noise that reads like data.
|
|
709
|
-
*/
|
|
710
|
-
declare function orchestraDelegatesLine(badge: OrchestraBadge, limit?: number): string | null;
|
|
711
|
-
|
|
712
101
|
/**
|
|
713
102
|
* catalog/default-row.ts — @ai-matrx/agents/catalog
|
|
714
103
|
*
|
|
@@ -765,6 +154,13 @@ declare function createMemoryStorage(): AgentCatalogStorage;
|
|
|
765
154
|
declare function defaultStorage(): AgentCatalogStorage;
|
|
766
155
|
declare function readCachedDefaultRow(storage: AgentCatalogStorage, mandateKey: string): ResolvedDefaultRow | null;
|
|
767
156
|
declare function writeCachedDefaultRow(storage: AgentCatalogStorage, resolved: ResolvedDefaultRow): void;
|
|
157
|
+
/**
|
|
158
|
+
* Read the cached row from EITHER storage shape. A store that throws or answers
|
|
159
|
+
* with a rejected promise costs a first paint, never correctness.
|
|
160
|
+
*/
|
|
161
|
+
declare function readCachedDefaultRowAsync(storage: AgentCatalogStorageLike, mandateKey: string): Promise<ResolvedDefaultRow | null>;
|
|
162
|
+
/** Write the cached row to EITHER storage shape. */
|
|
163
|
+
declare function writeCachedDefaultRowAsync(storage: AgentCatalogStorageLike, resolved: ResolvedDefaultRow): Promise<void>;
|
|
768
164
|
/** Build the `mandate:<key>` row from a resolved Holder. Never hardcodes text. */
|
|
769
165
|
declare function defaultRowFromResolution(resolved: ResolvedDefaultRow): AgentSummary;
|
|
770
166
|
/**
|
|
@@ -776,7 +172,7 @@ interface ResolveDefaultRowArgs {
|
|
|
776
172
|
mandateKey: string;
|
|
777
173
|
transport: AgentCatalogTransport;
|
|
778
174
|
client: AgentCatalogClient;
|
|
779
|
-
storage:
|
|
175
|
+
storage: AgentCatalogStorageLike;
|
|
780
176
|
errorSink: AgentCatalogErrorSink;
|
|
781
177
|
/** Look the Holder up in the rows this catalog already holds. */
|
|
782
178
|
lookupRow: (agentId: string) => AgentSummary | undefined;
|
|
@@ -965,4 +361,4 @@ declare const selectTotalFavoriteAgentsCount: (a: readonly AgentSummary[]) => nu
|
|
|
965
361
|
/** @internal Test-only: forget every session-shared value. */
|
|
966
362
|
declare function _resetCatalogGlobalState(): void;
|
|
967
363
|
|
|
968
|
-
export { AGENT_CARDS_LIMIT_DESKTOP, AGENT_CARDS_LIMIT_MOBILE, AGENT_LIST_ITEMS_PER_PAGE,
|
|
364
|
+
export { AGENT_CARDS_LIMIT_DESKTOP, AGENT_CARDS_LIMIT_MOBILE, AGENT_LIST_ITEMS_PER_PAGE, AGENT_SEARCH_LIMIT, AgentCatalogClient, AgentCatalogErrorSink, AgentCatalogLabels, AgentCatalogReadError, AgentCatalogStorage, AgentCatalogStorageLike, AgentCatalogTransport, AgentConsumerState, type AgentListPage, type AgentSearchable, type AgentServerSearchResult, AgentSortOption, AgentSummary, AgentTab, MandateDefaultRowError, MandateResolutionVerdict, type ResolveDefaultRowArgs, type ResolveDefaultRowOutcome, ResolvedDefaultRow, _resetCatalogGlobalState, agentConsumerHasActiveFilters, agentListEmptyLabel, agentMatchesSearch, applyAgentSortComparator, computeAgentSearchScore, createMemoryStorage, defaultRowFromResolution, defaultStorage, detectDefaultRowDrift, filterBuiltinTypeAgents, filterUserTypeAgents, makeSelectFilteredAgents, makeSelectFilteredAgentsCount, makeSelectFilteredBuiltinAgents, makeSelectFilteredBuiltinAgentsCount, makeSelectFilteredOwnedAgents, makeSelectFilteredSharedAgents, makeSelectOwnedAgentCards, makeSelectOwnedAgentListItems, makeSelectSharedAgentCards, makeSelectSharedAgentListItems, memoize1, memoize2, memoize3, parseMandateResolution, readAgentCatalogRows, readCachedDefaultRow, readCachedDefaultRowAsync, readSingleAgentRow, resolveDefaultRow, searchAgentsOnServer, selectAllAgentCategories, selectAllAgentTags, selectAllSystemAgentCategories, selectAllSystemAgentTags, selectBuiltinTypeAgents, selectTotalBuiltinAgentsCount, selectTotalFavoriteAgentsCount, selectTotalOwnedAgentsCount, selectTotalSharedAgentsCount, selectTotalUserAgentsCount, selectUserTypeAgents, shouldDefaultAgentListToPublicTab, sortFilteredAgents, toAgentSummary, writeAgentFavorite, writeCachedDefaultRow, writeCachedDefaultRowAsync };
|