@retinue/agentkit 0.1.0 → 0.3.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/README.md +59 -277
- package/dist/adapters/audio/openai.d.ts +36 -0
- package/dist/adapters/audio/openai.js +136 -0
- package/dist/adapters/bullmq/lock.d.ts +26 -2
- package/dist/adapters/embeddings/openai.d.ts +45 -0
- package/dist/adapters/embeddings/openai.js +109 -0
- package/dist/adapters/memory/connections.d.ts +10 -0
- package/dist/adapters/memory/connections.js +87 -0
- package/dist/adapters/memory/graph.d.ts +17 -0
- package/dist/adapters/memory/graph.js +267 -0
- package/dist/adapters/memory/index.d.ts +3 -0
- package/dist/adapters/memory/index.js +3 -0
- package/dist/adapters/memory/rate-limit.d.ts +14 -0
- package/dist/adapters/memory/rate-limit.js +28 -0
- package/dist/adapters/memory/runtime.js +0 -0
- package/dist/adapters/postgres/connections.d.ts +15 -0
- package/dist/adapters/postgres/connections.js +134 -0
- package/dist/adapters/postgres/graph.d.ts +24 -0
- package/dist/adapters/postgres/graph.js +325 -0
- package/dist/adapters/postgres/index.d.ts +2 -0
- package/dist/adapters/postgres/index.js +2 -0
- package/dist/adapters/postgres/migrations.js +198 -0
- package/dist/adapters/postgres/run-store.js +26 -2
- package/dist/adapters/postgres/schema.d.ts +61 -2
- package/dist/adapters/postgres/schema.js +95 -10
- package/dist/adapters/redis/index.d.ts +1 -0
- package/dist/adapters/redis/index.js +1 -0
- package/dist/adapters/redis/rate-limit.d.ts +46 -0
- package/dist/adapters/redis/rate-limit.js +55 -0
- package/dist/adapters/supabase/index.d.ts +15 -0
- package/dist/adapters/supabase/index.js +15 -0
- package/dist/adapters/supabase/rls.js +33 -0
- package/dist/agents/agent.d.ts +99 -1
- package/dist/agents/agent.js +215 -16
- package/dist/agents/define.js +24 -4
- package/dist/agents/engine.d.ts +48 -0
- package/dist/agents/engine.js +370 -13
- package/dist/audio/index.d.ts +151 -0
- package/dist/audio/index.js +183 -0
- package/dist/capabilities/index.d.ts +5 -1
- package/dist/capabilities/index.js +23 -0
- package/dist/capabilities/runtime.d.ts +8 -0
- package/dist/connections/cipher.d.ts +103 -0
- package/dist/connections/cipher.js +141 -0
- package/dist/connections/index.d.ts +156 -0
- package/dist/connections/index.js +72 -0
- package/dist/connections/oauth/client.d.ts +84 -0
- package/dist/connections/oauth/client.js +141 -0
- package/dist/connections/oauth/index.d.ts +166 -0
- package/dist/connections/oauth/index.js +226 -0
- package/dist/connections/oauth/service.d.ts +90 -0
- package/dist/connections/oauth/service.js +132 -0
- package/dist/connections/pause.d.ts +68 -0
- package/dist/connections/pause.js +97 -0
- package/dist/connections/resolver.d.ts +59 -0
- package/dist/connections/resolver.js +138 -0
- package/dist/connections/resume.d.ts +64 -0
- package/dist/connections/resume.js +99 -0
- package/dist/connections/vault-cipher.d.ts +95 -0
- package/dist/connections/vault-cipher.js +206 -0
- package/dist/core/budget.d.ts +55 -0
- package/dist/core/budget.js +56 -0
- package/dist/core/content-parts.d.ts +26 -2
- package/dist/core/content-parts.js +1 -0
- package/dist/core/context.d.ts +25 -0
- package/dist/core/errors.d.ts +1 -1
- package/dist/core/errors.js +15 -0
- package/dist/core/events.d.ts +110 -2
- package/dist/core/events.js +33 -2
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/validation.js +19 -0
- package/dist/documents/index.d.ts +14 -0
- package/dist/documents/parsers/text.d.ts +16 -0
- package/dist/documents/parsers/text.js +54 -2
- package/dist/entries/connections.d.ts +10 -0
- package/dist/entries/connections.js +10 -0
- package/dist/entries/guardrails.d.ts +14 -0
- package/dist/entries/guardrails.js +14 -0
- package/dist/entries/knowledge.d.ts +17 -0
- package/dist/entries/knowledge.js +16 -0
- package/dist/entries/mcp-server.d.ts +9 -0
- package/dist/entries/mcp-server.js +9 -0
- package/dist/entries/runtime.d.ts +10 -0
- package/dist/entries/runtime.js +8 -0
- package/dist/entries/testing.d.ts +28 -0
- package/dist/entries/testing.js +28 -0
- package/dist/graphql/resolvers.d.ts +7 -1
- package/dist/graphql/resolvers.js +20 -0
- package/dist/graphql/schema.d.ts +1 -1
- package/dist/graphql/schema.js +44 -0
- package/dist/guardrails/index.d.ts +115 -0
- package/dist/guardrails/index.js +108 -0
- package/dist/guardrails/moderation.d.ts +53 -0
- package/dist/guardrails/moderation.js +75 -0
- package/dist/guardrails/pii.d.ts +75 -0
- package/dist/guardrails/pii.js +193 -0
- package/dist/knowledge/communities.d.ts +166 -0
- package/dist/knowledge/communities.js +377 -0
- package/dist/knowledge/graph-global.d.ts +153 -0
- package/dist/knowledge/graph-global.js +246 -0
- package/dist/knowledge/graph-retrieval.d.ts +150 -0
- package/dist/knowledge/graph-retrieval.js +303 -0
- package/dist/knowledge/graph.d.ts +223 -0
- package/dist/knowledge/graph.js +369 -0
- package/dist/knowledge/index.d.ts +25 -0
- package/dist/knowledge/index.js +37 -1
- package/dist/knowledge/navigate.d.ts +89 -0
- package/dist/knowledge/navigate.js +107 -0
- package/dist/knowledge/retrieval.d.ts +98 -5
- package/dist/knowledge/retrieval.js +158 -28
- package/dist/mcp-server/index.d.ts +168 -0
- package/dist/mcp-server/index.js +175 -0
- package/dist/models/extraction.d.ts +73 -0
- package/dist/models/extraction.js +118 -0
- package/dist/models/index.d.ts +40 -1
- package/dist/models/index.js +22 -1
- package/dist/models/pricing.d.ts +2 -0
- package/dist/models/pricing.js +17 -1
- package/dist/models/provider-factory.js +9 -7
- package/dist/models/streaming.d.ts +111 -1
- package/dist/models/streaming.js +184 -3
- package/dist/persistence/index.d.ts +230 -0
- package/dist/persistence/index.js +2 -0
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +12 -0
- package/dist/runtime/worker.d.ts +36 -1
- package/dist/runtime/worker.js +37 -4
- package/dist/security/checklist.js +55 -0
- package/dist/security/findings.js +18 -9
- package/dist/server/bin.d.ts +19 -0
- package/dist/server/bin.js +226 -0
- package/dist/server/boot.d.ts +20 -2
- package/dist/server/boot.js +29 -3
- package/dist/server/cli.d.ts +13 -0
- package/dist/server/cli.js +7 -4
- package/dist/server/doctor.d.ts +74 -0
- package/dist/server/doctor.js +280 -0
- package/dist/skills/catalogue.d.ts +49 -0
- package/dist/skills/catalogue.js +61 -0
- package/dist/skills/context.d.ts +61 -0
- package/dist/skills/context.js +107 -0
- package/dist/skills/index.d.ts +2 -0
- package/dist/skills/index.js +2 -0
- package/dist/telemetry/spans.js +17 -0
- package/dist/testing/conformance/artifact-exports.d.ts +20 -0
- package/dist/testing/conformance/artifact-exports.js +172 -0
- package/dist/testing/conformance/artifacts.d.ts +11 -0
- package/dist/testing/conformance/artifacts.js +316 -0
- package/dist/testing/conformance/audio.d.ts +38 -0
- package/dist/testing/conformance/audio.js +145 -0
- package/dist/testing/conformance/capability.d.ts +23 -0
- package/dist/testing/conformance/capability.js +27 -0
- package/dist/testing/conformance/checkpoint-store.d.ts +15 -0
- package/dist/testing/conformance/checkpoint-store.js +72 -0
- package/dist/testing/conformance/connections.d.ts +14 -0
- package/dist/testing/conformance/connections.js +171 -0
- package/dist/testing/conformance/conversation-store.d.ts +10 -0
- package/dist/testing/conformance/conversation-store.js +60 -0
- package/dist/testing/conformance/evaluation.d.ts +10 -0
- package/dist/testing/conformance/evaluation.js +295 -0
- package/dist/testing/conformance/files.d.ts +19 -0
- package/dist/testing/conformance/files.js +454 -0
- package/dist/testing/conformance/flows.d.ts +16 -0
- package/dist/testing/conformance/flows.js +193 -0
- package/dist/testing/conformance/graph.d.ts +22 -0
- package/dist/testing/conformance/graph.js +500 -0
- package/dist/testing/conformance/hitl.d.ts +25 -0
- package/dist/testing/conformance/hitl.js +523 -0
- package/dist/testing/conformance/index.d.ts +163 -0
- package/dist/testing/conformance/index.js +321 -0
- package/dist/testing/conformance/invariants.d.ts +23 -0
- package/dist/testing/conformance/invariants.js +80 -0
- package/dist/testing/conformance/knowledge.d.ts +41 -0
- package/dist/testing/conformance/knowledge.js +592 -0
- package/dist/testing/conformance/parents.d.ts +50 -0
- package/dist/testing/conformance/parents.js +39 -0
- package/dist/testing/conformance/rate-limit.d.ts +25 -0
- package/dist/testing/conformance/rate-limit.js +71 -0
- package/dist/testing/conformance/records.d.ts +36 -0
- package/dist/testing/conformance/records.js +400 -0
- package/dist/testing/conformance/rollups.d.ts +30 -0
- package/dist/testing/conformance/rollups.js +425 -0
- package/dist/testing/conformance/run-coordinator.d.ts +27 -0
- package/dist/testing/conformance/run-coordinator.js +150 -0
- package/dist/testing/conformance/run-event-log.d.ts +9 -0
- package/dist/testing/conformance/run-event-log.js +138 -0
- package/dist/testing/conformance/run-store.d.ts +12 -0
- package/dist/testing/conformance/run-store.js +294 -0
- package/dist/testing/conformance/session-state.d.ts +38 -0
- package/dist/testing/conformance/session-state.js +198 -0
- package/dist/testing/conformance/usage-limits.d.ts +10 -0
- package/dist/testing/conformance/usage-limits.js +309 -0
- package/dist/testing/conformance.d.ts +8 -0
- package/dist/testing/conformance.js +8 -0
- package/dist/testing/memory-backend.d.ts +39 -0
- package/dist/testing/memory-backend.js +41 -0
- package/dist/testing/pglite.d.ts +55 -0
- package/dist/testing/pglite.js +78 -0
- package/dist/testing/stub-model.d.ts +58 -0
- package/dist/testing/stub-model.js +71 -0
- package/dist/testing/supabase-storage-double.d.ts +35 -0
- package/dist/testing/supabase-storage-double.js +101 -0
- package/dist/toolkit/files.d.ts +125 -0
- package/dist/toolkit/files.js +320 -0
- package/dist/toolkit/http.d.ts +27 -0
- package/dist/toolkit/http.js +48 -0
- package/dist/toolkit/index.d.ts +31 -1
- package/dist/toolkit/index.js +26 -1
- package/dist/toolkit/mime.d.ts +97 -0
- package/dist/toolkit/mime.js +233 -0
- package/dist/toolkit/sandbox.d.ts +119 -0
- package/dist/toolkit/sandbox.js +239 -0
- package/dist/toolkit/ssrf.d.ts +139 -0
- package/dist/toolkit/ssrf.js +349 -0
- package/dist/toolkit/vendor.d.ts +91 -0
- package/dist/toolkit/vendor.js +153 -0
- package/dist/toolkit/web.d.ts +13 -0
- package/dist/toolkit/web.js +7 -1
- package/dist/tools/budget.d.ts +28 -0
- package/dist/tools/budget.js +35 -0
- package/dist/tools/credentials.d.ts +316 -0
- package/dist/tools/credentials.js +369 -0
- package/dist/tools/define.d.ts +45 -0
- package/dist/tools/define.js +26 -0
- package/dist/tools/find.d.ts +109 -0
- package/dist/tools/find.js +210 -0
- package/dist/tools/index.d.ts +35 -2
- package/dist/tools/index.js +11 -0
- package/dist/tools/library/audio.d.ts +63 -0
- package/dist/tools/library/audio.js +148 -0
- package/dist/tools/library/fs.d.ts +24 -0
- package/dist/tools/library/fs.js +102 -0
- package/dist/tools/library/index.d.ts +37 -2
- package/dist/tools/library/index.js +47 -0
- package/dist/tools/library/shell.d.ts +45 -0
- package/dist/tools/library/shell.js +70 -0
- package/dist/tools/meta-tools.js +8 -0
- package/dist/tools/registry.d.ts +146 -0
- package/dist/tools/registry.js +250 -4
- package/dist/usage/index.d.ts +21 -0
- package/dist/usage/index.js +1 -0
- package/dist/usage/rate-limit.d.ts +122 -0
- package/dist/usage/rate-limit.js +131 -0
- package/dist/usage/recorder.js +3 -0
- package/package.json +33 -2
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
package/dist/core/validation.js
CHANGED
|
@@ -133,6 +133,25 @@ const messagePartSchema = z.discriminatedUnion("type", [
|
|
|
133
133
|
z.object({ ...base, type: z.literal("artifact"), artifactId: idString, versionId: idString, title: z.string() }),
|
|
134
134
|
z.object({ ...base, type: z.literal("status"), status: z.string(), detail: z.string().optional() }),
|
|
135
135
|
z.object({ ...base, type: z.literal("error"), error: platformErrorSchema }),
|
|
136
|
+
/**
|
|
137
|
+
* A structured agent's validated answer — #243.
|
|
138
|
+
*
|
|
139
|
+
* `value` is `unknown` on purpose. The schema that constrains it belongs to the *agent*, is chosen by whoever
|
|
140
|
+
* wrote the manifest, and has already been enforced before the part was emitted — so re-describing it here is
|
|
141
|
+
* impossible (there is no one shape) and re-validating it would be validating against the wrong schema.
|
|
142
|
+
*
|
|
143
|
+
* What this layer does check is that `value` is **present**. `z.unknown()` accepts `undefined`, which would let
|
|
144
|
+
* a part claiming to be a structured answer round-trip carrying nothing — the empty version of the exact defect
|
|
145
|
+
* #243 fixed. `z.unknown().refine(v => v !== undefined)` is the narrowest thing that closes it, and `null`
|
|
146
|
+
* stays legal because `null` is a valid JSON value a schema may well permit.
|
|
147
|
+
*/
|
|
148
|
+
z.object({
|
|
149
|
+
...base,
|
|
150
|
+
type: z.literal("structured"),
|
|
151
|
+
value: z.unknown().refine((v) => v !== undefined, {
|
|
152
|
+
message: "a structured part must carry a value; an absent one is an answer that was never validated",
|
|
153
|
+
}),
|
|
154
|
+
}),
|
|
136
155
|
]);
|
|
137
156
|
const executionContextSchema = z.object({
|
|
138
157
|
tenantId: idString,
|
|
@@ -73,6 +73,20 @@ export type ExtractedDocument = {
|
|
|
73
73
|
* answer, and a log line does not reach them.
|
|
74
74
|
*/
|
|
75
75
|
readonly warnings: readonly string[];
|
|
76
|
+
/**
|
|
77
|
+
* YAML front matter, when the source had a leading `---` block — REQ-050 (#209), task #220.
|
|
78
|
+
*
|
|
79
|
+
* **Scalar keys only, and deliberately not a YAML parser.** A nested mapping, a list of mappings or a flow
|
|
80
|
+
* collection is reported in `warnings` and otherwise dropped, because a half-correct parse of provenance
|
|
81
|
+
* metadata is worse than none: `generated: { by: x, at: y }` silently read as the string `{ by: x, at: y }`
|
|
82
|
+
* would be recorded as if it had been understood.
|
|
83
|
+
*
|
|
84
|
+
* It exists because the alternative was worse. Front matter used to reach the block stream as *content*: a
|
|
85
|
+
* document's `sidebar_position` and `type` became a paragraph, got chunked, embedded, and could be returned as
|
|
86
|
+
* a retrieval hit and cited. #220 found it while reading the Open Knowledge Format — whose concept files carry
|
|
87
|
+
* far more metadata than ours — and it was already happening to this repository's own documentation site.
|
|
88
|
+
*/
|
|
89
|
+
readonly frontMatter?: Readonly<Record<string, string>>;
|
|
76
90
|
/**
|
|
77
91
|
* How confident the extraction is, 0–1 (#132).
|
|
78
92
|
*
|
|
@@ -30,6 +30,22 @@ export type BlockBuilder = ReturnType<typeof createBlockBuilder>;
|
|
|
30
30
|
* Plain text has no headings or tables, so running it through the same parser costs nothing and means one
|
|
31
31
|
* code path instead of two that differ in how they split paragraphs.
|
|
32
32
|
*/
|
|
33
|
+
/**
|
|
34
|
+
* A leading `---` block, split off before anything else reads the document — task #220.
|
|
35
|
+
*
|
|
36
|
+
* Returns the remaining lines and the scalar keys, and **names what it could not read** rather than guessing.
|
|
37
|
+
* Front matter is metadata about a document, not part of it: left in the stream it becomes a paragraph, gets
|
|
38
|
+
* chunked and embedded, and can be returned as a retrieval hit — so a question about revenue policy can be
|
|
39
|
+
* answered with a block of YAML.
|
|
40
|
+
*
|
|
41
|
+
* Scalar keys only. `generated: { by: x, at: y }` read as the *string* `{ by: x, at: y }` would be provenance
|
|
42
|
+
* recorded as if it had been understood, which is worse than a warning saying it was skipped.
|
|
43
|
+
*/
|
|
44
|
+
export declare const splitFrontMatter: (lines: readonly string[]) => {
|
|
45
|
+
readonly body: readonly string[];
|
|
46
|
+
readonly fields: Record<string, string>;
|
|
47
|
+
readonly warnings: readonly string[];
|
|
48
|
+
};
|
|
33
49
|
export declare const parseMarkdown: (bytes: Uint8Array, limits: ExtractionLimits) => ExtractedDocument;
|
|
34
50
|
/**
|
|
35
51
|
* A CSV row splitter that understands quotes.
|
|
@@ -96,9 +96,56 @@ const isPipeDivider = (line) => /^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s
|
|
|
96
96
|
* Plain text has no headings or tables, so running it through the same parser costs nothing and means one
|
|
97
97
|
* code path instead of two that differ in how they split paragraphs.
|
|
98
98
|
*/
|
|
99
|
+
/**
|
|
100
|
+
* A leading `---` block, split off before anything else reads the document — task #220.
|
|
101
|
+
*
|
|
102
|
+
* Returns the remaining lines and the scalar keys, and **names what it could not read** rather than guessing.
|
|
103
|
+
* Front matter is metadata about a document, not part of it: left in the stream it becomes a paragraph, gets
|
|
104
|
+
* chunked and embedded, and can be returned as a retrieval hit — so a question about revenue policy can be
|
|
105
|
+
* answered with a block of YAML.
|
|
106
|
+
*
|
|
107
|
+
* Scalar keys only. `generated: { by: x, at: y }` read as the *string* `{ by: x, at: y }` would be provenance
|
|
108
|
+
* recorded as if it had been understood, which is worse than a warning saying it was skipped.
|
|
109
|
+
*/
|
|
110
|
+
export const splitFrontMatter = (lines) => {
|
|
111
|
+
if ((lines[0] ?? "").trim() !== "---")
|
|
112
|
+
return { body: lines, fields: {}, warnings: [] };
|
|
113
|
+
const end = lines.findIndex((line, at) => at > 0 && line.trim() === "---");
|
|
114
|
+
// No closing fence: a document that happens to start with a horizontal rule, not front matter.
|
|
115
|
+
if (end === -1)
|
|
116
|
+
return { body: lines, fields: {}, warnings: [] };
|
|
117
|
+
const fields = {};
|
|
118
|
+
const skipped = [];
|
|
119
|
+
for (const line of lines.slice(1, end)) {
|
|
120
|
+
if (line.trim() === "" || line.trimStart().startsWith("#"))
|
|
121
|
+
continue;
|
|
122
|
+
// An indented line or a list item belongs to a structure this does not read.
|
|
123
|
+
if (/^\s/.test(line) || line.trimStart().startsWith("- "))
|
|
124
|
+
continue;
|
|
125
|
+
const match = /^([A-Za-z_][\w.-]*)\s*:\s*(.*)$/.exec(line);
|
|
126
|
+
if (match === null)
|
|
127
|
+
continue;
|
|
128
|
+
const [, key, raw] = match;
|
|
129
|
+
const value = (raw ?? "").trim();
|
|
130
|
+
// A flow collection or the start of a block one: named as skipped, never half-read.
|
|
131
|
+
if (value === "" || value.startsWith("{") || value.startsWith("[")) {
|
|
132
|
+
skipped.push(key);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
fields[key] = value.replace(/^["']|["']$/g, "");
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
body: lines.slice(end + 1),
|
|
139
|
+
fields,
|
|
140
|
+
warnings: skipped.length === 0
|
|
141
|
+
? []
|
|
142
|
+
: [`front matter key(s) not read because they are not scalars: ${skipped.join(", ")}`],
|
|
143
|
+
};
|
|
144
|
+
};
|
|
99
145
|
export const parseMarkdown = (bytes, limits) => {
|
|
100
146
|
const builder = createBlockBuilder(limits);
|
|
101
|
-
const
|
|
147
|
+
const matter = splitFrontMatter(decode(bytes).split(/\r?\n/));
|
|
148
|
+
const lines = matter.body;
|
|
102
149
|
let paragraph = [];
|
|
103
150
|
const flushParagraph = () => {
|
|
104
151
|
if (paragraph.length === 0)
|
|
@@ -176,7 +223,12 @@ export const parseMarkdown = (bytes, limits) => {
|
|
|
176
223
|
}
|
|
177
224
|
flushParagraph();
|
|
178
225
|
flushList();
|
|
179
|
-
|
|
226
|
+
const parsed = builder.done();
|
|
227
|
+
return {
|
|
228
|
+
...parsed,
|
|
229
|
+
...(Object.keys(matter.fields).length === 0 ? {} : { frontMatter: matter.fields }),
|
|
230
|
+
warnings: [...parsed.warnings, ...matter.warnings],
|
|
231
|
+
};
|
|
180
232
|
};
|
|
181
233
|
/**
|
|
182
234
|
* A CSV row splitter that understands quotes.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/connections` — a tenant's links to third-party providers, and the cipher that protects
|
|
3
|
+
* them (#261).
|
|
4
|
+
*
|
|
5
|
+
* Its own subpath rather than part of `./tools`, because the two have different readers: a toolkit author needs
|
|
6
|
+
* `credentialRef` and `Credential`, and a *deployment* needs the store, the cipher and the resolver that
|
|
7
|
+
* connects them. Nothing here is needed to write a tool.
|
|
8
|
+
*/
|
|
9
|
+
export * from "../connections/index.js";
|
|
10
|
+
//# sourceMappingURL=connections.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/connections` — a tenant's links to third-party providers, and the cipher that protects
|
|
3
|
+
* them (#261).
|
|
4
|
+
*
|
|
5
|
+
* Its own subpath rather than part of `./tools`, because the two have different readers: a toolkit author needs
|
|
6
|
+
* `credentialRef` and `Credential`, and a *deployment* needs the store, the cipher and the resolver that
|
|
7
|
+
* connects them. Nothing here is needed to write a tool.
|
|
8
|
+
*/
|
|
9
|
+
export * from "../connections/index.js";
|
|
10
|
+
//# sourceMappingURL=connections.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/guardrails` — checks a deployment adds, and the contract they satisfy.
|
|
3
|
+
*
|
|
4
|
+
* Its own subpath rather than part of `./hitl`, though both stop a run. The distinction is who decides: a
|
|
5
|
+
* guardrail is an automated inspection whose verdict is final, and HITL is a person being asked. Putting them
|
|
6
|
+
* together would invite a host to treat a refusal as something a human could override, which is precisely what a
|
|
7
|
+
* guardrail must not be.
|
|
8
|
+
*
|
|
9
|
+
* Nothing here imports a provider or a store, so declaring the capability costs a consumer no dependency.
|
|
10
|
+
*/
|
|
11
|
+
export * from "../guardrails/index.js";
|
|
12
|
+
export * from "../guardrails/pii.js";
|
|
13
|
+
export * from "../guardrails/moderation.js";
|
|
14
|
+
//# sourceMappingURL=guardrails.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/guardrails` — checks a deployment adds, and the contract they satisfy.
|
|
3
|
+
*
|
|
4
|
+
* Its own subpath rather than part of `./hitl`, though both stop a run. The distinction is who decides: a
|
|
5
|
+
* guardrail is an automated inspection whose verdict is final, and HITL is a person being asked. Putting them
|
|
6
|
+
* together would invite a host to treat a refusal as something a human could override, which is precisely what a
|
|
7
|
+
* guardrail must not be.
|
|
8
|
+
*
|
|
9
|
+
* Nothing here imports a provider or a store, so declaring the capability costs a consumer no dependency.
|
|
10
|
+
*/
|
|
11
|
+
export * from "../guardrails/index.js";
|
|
12
|
+
export * from "../guardrails/pii.js";
|
|
13
|
+
export * from "../guardrails/moderation.js";
|
|
14
|
+
//# sourceMappingURL=guardrails.js.map
|
|
@@ -15,4 +15,21 @@ export * from "../artifacts/index.js";
|
|
|
15
15
|
export * from "../export/index.js";
|
|
16
16
|
export * from "../export/pdf.js";
|
|
17
17
|
export * from "../export/markdown.js";
|
|
18
|
+
/**
|
|
19
|
+
* The one embedding adapter — REQ-050 (#209), task #219.
|
|
20
|
+
*
|
|
21
|
+
* Here rather than behind an `adapters/*` subpath because it carries no driver: it is a `fetch` to an
|
|
22
|
+
* OpenAI-shaped endpoint, so it adds nothing to a consumer's install. The Postgres and Redis adapters have their
|
|
23
|
+
* own subpaths because they each pull a client library in.
|
|
24
|
+
*/
|
|
25
|
+
export { DEFAULT_EMBEDDING_BATCH, DEFAULT_EMBEDDING_MODEL, createOpenAiEmbeddings } from "../adapters/embeddings/openai.js";
|
|
26
|
+
export type { OpenAiEmbeddingsConfig } from "../adapters/embeddings/openai.js";
|
|
27
|
+
/**
|
|
28
|
+
* The extraction prompt, exported so a harness can use the same one the runtime does — task #275.
|
|
29
|
+
*
|
|
30
|
+
* `extractGraph` itself is not exported here: it takes a `LanguageModel` from the AI SDK, and a consumer that
|
|
31
|
+
* wanted it would be pulling a provider package through the knowledge entrypoint. The prompt is the part worth
|
|
32
|
+
* sharing — a measurement run against a *different* prompt is measuring a different system.
|
|
33
|
+
*/
|
|
34
|
+
export { DEFAULT_EXTRACTION_PROMPT } from "../models/extraction.js";
|
|
18
35
|
//# sourceMappingURL=knowledge.d.ts.map
|
|
@@ -16,4 +16,20 @@ export * from "../artifacts/index.js";
|
|
|
16
16
|
export * from "../export/index.js";
|
|
17
17
|
export * from "../export/pdf.js";
|
|
18
18
|
export * from "../export/markdown.js";
|
|
19
|
+
/**
|
|
20
|
+
* The one embedding adapter — REQ-050 (#209), task #219.
|
|
21
|
+
*
|
|
22
|
+
* Here rather than behind an `adapters/*` subpath because it carries no driver: it is a `fetch` to an
|
|
23
|
+
* OpenAI-shaped endpoint, so it adds nothing to a consumer's install. The Postgres and Redis adapters have their
|
|
24
|
+
* own subpaths because they each pull a client library in.
|
|
25
|
+
*/
|
|
26
|
+
export { DEFAULT_EMBEDDING_BATCH, DEFAULT_EMBEDDING_MODEL, createOpenAiEmbeddings } from "../adapters/embeddings/openai.js";
|
|
27
|
+
/**
|
|
28
|
+
* The extraction prompt, exported so a harness can use the same one the runtime does — task #275.
|
|
29
|
+
*
|
|
30
|
+
* `extractGraph` itself is not exported here: it takes a `LanguageModel` from the AI SDK, and a consumer that
|
|
31
|
+
* wanted it would be pulling a provider package through the knowledge entrypoint. The prompt is the part worth
|
|
32
|
+
* sharing — a measurement run against a *different* prompt is measuring a different system.
|
|
33
|
+
*/
|
|
34
|
+
export { DEFAULT_EXTRACTION_PROMPT } from "../models/extraction.js";
|
|
19
35
|
//# sourceMappingURL=knowledge.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/mcp-server` — expose this deployment's tools to MCP clients (#250).
|
|
3
|
+
*
|
|
4
|
+
* Its own subpath, and separate from `./mcp`, because the two are opposite directions: `./mcp` consumes a
|
|
5
|
+
* tenant's MCP servers, and this **is** one. Sharing an entry would put the SDK's server half in the way of
|
|
6
|
+
* every consumer who only wanted the client half.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../mcp-server/index.js";
|
|
9
|
+
//# sourceMappingURL=mcp-server.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/mcp-server` — expose this deployment's tools to MCP clients (#250).
|
|
3
|
+
*
|
|
4
|
+
* Its own subpath, and separate from `./mcp`, because the two are opposite directions: `./mcp` consumes a
|
|
5
|
+
* tenant's MCP servers, and this **is** one. Sharing an entry would put the SDK's server half in the way of
|
|
6
|
+
* every consumer who only wanted the client half.
|
|
7
|
+
*/
|
|
8
|
+
export * from "../mcp-server/index.js";
|
|
9
|
+
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -10,4 +10,14 @@ export * from "../models/index.js";
|
|
|
10
10
|
export * from "../capabilities/index.js";
|
|
11
11
|
export * from "../capabilities/runtime.js";
|
|
12
12
|
export * from "../core/index.js";
|
|
13
|
+
/**
|
|
14
|
+
* The audio ports and their OpenAI adapters — REQ-062 (#257).
|
|
15
|
+
*
|
|
16
|
+
* Here rather than in `tools`, because a `TranscriptionProvider` is a runtime capability a host wires once —
|
|
17
|
+
* the same place a `SearchProvider` is chosen. The two tools that use them live in the tool library.
|
|
18
|
+
*/
|
|
19
|
+
export { assertWithinBounds, AUDIO_MEDIA_TYPES, AudioRejected, boundTranscript, describeAudioFailure, isAudioMediaType, MAX_AUDIO_BYTES, MAX_AUDIO_SECONDS, MAX_SPEECH_CHARS, MAX_TRANSCRIPT_CHARS, } from "../audio/index.js";
|
|
20
|
+
export type { AudioBounds, AudioMediaType, SpeechProvider, SpeechRequest, SpeechResult, TranscriptionProvider, TranscriptionRequest, TranscriptionResult, } from "../audio/index.js";
|
|
21
|
+
export { openAiSpeech, openAiTranscription } from "../adapters/audio/openai.js";
|
|
22
|
+
export type { OpenAiAudioConfig } from "../adapters/audio/openai.js";
|
|
13
23
|
//# sourceMappingURL=runtime.d.ts.map
|
package/dist/entries/runtime.js
CHANGED
|
@@ -10,4 +10,12 @@ export * from "../models/index.js";
|
|
|
10
10
|
export * from "../capabilities/index.js";
|
|
11
11
|
export * from "../capabilities/runtime.js";
|
|
12
12
|
export * from "../core/index.js";
|
|
13
|
+
/**
|
|
14
|
+
* The audio ports and their OpenAI adapters — REQ-062 (#257).
|
|
15
|
+
*
|
|
16
|
+
* Here rather than in `tools`, because a `TranscriptionProvider` is a runtime capability a host wires once —
|
|
17
|
+
* the same place a `SearchProvider` is chosen. The two tools that use them live in the tool library.
|
|
18
|
+
*/
|
|
19
|
+
export { assertWithinBounds, AUDIO_MEDIA_TYPES, AudioRejected, boundTranscript, describeAudioFailure, isAudioMediaType, MAX_AUDIO_BYTES, MAX_AUDIO_SECONDS, MAX_SPEECH_CHARS, MAX_TRANSCRIPT_CHARS, } from "../audio/index.js";
|
|
20
|
+
export { openAiSpeech, openAiTranscription } from "../adapters/audio/openai.js";
|
|
13
21
|
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/testing` — the conformance suite and the fakes — task #253.
|
|
3
|
+
*
|
|
4
|
+
* The README's headline claim is *"Replaceable everything — 31 ports, three adapter families, one conformance
|
|
5
|
+
* suite held over all of them."* A consumer who took that invitation and wrote a fourth adapter family could not
|
|
6
|
+
* run the suite: it lived in `src/testing/`, which the build excluded and no export reached. The most valuable
|
|
7
|
+
* thing in the repository for anyone doing that was the one thing they could not have.
|
|
8
|
+
*
|
|
9
|
+
* ## Two audiences, one entry
|
|
10
|
+
*
|
|
11
|
+
* - **Implementing a port.** `<port>Conformance` runs the same contract tests the built-in families are held to.
|
|
12
|
+
* That is what makes "replaceable" checkable rather than an invitation.
|
|
13
|
+
* - **Implementing an agent or a tool.** `createStubModel` and `createMemoryStores` are for a test that must not
|
|
14
|
+
* call a provider or stand up a database.
|
|
15
|
+
*
|
|
16
|
+
* ## Why the test runner is an optional peer
|
|
17
|
+
*
|
|
18
|
+
* The harnesses call `describe`/`it`/`expect` at module scope, so importing this pulls `vitest`. It is an
|
|
19
|
+
* **optional peer dependency**, not a dependency: a consumer who never imports this subpath never installs it,
|
|
20
|
+
* and nothing in a production bundle can reach it — the only paths to these modules are through this entry.
|
|
21
|
+
* `@electric-sql/pglite` is optional for the same reason, and only `pgliteExecutor` needs it.
|
|
22
|
+
*/
|
|
23
|
+
export * from "../testing/conformance/index.js";
|
|
24
|
+
export * from "../testing/stub-model.js";
|
|
25
|
+
export * from "../testing/memory-backend.js";
|
|
26
|
+
export * from "../testing/pglite.js";
|
|
27
|
+
export * from "../testing/conformance/audio.js";
|
|
28
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@retinue/agentkit/testing` — the conformance suite and the fakes — task #253.
|
|
3
|
+
*
|
|
4
|
+
* The README's headline claim is *"Replaceable everything — 31 ports, three adapter families, one conformance
|
|
5
|
+
* suite held over all of them."* A consumer who took that invitation and wrote a fourth adapter family could not
|
|
6
|
+
* run the suite: it lived in `src/testing/`, which the build excluded and no export reached. The most valuable
|
|
7
|
+
* thing in the repository for anyone doing that was the one thing they could not have.
|
|
8
|
+
*
|
|
9
|
+
* ## Two audiences, one entry
|
|
10
|
+
*
|
|
11
|
+
* - **Implementing a port.** `<port>Conformance` runs the same contract tests the built-in families are held to.
|
|
12
|
+
* That is what makes "replaceable" checkable rather than an invitation.
|
|
13
|
+
* - **Implementing an agent or a tool.** `createStubModel` and `createMemoryStores` are for a test that must not
|
|
14
|
+
* call a provider or stand up a database.
|
|
15
|
+
*
|
|
16
|
+
* ## Why the test runner is an optional peer
|
|
17
|
+
*
|
|
18
|
+
* The harnesses call `describe`/`it`/`expect` at module scope, so importing this pulls `vitest`. It is an
|
|
19
|
+
* **optional peer dependency**, not a dependency: a consumer who never imports this subpath never installs it,
|
|
20
|
+
* and nothing in a production bundle can reach it — the only paths to these modules are through this entry.
|
|
21
|
+
* `@electric-sql/pglite` is optional for the same reason, and only `pgliteExecutor` needs it.
|
|
22
|
+
*/
|
|
23
|
+
export * from "../testing/conformance/index.js";
|
|
24
|
+
export * from "../testing/stub-model.js";
|
|
25
|
+
export * from "../testing/memory-backend.js";
|
|
26
|
+
export * from "../testing/pglite.js";
|
|
27
|
+
export * from "../testing/conformance/audio.js";
|
|
28
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* shape and delegates to a service. No business logic lives in this layer.
|
|
6
6
|
*/
|
|
7
7
|
import type { ExecutionContext } from "../core/context.js";
|
|
8
|
-
import type { QuotaGuard } from "../usage/index.js";
|
|
8
|
+
import type { QuotaGuard, RateLimitGuard } from "../usage/index.js";
|
|
9
9
|
import type { UsageRollupStore } from "../persistence/index.js";
|
|
10
10
|
import type { ConversationId, RunId } from "../core/ids.js";
|
|
11
11
|
import type { ConversationStore, UsageStore } from "../persistence/index.js";
|
|
@@ -38,6 +38,8 @@ export type ResolverDeps = {
|
|
|
38
38
|
* that blocks nothing is a bill the rollups make visible.
|
|
39
39
|
*/
|
|
40
40
|
readonly quota?: QuotaGuard;
|
|
41
|
+
/** Capacity, as distinct from spend — task #248. Absent means unchecked. */
|
|
42
|
+
readonly rateLimit?: RateLimitGuard;
|
|
41
43
|
/**
|
|
42
44
|
* Rollups for the spend panel (#140).
|
|
43
45
|
*
|
|
@@ -76,6 +78,10 @@ export declare const createResolvers: (deps: ResolverDeps) => {
|
|
|
76
78
|
categories: string[];
|
|
77
79
|
excluded: string[];
|
|
78
80
|
}, ctx: GraphQLContext): Promise<import("../tools/registry.js").ToolCatalog>;
|
|
81
|
+
findTools(_: unknown, args: {
|
|
82
|
+
query: string;
|
|
83
|
+
limit?: number;
|
|
84
|
+
}, ctx: GraphQLContext): Promise<import("../tools/find.js").ToolSearchOutcome>;
|
|
79
85
|
usage(_: unknown, args: {
|
|
80
86
|
runId?: string;
|
|
81
87
|
}, ctx: GraphQLContext): Promise<import("../persistence/index.js").UsageTotals>;
|
|
@@ -75,6 +75,12 @@ export const createResolvers = (deps) => {
|
|
|
75
75
|
async toolCatalog(_, args, ctx) {
|
|
76
76
|
return deps.toolRegistry.catalog(ctx.execution, args);
|
|
77
77
|
},
|
|
78
|
+
async findTools(_, args, ctx) {
|
|
79
|
+
return deps.toolRegistry.find(ctx.execution, {
|
|
80
|
+
query: args.query,
|
|
81
|
+
...(args.limit === undefined ? {} : { limit: args.limit }),
|
|
82
|
+
});
|
|
83
|
+
},
|
|
78
84
|
async usage(_, args, ctx) {
|
|
79
85
|
return deps.usage.totals({ tenantId: tid(ctx), ...(args.runId ? { runId: asId(args.runId) } : {}) });
|
|
80
86
|
},
|
|
@@ -195,6 +201,20 @@ export const createResolvers = (deps) => {
|
|
|
195
201
|
//
|
|
196
202
|
// Optional, because a deployment with no limits configured is valid; when it is absent nothing is
|
|
197
203
|
// checked, which is the same as an unbounded limit.
|
|
204
|
+
/**
|
|
205
|
+
* Rate before cost — task #248.
|
|
206
|
+
*
|
|
207
|
+
* This order is deliberate. A rate check is one atomic counter increment; a quota check reads a rollup.
|
|
208
|
+
* A tenant hammering the platform should be turned away by the cheaper check, not made to do the more
|
|
209
|
+
* expensive one first — otherwise the defence against a runaway client is itself proportional to how
|
|
210
|
+
* hard the client is running.
|
|
211
|
+
*
|
|
212
|
+
* Optional like the quota, and absent means unchecked. See `createRateLimitGuard`: an absent policy or a
|
|
213
|
+
* `max` of zero is unlimited, so adding this feature cannot refuse a deployment that has configured
|
|
214
|
+
* nothing.
|
|
215
|
+
*/
|
|
216
|
+
if (deps.rateLimit !== undefined)
|
|
217
|
+
await deps.rateLimit.assertAdmitted(ctx.execution);
|
|
198
218
|
if (deps.quota !== undefined)
|
|
199
219
|
await deps.quota.assertAdmitted(ctx.execution);
|
|
200
220
|
const started = await startOrEnqueueRun(deps.coordinator, { tenantId: tid(ctx), conversationId, runId });
|
package/dist/graphql/schema.d.ts
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
* platform service. Subscriptions carry the stable `RunEvent` set and support resuming after a
|
|
8
8
|
* cursor via `openRunEventStream`.
|
|
9
9
|
*/
|
|
10
|
-
export declare const typeDefs = "\n scalar JSON\n scalar DateTime\n\n type Conversation {\n id: ID!\n title: String!\n version: Int!\n archivedAt: DateTime\n createdAt: DateTime!\n updatedAt: DateTime!\n }\n\n type ConversationPage {\n items: [Conversation!]!\n nextCursor: String\n }\n\n enum RunStatus {\n queued\n running\n waiting_for_question\n waiting_for_approval\n retry_pending\n completed\n failed\n cancelled\n }\n\n type Run {\n id: ID!\n \"Null for a run that belongs to no conversation \u2014 a triggered automation rather than a chat turn (#198).\"\n conversationId: ID\n status: RunStatus!\n createdAt: DateTime!\n finishedAt: DateTime\n }\n\n type ToolCatalogEntry {\n name: String!\n label: String!\n description: String!\n category: String!\n effect: String!\n }\n\n type ToolCatalog {\n preloaded: [JSON!]!\n discoverable: [ToolCatalogEntry!]!\n meta: [ToolCatalogEntry!]!\n }\n\n type UsageTotals {\n inputTokens: Int!\n outputTokens: Int!\n cachedInputTokens: Int!\n costMinorUnits: Int!\n eventCount: Int!\n }\n\n \"One period's consumption. #139's rollups, so a chart never scans raw records.\"\n type UsageBucket {\n bucketStart: String!\n totals: UsageTotals!\n currency: String!\n }\n\n \"Consumption grouped by model or conversation over the requested range.\"\n type UsageBreakdownEntry {\n key: String!\n totals: UsageTotals!\n }\n\n \"\"\"\n Where the tenant stands against its limit.\n\n Absent when no limit is configured \u2014 which means unbounded, not zero. A UI must show \"no limit set\"\n rather than a full bar.\n \"\"\"\n type UsageQuota {\n \"\"\"\n The window in words \u2014 \"the day\", \"any 5 hours\" (#181).\n\n period stayed for the calendar case and is **null** for a rolling window, because no RollupPeriod describes\n one and returning \"hour\" for a five-hour window would be a wrong answer rather than a missing one. A client\n rendering the window reads this field; one keying a chart by bucket reads period and correctly finds nothing\n to key by.\n \"\"\"\n window: String!\n period: String\n \"The model this limit covers, or null for any model (#182).\"\n modelId: String\n costLimitMinorUnits: Int\n inputTokenLimit: Int\n outputTokenLimit: Int\n \"The fraction of the limit at which a warning shows. Sent so the UI cannot disagree with the server.\"\n warnAt: Float!\n \"True once any dimension is past warnAt and still admitted.\"\n warning: Boolean!\n \"True once any dimension has reached its limit, so work is being refused.\"\n exceeded: Boolean!\n }\n\n \"\"\"\n The usage report a spend panel renders.\n\n One query rather than several, so a panel cannot show a total from one moment and a breakdown from another.\n \"\"\"\n type UsageReport {\n period: String!\n from: String!\n to: String!\n totals: UsageTotals!\n buckets: [UsageBucket!]!\n byModel: [UsageBreakdownEntry!]!\n byConversation: [UsageBreakdownEntry!]!\n quota: UsageQuota\n currency: String!\n }\n\n \"A single transport event; payload carries the typed part / lifecycle detail.\"\n type RunEvent {\n type: String!\n runId: ID!\n sequence: Int!\n occurredAt: DateTime!\n payload: JSON!\n }\n\n \"\"\"\n One question put to a person, as it must be *rendered* \u2014 #163.\n\n The event that suspends a run carries only an interactionId, deliberately: events are thin, and a payload\n that duplicated the question would be a second copy to keep in step with the stored one. But nothing exposed\n the stored one either, so a client could answer a question it had no way to display. The example's picker\n rendered an empty text box next to \"The assistant has a question\", which is the whole gap in one screenshot.\n \"\"\"\n type PendingQuestionSpec {\n \"Stable key the answer is filed under.\"\n key: String!\n prompt: String!\n \"A short closed list, when there is one. Empty means free text.\"\n options: [String!]!\n \"Several choices are allowed, not one.\"\n multiple: Boolean!\n \"Free text is accepted alongside the options.\"\n allowOther: Boolean!\n }\n\n type PendingQuestion {\n interactionId: ID!\n runId: ID!\n questions: [PendingQuestionSpec!]!\n createdAt: DateTime!\n }\n\n \"\"\"\n The approval a run is parked on \u2014 the read side of decideApproval (#163).\n\n The same gap as pendingQuestion and milder rather than absent: approval.requested also carries only an\n interaction id, so a client had no summary to show and fell back to a generic \"Run a tool?\". Asking someone\n to authorise an action the card cannot name is how approval becomes a reflex.\n \"\"\"\n type PendingApprovalDetail {\n interactionId: ID!\n runId: ID!\n toolName: String!\n \"One line a person can decide on, written by the host's summarizer.\"\n summary: String!\n riskCategory: String!\n expiresAt: DateTime!\n \"The arguments the approval is for, so what runs is what was shown.\"\n normalizedInput: JSON!\n }\n\n input QuestionAnswerInput {\n interactionId: ID!\n runId: ID!\n answers: JSON!\n }\n\n input ApprovalDecisionInput {\n interactionId: ID!\n runId: ID!\n decision: String!\n }\n\n \"A section that shaped a turn's prompt \u2014 for the context inspector (#39).\"\n type InspectedSection {\n title: String!\n providerId: String!\n kind: String!\n provenance: String!\n estimatedTokens: Int!\n sensitivity: String!\n included: Boolean!\n prunedReason: String\n }\n\n type ContextInspection {\n sections: [InspectedSection!]!\n totalTokens: Int!\n budget: JSON!\n }\n\n type Query {\n conversations(limit: Int!, cursor: String): ConversationPage!\n conversation(id: ID!): Conversation\n run(id: ID!): Run\n toolCatalog(preloaded: [String!]!, categories: [String!]!, excluded: [String!]!): ToolCatalog!\n usage(runId: ID): UsageTotals!\n \"\"\"\n Consumption and cost by period, with breakdowns and quota state (#140).\n\n An extension of the usage query rather than a second endpoint: a panel showing a total from one query and a\n breakdown from another can show two moments at once, and the discrepancy looks like a bug in the numbers.\n \"\"\"\n usageReport(period: String!, from: String!, to: String!, breakdownLimit: Int): UsageReport!\n \"What context shaped a turn \u2014 attributes memory/tools/history that influenced the prompt.\"\n conversationContext(conversationId: ID!, runId: ID): ContextInspection\n \"\"\"\n The question a run is parked on, or null \u2014 the read side of answerQuestion (#163).\n\n Null covers both \"this run was never asked anything\" and \"it has been answered already\", because a client\n has the same thing to do in either case: show no picker. A run that is waiting is the only state with a\n question to render.\n \"\"\"\n pendingQuestion(runId: ID!): PendingQuestion\n \"The approval a run is parked on, or null (#163).\"\n pendingApproval(runId: ID!): PendingApprovalDetail\n }\n\n type Mutation {\n createConversation(id: ID!, title: String!): Conversation!\n renameConversation(id: ID!, expectedVersion: Int!, title: String!): Conversation!\n archiveConversation(id: ID!, expectedVersion: Int!): Conversation!\n deleteConversation(id: ID!): Boolean!\n sendMessage(conversationId: ID!, runId: ID!): Run!\n cancelRun(runId: ID!): Boolean!\n answerQuestion(input: QuestionAnswerInput!): Boolean!\n decideApproval(input: ApprovalDecisionInput!): Boolean!\n }\n\n type Subscription {\n \"Conversation/run events, resumable after a cursor (sequence).\"\n runEvents(runId: ID!, conversationId: ID!, after: Int): RunEvent!\n }\n";
|
|
10
|
+
export declare const typeDefs = "\n scalar JSON\n scalar DateTime\n\n type Conversation {\n id: ID!\n title: String!\n version: Int!\n archivedAt: DateTime\n createdAt: DateTime!\n updatedAt: DateTime!\n }\n\n type ConversationPage {\n items: [Conversation!]!\n nextCursor: String\n }\n\n enum RunStatus {\n queued\n running\n waiting_for_question\n waiting_for_approval\n retry_pending\n completed\n failed\n cancelled\n }\n\n type Run {\n id: ID!\n \"Null for a run that belongs to no conversation \u2014 a triggered automation rather than a chat turn (#198).\"\n conversationId: ID\n status: RunStatus!\n createdAt: DateTime!\n finishedAt: DateTime\n }\n\n type ToolCatalogEntry {\n name: String!\n label: String!\n description: String!\n category: String!\n effect: String!\n }\n\n \"\"\"\n What was withheld from a catalogue, and why \u2014 REQ-045 (#204), task #210.\n\n Present only when a budget bound. A client rendering a shortened list with nothing saying it was shortened\n is the same invisible failure the run event exists to prevent, one layer out.\n \"\"\"\n type ToolCatalogTruncation {\n budgetTokens: Int!\n residentTokens: Int!\n dropped: [String!]!\n \"Whether find_tools is wired, which is the difference between a deferral and a removal.\"\n findable: Boolean!\n \"True when the protected set alone exceeds the budget: a misconfiguration, not the mechanism working.\"\n overBudget: Boolean!\n }\n\n \"The tenant's category switches as they were applied \u2014 task #210, AC-4.\"\n type TenantToolset {\n enabledCategories: [String!]\n disabledCategories: [String!]\n }\n\n type ToolCatalog {\n preloaded: [JSON!]!\n discoverable: [ToolCatalogEntry!]!\n meta: [ToolCatalogEntry!]!\n truncation: ToolCatalogTruncation\n toolset: TenantToolset\n }\n\n \"A tool found by describing a need \u2014 task #210, AC-1. Filtered by the same authorization as discovery.\"\n type ToolSearchHit {\n entry: ToolCatalogEntry!\n score: Float!\n signals: [String!]!\n }\n\n type ToolSearchResult {\n hits: [ToolSearchHit!]!\n \"The signals actually used. Keyword-only when no embedding provider is wired.\"\n modes: [String!]!\n }\n\n type UsageTotals {\n inputTokens: Int!\n outputTokens: Int!\n cachedInputTokens: Int!\n costMinorUnits: Int!\n eventCount: Int!\n }\n\n \"One period's consumption. #139's rollups, so a chart never scans raw records.\"\n type UsageBucket {\n bucketStart: String!\n totals: UsageTotals!\n currency: String!\n }\n\n \"Consumption grouped by model or conversation over the requested range.\"\n type UsageBreakdownEntry {\n key: String!\n totals: UsageTotals!\n }\n\n \"\"\"\n Where the tenant stands against its limit.\n\n Absent when no limit is configured \u2014 which means unbounded, not zero. A UI must show \"no limit set\"\n rather than a full bar.\n \"\"\"\n type UsageQuota {\n \"\"\"\n The window in words \u2014 \"the day\", \"any 5 hours\" (#181).\n\n period stayed for the calendar case and is **null** for a rolling window, because no RollupPeriod describes\n one and returning \"hour\" for a five-hour window would be a wrong answer rather than a missing one. A client\n rendering the window reads this field; one keying a chart by bucket reads period and correctly finds nothing\n to key by.\n \"\"\"\n window: String!\n period: String\n \"The model this limit covers, or null for any model (#182).\"\n modelId: String\n costLimitMinorUnits: Int\n inputTokenLimit: Int\n outputTokenLimit: Int\n \"The fraction of the limit at which a warning shows. Sent so the UI cannot disagree with the server.\"\n warnAt: Float!\n \"True once any dimension is past warnAt and still admitted.\"\n warning: Boolean!\n \"True once any dimension has reached its limit, so work is being refused.\"\n exceeded: Boolean!\n }\n\n \"\"\"\n The usage report a spend panel renders.\n\n One query rather than several, so a panel cannot show a total from one moment and a breakdown from another.\n \"\"\"\n type UsageReport {\n period: String!\n from: String!\n to: String!\n totals: UsageTotals!\n buckets: [UsageBucket!]!\n byModel: [UsageBreakdownEntry!]!\n byConversation: [UsageBreakdownEntry!]!\n quota: UsageQuota\n currency: String!\n }\n\n \"A single transport event; payload carries the typed part / lifecycle detail.\"\n type RunEvent {\n type: String!\n runId: ID!\n sequence: Int!\n occurredAt: DateTime!\n payload: JSON!\n }\n\n \"\"\"\n One question put to a person, as it must be *rendered* \u2014 #163.\n\n The event that suspends a run carries only an interactionId, deliberately: events are thin, and a payload\n that duplicated the question would be a second copy to keep in step with the stored one. But nothing exposed\n the stored one either, so a client could answer a question it had no way to display. The example's picker\n rendered an empty text box next to \"The assistant has a question\", which is the whole gap in one screenshot.\n \"\"\"\n type PendingQuestionSpec {\n \"Stable key the answer is filed under.\"\n key: String!\n prompt: String!\n \"A short closed list, when there is one. Empty means free text.\"\n options: [String!]!\n \"Several choices are allowed, not one.\"\n multiple: Boolean!\n \"Free text is accepted alongside the options.\"\n allowOther: Boolean!\n }\n\n type PendingQuestion {\n interactionId: ID!\n runId: ID!\n questions: [PendingQuestionSpec!]!\n createdAt: DateTime!\n }\n\n \"\"\"\n The approval a run is parked on \u2014 the read side of decideApproval (#163).\n\n The same gap as pendingQuestion and milder rather than absent: approval.requested also carries only an\n interaction id, so a client had no summary to show and fell back to a generic \"Run a tool?\". Asking someone\n to authorise an action the card cannot name is how approval becomes a reflex.\n \"\"\"\n type PendingApprovalDetail {\n interactionId: ID!\n runId: ID!\n toolName: String!\n \"One line a person can decide on, written by the host's summarizer.\"\n summary: String!\n riskCategory: String!\n expiresAt: DateTime!\n \"The arguments the approval is for, so what runs is what was shown.\"\n normalizedInput: JSON!\n }\n\n input QuestionAnswerInput {\n interactionId: ID!\n runId: ID!\n answers: JSON!\n }\n\n input ApprovalDecisionInput {\n interactionId: ID!\n runId: ID!\n decision: String!\n }\n\n \"A section that shaped a turn's prompt \u2014 for the context inspector (#39).\"\n type InspectedSection {\n title: String!\n providerId: String!\n kind: String!\n provenance: String!\n estimatedTokens: Int!\n sensitivity: String!\n included: Boolean!\n prunedReason: String\n }\n\n type ContextInspection {\n sections: [InspectedSection!]!\n totalTokens: Int!\n budget: JSON!\n }\n\n type Query {\n conversations(limit: Int!, cursor: String): ConversationPage!\n conversation(id: ID!): Conversation\n run(id: ID!): Run\n toolCatalog(preloaded: [String!]!, categories: [String!]!, excluded: [String!]!): ToolCatalog!\n \"\"\"\n Search the catalogue by describing what you need \u2014 task #210, AC-1.\n\n Returns nothing at all when no search is configured, rather than failing: a client asking for a capability\n the deployment did not wire should render an empty result, not an error dialog.\n \"\"\"\n findTools(query: String!, limit: Int): ToolSearchResult!\n usage(runId: ID): UsageTotals!\n \"\"\"\n Consumption and cost by period, with breakdowns and quota state (#140).\n\n An extension of the usage query rather than a second endpoint: a panel showing a total from one query and a\n breakdown from another can show two moments at once, and the discrepancy looks like a bug in the numbers.\n \"\"\"\n usageReport(period: String!, from: String!, to: String!, breakdownLimit: Int): UsageReport!\n \"What context shaped a turn \u2014 attributes memory/tools/history that influenced the prompt.\"\n conversationContext(conversationId: ID!, runId: ID): ContextInspection\n \"\"\"\n The question a run is parked on, or null \u2014 the read side of answerQuestion (#163).\n\n Null covers both \"this run was never asked anything\" and \"it has been answered already\", because a client\n has the same thing to do in either case: show no picker. A run that is waiting is the only state with a\n question to render.\n \"\"\"\n pendingQuestion(runId: ID!): PendingQuestion\n \"The approval a run is parked on, or null (#163).\"\n pendingApproval(runId: ID!): PendingApprovalDetail\n }\n\n type Mutation {\n createConversation(id: ID!, title: String!): Conversation!\n renameConversation(id: ID!, expectedVersion: Int!, title: String!): Conversation!\n archiveConversation(id: ID!, expectedVersion: Int!): Conversation!\n deleteConversation(id: ID!): Boolean!\n sendMessage(conversationId: ID!, runId: ID!): Run!\n cancelRun(runId: ID!): Boolean!\n answerQuestion(input: QuestionAnswerInput!): Boolean!\n decideApproval(input: ApprovalDecisionInput!): Boolean!\n }\n\n type Subscription {\n \"Conversation/run events, resumable after a cursor (sequence).\"\n runEvents(runId: ID!, conversationId: ID!, after: Int): RunEvent!\n }\n";
|
|
11
11
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/graphql/schema.js
CHANGED
|
@@ -53,10 +53,47 @@ export const typeDefs = /* GraphQL */ `
|
|
|
53
53
|
effect: String!
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
"""
|
|
57
|
+
What was withheld from a catalogue, and why — REQ-045 (#204), task #210.
|
|
58
|
+
|
|
59
|
+
Present only when a budget bound. A client rendering a shortened list with nothing saying it was shortened
|
|
60
|
+
is the same invisible failure the run event exists to prevent, one layer out.
|
|
61
|
+
"""
|
|
62
|
+
type ToolCatalogTruncation {
|
|
63
|
+
budgetTokens: Int!
|
|
64
|
+
residentTokens: Int!
|
|
65
|
+
dropped: [String!]!
|
|
66
|
+
"Whether find_tools is wired, which is the difference between a deferral and a removal."
|
|
67
|
+
findable: Boolean!
|
|
68
|
+
"True when the protected set alone exceeds the budget: a misconfiguration, not the mechanism working."
|
|
69
|
+
overBudget: Boolean!
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
"The tenant's category switches as they were applied — task #210, AC-4."
|
|
73
|
+
type TenantToolset {
|
|
74
|
+
enabledCategories: [String!]
|
|
75
|
+
disabledCategories: [String!]
|
|
76
|
+
}
|
|
77
|
+
|
|
56
78
|
type ToolCatalog {
|
|
57
79
|
preloaded: [JSON!]!
|
|
58
80
|
discoverable: [ToolCatalogEntry!]!
|
|
59
81
|
meta: [ToolCatalogEntry!]!
|
|
82
|
+
truncation: ToolCatalogTruncation
|
|
83
|
+
toolset: TenantToolset
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
"A tool found by describing a need — task #210, AC-1. Filtered by the same authorization as discovery."
|
|
87
|
+
type ToolSearchHit {
|
|
88
|
+
entry: ToolCatalogEntry!
|
|
89
|
+
score: Float!
|
|
90
|
+
signals: [String!]!
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
type ToolSearchResult {
|
|
94
|
+
hits: [ToolSearchHit!]!
|
|
95
|
+
"The signals actually used. Keyword-only when no embedding provider is wired."
|
|
96
|
+
modes: [String!]!
|
|
60
97
|
}
|
|
61
98
|
|
|
62
99
|
type UsageTotals {
|
|
@@ -217,6 +254,13 @@ export const typeDefs = /* GraphQL */ `
|
|
|
217
254
|
conversation(id: ID!): Conversation
|
|
218
255
|
run(id: ID!): Run
|
|
219
256
|
toolCatalog(preloaded: [String!]!, categories: [String!]!, excluded: [String!]!): ToolCatalog!
|
|
257
|
+
"""
|
|
258
|
+
Search the catalogue by describing what you need — task #210, AC-1.
|
|
259
|
+
|
|
260
|
+
Returns nothing at all when no search is configured, rather than failing: a client asking for a capability
|
|
261
|
+
the deployment did not wire should render an empty result, not an error dialog.
|
|
262
|
+
"""
|
|
263
|
+
findTools(query: String!, limit: Int): ToolSearchResult!
|
|
220
264
|
usage(runId: ID): UsageTotals!
|
|
221
265
|
"""
|
|
222
266
|
Consumption and cost by period, with breakdowns and quota state (#140).
|