mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-28 11:54:42 +00:00
refactor(agent)!: migrate to Pi Durable and embed the agent queue (#525)
* refactor(agent)!: migrate sessions to Pi Durable Replace patched AgentHarness storage with per-session SQLite and PostgreSQL commit mirroring. Migrate legacy history automatically and run agent queues with the main server. BREAKING CHANGE: Remove standalone agent workers and return native Pi entry records from chat history APIs. * fix(agent): constrain session log dialog scrolling Keep the header visible and wrap long output while log entries and expanded records scroll within the dialog. Cover desktop and narrow viewports through the dashboard Sessions flow. * fix(agent): hide entry IDs from session log card headers Retain internal entry IDs in expanded raw records for debugging. Verify that card headers omit the IDs while raw JSON preserves them. * test(e2e): handle browser wheel limits in session log checks Verify that a normal wheel event moves the viewport before explicitly scrolling to the final record. Keep the dialog bounds, fixed header, wrapping, and expanded-record assertions. * fix(agent): select model providers without inheriting unrelated auth * fix(webui): prevent resize feedback when toggling agent panel * test(agent): reproduce concurrent comment session races * fix(agent): serialize comment sessions and deduplicate history * docs(changelog): consolidate Pi Durable changes into one entry
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
"./src/*": "./src/*.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@earendil-works/pi-agent-core": "0.82.1",
|
||||
"@prisma/adapter-pg": "7.10.0",
|
||||
"@prisma/client": "7.10.0",
|
||||
"pg": "8.23.0",
|
||||
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
BEGIN;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "agent_sessions" ADD COLUMN "writer_version" INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "agent_session_commits" (
|
||||
"id" TEXT NOT NULL,
|
||||
"session_id" TEXT NOT NULL,
|
||||
"seq" BIGINT NOT NULL,
|
||||
"data" JSONB NOT NULL,
|
||||
|
||||
CONSTRAINT "agent_session_commits_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "agent_session_commits_session_id_seq_key" ON "agent_session_commits"("session_id", "seq");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "agent_session_commits" ADD CONSTRAINT "agent_session_commits_session_id_fkey" FOREIGN KEY ("session_id") REFERENCES "agent_sessions"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- Backfill historical transcripts as idle Pi Durable 1.5 sessions. No provider requests run.
|
||||
DO $migration$
|
||||
BEGIN
|
||||
CREATE TEMP TABLE pi_legacy_path ON COMMIT DROP AS
|
||||
WITH RECURSIVE path AS (
|
||||
SELECT s.id AS session_id, e.id AS old_id, e.parent_id, e.type, e.data,
|
||||
e.created_at, 0 AS depth, ARRAY[e.id] AS visited
|
||||
FROM agent_sessions s JOIN agent_session_entries e ON e.id = s.leaf_id
|
||||
UNION ALL
|
||||
SELECT p.session_id, e.id, e.parent_id, e.type, e.data, e.created_at,
|
||||
p.depth + 1, p.visited || e.id
|
||||
FROM path p JOIN agent_session_entries e ON e.id = p.parent_id
|
||||
WHERE NOT e.id = ANY(p.visited)
|
||||
), all_entries AS (
|
||||
SELECT session_id, old_id, parent_id, type, data, created_at, depth, visited FROM path
|
||||
UNION ALL
|
||||
SELECT s.id, e.id, e.parent_id, e.type, e.data, e.created_at,
|
||||
-row_number() OVER (PARTITION BY s.id ORDER BY e.id)::integer, ARRAY[e.id]
|
||||
FROM agent_sessions s JOIN agent_session_entries e ON e.session_id = s.id
|
||||
WHERE s.leaf_id IS NULL
|
||||
)
|
||||
SELECT *, row_number() OVER (PARTITION BY session_id ORDER BY depth DESC) AS position
|
||||
FROM all_entries;
|
||||
|
||||
IF EXISTS (SELECT 1 FROM agent_sessions s WHERE s.leaf_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM agent_session_entries e WHERE e.id = s.leaf_id)) THEN
|
||||
RAISE EXCEPTION 'Cannot migrate agent sessions: a session leaf is missing';
|
||||
END IF;
|
||||
IF EXISTS (SELECT 1 FROM pi_legacy_path p WHERE p.parent_id = ANY(p.visited)) THEN
|
||||
RAISE EXCEPTION 'Cannot migrate agent sessions: cyclic history';
|
||||
END IF;
|
||||
IF EXISTS (SELECT 1 FROM pi_legacy_path p WHERE p.parent_id IS NOT NULL AND NOT EXISTS (SELECT 1 FROM agent_session_entries e WHERE e.id = p.parent_id)) THEN
|
||||
RAISE EXCEPTION 'Cannot migrate agent sessions: an ancestor is missing';
|
||||
END IF;
|
||||
|
||||
-- Migration-only ULIDs: preserve the historical timestamp and derive collision-resistant entropy.
|
||||
CREATE FUNCTION pg_temp.pi_commit_id(seed text, stamp timestamp) RETURNS text
|
||||
LANGUAGE plpgsql AS $id$
|
||||
DECLARE
|
||||
alphabet text := '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
|
||||
number numeric := floor(extract(epoch FROM stamp) * 1000);
|
||||
bytes bytea := decode(substr(md5(seed), 1, 20), 'hex');
|
||||
encoded text := '';
|
||||
i integer;
|
||||
BEGIN
|
||||
FOR i IN 0..9 LOOP number := number * 256 + get_byte(bytes, i); END LOOP;
|
||||
FOR i IN 1..26 LOOP
|
||||
encoded := substr(alphabet, mod(number, 32)::integer + 1, 1) || encoded;
|
||||
number := trunc(number / 32);
|
||||
END LOOP;
|
||||
RETURN encoded;
|
||||
END $id$;
|
||||
|
||||
CREATE TEMP TABLE pi_legacy_usage ON COMMIT DROP AS
|
||||
SELECT session_id, coalesce(message->>'provider', 'legacy') || '/' || coalesce(message->>'model', 'unknown') AS model,
|
||||
jsonb_build_object(
|
||||
'input', sum(coalesce((message->'usage'->>'input')::numeric, 0)),
|
||||
'output', sum(coalesce((message->'usage'->>'output')::numeric, 0)),
|
||||
'cacheRead', sum(coalesce((message->'usage'->>'cacheRead')::numeric, 0)),
|
||||
'cacheWrite', sum(coalesce((message->'usage'->>'cacheWrite')::numeric, 0)),
|
||||
'totalTokens', sum(coalesce((message->'usage'->>'totalTokens')::numeric, 0)),
|
||||
'cost', jsonb_build_object(
|
||||
'input', sum(coalesce((message->'usage'->'cost'->>'input')::numeric, 0)),
|
||||
'output', sum(coalesce((message->'usage'->'cost'->>'output')::numeric, 0)),
|
||||
'cacheRead', sum(coalesce((message->'usage'->'cost'->>'cacheRead')::numeric, 0)),
|
||||
'cacheWrite', sum(coalesce((message->'usage'->'cost'->>'cacheWrite')::numeric, 0)),
|
||||
'total', sum(coalesce((message->'usage'->'cost'->>'total')::numeric, 0)))) AS usage
|
||||
FROM (SELECT session_id, CASE WHEN type IN ('compaction', 'branch_summary') THEN data ELSE data->'message' END AS message FROM pi_legacy_path) messages
|
||||
WHERE message->>'role' = 'assistant' OR message->'usage' IS NOT NULL
|
||||
GROUP BY session_id, coalesce(message->>'provider', 'legacy') || '/' || coalesce(message->>'model', 'unknown');
|
||||
|
||||
INSERT INTO agent_session_commits (id, session_id, seq, data)
|
||||
SELECT pg_temp.pi_commit_id(s.id || ':bootstrap', s.created_at), s.id, 1,
|
||||
jsonb_build_object('version', 1, 'writes', jsonb_build_array(
|
||||
jsonb_build_object('type', 'conversation', 'value', jsonb_build_object('id', 1)),
|
||||
jsonb_build_object('type', 'document.create', 'record', jsonb_build_object('id', 2, 'kind', 'pi.live', 'scope', jsonb_build_object('kind', 'conversation', 'conversationId', 1), 'history', 'latest', 'fork', 'initial'), 'content', jsonb_build_object('version', 3, 'kind', 'base', 'value', '{}'::jsonb)),
|
||||
jsonb_build_object('type', 'document.create', 'record', jsonb_build_object('id', 3, 'kind', 'pi.inbox', 'scope', jsonb_build_object('kind', 'conversation', 'conversationId', 1), 'history', 'latest', 'fork', 'initial'), 'content', jsonb_build_object('version', 1, 'kind', 'base', 'value', '{"items":[]}'::jsonb)),
|
||||
jsonb_build_object('type', 'document.create', 'record', jsonb_build_object('id', 4, 'kind', 'pi.usage', 'scope', jsonb_build_object('kind', 'conversation', 'conversationId', 1), 'history', 'latest', 'fork', 'initial'), 'content', jsonb_build_object('version', 1, 'kind', 'base', 'value', jsonb_build_object('models', coalesce((SELECT jsonb_object_agg(u.model, u.usage) FROM pi_legacy_usage u WHERE u.session_id = s.id), '{}'::jsonb), 'tools', '{}'::jsonb))),
|
||||
jsonb_build_object('type', 'document.create', 'record', jsonb_build_object('id', 5, 'kind', 'pi.provider', 'scope', jsonb_build_object('kind', 'conversation', 'conversationId', 1), 'history', 'latest', 'fork', 'initial'), 'content', jsonb_build_object('version', 1, 'kind', 'base', 'value', jsonb_build_object('sessionId', gen_random_uuid()::text))),
|
||||
jsonb_build_object('type', 'document.create', 'record', jsonb_build_object('id', 6, 'kind', 'pi.agent', 'scope', jsonb_build_object('kind', 'conversation', 'conversationId', 1), 'history', 'rewindable', 'fork', 'asOf'), 'content', jsonb_build_object('version', 1, 'kind', 'base', 'value', '{}'::jsonb))
|
||||
))
|
||||
FROM agent_sessions s
|
||||
WHERE NOT EXISTS (SELECT 1 FROM agent_session_commits c WHERE c.session_id = s.id);
|
||||
|
||||
CREATE TEMP TABLE pi_migrated_entries ON COMMIT DROP AS
|
||||
SELECT p.*, 5 + 2 * p.position AS entry_id,
|
||||
CASE
|
||||
WHEN p.type = 'custom_message' AND p.data->>'customType' = 'shumai_message' THEN 'shumai.message'
|
||||
WHEN p.type = 'message' AND p.data->>'customType' = 'shumai_message' THEN 'shumai.message'
|
||||
WHEN p.type = 'message' THEN CASE p.data->'message'->>'role'
|
||||
WHEN 'user' THEN 'pi.user' WHEN 'assistant' THEN 'pi.assistant'
|
||||
WHEN 'toolResult' THEN 'pi.tool-result' WHEN 'system' THEN 'pi.system'
|
||||
ELSE 'shumai.legacy' END
|
||||
WHEN p.type = 'compaction' THEN 'pi.compaction'
|
||||
ELSE 'shumai.' || coalesce(p.type, 'legacy') END AS kind
|
||||
FROM pi_legacy_path p;
|
||||
|
||||
CREATE FUNCTION pg_temp.pi_references(value jsonb, target_session text) RETURNS jsonb
|
||||
LANGUAGE plpgsql AS $refs$
|
||||
DECLARE result jsonb; item record; reference text; text_value text;
|
||||
BEGIN
|
||||
IF jsonb_typeof(value) = 'object' THEN
|
||||
result := '{}'::jsonb;
|
||||
FOR item IN SELECT * FROM jsonb_each(value) LOOP
|
||||
IF item.key = 'annotationId' AND jsonb_typeof(item.value) = 'string' THEN
|
||||
SELECT 'chat:' || target_session || ':legacy-' || p.old_id INTO reference
|
||||
FROM pi_migrated_entries p WHERE p.session_id = target_session AND p.old_id = item.value #>> '{}'
|
||||
AND NOT EXISTS (SELECT 1 FROM asset_comments c WHERE c.id = p.old_id);
|
||||
result := result || jsonb_build_object(item.key, coalesce(to_jsonb(reference), item.value));
|
||||
ELSE result := result || jsonb_build_object(item.key, pg_temp.pi_references(item.value, target_session)); END IF;
|
||||
END LOOP;
|
||||
RETURN result;
|
||||
ELSIF jsonb_typeof(value) = 'array' THEN
|
||||
SELECT coalesce(jsonb_agg(pg_temp.pi_references(element, target_session) ORDER BY ordinal), '[]'::jsonb) INTO result FROM jsonb_array_elements(value) WITH ORDINALITY AS items(element, ordinal);
|
||||
RETURN result;
|
||||
ELSIF jsonb_typeof(value) = 'string' THEN
|
||||
text_value := value #>> '{}';
|
||||
FOR item IN SELECT old_id FROM pi_migrated_entries p WHERE p.session_id = target_session AND NOT EXISTS (SELECT 1 FROM asset_comments c WHERE c.id = p.old_id) LOOP
|
||||
text_value := replace(text_value, 'id="' || item.old_id || '"', 'id="chat:' || target_session || ':legacy-' || item.old_id || '"');
|
||||
END LOOP;
|
||||
RETURN to_jsonb(text_value);
|
||||
END IF;
|
||||
RETURN value;
|
||||
END $refs$;
|
||||
|
||||
UPDATE pi_migrated_entries SET data = pg_temp.pi_references(data, session_id);
|
||||
|
||||
IF EXISTS (SELECT 1 FROM pi_migrated_entries p WHERE p.type = 'compaction' AND p.data->>'firstKeptEntryId' IS NOT NULL AND NOT EXISTS (SELECT 1 FROM pi_migrated_entries k WHERE k.session_id = p.session_id AND k.old_id = p.data->>'firstKeptEntryId')) THEN
|
||||
RAISE EXCEPTION 'Cannot migrate agent sessions: compaction boundary is missing';
|
||||
END IF;
|
||||
|
||||
INSERT INTO agent_session_commits (id, session_id, seq, data)
|
||||
SELECT pg_temp.pi_commit_id(p.session_id || ':' || p.position::text, p.created_at), p.session_id, p.position + 1,
|
||||
jsonb_build_object('version', 1, 'writes', jsonb_build_array(
|
||||
jsonb_build_object('type', 'entry', 'value', jsonb_strip_nulls(jsonb_build_object(
|
||||
'id', p.entry_id, 'conversationId', 1, 'kind', p.kind,
|
||||
'model', CASE
|
||||
WHEN p.kind = 'shumai.message' THEN jsonb_build_array(jsonb_build_object('role', 'user', 'content', coalesce(p.data->>'content', ''), 'timestamp', floor(extract(epoch FROM p.created_at) * 1000)))
|
||||
WHEN p.kind IN ('pi.user', 'pi.assistant', 'pi.tool-result', 'pi.system') THEN jsonb_build_array(p.data->'message')
|
||||
WHEN p.kind IN ('pi.compaction', 'shumai.branch_summary') THEN jsonb_build_array(jsonb_build_object('role', 'user', 'content', 'The conversation history before this point was compacted into the following summary:' || chr(10) || '<summary>' || chr(10) || coalesce(p.data->>'summary', '') || chr(10) || '</summary>', 'timestamp', floor(extract(epoch FROM p.created_at) * 1000)))
|
||||
WHEN p.type = 'custom_message' AND p.data->>'content' IS NOT NULL THEN jsonb_build_array(jsonb_build_object('role', 'user', 'content', p.data->>'content', 'timestamp', floor(extract(epoch FROM p.created_at) * 1000)))
|
||||
ELSE NULL END,
|
||||
'head', CASE WHEN p.kind = 'pi.compaction' THEN (SELECT k.entry_id FROM pi_migrated_entries k WHERE k.session_id = p.session_id AND k.old_id = p.data->>'firstKeptEntryId') ELSE NULL END,
|
||||
'data', CASE WHEN p.kind = 'shumai.message' THEN jsonb_build_object(
|
||||
'displayText', coalesce(p.data->>'content', ''),
|
||||
'timestamp', floor(extract(epoch FROM p.created_at) * 1000),
|
||||
'sourceCommentId', CASE WHEN EXISTS (SELECT 1 FROM asset_comments a WHERE a.id = p.old_id) THEN p.old_id ELSE NULL END,
|
||||
'context', coalesce(p.data->'details', '{}'::jsonb) || jsonb_build_object('id', CASE WHEN EXISTS (SELECT 1 FROM asset_comments a WHERE a.id = p.old_id) THEN p.old_id ELSE 'chat:' || p.session_id || ':legacy-' || p.old_id END),
|
||||
'legacyId', p.old_id)
|
||||
WHEN p.kind = 'pi.tool-result' THEN '{"diagnostics":[]}'::jsonb
|
||||
WHEN p.kind = 'pi.compaction' THEN '{"reason":"manual"}'::jsonb
|
||||
ELSE coalesce(p.data, '{}'::jsonb) || jsonb_build_object('legacyId', p.old_id) END
|
||||
))),
|
||||
jsonb_build_object('type', 'submission', 'value', jsonb_build_object(
|
||||
'id', p.entry_id + 1, 'conversationId', 1, 'type', 'write', 'status', 'done',
|
||||
'entry', p.entry_id, 'requestId', 'legacy-' || p.old_id))
|
||||
))
|
||||
FROM pi_migrated_entries p
|
||||
WHERE NOT EXISTS (SELECT 1 FROM agent_session_commits c WHERE c.session_id = p.session_id AND c.seq = p.position + 1)
|
||||
ORDER BY p.session_id, p.position;
|
||||
|
||||
DROP FUNCTION pg_temp.pi_references(jsonb, text);
|
||||
DROP TABLE pi_legacy_usage;
|
||||
DROP FUNCTION pg_temp.pi_commit_id(text, timestamp);
|
||||
DROP TABLE pi_migrated_entries;
|
||||
DROP TABLE pi_legacy_path;
|
||||
END $migration$;
|
||||
|
||||
COMMIT;
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "agent_sessions" ADD COLUMN "accounted_usage" JSONB;
|
||||
|
||||
-- Historical spend has already been charged. Seed its checkpoint so continuation only bills new work.
|
||||
UPDATE agent_sessions s SET accounted_usage = (
|
||||
SELECT jsonb_build_object(
|
||||
'inputTokens', coalesce(sum((model.value->>'input')::numeric), 0),
|
||||
'outputTokens', coalesce(sum((model.value->>'output')::numeric), 0),
|
||||
'cacheReadTokens', coalesce(sum((model.value->>'cacheRead')::numeric), 0),
|
||||
'totalTokens', coalesce(sum((model.value->>'totalTokens')::numeric), 0),
|
||||
'cost', coalesce(sum((model.value->'cost'->>'total')::numeric), 0))
|
||||
FROM agent_session_commits c,
|
||||
jsonb_array_elements(c.data->'writes') AS write,
|
||||
jsonb_each(write->'content'->'value'->'models') AS model
|
||||
WHERE c.session_id = s.id AND c.seq = 1 AND write->'record'->>'kind' = 'pi.usage'
|
||||
);
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
-- Preserve explicit JSON nulls in historical payloads. The first conversion omits
|
||||
-- absent optional entry fields; nested payloads must keep their original values.
|
||||
BEGIN;
|
||||
CREATE FUNCTION pg_temp.pi_restore_nulls(original jsonb, converted jsonb) RETURNS jsonb
|
||||
LANGUAGE plpgsql AS $restore$
|
||||
DECLARE item record; result jsonb := converted;
|
||||
BEGIN
|
||||
IF jsonb_typeof(original) = 'object' AND jsonb_typeof(converted) = 'object' THEN
|
||||
FOR item IN SELECT * FROM jsonb_each(original) LOOP
|
||||
IF item.value = 'null'::jsonb AND NOT result ? item.key THEN
|
||||
result := result || jsonb_build_object(item.key, NULL);
|
||||
ELSIF result ? item.key THEN
|
||||
result := jsonb_set(result, ARRAY[item.key], pg_temp.pi_restore_nulls(item.value, result->item.key));
|
||||
END IF;
|
||||
END LOOP;
|
||||
ELSIF jsonb_typeof(original) = 'array' AND jsonb_typeof(converted) = 'array' THEN
|
||||
FOR item IN SELECT value, ordinality FROM jsonb_array_elements(original) WITH ORDINALITY LOOP
|
||||
IF item.ordinality <= jsonb_array_length(result) THEN
|
||||
result := jsonb_set(result, ARRAY[(item.ordinality - 1)::text], pg_temp.pi_restore_nulls(item.value, result->(item.ordinality - 1)::integer));
|
||||
END IF;
|
||||
END LOOP;
|
||||
END IF;
|
||||
RETURN result;
|
||||
END $restore$;
|
||||
|
||||
WITH RECURSIVE path AS (
|
||||
SELECT s.id AS session_id, e.id, e.parent_id, e.type, e.data, 0 AS depth
|
||||
FROM agent_sessions s JOIN agent_session_entries e ON e.id = s.leaf_id
|
||||
UNION ALL
|
||||
SELECT p.session_id, e.id, e.parent_id, e.type, e.data, p.depth + 1
|
||||
FROM path p JOIN agent_session_entries e ON e.id = p.parent_id
|
||||
), historical AS (
|
||||
SELECT session_id, type, data, depth FROM path
|
||||
UNION ALL
|
||||
SELECT s.id, e.type, e.data, -row_number() OVER (PARTITION BY s.id ORDER BY e.id)::integer
|
||||
FROM agent_sessions s JOIN agent_session_entries e ON e.session_id = s.id WHERE s.leaf_id IS NULL
|
||||
), numbered AS (
|
||||
SELECT *, row_number() OVER (PARTITION BY session_id ORDER BY depth DESC) + 1 AS seq FROM historical
|
||||
), payloads AS (
|
||||
SELECT session_id, seq, CASE
|
||||
WHEN data->>'customType' = 'shumai_message' THEN jsonb_build_object('data', jsonb_build_object('context', data->'details'))
|
||||
WHEN type = 'message' AND data->'message' IS NOT NULL THEN jsonb_build_object('model', jsonb_build_array(data->'message'))
|
||||
ELSE jsonb_build_object('data', data) END AS original
|
||||
FROM numbered
|
||||
)
|
||||
UPDATE agent_session_commits c SET data = jsonb_set(c.data, '{writes}', (
|
||||
SELECT jsonb_agg(CASE WHEN write->>'type' = 'entry'
|
||||
THEN jsonb_set(write, '{value}', pg_temp.pi_restore_nulls(p.original, write->'value'))
|
||||
ELSE write END ORDER BY ordinal)
|
||||
FROM jsonb_array_elements(c.data->'writes') WITH ORDINALITY AS writes(write, ordinal)
|
||||
))
|
||||
FROM payloads p WHERE c.session_id = p.session_id AND c.seq = p.seq;
|
||||
|
||||
DROP FUNCTION pg_temp.pi_restore_nulls(jsonb, jsonb);
|
||||
COMMIT;
|
||||
@@ -1004,12 +1004,28 @@ model AgentSession {
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
entries AgentSessionEntry[]
|
||||
commits AgentSessionCommit[]
|
||||
writerVersion Int @default(0) @map("writer_version")
|
||||
/// [AgentSessionUsage]
|
||||
accountedUsage Json? @map("accounted_usage")
|
||||
comments AssetComment[]
|
||||
|
||||
@@index([type])
|
||||
@@map("agent_sessions")
|
||||
}
|
||||
|
||||
model AgentSessionCommit {
|
||||
id String @id @default(ulid())
|
||||
sessionId String @map("session_id")
|
||||
session AgentSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
seq BigInt
|
||||
/// [AgentSessionCommitData]
|
||||
data Json
|
||||
|
||||
@@unique([sessionId, seq])
|
||||
@@map("agent_session_commits")
|
||||
}
|
||||
|
||||
model AgentSessionEntry {
|
||||
id String @id // Uses ULID generated by pi-coding-agent
|
||||
sessionId String? @map("session_id")
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Pool } from 'pg'
|
||||
|
||||
const locks = new Pool({ connectionString: process.env.DATABASE_URL, max: 20 })
|
||||
|
||||
/** A session lock uses a dedicated connection, never a long-running application transaction. */
|
||||
export async function acquireAdvisoryLock(key: string, signal?: AbortSignal) {
|
||||
const client = await locks.connect()
|
||||
const lost = new AbortController()
|
||||
const onError = (error: Error) => lost.abort(error)
|
||||
client.on('error', onError)
|
||||
try {
|
||||
while (true) {
|
||||
signal?.throwIfAborted()
|
||||
lost.signal.throwIfAborted()
|
||||
const result = await client.query<{ acquired: boolean }>(
|
||||
'SELECT pg_try_advisory_lock(hashtextextended($1, 0)) AS acquired',
|
||||
[key],
|
||||
)
|
||||
if (result.rows[0]?.acquired) break
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
}
|
||||
} catch (error) {
|
||||
client.release(true)
|
||||
throw error
|
||||
}
|
||||
let released = false
|
||||
return {
|
||||
signal: lost.signal,
|
||||
async release() {
|
||||
if (released) return
|
||||
released = true
|
||||
client.off('error', onError)
|
||||
try {
|
||||
if (!lost.signal.aborted)
|
||||
await client.query('SELECT pg_advisory_unlock(hashtextextended($1, 0))', [key])
|
||||
} finally {
|
||||
client.release(lost.signal.aborted)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
+68
-63
@@ -2,11 +2,11 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
// @ts-nocheck
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* This file should be your main import to use Prisma-related types and utilities in a browser.
|
||||
* This file should be your main import to use Prisma-related types and utilities in a browser.
|
||||
* Use it to get access to models, enums, and input types.
|
||||
*
|
||||
*
|
||||
* This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
|
||||
* See `client.ts` for the standard, server-side entry point.
|
||||
*
|
||||
@@ -19,301 +19,306 @@ export * as $Enums from './enums.ts'
|
||||
export * from './enums.ts';
|
||||
/**
|
||||
* Model User
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type User = Prisma.UserModel
|
||||
/**
|
||||
* Model Session
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Session = Prisma.SessionModel
|
||||
/**
|
||||
* Model Account
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Account = Prisma.AccountModel
|
||||
/**
|
||||
* Model Verification
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Verification = Prisma.VerificationModel
|
||||
/**
|
||||
* Model AuthToken
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AuthToken = Prisma.AuthTokenModel
|
||||
/**
|
||||
* Model Team
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Team = Prisma.TeamModel
|
||||
/**
|
||||
* Model Sandbox
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Sandbox = Prisma.SandboxModel
|
||||
/**
|
||||
* Model Skill
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Skill = Prisma.SkillModel
|
||||
/**
|
||||
* Model TeamMember
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type TeamMember = Prisma.TeamMemberModel
|
||||
/**
|
||||
* Model Project
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Project = Prisma.ProjectModel
|
||||
/**
|
||||
* Model ProjectMember
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type ProjectMember = Prisma.ProjectMemberModel
|
||||
/**
|
||||
* Model ShareLink
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type ShareLink = Prisma.ShareLinkModel
|
||||
/**
|
||||
* Model WatermarkConfig
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type WatermarkConfig = Prisma.WatermarkConfigModel
|
||||
/**
|
||||
* Model WatermarkTemplate
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type WatermarkTemplate = Prisma.WatermarkTemplateModel
|
||||
/**
|
||||
* Model WatermarkFile
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type WatermarkFile = Prisma.WatermarkFileModel
|
||||
/**
|
||||
* Model Asset
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Asset = Prisma.AssetModel
|
||||
/**
|
||||
* Model StorageKey
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type StorageKey = Prisma.StorageKeyModel
|
||||
/**
|
||||
* Model AssetMetadataValue
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetMetadataValue = Prisma.AssetMetadataValueModel
|
||||
/**
|
||||
* Model AssetAgentMd
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetAgentMd = Prisma.AssetAgentMdModel
|
||||
/**
|
||||
* Model AssetComment
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetComment = Prisma.AssetCommentModel
|
||||
/**
|
||||
* Model AssetCommentAttachment
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetCommentAttachment = Prisma.AssetCommentAttachmentModel
|
||||
/**
|
||||
* Model AssetCommentReaction
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetCommentReaction = Prisma.AssetCommentReactionModel
|
||||
/**
|
||||
* Model AssetEmbedding
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetEmbedding = Prisma.AssetEmbeddingModel
|
||||
/**
|
||||
* Model Invite
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Invite = Prisma.InviteModel
|
||||
/**
|
||||
* Model MetadataField
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type MetadataField = Prisma.MetadataFieldModel
|
||||
/**
|
||||
* Model Notification
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Notification = Prisma.NotificationModel
|
||||
/**
|
||||
* Model SystemSettings
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type SystemSettings = Prisma.SystemSettingsModel
|
||||
/**
|
||||
* Model Task
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Task = Prisma.TaskModel
|
||||
/**
|
||||
* Model WorkflowTask
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type WorkflowTask = Prisma.WorkflowTaskModel
|
||||
/**
|
||||
* Model Agent
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Agent = Prisma.AgentModel
|
||||
/**
|
||||
* Model AgentSkill
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AgentSkill = Prisma.AgentSkillModel
|
||||
/**
|
||||
* Model McpServer
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type McpServer = Prisma.McpServerModel
|
||||
/**
|
||||
* Model AgentMcpServer
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AgentMcpServer = Prisma.AgentMcpServerModel
|
||||
/**
|
||||
* Model McpServerCredential
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type McpServerCredential = Prisma.McpServerCredentialModel
|
||||
/**
|
||||
* Model AgentSession
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AgentSession = Prisma.AgentSessionModel
|
||||
/**
|
||||
* Model AgentSessionCommit
|
||||
*
|
||||
*/
|
||||
export type AgentSessionCommit = Prisma.AgentSessionCommitModel
|
||||
/**
|
||||
* Model AgentSessionEntry
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AgentSessionEntry = Prisma.AgentSessionEntryModel
|
||||
/**
|
||||
* Model UserMetadata
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type UserMetadata = Prisma.UserMetadataModel
|
||||
/**
|
||||
* Model Model
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Model = Prisma.ModelModel
|
||||
/**
|
||||
* Model Provider
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Provider = Prisma.ProviderModel
|
||||
/**
|
||||
* Model Collection
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Collection = Prisma.CollectionModel
|
||||
/**
|
||||
* Model ApiToken
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type ApiToken = Prisma.ApiTokenModel
|
||||
/**
|
||||
* Model AiUsage
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AiUsage = Prisma.AiUsageModel
|
||||
/**
|
||||
* Model AuditLog
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AuditLog = Prisma.AuditLogModel
|
||||
/**
|
||||
* Model QuotaRule
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type QuotaRule = Prisma.QuotaRuleModel
|
||||
/**
|
||||
* Model QuotaRecord
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type QuotaRecord = Prisma.QuotaRecordModel
|
||||
/**
|
||||
* Model KanbanGoal
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanGoal = Prisma.KanbanGoalModel
|
||||
/**
|
||||
* Model KanbanTask
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTask = Prisma.KanbanTaskModel
|
||||
/**
|
||||
* Model KanbanTaskLink
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTaskLink = Prisma.KanbanTaskLinkModel
|
||||
/**
|
||||
* Model KanbanTaskAsset
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTaskAsset = Prisma.KanbanTaskAssetModel
|
||||
/**
|
||||
* Model KanbanTaskComment
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTaskComment = Prisma.KanbanTaskCommentModel
|
||||
/**
|
||||
* Model KanbanTaskEvent
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTaskEvent = Prisma.KanbanTaskEventModel
|
||||
/**
|
||||
* Model RecentFileItem
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type RecentFileItem = Prisma.RecentFileItemModel
|
||||
/**
|
||||
* Model Jwks
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Jwks = Prisma.JwksModel
|
||||
/**
|
||||
* Model OauthClient
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthClient = Prisma.OauthClientModel
|
||||
/**
|
||||
* Model OauthResource
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthResource = Prisma.OauthResourceModel
|
||||
/**
|
||||
* Model OauthClientResource
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthClientResource = Prisma.OauthClientResourceModel
|
||||
/**
|
||||
* Model OauthRefreshToken
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthRefreshToken = Prisma.OauthRefreshTokenModel
|
||||
/**
|
||||
* Model OauthAccessToken
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthAccessToken = Prisma.OauthAccessTokenModel
|
||||
/**
|
||||
* Model OauthConsent
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthConsent = Prisma.OauthConsentModel
|
||||
/**
|
||||
* Model OauthClientAssertion
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthClientAssertion = Prisma.OauthClientAssertionModel
|
||||
|
||||
+68
-63
@@ -2,7 +2,7 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
// @ts-nocheck
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
|
||||
* If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
|
||||
@@ -24,7 +24,7 @@ export * as $Enums from './enums.ts'
|
||||
export * from "./enums.ts"
|
||||
/**
|
||||
* ## Prisma Client
|
||||
*
|
||||
*
|
||||
* Type-safe database client for TypeScript
|
||||
* @example
|
||||
* ```
|
||||
@@ -34,7 +34,7 @@ export * from "./enums.ts"
|
||||
* // Fetch zero or more Users
|
||||
* const users = await prisma.user.findMany()
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* Read more in our [docs](https://pris.ly/d/client).
|
||||
*/
|
||||
export const PrismaClient = $Class.getPrismaClientClass()
|
||||
@@ -43,301 +43,306 @@ export { Prisma }
|
||||
|
||||
/**
|
||||
* Model User
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type User = Prisma.UserModel
|
||||
/**
|
||||
* Model Session
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Session = Prisma.SessionModel
|
||||
/**
|
||||
* Model Account
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Account = Prisma.AccountModel
|
||||
/**
|
||||
* Model Verification
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Verification = Prisma.VerificationModel
|
||||
/**
|
||||
* Model AuthToken
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AuthToken = Prisma.AuthTokenModel
|
||||
/**
|
||||
* Model Team
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Team = Prisma.TeamModel
|
||||
/**
|
||||
* Model Sandbox
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Sandbox = Prisma.SandboxModel
|
||||
/**
|
||||
* Model Skill
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Skill = Prisma.SkillModel
|
||||
/**
|
||||
* Model TeamMember
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type TeamMember = Prisma.TeamMemberModel
|
||||
/**
|
||||
* Model Project
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Project = Prisma.ProjectModel
|
||||
/**
|
||||
* Model ProjectMember
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type ProjectMember = Prisma.ProjectMemberModel
|
||||
/**
|
||||
* Model ShareLink
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type ShareLink = Prisma.ShareLinkModel
|
||||
/**
|
||||
* Model WatermarkConfig
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type WatermarkConfig = Prisma.WatermarkConfigModel
|
||||
/**
|
||||
* Model WatermarkTemplate
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type WatermarkTemplate = Prisma.WatermarkTemplateModel
|
||||
/**
|
||||
* Model WatermarkFile
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type WatermarkFile = Prisma.WatermarkFileModel
|
||||
/**
|
||||
* Model Asset
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Asset = Prisma.AssetModel
|
||||
/**
|
||||
* Model StorageKey
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type StorageKey = Prisma.StorageKeyModel
|
||||
/**
|
||||
* Model AssetMetadataValue
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetMetadataValue = Prisma.AssetMetadataValueModel
|
||||
/**
|
||||
* Model AssetAgentMd
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetAgentMd = Prisma.AssetAgentMdModel
|
||||
/**
|
||||
* Model AssetComment
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetComment = Prisma.AssetCommentModel
|
||||
/**
|
||||
* Model AssetCommentAttachment
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetCommentAttachment = Prisma.AssetCommentAttachmentModel
|
||||
/**
|
||||
* Model AssetCommentReaction
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetCommentReaction = Prisma.AssetCommentReactionModel
|
||||
/**
|
||||
* Model AssetEmbedding
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AssetEmbedding = Prisma.AssetEmbeddingModel
|
||||
/**
|
||||
* Model Invite
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Invite = Prisma.InviteModel
|
||||
/**
|
||||
* Model MetadataField
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type MetadataField = Prisma.MetadataFieldModel
|
||||
/**
|
||||
* Model Notification
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Notification = Prisma.NotificationModel
|
||||
/**
|
||||
* Model SystemSettings
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type SystemSettings = Prisma.SystemSettingsModel
|
||||
/**
|
||||
* Model Task
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Task = Prisma.TaskModel
|
||||
/**
|
||||
* Model WorkflowTask
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type WorkflowTask = Prisma.WorkflowTaskModel
|
||||
/**
|
||||
* Model Agent
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Agent = Prisma.AgentModel
|
||||
/**
|
||||
* Model AgentSkill
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AgentSkill = Prisma.AgentSkillModel
|
||||
/**
|
||||
* Model McpServer
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type McpServer = Prisma.McpServerModel
|
||||
/**
|
||||
* Model AgentMcpServer
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AgentMcpServer = Prisma.AgentMcpServerModel
|
||||
/**
|
||||
* Model McpServerCredential
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type McpServerCredential = Prisma.McpServerCredentialModel
|
||||
/**
|
||||
* Model AgentSession
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AgentSession = Prisma.AgentSessionModel
|
||||
/**
|
||||
* Model AgentSessionCommit
|
||||
*
|
||||
*/
|
||||
export type AgentSessionCommit = Prisma.AgentSessionCommitModel
|
||||
/**
|
||||
* Model AgentSessionEntry
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AgentSessionEntry = Prisma.AgentSessionEntryModel
|
||||
/**
|
||||
* Model UserMetadata
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type UserMetadata = Prisma.UserMetadataModel
|
||||
/**
|
||||
* Model Model
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Model = Prisma.ModelModel
|
||||
/**
|
||||
* Model Provider
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Provider = Prisma.ProviderModel
|
||||
/**
|
||||
* Model Collection
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Collection = Prisma.CollectionModel
|
||||
/**
|
||||
* Model ApiToken
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type ApiToken = Prisma.ApiTokenModel
|
||||
/**
|
||||
* Model AiUsage
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AiUsage = Prisma.AiUsageModel
|
||||
/**
|
||||
* Model AuditLog
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type AuditLog = Prisma.AuditLogModel
|
||||
/**
|
||||
* Model QuotaRule
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type QuotaRule = Prisma.QuotaRuleModel
|
||||
/**
|
||||
* Model QuotaRecord
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type QuotaRecord = Prisma.QuotaRecordModel
|
||||
/**
|
||||
* Model KanbanGoal
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanGoal = Prisma.KanbanGoalModel
|
||||
/**
|
||||
* Model KanbanTask
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTask = Prisma.KanbanTaskModel
|
||||
/**
|
||||
* Model KanbanTaskLink
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTaskLink = Prisma.KanbanTaskLinkModel
|
||||
/**
|
||||
* Model KanbanTaskAsset
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTaskAsset = Prisma.KanbanTaskAssetModel
|
||||
/**
|
||||
* Model KanbanTaskComment
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTaskComment = Prisma.KanbanTaskCommentModel
|
||||
/**
|
||||
* Model KanbanTaskEvent
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type KanbanTaskEvent = Prisma.KanbanTaskEventModel
|
||||
/**
|
||||
* Model RecentFileItem
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type RecentFileItem = Prisma.RecentFileItemModel
|
||||
/**
|
||||
* Model Jwks
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type Jwks = Prisma.JwksModel
|
||||
/**
|
||||
* Model OauthClient
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthClient = Prisma.OauthClientModel
|
||||
/**
|
||||
* Model OauthResource
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthResource = Prisma.OauthResourceModel
|
||||
/**
|
||||
* Model OauthClientResource
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthClientResource = Prisma.OauthClientResourceModel
|
||||
/**
|
||||
* Model OauthRefreshToken
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthRefreshToken = Prisma.OauthRefreshTokenModel
|
||||
/**
|
||||
* Model OauthAccessToken
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthAccessToken = Prisma.OauthAccessTokenModel
|
||||
/**
|
||||
* Model OauthConsent
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthConsent = Prisma.OauthConsentModel
|
||||
/**
|
||||
* Model OauthClientAssertion
|
||||
*
|
||||
*
|
||||
*/
|
||||
export type OauthClientAssertion = Prisma.OauthClientAssertionModel
|
||||
|
||||
+20
-10
File diff suppressed because one or more lines are too long
+171
-83
@@ -2,7 +2,7 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
// @ts-nocheck
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* WARNING: This is an internal file that is subject to change!
|
||||
*
|
||||
@@ -432,6 +432,7 @@ export const ModelName = {
|
||||
AgentMcpServer: 'AgentMcpServer',
|
||||
McpServerCredential: 'McpServerCredential',
|
||||
AgentSession: 'AgentSession',
|
||||
AgentSessionCommit: 'AgentSessionCommit',
|
||||
AgentSessionEntry: 'AgentSessionEntry',
|
||||
UserMetadata: 'UserMetadata',
|
||||
Model: 'Model',
|
||||
@@ -472,7 +473,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
omit: GlobalOmitOptions
|
||||
}
|
||||
meta: {
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
modelProps: "user" | "session" | "account" | "verification" | "authToken" | "team" | "sandbox" | "skill" | "teamMember" | "project" | "projectMember" | "shareLink" | "watermarkConfig" | "watermarkTemplate" | "watermarkFile" | "asset" | "storageKey" | "assetMetadataValue" | "assetAgentMd" | "assetComment" | "assetCommentAttachment" | "assetCommentReaction" | "assetEmbedding" | "invite" | "metadataField" | "notification" | "systemSettings" | "task" | "workflowTask" | "agent" | "agentSkill" | "mcpServer" | "agentMcpServer" | "mcpServerCredential" | "agentSession" | "agentSessionCommit" | "agentSessionEntry" | "userMetadata" | "model" | "provider" | "collection" | "apiToken" | "aiUsage" | "auditLog" | "quotaRule" | "quotaRecord" | "kanbanGoal" | "kanbanTask" | "kanbanTaskLink" | "kanbanTaskAsset" | "kanbanTaskComment" | "kanbanTaskEvent" | "recentFileItem" | "jwks" | "oauthClient" | "oauthResource" | "oauthClientResource" | "oauthRefreshToken" | "oauthAccessToken" | "oauthConsent" | "oauthClientAssertion"
|
||||
txIsolationLevel: TransactionIsolationLevel
|
||||
}
|
||||
model: {
|
||||
@@ -3066,6 +3067,80 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
||||
}
|
||||
}
|
||||
}
|
||||
AgentSessionCommit: {
|
||||
payload: Prisma.$AgentSessionCommitPayload<ExtArgs>
|
||||
fields: Prisma.AgentSessionCommitFieldRefs
|
||||
operations: {
|
||||
findUnique: {
|
||||
args: Prisma.AgentSessionCommitFindUniqueArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload> | null
|
||||
}
|
||||
findUniqueOrThrow: {
|
||||
args: Prisma.AgentSessionCommitFindUniqueOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>
|
||||
}
|
||||
findFirst: {
|
||||
args: Prisma.AgentSessionCommitFindFirstArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload> | null
|
||||
}
|
||||
findFirstOrThrow: {
|
||||
args: Prisma.AgentSessionCommitFindFirstOrThrowArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>
|
||||
}
|
||||
findMany: {
|
||||
args: Prisma.AgentSessionCommitFindManyArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>[]
|
||||
}
|
||||
create: {
|
||||
args: Prisma.AgentSessionCommitCreateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>
|
||||
}
|
||||
createMany: {
|
||||
args: Prisma.AgentSessionCommitCreateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
createManyAndReturn: {
|
||||
args: Prisma.AgentSessionCommitCreateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>[]
|
||||
}
|
||||
delete: {
|
||||
args: Prisma.AgentSessionCommitDeleteArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>
|
||||
}
|
||||
update: {
|
||||
args: Prisma.AgentSessionCommitUpdateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>
|
||||
}
|
||||
deleteMany: {
|
||||
args: Prisma.AgentSessionCommitDeleteManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateMany: {
|
||||
args: Prisma.AgentSessionCommitUpdateManyArgs<ExtArgs>
|
||||
result: BatchPayload
|
||||
}
|
||||
updateManyAndReturn: {
|
||||
args: Prisma.AgentSessionCommitUpdateManyAndReturnArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>[]
|
||||
}
|
||||
upsert: {
|
||||
args: Prisma.AgentSessionCommitUpsertArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$AgentSessionCommitPayload>
|
||||
}
|
||||
aggregate: {
|
||||
args: Prisma.AgentSessionCommitAggregateArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AggregateAgentSessionCommit>
|
||||
}
|
||||
groupBy: {
|
||||
args: Prisma.AgentSessionCommitGroupByArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AgentSessionCommitGroupByOutputType>[]
|
||||
}
|
||||
count: {
|
||||
args: Prisma.AgentSessionCommitCountArgs<ExtArgs>
|
||||
result: runtime.Types.Utils.Optional<Prisma.AgentSessionCommitCountAggregateOutputType> | number
|
||||
}
|
||||
}
|
||||
}
|
||||
AgentSessionEntry: {
|
||||
payload: Prisma.$AgentSessionEntryPayload<ExtArgs>
|
||||
fields: Prisma.AgentSessionEntryFieldRefs
|
||||
@@ -5468,12 +5543,24 @@ export const AgentSessionScalarFieldEnum = {
|
||||
type: 'type',
|
||||
name: 'name',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
updatedAt: 'updatedAt',
|
||||
writerVersion: 'writerVersion',
|
||||
accountedUsage: 'accountedUsage'
|
||||
} as const
|
||||
|
||||
export type AgentSessionScalarFieldEnum = (typeof AgentSessionScalarFieldEnum)[keyof typeof AgentSessionScalarFieldEnum]
|
||||
|
||||
|
||||
export const AgentSessionCommitScalarFieldEnum = {
|
||||
id: 'id',
|
||||
sessionId: 'sessionId',
|
||||
seq: 'seq',
|
||||
data: 'data'
|
||||
} as const
|
||||
|
||||
export type AgentSessionCommitScalarFieldEnum = (typeof AgentSessionCommitScalarFieldEnum)[keyof typeof AgentSessionCommitScalarFieldEnum]
|
||||
|
||||
|
||||
export const AgentSessionEntryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
sessionId: 'sessionId',
|
||||
@@ -5925,455 +6012,455 @@ export type NullsOrder = (typeof NullsOrder)[keyof typeof NullsOrder]
|
||||
* Reference to a field of type 'String'
|
||||
*/
|
||||
export type StringFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'String'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'String[]'
|
||||
*/
|
||||
export type ListStringFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'String[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'UserType'
|
||||
*/
|
||||
export type EnumUserTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'UserType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'UserType[]'
|
||||
*/
|
||||
export type ListEnumUserTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'UserType[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Boolean'
|
||||
*/
|
||||
export type BooleanFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Boolean'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Json'
|
||||
*/
|
||||
export type JsonFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Json'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'QueryMode'
|
||||
*/
|
||||
export type EnumQueryModeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QueryMode'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'DateTime'
|
||||
*/
|
||||
export type DateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'DateTime'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'DateTime[]'
|
||||
*/
|
||||
export type ListDateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'DateTime[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'TeamMemberRole'
|
||||
*/
|
||||
export type EnumTeamMemberRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'TeamMemberRole'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'TeamMemberRole[]'
|
||||
*/
|
||||
export type ListEnumTeamMemberRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'TeamMemberRole[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'TeamMemberScope'
|
||||
*/
|
||||
export type EnumTeamMemberScopeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'TeamMemberScope'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'TeamMemberScope[]'
|
||||
*/
|
||||
export type ListEnumTeamMemberScopeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'TeamMemberScope[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'ProjectMemberRole'
|
||||
*/
|
||||
export type EnumProjectMemberRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'ProjectMemberRole'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'ProjectMemberRole[]'
|
||||
*/
|
||||
export type ListEnumProjectMemberRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'ProjectMemberRole[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WatermarkStatus'
|
||||
*/
|
||||
export type EnumWatermarkStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'WatermarkStatus'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WatermarkStatus[]'
|
||||
*/
|
||||
export type ListEnumWatermarkStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'WatermarkStatus[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WatermarkFileStatus'
|
||||
*/
|
||||
export type EnumWatermarkFileStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'WatermarkFileStatus'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WatermarkFileStatus[]'
|
||||
*/
|
||||
export type ListEnumWatermarkFileStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'WatermarkFileStatus[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AssetType'
|
||||
*/
|
||||
export type EnumAssetTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AssetType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AssetType[]'
|
||||
*/
|
||||
export type ListEnumAssetTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AssetType[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Int'
|
||||
*/
|
||||
export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Int[]'
|
||||
*/
|
||||
export type ListIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'BigInt'
|
||||
*/
|
||||
export type BigIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'BigInt'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'BigInt[]'
|
||||
*/
|
||||
export type ListBigIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'BigInt[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AssetStatus'
|
||||
*/
|
||||
export type EnumAssetStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AssetStatus'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AssetStatus[]'
|
||||
*/
|
||||
export type ListEnumAssetStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AssetStatus[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'StorageKeyStatus'
|
||||
*/
|
||||
export type EnumStorageKeyStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'StorageKeyStatus'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'StorageKeyStatus[]'
|
||||
*/
|
||||
export type ListEnumStorageKeyStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'StorageKeyStatus[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Float'
|
||||
*/
|
||||
export type FloatFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Float'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'Float[]'
|
||||
*/
|
||||
export type ListFloatFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Float[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'InviteRole'
|
||||
*/
|
||||
export type EnumInviteRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'InviteRole'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'InviteRole[]'
|
||||
*/
|
||||
export type ListEnumInviteRoleFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'InviteRole[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'MetadataFieldScope'
|
||||
*/
|
||||
export type EnumMetadataFieldScopeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'MetadataFieldScope'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'MetadataFieldScope[]'
|
||||
*/
|
||||
export type ListEnumMetadataFieldScopeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'MetadataFieldScope[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'NotificationType'
|
||||
*/
|
||||
export type EnumNotificationTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'NotificationType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'NotificationType[]'
|
||||
*/
|
||||
export type ListEnumNotificationTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'NotificationType[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'NotificationEmailStatus'
|
||||
*/
|
||||
export type EnumNotificationEmailStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'NotificationEmailStatus'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'NotificationEmailStatus[]'
|
||||
*/
|
||||
export type ListEnumNotificationEmailStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'NotificationEmailStatus[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'TaskType'
|
||||
*/
|
||||
export type EnumTaskTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'TaskType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'TaskType[]'
|
||||
*/
|
||||
export type ListEnumTaskTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'TaskType[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'TaskStatus'
|
||||
*/
|
||||
export type EnumTaskStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'TaskStatus'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'TaskStatus[]'
|
||||
*/
|
||||
export type ListEnumTaskStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'TaskStatus[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WorkflowTaskType'
|
||||
*/
|
||||
export type EnumWorkflowTaskTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'WorkflowTaskType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WorkflowTaskType[]'
|
||||
*/
|
||||
export type ListEnumWorkflowTaskTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'WorkflowTaskType[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WorkflowTaskStatus'
|
||||
*/
|
||||
export type EnumWorkflowTaskStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'WorkflowTaskStatus'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'WorkflowTaskStatus[]'
|
||||
*/
|
||||
export type ListEnumWorkflowTaskStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'WorkflowTaskStatus[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AgentType'
|
||||
*/
|
||||
export type EnumAgentTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AgentType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AgentType[]'
|
||||
*/
|
||||
export type ListEnumAgentTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AgentType[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'McpTransport'
|
||||
*/
|
||||
export type EnumMcpTransportFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'McpTransport'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'McpTransport[]'
|
||||
*/
|
||||
export type ListEnumMcpTransportFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'McpTransport[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AgentSessionType'
|
||||
*/
|
||||
export type EnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AgentSessionType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'AgentSessionType[]'
|
||||
*/
|
||||
export type ListEnumAgentSessionTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'AgentSessionType[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'QuotaScopeMode'
|
||||
*/
|
||||
export type EnumQuotaScopeModeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaScopeMode'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'QuotaScopeMode[]'
|
||||
*/
|
||||
export type ListEnumQuotaScopeModeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaScopeMode[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'QuotaResourceType'
|
||||
*/
|
||||
export type EnumQuotaResourceTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaResourceType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'QuotaResourceType[]'
|
||||
*/
|
||||
export type ListEnumQuotaResourceTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaResourceType[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'QuotaPeriod'
|
||||
*/
|
||||
export type EnumQuotaPeriodFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaPeriod'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'QuotaPeriod[]'
|
||||
*/
|
||||
export type ListEnumQuotaPeriodFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'QuotaPeriod[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'KanbanTaskStatus'
|
||||
*/
|
||||
export type EnumKanbanTaskStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'KanbanTaskStatus'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'KanbanTaskStatus[]'
|
||||
*/
|
||||
export type ListEnumKanbanTaskStatusFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'KanbanTaskStatus[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'KanbanTaskPriority'
|
||||
*/
|
||||
export type EnumKanbanTaskPriorityFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'KanbanTaskPriority'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'KanbanTaskPriority[]'
|
||||
*/
|
||||
export type ListEnumKanbanTaskPriorityFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'KanbanTaskPriority[]'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'KanbanTaskEventType'
|
||||
*/
|
||||
export type EnumKanbanTaskEventTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'KanbanTaskEventType'>
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reference to a field of type 'KanbanTaskEventType[]'
|
||||
*/
|
||||
export type ListEnumKanbanTaskEventTypeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'KanbanTaskEventType[]'>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Batch Payload for updateMany & deleteMany & createMany
|
||||
@@ -6398,7 +6485,7 @@ export interface PrismaClientBaseOptions {
|
||||
* ```
|
||||
* // Shorthand for `emit: 'stdout'`
|
||||
* log: ['query', 'info', 'warn', 'error']
|
||||
*
|
||||
*
|
||||
* // Emit as events only
|
||||
* log: [
|
||||
* { emit: 'event', level: 'query' },
|
||||
@@ -6406,14 +6493,14 @@ export interface PrismaClientBaseOptions {
|
||||
* { emit: 'event', level: 'warn' }
|
||||
* { emit: 'event', level: 'error' }
|
||||
* ]
|
||||
*
|
||||
*
|
||||
* / Emit as events and log to stdout
|
||||
* og: [
|
||||
* { emit: 'stdout', level: 'query' },
|
||||
* { emit: 'stdout', level: 'info' },
|
||||
* { emit: 'stdout', level: 'warn' }
|
||||
* { emit: 'stdout', level: 'error' }
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* Read more in our [docs](https://pris.ly/d/logging).
|
||||
*/
|
||||
@@ -6430,7 +6517,7 @@ export interface PrismaClientBaseOptions {
|
||||
}
|
||||
/**
|
||||
* Global configuration for omitting model fields by default.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* const prisma = new PrismaClient({
|
||||
@@ -6446,7 +6533,7 @@ export interface PrismaClientBaseOptions {
|
||||
/**
|
||||
* SQL commenter plugins that add metadata to SQL queries as comments.
|
||||
* Comments follow the sqlcommenter format: https://google.github.io/sqlcommenter/
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* const prisma = new PrismaClient({
|
||||
@@ -6464,7 +6551,7 @@ export interface PrismaClientBaseOptions {
|
||||
* A value of `0` can be used to disable the cache entirely. A higher cache size can improve
|
||||
* performance for applications that execute a large number of unique queries, while a smaller
|
||||
* cache size can reduce memory usage.
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* const prisma = new PrismaClient({
|
||||
@@ -6478,13 +6565,13 @@ export interface PrismaClientBaseOptions {
|
||||
|
||||
/**
|
||||
* `PrismaClient` options for connecting to your database through Prisma Accelerate instead of a driver adapter.
|
||||
*
|
||||
*
|
||||
* Learn more: https://pris.ly/d/accelerate
|
||||
*/
|
||||
export interface PrismaClientOptionsWithAccelerateUrl extends PrismaClientBaseOptions {
|
||||
/**
|
||||
* The Prisma Accelerate connection URL. Use this option to connect to your database through Prisma Accelerate instead of using a driver adapter to connect directly.
|
||||
*
|
||||
*
|
||||
* Learn more: https://pris.ly/d/accelerate
|
||||
*/
|
||||
accelerateUrl: string
|
||||
@@ -6493,22 +6580,22 @@ export interface PrismaClientOptionsWithAccelerateUrl extends PrismaClientBaseOp
|
||||
|
||||
/**
|
||||
* `PrismaClient` options for connecting to your database through a driver adapter. This is the common case in Prisma 7.
|
||||
*
|
||||
*
|
||||
* Learn more: https://pris.ly/d/driver-adapters
|
||||
*/
|
||||
export interface PrismaClientOptionsWithAdapter extends PrismaClientBaseOptions {
|
||||
/**
|
||||
* A driver adapter that PrismaClient uses to connect to your database, such as the ones provided by `@prisma/adapter-pg`, `@prisma/adapter-libsql`, `@prisma/adapter-planetscale`, etc.
|
||||
*
|
||||
*
|
||||
* A driver adapter is **required** unless you connect to your database through Prisma Accelerate (in which case use `accelerateUrl` instead).
|
||||
*
|
||||
*
|
||||
* Learn more: https://pris.ly/d/driver-adapters
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* import { PrismaPg } from '@prisma/adapter-pg'
|
||||
* import { PrismaClient } from './generated/prisma/client'
|
||||
*
|
||||
*
|
||||
* const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
|
||||
* const prisma = new PrismaClient({ adapter })
|
||||
* ```
|
||||
@@ -6519,9 +6606,9 @@ export interface PrismaClientOptionsWithAdapter extends PrismaClientBaseOptions
|
||||
|
||||
/**
|
||||
* Options passed to the `PrismaClient` constructor.
|
||||
*
|
||||
*
|
||||
* A driver adapter (or, alternatively, a Prisma Accelerate URL) is **required**. See {@link PrismaClientOptionsWithAdapter} and {@link PrismaClientOptionsWithAccelerateUrl} for the two variants. All other properties live in {@link PrismaClientBaseOptions} and are optional.
|
||||
*
|
||||
*
|
||||
* Learn more about driver adapters: https://pris.ly/d/driver-adapters
|
||||
*/
|
||||
export type PrismaClientOptions = PrismaClientOptionsWithAccelerateUrl | PrismaClientOptionsWithAdapter
|
||||
@@ -6561,6 +6648,7 @@ export type GlobalOmitConfig = {
|
||||
agentMcpServer?: Prisma.AgentMcpServerOmit
|
||||
mcpServerCredential?: Prisma.McpServerCredentialOmit
|
||||
agentSession?: Prisma.AgentSessionOmit
|
||||
agentSessionCommit?: Prisma.AgentSessionCommitOmit
|
||||
agentSessionEntry?: Prisma.AgentSessionEntryOmit
|
||||
userMetadata?: Prisma.UserMetadataOmit
|
||||
model?: Prisma.ModelOmit
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
// @ts-nocheck
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* WARNING: This is an internal file that is subject to change!
|
||||
*
|
||||
@@ -86,6 +86,7 @@ export const ModelName = {
|
||||
AgentMcpServer: 'AgentMcpServer',
|
||||
McpServerCredential: 'McpServerCredential',
|
||||
AgentSession: 'AgentSession',
|
||||
AgentSessionCommit: 'AgentSessionCommit',
|
||||
AgentSessionEntry: 'AgentSessionEntry',
|
||||
UserMetadata: 'UserMetadata',
|
||||
Model: 'Model',
|
||||
@@ -642,12 +643,24 @@ export const AgentSessionScalarFieldEnum = {
|
||||
type: 'type',
|
||||
name: 'name',
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
updatedAt: 'updatedAt',
|
||||
writerVersion: 'writerVersion',
|
||||
accountedUsage: 'accountedUsage'
|
||||
} as const
|
||||
|
||||
export type AgentSessionScalarFieldEnum = (typeof AgentSessionScalarFieldEnum)[keyof typeof AgentSessionScalarFieldEnum]
|
||||
|
||||
|
||||
export const AgentSessionCommitScalarFieldEnum = {
|
||||
id: 'id',
|
||||
sessionId: 'sessionId',
|
||||
seq: 'seq',
|
||||
data: 'data'
|
||||
} as const
|
||||
|
||||
export type AgentSessionCommitScalarFieldEnum = (typeof AgentSessionCommitScalarFieldEnum)[keyof typeof AgentSessionCommitScalarFieldEnum]
|
||||
|
||||
|
||||
export const AgentSessionEntryScalarFieldEnum = {
|
||||
id: 'id',
|
||||
sessionId: 'sessionId',
|
||||
|
||||
+3
-2
@@ -2,7 +2,7 @@
|
||||
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
||||
/* eslint-disable */
|
||||
// biome-ignore-all lint: generated file
|
||||
// @ts-nocheck
|
||||
// @ts-nocheck
|
||||
/*
|
||||
* This is a barrel export file for all models and their related types.
|
||||
*
|
||||
@@ -43,6 +43,7 @@ export type * from './models/McpServer.ts'
|
||||
export type * from './models/AgentMcpServer.ts'
|
||||
export type * from './models/McpServerCredential.ts'
|
||||
export type * from './models/AgentSession.ts'
|
||||
export type * from './models/AgentSessionCommit.ts'
|
||||
export type * from './models/AgentSessionEntry.ts'
|
||||
export type * from './models/UserMetadata.ts'
|
||||
export type * from './models/Model.ts'
|
||||
@@ -68,4 +69,4 @@ export type * from './models/OauthRefreshToken.ts'
|
||||
export type * from './models/OauthAccessToken.ts'
|
||||
export type * from './models/OauthConsent.ts'
|
||||
export type * from './models/OauthClientAssertion.ts'
|
||||
export type * from './commonInputTypes.ts'
|
||||
export type * from './commonInputTypes.ts'
|
||||
|
||||
+362
-40
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,20 @@ export {}
|
||||
declare global {
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
namespace PrismaJson {
|
||||
export type PiSessionEntryData = Omit<
|
||||
import('@earendil-works/pi-agent-core').SessionTreeEntry,
|
||||
'id' | 'type' | 'parentId' | 'timestamp'
|
||||
>
|
||||
export interface AgentSessionCommitData {
|
||||
version: 1
|
||||
writes: import('./generated/prisma/internal/prismaNamespace').JsonValue[]
|
||||
}
|
||||
|
||||
export interface AgentSessionUsage {
|
||||
inputTokens: number
|
||||
outputTokens: number
|
||||
cacheReadTokens: number
|
||||
totalTokens: number
|
||||
cost: number
|
||||
}
|
||||
|
||||
export type PiSessionEntryData = { [key: string]: unknown }
|
||||
|
||||
export type ShumaiMessageContext = import('@shumai/dtos').ShumaiMessageContext
|
||||
|
||||
|
||||
Reference in New Issue
Block a user