@kindgi/agents 0.1.2 → 0.1.4-rc.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/dist/blocks.d.ts +101 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +149 -0
- package/dist/blocks.js.map +1 -0
- package/dist/conversation-binding.d.ts +9 -1
- package/dist/conversation-binding.d.ts.map +1 -1
- package/dist/define.d.ts +17 -2
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +93 -6
- package/dist/define.js.map +1 -1
- package/dist/guardrails-gate.d.ts +7 -4
- package/dist/guardrails-gate.d.ts.map +1 -1
- package/dist/guardrails-gate.js +5 -2
- package/dist/guardrails-gate.js.map +1 -1
- package/dist/handlers/compose-result.d.ts.map +1 -1
- package/dist/handlers/compose-result.js +3 -0
- package/dist/handlers/compose-result.js.map +1 -1
- package/dist/handlers/context.d.ts +24 -0
- package/dist/handlers/context.d.ts.map +1 -1
- package/dist/handlers/dispatch-tools.d.ts.map +1 -1
- package/dist/handlers/dispatch-tools.js +69 -43
- package/dist/handlers/dispatch-tools.js.map +1 -1
- package/dist/handlers/errors.d.ts +12 -1
- package/dist/handlers/errors.d.ts.map +1 -1
- package/dist/handlers/errors.js.map +1 -1
- package/dist/handlers/evaluate-guardrails.d.ts.map +1 -1
- package/dist/handlers/evaluate-guardrails.js +36 -1
- package/dist/handlers/evaluate-guardrails.js.map +1 -1
- package/dist/handlers/gate-decision.d.ts +62 -0
- package/dist/handlers/gate-decision.d.ts.map +1 -0
- package/dist/handlers/gate-decision.js +55 -0
- package/dist/handlers/gate-decision.js.map +1 -0
- package/dist/handlers/model-call.d.ts +10 -0
- package/dist/handlers/model-call.d.ts.map +1 -1
- package/dist/handlers/model-call.js +120 -34
- package/dist/handlers/model-call.js.map +1 -1
- package/dist/handlers/persist-provenance.d.ts.map +1 -1
- package/dist/handlers/persist-provenance.js +3 -1
- package/dist/handlers/persist-provenance.js.map +1 -1
- package/dist/handlers/persist-user-message.d.ts.map +1 -1
- package/dist/handlers/persist-user-message.js +5 -16
- package/dist/handlers/persist-user-message.js.map +1 -1
- package/dist/handlers/public-types.d.ts +37 -3
- package/dist/handlers/public-types.d.ts.map +1 -1
- package/dist/handlers/rehydrate.d.ts.map +1 -1
- package/dist/handlers/rehydrate.js +91 -1
- package/dist/handlers/rehydrate.js.map +1 -1
- package/dist/handlers/render-prompt.d.ts.map +1 -1
- package/dist/handlers/render-prompt.js +4 -1
- package/dist/handlers/render-prompt.js.map +1 -1
- package/dist/handlers/replay.d.ts +143 -0
- package/dist/handlers/replay.d.ts.map +1 -0
- package/dist/handlers/replay.js +177 -0
- package/dist/handlers/replay.js.map +1 -0
- package/dist/handlers/resolve-blocks.d.ts +32 -0
- package/dist/handlers/resolve-blocks.d.ts.map +1 -0
- package/dist/handlers/resolve-blocks.js +129 -0
- package/dist/handlers/resolve-blocks.js.map +1 -0
- package/dist/handlers/resolve-tools.d.ts +6 -2
- package/dist/handlers/resolve-tools.d.ts.map +1 -1
- package/dist/handlers/resolve-tools.js +59 -27
- package/dist/handlers/resolve-tools.js.map +1 -1
- package/dist/handlers/result-shape.d.ts +7 -0
- package/dist/handlers/result-shape.d.ts.map +1 -1
- package/dist/handlers/result-shape.js.map +1 -1
- package/dist/handlers/run-retrievals.d.ts.map +1 -1
- package/dist/handlers/run-retrievals.js +35 -35
- package/dist/handlers/run-retrievals.js.map +1 -1
- package/dist/handlers/run-snapshot.d.ts.map +1 -1
- package/dist/handlers/run-snapshot.js +1 -0
- package/dist/handlers/run-snapshot.js.map +1 -1
- package/dist/handlers/setup.d.ts +2 -0
- package/dist/handlers/setup.d.ts.map +1 -1
- package/dist/handlers/setup.js +29 -12
- package/dist/handlers/setup.js.map +1 -1
- package/dist/handlers/tool-hitl.d.ts +5 -9
- package/dist/handlers/tool-hitl.d.ts.map +1 -1
- package/dist/handlers/tool-hitl.js +5 -0
- package/dist/handlers/tool-hitl.js.map +1 -1
- package/dist/handlers/turn-environment.d.ts +13 -2
- package/dist/handlers/turn-environment.d.ts.map +1 -1
- package/dist/handlers/turn-environment.js +12 -3
- package/dist/handlers/turn-environment.js.map +1 -1
- package/dist/handlers/turn-provenance.d.ts +67 -0
- package/dist/handlers/turn-provenance.d.ts.map +1 -0
- package/dist/handlers/turn-provenance.js +160 -0
- package/dist/handlers/turn-provenance.js.map +1 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/invoke.d.ts +14 -1
- package/dist/invoke.d.ts.map +1 -1
- package/dist/invoke.js +37 -19
- package/dist/invoke.js.map +1 -1
- package/dist/pins.d.ts +54 -0
- package/dist/pins.d.ts.map +1 -0
- package/dist/pins.js +51 -0
- package/dist/pins.js.map +1 -0
- package/dist/prompt.d.ts +12 -2
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +41 -4
- package/dist/prompt.js.map +1 -1
- package/dist/provenance-emit.d.ts +4 -2
- package/dist/provenance-emit.d.ts.map +1 -1
- package/dist/provenance-emit.js +4 -2
- package/dist/provenance-emit.js.map +1 -1
- package/dist/run-snapshot-binding.d.ts +5 -0
- package/dist/run-snapshot-binding.d.ts.map +1 -1
- package/dist/schema.d.ts +34 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +16 -0
- package/dist/schema.js.map +1 -1
- package/dist/streaming.d.ts +5 -0
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js.map +1 -1
- package/dist/types.d.ts +65 -2
- package/dist/types.d.ts.map +1 -1
- package/migrations/0003_hesitant_captain_cross.sql +2 -0
- package/migrations/0004_stormy_moondragon.sql +1 -0
- package/migrations/meta/0003_snapshot.json +321 -0
- package/migrations/meta/0004_snapshot.json +327 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +15 -15
- package/src/blocks.ts +231 -0
- package/src/conversation-binding.ts +9 -1
- package/src/define.ts +104 -7
- package/src/guardrails-gate.ts +17 -3
- package/src/handlers/compose-result.ts +3 -0
- package/src/handlers/context.ts +24 -0
- package/src/handlers/dispatch-tools.ts +75 -44
- package/src/handlers/errors.ts +13 -0
- package/src/handlers/evaluate-guardrails.ts +41 -1
- package/src/handlers/gate-decision.ts +101 -0
- package/src/handlers/model-call.ts +163 -33
- package/src/handlers/persist-provenance.ts +3 -1
- package/src/handlers/persist-user-message.ts +3 -16
- package/src/handlers/public-types.ts +38 -3
- package/src/handlers/rehydrate.ts +141 -9
- package/src/handlers/render-prompt.ts +13 -7
- package/src/handlers/replay.ts +314 -0
- package/src/handlers/resolve-blocks.ts +188 -0
- package/src/handlers/resolve-tools.ts +76 -28
- package/src/handlers/result-shape.ts +8 -0
- package/src/handlers/run-retrievals.ts +45 -41
- package/src/handlers/run-snapshot.ts +1 -0
- package/src/handlers/setup.ts +30 -22
- package/src/handlers/tool-hitl.ts +6 -10
- package/src/handlers/turn-environment.ts +28 -3
- package/src/handlers/turn-provenance.ts +230 -0
- package/src/index.ts +44 -0
- package/src/invoke.ts +49 -20
- package/src/pins.ts +98 -0
- package/src/prompt.ts +52 -4
- package/src/provenance-emit.ts +4 -1
- package/src/run-snapshot-binding.ts +6 -0
- package/src/schema.ts +16 -0
- package/src/streaming.ts +5 -0
- package/src/types.ts +68 -2
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Capability } from '@kindgi/capabilities';
|
|
2
2
|
import type { Fact, MemoryScope } from '@kindgi/memory';
|
|
3
3
|
import type { ToolErrorsSpec, ToolHitlMode, ToolHitlRule } from '@kindgi/policy-contract';
|
|
4
|
-
import type { Brand, ConversationId, Semver, TenantId, Timestamp } from '@kindgi/types';
|
|
4
|
+
import type { Brand, ConversationId, ProjectId, Semver, TenantId, Timestamp } from '@kindgi/types';
|
|
5
|
+
import type { AgentDerivation, AgentPins } from './pins.js';
|
|
5
6
|
/**
|
|
6
7
|
* Branded agent id. Convention: dotted namespace under the tenant's
|
|
7
8
|
* pack — e.g. `acme.citation-verifier`, `acme.drafting`.
|
|
@@ -110,6 +111,20 @@ export interface ToolRef {
|
|
|
110
111
|
readonly id: string;
|
|
111
112
|
readonly version: string;
|
|
112
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* A prompt block an agent's instructions come from: its id and a semver
|
|
116
|
+
* range, resolved like a tool's (`pickVersion`) and pinned when the
|
|
117
|
+
* agent version is published.
|
|
118
|
+
*/
|
|
119
|
+
export interface PromptRef {
|
|
120
|
+
readonly prompt: string;
|
|
121
|
+
readonly version: string;
|
|
122
|
+
}
|
|
123
|
+
/** A settings block an agent reads: its id and a semver range, pinned at publish. */
|
|
124
|
+
export interface BlockRef {
|
|
125
|
+
readonly id: string;
|
|
126
|
+
readonly version: string;
|
|
127
|
+
}
|
|
113
128
|
/**
|
|
114
129
|
* Per-agent behavior for multi-turn conversations. The agent chooses:
|
|
115
130
|
* - How many prior messages to load (`historyLimit`; unset = all).
|
|
@@ -191,6 +206,14 @@ export interface ConversationHitlPolicy {
|
|
|
191
206
|
* (see `resolveEffectiveHitlPolicy`).
|
|
192
207
|
*/
|
|
193
208
|
readonly timeoutMs?: number;
|
|
209
|
+
/**
|
|
210
|
+
* What happens when an approval's time runs out: it escalates one
|
|
211
|
+
* reviewer tier, and at `admin` it expires (the turn fails with
|
|
212
|
+
* `hitl-cancelled`). `'escalate'` is the only behavior today, and the
|
|
213
|
+
* default; `'auto-approve'` and `'auto-reject'` are refused rather than
|
|
214
|
+
* accepted and ignored.
|
|
215
|
+
*/
|
|
216
|
+
readonly onTimeout?: 'escalate';
|
|
194
217
|
}
|
|
195
218
|
/**
|
|
196
219
|
* Budgets guard a single agent turn. Every field is optional; unset
|
|
@@ -268,8 +291,13 @@ export interface Agent {
|
|
|
268
291
|
* unresolved reference fails the turn at invoke time
|
|
269
292
|
* (`model-invocation-failed` whose `cause` is the `missing-parameter`
|
|
270
293
|
* render error), never a silent empty string.
|
|
294
|
+
*
|
|
295
|
+
* Or a prompt block, by range (`{ prompt: 'acme.intake-prompt',
|
|
296
|
+
* version: '^1.0.0' }`): its template renders here instead, with the
|
|
297
|
+
* parameters it declares, and the version that runs is pinned when the
|
|
298
|
+
* agent version is published (`pins.prompts`).
|
|
271
299
|
*/
|
|
272
|
-
readonly instructions: string;
|
|
300
|
+
readonly instructions: string | PromptRef;
|
|
273
301
|
/**
|
|
274
302
|
* Typed parameters the caller supplies at invoke time. The UI reads
|
|
275
303
|
* this to build a "configure agent" form; the runtime validates each
|
|
@@ -381,6 +409,35 @@ export interface Agent {
|
|
|
381
409
|
* A tenant's `tool-errors` policy can lower it. See `ToolErrorsSpec`.
|
|
382
410
|
*/
|
|
383
411
|
readonly toolErrors?: ToolErrorsSpec;
|
|
412
|
+
/**
|
|
413
|
+
* The exact block versions this agent version runs, resolved by the
|
|
414
|
+
* runtime when the version was published (see `AgentPins`). Never
|
|
415
|
+
* authored: `defineAgent` doesn't take it. Absent on an agent defined
|
|
416
|
+
* in code and on a version published before pins existed; its tool
|
|
417
|
+
* ranges then resolve per run.
|
|
418
|
+
*/
|
|
419
|
+
readonly pins?: AgentPins;
|
|
420
|
+
/**
|
|
421
|
+
* Settings blocks the agent reads, by range. Each block's values reach
|
|
422
|
+
* its tools as `ToolContext.settings[<block id>]` and its templates as
|
|
423
|
+
* `settings.<block id>.<key>`; the versions are pinned at publish
|
|
424
|
+
* (`pins.settings`).
|
|
425
|
+
*/
|
|
426
|
+
readonly settings?: readonly BlockRef[];
|
|
427
|
+
/**
|
|
428
|
+
* A settings block of model settings (`MODEL_SETTINGS_SCHEMA`:
|
|
429
|
+
* `temperature`, `maxOutputTokens`) the turn's model calls use. Pinned
|
|
430
|
+
* at publish with the other settings.
|
|
431
|
+
*/
|
|
432
|
+
readonly modelSettings?: BlockRef;
|
|
433
|
+
/** `pinsDigest(pins)`, recorded when the version was published. */
|
|
434
|
+
readonly pinsDigest?: string;
|
|
435
|
+
/**
|
|
436
|
+
* Set by the runtime on a version it registered under another number
|
|
437
|
+
* than the definition's, when a deploy couldn't register that number
|
|
438
|
+
* as it was (see `AgentDerivation`). Never authored.
|
|
439
|
+
*/
|
|
440
|
+
readonly derivedFrom?: AgentDerivation;
|
|
384
441
|
}
|
|
385
442
|
/**
|
|
386
443
|
* A conversation record (the `agent_conversations` table in this
|
|
@@ -399,6 +456,12 @@ export interface Conversation {
|
|
|
399
456
|
readonly title: string;
|
|
400
457
|
/** UUID or free-form identifier for the human participant. */
|
|
401
458
|
readonly participantId?: string;
|
|
459
|
+
/**
|
|
460
|
+
* The project the conversation is in, set when it is opened (by a run,
|
|
461
|
+
* from the run's project). Absent on conversations opened without one,
|
|
462
|
+
* and on those from before it was stored.
|
|
463
|
+
*/
|
|
464
|
+
readonly projectId?: ProjectId;
|
|
402
465
|
/** Additional attributes (project id, matter id, etc.). */
|
|
403
466
|
readonly scope: MemoryScope;
|
|
404
467
|
readonly openedAt: Timestamp;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC1F,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY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IAC7B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
ALTER TABLE "agent_conversations" ADD COLUMN "project_id" uuid;--> statement-breakpoint
|
|
2
|
+
CREATE INDEX "agent_conversations_tenant_project_opened_idx" ON "agent_conversations" USING btree ("tenant_id","project_id","opened_at" DESC NULLS LAST) WHERE "agent_conversations"."project_id" IS NOT NULL;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "agent_run_snapshots" ADD COLUMN "replay" jsonb;
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "39c9de18-7608-4826-84f7-af1dda0ba078",
|
|
3
|
+
"prevId": "2769ef0e-69b4-4a4d-ab47-044e2f11945e",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.agent_conversations": {
|
|
8
|
+
"name": "agent_conversations",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "uuid",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true,
|
|
16
|
+
"default": "gen_random_uuid()"
|
|
17
|
+
},
|
|
18
|
+
"tenant_id": {
|
|
19
|
+
"name": "tenant_id",
|
|
20
|
+
"type": "uuid",
|
|
21
|
+
"primaryKey": false,
|
|
22
|
+
"notNull": true
|
|
23
|
+
},
|
|
24
|
+
"agent_id": {
|
|
25
|
+
"name": "agent_id",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true
|
|
29
|
+
},
|
|
30
|
+
"agent_version": {
|
|
31
|
+
"name": "agent_version",
|
|
32
|
+
"type": "text",
|
|
33
|
+
"primaryKey": false,
|
|
34
|
+
"notNull": true
|
|
35
|
+
},
|
|
36
|
+
"title": {
|
|
37
|
+
"name": "title",
|
|
38
|
+
"type": "text",
|
|
39
|
+
"primaryKey": false,
|
|
40
|
+
"notNull": true
|
|
41
|
+
},
|
|
42
|
+
"participant_id": {
|
|
43
|
+
"name": "participant_id",
|
|
44
|
+
"type": "text",
|
|
45
|
+
"primaryKey": false,
|
|
46
|
+
"notNull": false
|
|
47
|
+
},
|
|
48
|
+
"project_id": {
|
|
49
|
+
"name": "project_id",
|
|
50
|
+
"type": "uuid",
|
|
51
|
+
"primaryKey": false,
|
|
52
|
+
"notNull": false
|
|
53
|
+
},
|
|
54
|
+
"scope": {
|
|
55
|
+
"name": "scope",
|
|
56
|
+
"type": "jsonb",
|
|
57
|
+
"primaryKey": false,
|
|
58
|
+
"notNull": true
|
|
59
|
+
},
|
|
60
|
+
"opened_at": {
|
|
61
|
+
"name": "opened_at",
|
|
62
|
+
"type": "timestamp with time zone",
|
|
63
|
+
"primaryKey": false,
|
|
64
|
+
"notNull": true,
|
|
65
|
+
"default": "now()"
|
|
66
|
+
},
|
|
67
|
+
"closed_at": {
|
|
68
|
+
"name": "closed_at",
|
|
69
|
+
"type": "timestamp with time zone",
|
|
70
|
+
"primaryKey": false,
|
|
71
|
+
"notNull": false
|
|
72
|
+
},
|
|
73
|
+
"turn_count": {
|
|
74
|
+
"name": "turn_count",
|
|
75
|
+
"type": "integer",
|
|
76
|
+
"primaryKey": false,
|
|
77
|
+
"notNull": true,
|
|
78
|
+
"default": 0
|
|
79
|
+
},
|
|
80
|
+
"last_message_at": {
|
|
81
|
+
"name": "last_message_at",
|
|
82
|
+
"type": "timestamp with time zone",
|
|
83
|
+
"primaryKey": false,
|
|
84
|
+
"notNull": false
|
|
85
|
+
},
|
|
86
|
+
"metadata": {
|
|
87
|
+
"name": "metadata",
|
|
88
|
+
"type": "jsonb",
|
|
89
|
+
"primaryKey": false,
|
|
90
|
+
"notNull": false
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"indexes": {
|
|
94
|
+
"agent_conversations_tenant_agent_idx": {
|
|
95
|
+
"name": "agent_conversations_tenant_agent_idx",
|
|
96
|
+
"columns": [
|
|
97
|
+
{
|
|
98
|
+
"expression": "tenant_id",
|
|
99
|
+
"isExpression": false,
|
|
100
|
+
"asc": true,
|
|
101
|
+
"nulls": "last"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"expression": "agent_id",
|
|
105
|
+
"isExpression": false,
|
|
106
|
+
"asc": true,
|
|
107
|
+
"nulls": "last"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"isUnique": false,
|
|
111
|
+
"concurrently": false,
|
|
112
|
+
"method": "btree",
|
|
113
|
+
"with": {}
|
|
114
|
+
},
|
|
115
|
+
"agent_conversations_tenant_participant_idx": {
|
|
116
|
+
"name": "agent_conversations_tenant_participant_idx",
|
|
117
|
+
"columns": [
|
|
118
|
+
{
|
|
119
|
+
"expression": "tenant_id",
|
|
120
|
+
"isExpression": false,
|
|
121
|
+
"asc": true,
|
|
122
|
+
"nulls": "last"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"expression": "participant_id",
|
|
126
|
+
"isExpression": false,
|
|
127
|
+
"asc": true,
|
|
128
|
+
"nulls": "last"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"isUnique": false,
|
|
132
|
+
"concurrently": false,
|
|
133
|
+
"method": "btree",
|
|
134
|
+
"with": {}
|
|
135
|
+
},
|
|
136
|
+
"agent_conversations_tenant_project_opened_idx": {
|
|
137
|
+
"name": "agent_conversations_tenant_project_opened_idx",
|
|
138
|
+
"columns": [
|
|
139
|
+
{
|
|
140
|
+
"expression": "tenant_id",
|
|
141
|
+
"isExpression": false,
|
|
142
|
+
"asc": true,
|
|
143
|
+
"nulls": "last"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"expression": "project_id",
|
|
147
|
+
"isExpression": false,
|
|
148
|
+
"asc": true,
|
|
149
|
+
"nulls": "last"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"expression": "opened_at",
|
|
153
|
+
"isExpression": false,
|
|
154
|
+
"asc": false,
|
|
155
|
+
"nulls": "last"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"isUnique": false,
|
|
159
|
+
"where": "\"agent_conversations\".\"project_id\" IS NOT NULL",
|
|
160
|
+
"concurrently": false,
|
|
161
|
+
"method": "btree",
|
|
162
|
+
"with": {}
|
|
163
|
+
},
|
|
164
|
+
"agent_conversations_open_recent_idx": {
|
|
165
|
+
"name": "agent_conversations_open_recent_idx",
|
|
166
|
+
"columns": [
|
|
167
|
+
{
|
|
168
|
+
"expression": "tenant_id",
|
|
169
|
+
"isExpression": false,
|
|
170
|
+
"asc": true,
|
|
171
|
+
"nulls": "last"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"expression": "last_message_at",
|
|
175
|
+
"isExpression": false,
|
|
176
|
+
"asc": false,
|
|
177
|
+
"nulls": "last"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"isUnique": false,
|
|
181
|
+
"where": "\"agent_conversations\".\"closed_at\" IS NULL",
|
|
182
|
+
"concurrently": false,
|
|
183
|
+
"method": "btree",
|
|
184
|
+
"with": {}
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"foreignKeys": {},
|
|
188
|
+
"compositePrimaryKeys": {},
|
|
189
|
+
"uniqueConstraints": {},
|
|
190
|
+
"policies": {},
|
|
191
|
+
"checkConstraints": {},
|
|
192
|
+
"isRLSEnabled": false
|
|
193
|
+
},
|
|
194
|
+
"public.agent_run_snapshots": {
|
|
195
|
+
"name": "agent_run_snapshots",
|
|
196
|
+
"schema": "",
|
|
197
|
+
"columns": {
|
|
198
|
+
"id": {
|
|
199
|
+
"name": "id",
|
|
200
|
+
"type": "uuid",
|
|
201
|
+
"primaryKey": true,
|
|
202
|
+
"notNull": true
|
|
203
|
+
},
|
|
204
|
+
"tenant_id": {
|
|
205
|
+
"name": "tenant_id",
|
|
206
|
+
"type": "uuid",
|
|
207
|
+
"primaryKey": false,
|
|
208
|
+
"notNull": true
|
|
209
|
+
},
|
|
210
|
+
"project_id": {
|
|
211
|
+
"name": "project_id",
|
|
212
|
+
"type": "uuid",
|
|
213
|
+
"primaryKey": false,
|
|
214
|
+
"notNull": true
|
|
215
|
+
},
|
|
216
|
+
"agent_id": {
|
|
217
|
+
"name": "agent_id",
|
|
218
|
+
"type": "text",
|
|
219
|
+
"primaryKey": false,
|
|
220
|
+
"notNull": true
|
|
221
|
+
},
|
|
222
|
+
"agent_version": {
|
|
223
|
+
"name": "agent_version",
|
|
224
|
+
"type": "text",
|
|
225
|
+
"primaryKey": false,
|
|
226
|
+
"notNull": true
|
|
227
|
+
},
|
|
228
|
+
"conversation_id": {
|
|
229
|
+
"name": "conversation_id",
|
|
230
|
+
"type": "uuid",
|
|
231
|
+
"primaryKey": false,
|
|
232
|
+
"notNull": true
|
|
233
|
+
},
|
|
234
|
+
"user_message": {
|
|
235
|
+
"name": "user_message",
|
|
236
|
+
"type": "text",
|
|
237
|
+
"primaryKey": false,
|
|
238
|
+
"notNull": true
|
|
239
|
+
},
|
|
240
|
+
"parameters": {
|
|
241
|
+
"name": "parameters",
|
|
242
|
+
"type": "jsonb",
|
|
243
|
+
"primaryKey": false,
|
|
244
|
+
"notNull": false
|
|
245
|
+
},
|
|
246
|
+
"input": {
|
|
247
|
+
"name": "input",
|
|
248
|
+
"type": "jsonb",
|
|
249
|
+
"primaryKey": false,
|
|
250
|
+
"notNull": false
|
|
251
|
+
},
|
|
252
|
+
"participant_id": {
|
|
253
|
+
"name": "participant_id",
|
|
254
|
+
"type": "text",
|
|
255
|
+
"primaryKey": false,
|
|
256
|
+
"notNull": false
|
|
257
|
+
},
|
|
258
|
+
"dry_run": {
|
|
259
|
+
"name": "dry_run",
|
|
260
|
+
"type": "integer",
|
|
261
|
+
"primaryKey": false,
|
|
262
|
+
"notNull": true,
|
|
263
|
+
"default": 0
|
|
264
|
+
},
|
|
265
|
+
"principal": {
|
|
266
|
+
"name": "principal",
|
|
267
|
+
"type": "jsonb",
|
|
268
|
+
"primaryKey": false,
|
|
269
|
+
"notNull": false
|
|
270
|
+
},
|
|
271
|
+
"authz": {
|
|
272
|
+
"name": "authz",
|
|
273
|
+
"type": "jsonb",
|
|
274
|
+
"primaryKey": false,
|
|
275
|
+
"notNull": false
|
|
276
|
+
},
|
|
277
|
+
"created_at": {
|
|
278
|
+
"name": "created_at",
|
|
279
|
+
"type": "timestamp with time zone",
|
|
280
|
+
"primaryKey": false,
|
|
281
|
+
"notNull": true,
|
|
282
|
+
"default": "now()"
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"indexes": {
|
|
286
|
+
"agent_run_snapshots_tenant_idx": {
|
|
287
|
+
"name": "agent_run_snapshots_tenant_idx",
|
|
288
|
+
"columns": [
|
|
289
|
+
{
|
|
290
|
+
"expression": "tenant_id",
|
|
291
|
+
"isExpression": false,
|
|
292
|
+
"asc": true,
|
|
293
|
+
"nulls": "last"
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"isUnique": false,
|
|
297
|
+
"concurrently": false,
|
|
298
|
+
"method": "btree",
|
|
299
|
+
"with": {}
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
"foreignKeys": {},
|
|
303
|
+
"compositePrimaryKeys": {},
|
|
304
|
+
"uniqueConstraints": {},
|
|
305
|
+
"policies": {},
|
|
306
|
+
"checkConstraints": {},
|
|
307
|
+
"isRLSEnabled": false
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
"enums": {},
|
|
311
|
+
"schemas": {},
|
|
312
|
+
"sequences": {},
|
|
313
|
+
"roles": {},
|
|
314
|
+
"policies": {},
|
|
315
|
+
"views": {},
|
|
316
|
+
"_meta": {
|
|
317
|
+
"columns": {},
|
|
318
|
+
"schemas": {},
|
|
319
|
+
"tables": {}
|
|
320
|
+
}
|
|
321
|
+
}
|