@tangle-network/agent-app 0.50.30 → 0.50.32
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/VaultPane-RHLY4DR5.js +7 -0
- package/dist/agent-enrollment/application.d.ts +42 -0
- package/dist/agent-enrollment/drizzle.d.ts +63 -0
- package/dist/agent-enrollment/drizzle.js +160 -0
- package/dist/agent-enrollment/drizzle.js.map +1 -0
- package/dist/agent-enrollment/index.d.ts +59 -0
- package/dist/agent-enrollment/index.js +14 -0
- package/dist/agent-enrollment/index.js.map +1 -0
- package/dist/assistant/index.js +7 -7
- package/dist/chat-routes/index.js +13 -13
- package/dist/chat-store/index.js +4 -4
- package/dist/{chunk-2ZNU55YJ.js → chunk-3IATFW4U.js} +5 -5
- package/dist/chunk-3IATFW4U.js.map +1 -0
- package/dist/{chunk-RACQDXJ7.js → chunk-4PZE7XAM.js} +6 -6
- package/dist/{chunk-QWYAR2CY.js → chunk-5KFRCVAO.js} +2 -2
- package/dist/{chunk-KTV5RQBQ.js → chunk-5TOV7EDF.js} +4 -4
- package/dist/chunk-6RWQ4VW5.js +124 -0
- package/dist/chunk-6RWQ4VW5.js.map +1 -0
- package/dist/{chunk-RFVTTZPG.js → chunk-CNI46COH.js} +2 -2
- package/dist/{chunk-RFVTTZPG.js.map → chunk-CNI46COH.js.map} +1 -1
- package/dist/{chunk-TJCTC5QI.js → chunk-LDCR7MRU.js} +2 -2
- package/dist/chunk-NLXY7TFB.js +207 -0
- package/dist/chunk-NLXY7TFB.js.map +1 -0
- package/dist/{chunk-QJRXKMHJ.js → chunk-UNXMIWPK.js} +6 -6
- package/dist/{chunk-XFCKMBOC.js → chunk-YFGG722I.js} +5 -5
- package/dist/{chunk-MX55JP7D.js → chunk-ZMMIQOFI.js} +5 -5
- package/dist/design-canvas-react/index.js +4 -4
- package/dist/hosted-agent/application.js +5 -116
- package/dist/hosted-agent/application.js.map +1 -1
- package/dist/integrations-react/callback.d.ts +6 -0
- package/dist/integrations-react/client.d.ts +34 -0
- package/dist/integrations-react/index.d.ts +6 -0
- package/dist/integrations-react/index.js +830 -0
- package/dist/integrations-react/index.js.map +1 -0
- package/dist/integrations-react/panel.d.ts +22 -0
- package/dist/integrations-react/popup.d.ts +19 -0
- package/dist/integrations-react/projection.d.ts +25 -0
- package/dist/integrations-react/use-hub-integrations.d.ts +102 -0
- package/dist/platform/hub-settings.d.ts +117 -0
- package/dist/platform/index.d.ts +1 -0
- package/dist/platform/index.js +225 -20
- package/dist/platform/index.js.map +1 -1
- package/dist/preset-cloudflare/index.js +2 -2
- package/dist/public-consultation/index.js +6 -6
- package/dist/sandbox/index.js +4 -4
- package/dist/stream/index.js +2 -2
- package/dist/tools/index.js +4 -4
- package/dist/vault/index.js +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/index.js +9 -9
- package/dist/work-product/index.js +2 -2
- package/package.json +19 -4
- package/dist/VaultPane-OTUP5AEX.js +0 -7
- package/dist/chunk-2ZNU55YJ.js.map +0 -1
- /package/dist/{VaultPane-OTUP5AEX.js.map → VaultPane-RHLY4DR5.js.map} +0 -0
- /package/dist/{chunk-RACQDXJ7.js.map → chunk-4PZE7XAM.js.map} +0 -0
- /package/dist/{chunk-QWYAR2CY.js.map → chunk-5KFRCVAO.js.map} +0 -0
- /package/dist/{chunk-KTV5RQBQ.js.map → chunk-5TOV7EDF.js.map} +0 -0
- /package/dist/{chunk-TJCTC5QI.js.map → chunk-LDCR7MRU.js.map} +0 -0
- /package/dist/{chunk-QJRXKMHJ.js.map → chunk-UNXMIWPK.js.map} +0 -0
- /package/dist/{chunk-XFCKMBOC.js.map → chunk-YFGG722I.js.map} +0 -0
- /package/dist/{chunk-MX55JP7D.js.map → chunk-ZMMIQOFI.js.map} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { LineApplicationRequest } from '@tangle-network/sandbox/core';
|
|
2
|
+
import { type ApplicationLineObservation } from '../hosted-agent/application';
|
|
3
|
+
import type { ResolvedAgentEnrollment } from './index';
|
|
4
|
+
/** The host verifies Hub's signed callback before the SDK parses its body. */
|
|
5
|
+
export interface AuthenticatedSharedLinePrincipal<Principal> {
|
|
6
|
+
principal: Principal;
|
|
7
|
+
binding: string;
|
|
8
|
+
}
|
|
9
|
+
/** Current host-owned app, customer and member grant for one Hub subject. */
|
|
10
|
+
export interface LiveSharedEnrollmentMember {
|
|
11
|
+
binding: string;
|
|
12
|
+
subjectId: string;
|
|
13
|
+
appId: string;
|
|
14
|
+
lineId: string;
|
|
15
|
+
attachmentId: string;
|
|
16
|
+
memberId: string;
|
|
17
|
+
/** Changes on every grant, consent, or target remap, including revoke and regrant. */
|
|
18
|
+
grantRevision: string;
|
|
19
|
+
ownerUserId: string;
|
|
20
|
+
senderAddress: string;
|
|
21
|
+
enrollmentId: string;
|
|
22
|
+
agentId: string;
|
|
23
|
+
workspaceId: string;
|
|
24
|
+
threadId: string;
|
|
25
|
+
}
|
|
26
|
+
export interface EnrolledApplicationLineOptions<Principal> {
|
|
27
|
+
/** Verify the server-to-server callback; the maintained SDK parses its subjectId. */
|
|
28
|
+
authenticate(request: Request): Promise<AuthenticatedSharedLinePrincipal<Principal>>;
|
|
29
|
+
/** Select an intended app from durable policy. Message text is intent, never a grant. */
|
|
30
|
+
selectApp(authenticated: AuthenticatedSharedLinePrincipal<Principal>, input: Readonly<LineApplicationRequest>): Promise<string>;
|
|
31
|
+
/** Re-read live app, customer, consent and member grant for the selected app. */
|
|
32
|
+
lookup(principal: Principal, binding: string, subjectId: string, appId: string): Promise<LiveSharedEnrollmentMember | null>;
|
|
33
|
+
enrollment: {
|
|
34
|
+
resolve(principal: Principal, enrollmentId: string): Promise<ResolvedAgentEnrollment>;
|
|
35
|
+
};
|
|
36
|
+
/** Read through the application's existing durable output store using the pinned grant. */
|
|
37
|
+
read(resolved: ResolvedAgentEnrollment, input: Readonly<LineApplicationRequest>, member: Readonly<LiveSharedEnrollmentMember>): Promise<ApplicationLineObservation>;
|
|
38
|
+
/** Atomically compare the pinned grant revision at the durable task write before paid work. */
|
|
39
|
+
admit(resolved: ResolvedAgentEnrollment, input: Readonly<LineApplicationRequest>, member: Readonly<LiveSharedEnrollmentMember>): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/** Bind a signed shared Line member to the same native target used by web and ChatGPT. */
|
|
42
|
+
export declare function createEnrolledApplicationLineHandler<Principal>(options: EnrolledApplicationLineOptions<Principal>): (request: Request) => Promise<Response>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable enrollment claims for products that already use Drizzle over D1.
|
|
3
|
+
* This optional subpath leaves the core enrollment module free of Drizzle.
|
|
4
|
+
*
|
|
5
|
+
* The product owns two SQLite tables and their migration:
|
|
6
|
+
*
|
|
7
|
+
* - `instanceClaims`: NOT NULL ownerScope, instanceKey, profileVersion and
|
|
8
|
+
* configurationDigest; PRIMARY KEY (ownerScope, instanceKey).
|
|
9
|
+
* - `enrollments`: PRIMARY KEY enrollmentId with explicit NOT NULL; NOT NULL
|
|
10
|
+
* ownerScope and every other AgentEnrollmentClaim field; nullable generation, sandboxId,
|
|
11
|
+
* filesystemIncarnationId and sessionId. These four target fields must be
|
|
12
|
+
* all NULL or all non-NULL, and a committed target must be immutable.
|
|
13
|
+
*
|
|
14
|
+
* `enrollmentId` must be explicitly NOT NULL: the guarded insert returns NULL
|
|
15
|
+
* for a mismatched instance config, which must abort the entire batch. The
|
|
16
|
+
* instance row must be immutable while an enrollment references it. A foreign
|
|
17
|
+
* key from (ownerScope, instanceKey) to the reservation is recommended.
|
|
18
|
+
* Products may add their own foreign keys and live authorization triggers.
|
|
19
|
+
* No table is created or changed by this adapter.
|
|
20
|
+
*
|
|
21
|
+
* `claimIfAbsent` uses one D1 batch. Its second statement can insert an
|
|
22
|
+
* enrollment only when the reserved instance has the same profile and digest.
|
|
23
|
+
* The final statement removes a reservation created by a losing enrollment-ID
|
|
24
|
+
* race, before the batch commits. D1 batches are atomic; a driver without
|
|
25
|
+
* batch is refused rather than leaving half a claim.
|
|
26
|
+
*/
|
|
27
|
+
import type { AnySQLiteColumn, AnySQLiteTable, BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
|
|
28
|
+
import { type AgentEnrollmentStore } from './index';
|
|
29
|
+
export type AgentEnrollmentDatabase = BaseSQLiteDatabase<'sync' | 'async', any, any>;
|
|
30
|
+
/** Required Drizzle column properties; SQL column names remain product-owned. */
|
|
31
|
+
export type AgentInstanceClaimTable = AnySQLiteTable & {
|
|
32
|
+
ownerScope: AnySQLiteColumn;
|
|
33
|
+
instanceKey: AnySQLiteColumn;
|
|
34
|
+
profileVersion: AnySQLiteColumn;
|
|
35
|
+
configurationDigest: AnySQLiteColumn;
|
|
36
|
+
};
|
|
37
|
+
/** The claim and its write-once native target share one enrollment row. */
|
|
38
|
+
export type AgentEnrollmentClaimTable = AnySQLiteTable & {
|
|
39
|
+
enrollmentId: AnySQLiteColumn;
|
|
40
|
+
ownerScope: AnySQLiteColumn;
|
|
41
|
+
agentId: AnySQLiteColumn;
|
|
42
|
+
workspaceId: AnySQLiteColumn;
|
|
43
|
+
threadId: AnySQLiteColumn;
|
|
44
|
+
instanceKey: AnySQLiteColumn;
|
|
45
|
+
profileVersion: AnySQLiteColumn;
|
|
46
|
+
configurationDigest: AnySQLiteColumn;
|
|
47
|
+
generation: AnySQLiteColumn;
|
|
48
|
+
sandboxId: AnySQLiteColumn;
|
|
49
|
+
filesystemIncarnationId: AnySQLiteColumn;
|
|
50
|
+
sessionId: AnySQLiteColumn;
|
|
51
|
+
};
|
|
52
|
+
export interface CreateDrizzleAgentEnrollmentStoreOptions {
|
|
53
|
+
db: AgentEnrollmentDatabase;
|
|
54
|
+
instanceClaims: AgentInstanceClaimTable;
|
|
55
|
+
enrollments: AgentEnrollmentClaimTable;
|
|
56
|
+
/** Stable owner identity, obtained from the host's authenticated request. */
|
|
57
|
+
ownerScope: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create an owner-scoped Drizzle D1 store; SQL `enrollment_id` must be explicitly `NOT NULL`.
|
|
61
|
+
* A config mismatch inserts NULL to roll back the entire claim batch.
|
|
62
|
+
*/
|
|
63
|
+
export declare function createDrizzleAgentEnrollmentStore(options: CreateDrizzleAgentEnrollmentStoreOptions): AgentEnrollmentStore;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EnrollmentTargetError
|
|
3
|
+
} from "../chunk-NLXY7TFB.js";
|
|
4
|
+
import "../chunk-6RWQ4VW5.js";
|
|
5
|
+
import "../chunk-3NCPXNBZ.js";
|
|
6
|
+
import "../chunk-TXD5HXLE.js";
|
|
7
|
+
|
|
8
|
+
// src/agent-enrollment/drizzle.ts
|
|
9
|
+
import { and, eq, exists, isNull, notExists, sql } from "drizzle-orm";
|
|
10
|
+
function claimFromRow(row) {
|
|
11
|
+
return {
|
|
12
|
+
enrollmentId: row.enrollmentId,
|
|
13
|
+
agentId: row.agentId,
|
|
14
|
+
workspaceId: row.workspaceId,
|
|
15
|
+
threadId: row.threadId,
|
|
16
|
+
instanceKey: row.instanceKey,
|
|
17
|
+
profileVersion: row.profileVersion,
|
|
18
|
+
configurationDigest: row.configurationDigest
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function targetFromRow(row) {
|
|
22
|
+
const values = [row.generation, row.sandboxId, row.filesystemIncarnationId, row.sessionId];
|
|
23
|
+
if (values.every((value) => value === null)) return null;
|
|
24
|
+
if (values.some((value) => value === null)) throw new EnrollmentTargetError("target_changed");
|
|
25
|
+
return {
|
|
26
|
+
...claimFromRow(row),
|
|
27
|
+
generation: row.generation,
|
|
28
|
+
sandboxId: row.sandboxId,
|
|
29
|
+
filesystemIncarnationId: row.filesystemIncarnationId,
|
|
30
|
+
sessionId: row.sessionId
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function createDrizzleAgentEnrollmentStore(options) {
|
|
34
|
+
const { db, instanceClaims, enrollments, ownerScope } = options;
|
|
35
|
+
if (!ownerScope.trim()) throw new EnrollmentTargetError("invalid_request");
|
|
36
|
+
const atomicDb = db;
|
|
37
|
+
async function findEnrollment(enrollmentId) {
|
|
38
|
+
const rows = await db.select().from(enrollments).where(and(
|
|
39
|
+
eq(enrollments.enrollmentId, enrollmentId),
|
|
40
|
+
eq(enrollments.ownerScope, ownerScope)
|
|
41
|
+
)).limit(1);
|
|
42
|
+
return rows[0] ?? null;
|
|
43
|
+
}
|
|
44
|
+
async function findInstance(instanceKey) {
|
|
45
|
+
const rows = await db.select({
|
|
46
|
+
profileVersion: instanceClaims.profileVersion,
|
|
47
|
+
configurationDigest: instanceClaims.configurationDigest
|
|
48
|
+
}).from(instanceClaims).where(and(
|
|
49
|
+
eq(instanceClaims.ownerScope, ownerScope),
|
|
50
|
+
eq(instanceClaims.instanceKey, instanceKey)
|
|
51
|
+
)).limit(1);
|
|
52
|
+
return rows[0] ?? null;
|
|
53
|
+
}
|
|
54
|
+
async function matchingInstance(claim) {
|
|
55
|
+
const instance = await findInstance(claim.instanceKey);
|
|
56
|
+
return !!instance && instance.profileVersion === claim.profileVersion && instance.configurationDigest === claim.configurationDigest;
|
|
57
|
+
}
|
|
58
|
+
async function get(enrollmentId) {
|
|
59
|
+
const row = await findEnrollment(enrollmentId);
|
|
60
|
+
if (!row) return null;
|
|
61
|
+
const target = targetFromRow(row);
|
|
62
|
+
if (!target) return null;
|
|
63
|
+
if (!await matchingInstance(target)) throw new EnrollmentTargetError("target_changed");
|
|
64
|
+
return target;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
get,
|
|
68
|
+
async claimIfAbsent(input) {
|
|
69
|
+
if (typeof atomicDb.batch !== "function") {
|
|
70
|
+
throw new Error("Agent enrollment requires an atomic Drizzle D1 batch");
|
|
71
|
+
}
|
|
72
|
+
const claim = { ...input };
|
|
73
|
+
const instanceScope = and(
|
|
74
|
+
eq(instanceClaims.ownerScope, ownerScope),
|
|
75
|
+
eq(instanceClaims.instanceKey, claim.instanceKey)
|
|
76
|
+
);
|
|
77
|
+
const reservation = db.insert(instanceClaims).values({
|
|
78
|
+
ownerScope,
|
|
79
|
+
instanceKey: claim.instanceKey,
|
|
80
|
+
profileVersion: claim.profileVersion,
|
|
81
|
+
configurationDigest: claim.configurationDigest
|
|
82
|
+
}).onConflictDoNothing();
|
|
83
|
+
const validEnrollmentId = sql`(
|
|
84
|
+
SELECT ${claim.enrollmentId} FROM ${instanceClaims}
|
|
85
|
+
WHERE ${instanceScope}
|
|
86
|
+
AND ${instanceClaims.profileVersion} = ${claim.profileVersion}
|
|
87
|
+
AND ${instanceClaims.configurationDigest} = ${claim.configurationDigest}
|
|
88
|
+
LIMIT 1
|
|
89
|
+
)`;
|
|
90
|
+
const enrollment = db.insert(enrollments).values({
|
|
91
|
+
...claim,
|
|
92
|
+
ownerScope,
|
|
93
|
+
enrollmentId: validEnrollmentId
|
|
94
|
+
}).onConflictDoNothing();
|
|
95
|
+
const cleanup = db.delete(instanceClaims).where(and(
|
|
96
|
+
instanceScope,
|
|
97
|
+
eq(instanceClaims.profileVersion, claim.profileVersion),
|
|
98
|
+
eq(instanceClaims.configurationDigest, claim.configurationDigest),
|
|
99
|
+
notExists(db.select({ id: enrollments.enrollmentId }).from(enrollments).where(and(
|
|
100
|
+
eq(enrollments.ownerScope, ownerScope),
|
|
101
|
+
eq(enrollments.instanceKey, claim.instanceKey)
|
|
102
|
+
)))
|
|
103
|
+
));
|
|
104
|
+
try {
|
|
105
|
+
await atomicDb.batch([reservation, enrollment, cleanup]);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
const existing = await findEnrollment(claim.enrollmentId);
|
|
108
|
+
if (existing) {
|
|
109
|
+
const winner = claimFromRow(existing);
|
|
110
|
+
if (!await matchingInstance(winner)) throw new EnrollmentTargetError("conflict");
|
|
111
|
+
return winner;
|
|
112
|
+
}
|
|
113
|
+
const instance = await findInstance(claim.instanceKey);
|
|
114
|
+
if (instance && (instance.profileVersion !== claim.profileVersion || instance.configurationDigest !== claim.configurationDigest)) {
|
|
115
|
+
throw new EnrollmentTargetError("conflict");
|
|
116
|
+
}
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
const row = await findEnrollment(claim.enrollmentId);
|
|
120
|
+
if (!row) throw new EnrollmentTargetError("conflict");
|
|
121
|
+
if (!await matchingInstance(claimFromRow(row))) throw new EnrollmentTargetError("conflict");
|
|
122
|
+
return claimFromRow(row);
|
|
123
|
+
},
|
|
124
|
+
async insertIfAbsent(target) {
|
|
125
|
+
const saved = { ...target };
|
|
126
|
+
await db.update(enrollments).set({
|
|
127
|
+
generation: saved.generation,
|
|
128
|
+
sandboxId: saved.sandboxId,
|
|
129
|
+
filesystemIncarnationId: saved.filesystemIncarnationId,
|
|
130
|
+
sessionId: saved.sessionId
|
|
131
|
+
}).where(and(
|
|
132
|
+
eq(enrollments.enrollmentId, saved.enrollmentId),
|
|
133
|
+
eq(enrollments.ownerScope, ownerScope),
|
|
134
|
+
eq(enrollments.agentId, saved.agentId),
|
|
135
|
+
eq(enrollments.workspaceId, saved.workspaceId),
|
|
136
|
+
eq(enrollments.threadId, saved.threadId),
|
|
137
|
+
eq(enrollments.instanceKey, saved.instanceKey),
|
|
138
|
+
eq(enrollments.profileVersion, saved.profileVersion),
|
|
139
|
+
eq(enrollments.configurationDigest, saved.configurationDigest),
|
|
140
|
+
isNull(enrollments.generation),
|
|
141
|
+
isNull(enrollments.sandboxId),
|
|
142
|
+
isNull(enrollments.filesystemIncarnationId),
|
|
143
|
+
isNull(enrollments.sessionId),
|
|
144
|
+
exists(db.select({ key: instanceClaims.instanceKey }).from(instanceClaims).where(and(
|
|
145
|
+
eq(instanceClaims.ownerScope, ownerScope),
|
|
146
|
+
eq(instanceClaims.instanceKey, saved.instanceKey),
|
|
147
|
+
eq(instanceClaims.profileVersion, saved.profileVersion),
|
|
148
|
+
eq(instanceClaims.configurationDigest, saved.configurationDigest)
|
|
149
|
+
)))
|
|
150
|
+
));
|
|
151
|
+
const winner = await get(saved.enrollmentId);
|
|
152
|
+
if (!winner) throw new EnrollmentTargetError("conflict");
|
|
153
|
+
return winner;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
createDrizzleAgentEnrollmentStore
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=drizzle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/agent-enrollment/drizzle.ts"],"sourcesContent":["/**\n * Durable enrollment claims for products that already use Drizzle over D1.\n * This optional subpath leaves the core enrollment module free of Drizzle.\n *\n * The product owns two SQLite tables and their migration:\n *\n * - `instanceClaims`: NOT NULL ownerScope, instanceKey, profileVersion and\n * configurationDigest; PRIMARY KEY (ownerScope, instanceKey).\n * - `enrollments`: PRIMARY KEY enrollmentId with explicit NOT NULL; NOT NULL\n * ownerScope and every other AgentEnrollmentClaim field; nullable generation, sandboxId,\n * filesystemIncarnationId and sessionId. These four target fields must be\n * all NULL or all non-NULL, and a committed target must be immutable.\n *\n * `enrollmentId` must be explicitly NOT NULL: the guarded insert returns NULL\n * for a mismatched instance config, which must abort the entire batch. The\n * instance row must be immutable while an enrollment references it. A foreign\n * key from (ownerScope, instanceKey) to the reservation is recommended.\n * Products may add their own foreign keys and live authorization triggers.\n * No table is created or changed by this adapter.\n *\n * `claimIfAbsent` uses one D1 batch. Its second statement can insert an\n * enrollment only when the reserved instance has the same profile and digest.\n * The final statement removes a reservation created by a losing enrollment-ID\n * race, before the batch commits. D1 batches are atomic; a driver without\n * batch is refused rather than leaving half a claim.\n */\n\nimport { and, eq, exists, isNull, notExists, sql } from 'drizzle-orm'\nimport type { AnySQLiteColumn, AnySQLiteTable, BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core'\nimport {\n EnrollmentTargetError,\n type AgentEnrollmentClaim,\n type AgentEnrollmentStore,\n type AgentEnrollmentTarget,\n} from './index'\n\nexport type AgentEnrollmentDatabase = BaseSQLiteDatabase<'sync' | 'async', any, any>\n\n/** Required Drizzle column properties; SQL column names remain product-owned. */\nexport type AgentInstanceClaimTable = AnySQLiteTable & {\n ownerScope: AnySQLiteColumn\n instanceKey: AnySQLiteColumn\n profileVersion: AnySQLiteColumn\n configurationDigest: AnySQLiteColumn\n}\n\n/** The claim and its write-once native target share one enrollment row. */\nexport type AgentEnrollmentClaimTable = AnySQLiteTable & {\n enrollmentId: AnySQLiteColumn\n ownerScope: AnySQLiteColumn\n agentId: AnySQLiteColumn\n workspaceId: AnySQLiteColumn\n threadId: AnySQLiteColumn\n instanceKey: AnySQLiteColumn\n profileVersion: AnySQLiteColumn\n configurationDigest: AnySQLiteColumn\n generation: AnySQLiteColumn\n sandboxId: AnySQLiteColumn\n filesystemIncarnationId: AnySQLiteColumn\n sessionId: AnySQLiteColumn\n}\n\nexport interface CreateDrizzleAgentEnrollmentStoreOptions {\n db: AgentEnrollmentDatabase\n instanceClaims: AgentInstanceClaimTable\n enrollments: AgentEnrollmentClaimTable\n /** Stable owner identity, obtained from the host's authenticated request. */\n ownerScope: string\n}\n\ntype EnrollmentRow = AgentEnrollmentClaim & {\n ownerScope: string\n generation: number | null\n sandboxId: string | null\n filesystemIncarnationId: string | null\n sessionId: string | null\n}\n\ntype InstanceRow = {\n profileVersion: string\n configurationDigest: string\n}\n\nfunction claimFromRow(row: EnrollmentRow): AgentEnrollmentClaim {\n return {\n enrollmentId: row.enrollmentId,\n agentId: row.agentId,\n workspaceId: row.workspaceId,\n threadId: row.threadId,\n instanceKey: row.instanceKey,\n profileVersion: row.profileVersion,\n configurationDigest: row.configurationDigest,\n }\n}\n\nfunction targetFromRow(row: EnrollmentRow): AgentEnrollmentTarget | null {\n const values = [row.generation, row.sandboxId, row.filesystemIncarnationId, row.sessionId]\n if (values.every(value => value === null)) return null\n if (values.some(value => value === null)) throw new EnrollmentTargetError('target_changed')\n return {\n ...claimFromRow(row),\n generation: row.generation!,\n sandboxId: row.sandboxId!,\n filesystemIncarnationId: row.filesystemIncarnationId!,\n sessionId: row.sessionId!,\n }\n}\n\n/**\n * Create an owner-scoped Drizzle D1 store; SQL `enrollment_id` must be explicitly `NOT NULL`.\n * A config mismatch inserts NULL to roll back the entire claim batch.\n */\nexport function createDrizzleAgentEnrollmentStore(\n options: CreateDrizzleAgentEnrollmentStoreOptions,\n): AgentEnrollmentStore {\n const { db, instanceClaims, enrollments, ownerScope } = options\n if (!ownerScope.trim()) throw new EnrollmentTargetError('invalid_request')\n const atomicDb = db as AgentEnrollmentDatabase & {\n batch?: (statements: [unknown, ...unknown[]]) => Promise<unknown[]>\n }\n\n async function findEnrollment(enrollmentId: string): Promise<EnrollmentRow | null> {\n const rows = await db.select().from(enrollments).where(and(\n eq(enrollments.enrollmentId, enrollmentId), eq(enrollments.ownerScope, ownerScope),\n )).limit(1)\n return (rows[0] ?? null) as EnrollmentRow | null\n }\n\n async function findInstance(instanceKey: string): Promise<InstanceRow | null> {\n const rows = await db.select({\n profileVersion: instanceClaims.profileVersion,\n configurationDigest: instanceClaims.configurationDigest,\n }).from(instanceClaims).where(and(\n eq(instanceClaims.ownerScope, ownerScope), eq(instanceClaims.instanceKey, instanceKey),\n )).limit(1)\n return (rows[0] ?? null) as InstanceRow | null\n }\n\n async function matchingInstance(claim: AgentEnrollmentClaim): Promise<boolean> {\n const instance = await findInstance(claim.instanceKey)\n return !!instance && instance.profileVersion === claim.profileVersion\n && instance.configurationDigest === claim.configurationDigest\n }\n\n async function get(enrollmentId: string): Promise<AgentEnrollmentTarget | null> {\n const row = await findEnrollment(enrollmentId)\n if (!row) return null\n const target = targetFromRow(row)\n if (!target) return null\n if (!await matchingInstance(target)) throw new EnrollmentTargetError('target_changed')\n return target\n }\n\n return {\n get,\n async claimIfAbsent(input) {\n if (typeof atomicDb.batch !== 'function') {\n throw new Error('Agent enrollment requires an atomic Drizzle D1 batch')\n }\n const claim: AgentEnrollmentClaim = { ...input }\n const instanceScope = and(\n eq(instanceClaims.ownerScope, ownerScope),\n eq(instanceClaims.instanceKey, claim.instanceKey),\n )\n const reservation = db.insert(instanceClaims).values({\n ownerScope, instanceKey: claim.instanceKey,\n profileVersion: claim.profileVersion,\n configurationDigest: claim.configurationDigest,\n }).onConflictDoNothing()\n // A NULL enrollment ID fails the required NOT NULL constraint. The\n // atomic batch then rolls back a reservation with a different config.\n const validEnrollmentId = sql<string>`(\n SELECT ${claim.enrollmentId} FROM ${instanceClaims}\n WHERE ${instanceScope}\n AND ${instanceClaims.profileVersion} = ${claim.profileVersion}\n AND ${instanceClaims.configurationDigest} = ${claim.configurationDigest}\n LIMIT 1\n )`\n const enrollment = db.insert(enrollments).values({\n ...claim, ownerScope, enrollmentId: validEnrollmentId,\n }).onConflictDoNothing()\n // If enrollmentId was already taken by a different key, the second\n // insert does nothing. Remove only a reservation with no enrollment.\n const cleanup = db.delete(instanceClaims).where(and(\n instanceScope,\n eq(instanceClaims.profileVersion, claim.profileVersion),\n eq(instanceClaims.configurationDigest, claim.configurationDigest),\n notExists(db.select({ id: enrollments.enrollmentId }).from(enrollments).where(and(\n eq(enrollments.ownerScope, ownerScope),\n eq(enrollments.instanceKey, claim.instanceKey),\n ))),\n ))\n try {\n await atomicDb.batch([reservation, enrollment, cleanup])\n } catch (error) {\n const existing = await findEnrollment(claim.enrollmentId)\n if (existing) {\n const winner = claimFromRow(existing)\n if (!await matchingInstance(winner)) throw new EnrollmentTargetError('conflict')\n return winner\n }\n const instance = await findInstance(claim.instanceKey)\n if (instance && (instance.profileVersion !== claim.profileVersion\n || instance.configurationDigest !== claim.configurationDigest)) {\n throw new EnrollmentTargetError('conflict')\n }\n throw error\n }\n const row = await findEnrollment(claim.enrollmentId)\n if (!row) throw new EnrollmentTargetError('conflict')\n if (!await matchingInstance(claimFromRow(row))) throw new EnrollmentTargetError('conflict')\n return claimFromRow(row)\n },\n async insertIfAbsent(target) {\n const saved = { ...target }\n await db.update(enrollments).set({\n generation: saved.generation,\n sandboxId: saved.sandboxId,\n filesystemIncarnationId: saved.filesystemIncarnationId,\n sessionId: saved.sessionId,\n }).where(and(\n eq(enrollments.enrollmentId, saved.enrollmentId),\n eq(enrollments.ownerScope, ownerScope),\n eq(enrollments.agentId, saved.agentId),\n eq(enrollments.workspaceId, saved.workspaceId),\n eq(enrollments.threadId, saved.threadId),\n eq(enrollments.instanceKey, saved.instanceKey),\n eq(enrollments.profileVersion, saved.profileVersion),\n eq(enrollments.configurationDigest, saved.configurationDigest),\n isNull(enrollments.generation),\n isNull(enrollments.sandboxId),\n isNull(enrollments.filesystemIncarnationId),\n isNull(enrollments.sessionId),\n exists(db.select({ key: instanceClaims.instanceKey }).from(instanceClaims).where(and(\n eq(instanceClaims.ownerScope, ownerScope),\n eq(instanceClaims.instanceKey, saved.instanceKey),\n eq(instanceClaims.profileVersion, saved.profileVersion),\n eq(instanceClaims.configurationDigest, saved.configurationDigest),\n ))),\n ))\n const winner = await get(saved.enrollmentId)\n if (!winner) throw new EnrollmentTargetError('conflict')\n return winner\n },\n }\n}\n"],"mappings":";;;;;;;;AA2BA,SAAS,KAAK,IAAI,QAAQ,QAAQ,WAAW,WAAW;AAwDxD,SAAS,aAAa,KAA0C;AAC9D,SAAO;AAAA,IACL,cAAc,IAAI;AAAA,IAClB,SAAS,IAAI;AAAA,IACb,aAAa,IAAI;AAAA,IACjB,UAAU,IAAI;AAAA,IACd,aAAa,IAAI;AAAA,IACjB,gBAAgB,IAAI;AAAA,IACpB,qBAAqB,IAAI;AAAA,EAC3B;AACF;AAEA,SAAS,cAAc,KAAkD;AACvE,QAAM,SAAS,CAAC,IAAI,YAAY,IAAI,WAAW,IAAI,yBAAyB,IAAI,SAAS;AACzF,MAAI,OAAO,MAAM,WAAS,UAAU,IAAI,EAAG,QAAO;AAClD,MAAI,OAAO,KAAK,WAAS,UAAU,IAAI,EAAG,OAAM,IAAI,sBAAsB,gBAAgB;AAC1F,SAAO;AAAA,IACL,GAAG,aAAa,GAAG;AAAA,IACnB,YAAY,IAAI;AAAA,IAChB,WAAW,IAAI;AAAA,IACf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YAAY,SAAS;AAAA,QAC5B,OAAO,GAAG,OAAO,EAAE,KAAK,eAAe,YAAY,CAAC,EAAE,KAAK,cAAc,EAAE,MAAM;AAAA,UAC/E,GAAG,eAAe,YAAY,UAAU;AAAA,UACxC,GAAG,eAAe,aAAa,MAAM,WAAW;AAAA,UAChD,GAAG,eAAe,gBAAgB,MAAM,cAAc;AAAA,UACtD,GAAG,eAAe,qBAAqB,MAAM,mBAAmB;AAAA,QAClE,CAAC,CAAC;AAAA,MACJ,CAAC;AACD,YAAM,SAAS,MAAM,IAAI,MAAM,YAAY;AAC3C,UAAI,CAAC,OAAQ,OAAM,IAAI,sBAAsB,UAAU;AACvD,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { EnsureInstanceOptions, Sandbox, SandboxInstance } from '@tangle-network/sandbox/core';
|
|
2
|
+
export { createEnrolledApplicationLineHandler } from './application';
|
|
3
|
+
export type { AuthenticatedSharedLinePrincipal, LiveSharedEnrollmentMember, EnrolledApplicationLineOptions } from './application';
|
|
4
|
+
/** An application's durable pointer to one private agent's native SDK session. */
|
|
5
|
+
export interface AgentEnrollmentTarget {
|
|
6
|
+
enrollmentId: string;
|
|
7
|
+
agentId: string;
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
threadId: string;
|
|
10
|
+
instanceKey: string;
|
|
11
|
+
configurationDigest: string;
|
|
12
|
+
generation: number;
|
|
13
|
+
profileVersion: string;
|
|
14
|
+
sandboxId: string;
|
|
15
|
+
filesystemIncarnationId: string;
|
|
16
|
+
sessionId: string;
|
|
17
|
+
}
|
|
18
|
+
export type AgentEnrollmentIdentity = Pick<AgentEnrollmentTarget, 'enrollmentId' | 'agentId' | 'workspaceId' | 'threadId'>;
|
|
19
|
+
export interface AgentEnrollmentRequest extends AgentEnrollmentIdentity {
|
|
20
|
+
/** The host derives this from the authorized agent and its saved profile. */
|
|
21
|
+
instance: Pick<EnsureInstanceOptions, 'key' | 'create'> & {
|
|
22
|
+
profile: NonNullable<EnsureInstanceOptions['profile']>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Immutable reservation made before any SDK provisioning can change an instance. */
|
|
26
|
+
export type AgentEnrollmentClaim = AgentEnrollmentIdentity & Pick<AgentEnrollmentTarget, 'instanceKey' | 'profileVersion' | 'configurationDigest'>;
|
|
27
|
+
export interface AgentEnrollmentStore {
|
|
28
|
+
get(enrollmentId: string): Promise<AgentEnrollmentTarget | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Atomically reserve the enrollment and instance key before SDK effects.
|
|
31
|
+
* Return the existing claim for an enrollment ID. Reject another configuration
|
|
32
|
+
* for a reserved instance key, even under a different enrollment ID.
|
|
33
|
+
* Claims survive failed provisioning so an identical request can retry.
|
|
34
|
+
*/
|
|
35
|
+
claimIfAbsent(claim: AgentEnrollmentClaim): Promise<AgentEnrollmentClaim>;
|
|
36
|
+
/** Atomically commit only under the matching claim. Never overwrite a target. */
|
|
37
|
+
insertIfAbsent(target: AgentEnrollmentTarget): Promise<AgentEnrollmentTarget>;
|
|
38
|
+
}
|
|
39
|
+
export interface AgentEnrollmentOptions<Principal> {
|
|
40
|
+
/** Check the live agent, workspace, thread and owner grant on every call. */
|
|
41
|
+
authorize(principal: Principal, identity: AgentEnrollmentIdentity, operation: 'enroll' | 'resolve'): Promise<void>;
|
|
42
|
+
/** Return the caller's owner-scoped SDK client. Never use a global service key. */
|
|
43
|
+
client(principal: Principal): Pick<Sandbox, 'instances' | 'get'> | Promise<Pick<Sandbox, 'instances' | 'get'>>;
|
|
44
|
+
store: AgentEnrollmentStore;
|
|
45
|
+
}
|
|
46
|
+
export declare class EnrollmentTargetError extends Error {
|
|
47
|
+
readonly code: 'invalid_request' | 'missing' | 'conflict' | 'target_changed' | 'session_missing';
|
|
48
|
+
constructor(code: 'invalid_request' | 'missing' | 'conflict' | 'target_changed' | 'session_missing');
|
|
49
|
+
}
|
|
50
|
+
export interface ResolvedAgentEnrollment {
|
|
51
|
+
target: AgentEnrollmentTarget;
|
|
52
|
+
box: SandboxInstance;
|
|
53
|
+
session: ReturnType<SandboxInstance['session']>;
|
|
54
|
+
}
|
|
55
|
+
/** Share one authenticated target between an app's phone, web and ChatGPT adapters. */
|
|
56
|
+
export declare function createAgentEnrollment<Principal>(options: AgentEnrollmentOptions<Principal>): {
|
|
57
|
+
enroll: (principal: Principal, request: AgentEnrollmentRequest) => Promise<AgentEnrollmentTarget>;
|
|
58
|
+
resolve: (principal: Principal, enrollmentId: string) => Promise<ResolvedAgentEnrollment>;
|
|
59
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EnrollmentTargetError,
|
|
3
|
+
createAgentEnrollment,
|
|
4
|
+
createEnrolledApplicationLineHandler
|
|
5
|
+
} from "../chunk-NLXY7TFB.js";
|
|
6
|
+
import "../chunk-6RWQ4VW5.js";
|
|
7
|
+
import "../chunk-3NCPXNBZ.js";
|
|
8
|
+
import "../chunk-TXD5HXLE.js";
|
|
9
|
+
export {
|
|
10
|
+
EnrollmentTargetError,
|
|
11
|
+
createAgentEnrollment,
|
|
12
|
+
createEnrolledApplicationLineHandler
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/assistant/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChatEmptyState,
|
|
3
3
|
ChatMessages
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-UNXMIWPK.js";
|
|
5
5
|
import "../chunk-42FA6YQH.js";
|
|
6
6
|
import "../chunk-3HUFJ5LO.js";
|
|
7
7
|
import "../chunk-FBVLEGEG.js";
|
|
8
8
|
import "../chunk-ENLRJYVW.js";
|
|
9
|
+
import "../chunk-GEYACSFW.js";
|
|
9
10
|
import {
|
|
10
11
|
ChatComposer
|
|
11
12
|
} from "../chunk-OSZBBLK5.js";
|
|
@@ -13,9 +14,8 @@ import "../chunk-L7MB2LLM.js";
|
|
|
13
14
|
import {
|
|
14
15
|
ModelPicker
|
|
15
16
|
} from "../chunk-XF6ZRY56.js";
|
|
16
|
-
import "../chunk-BATKJP3P.js";
|
|
17
17
|
import "../chunk-SJWIZT7B.js";
|
|
18
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-BATKJP3P.js";
|
|
19
19
|
import {
|
|
20
20
|
AsyncView
|
|
21
21
|
} from "../chunk-Q3ZHNN5X.js";
|
|
@@ -23,13 +23,13 @@ import "../chunk-FQYAJYPW.js";
|
|
|
23
23
|
import "../chunk-NU7QSZBR.js";
|
|
24
24
|
import "../chunk-MCYJON3F.js";
|
|
25
25
|
import "../chunk-7YA4QNTU.js";
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-X47R2IVO.js";
|
|
26
|
+
import "../chunk-4PZE7XAM.js";
|
|
28
27
|
import "../chunk-ZVEEWGDK.js";
|
|
28
|
+
import "../chunk-X47R2IVO.js";
|
|
29
29
|
import "../chunk-TXD5HXLE.js";
|
|
30
|
-
import "../chunk-
|
|
31
|
-
import "../chunk-YJMCRXQQ.js";
|
|
30
|
+
import "../chunk-ZMMIQOFI.js";
|
|
32
31
|
import "../chunk-M3K2HVQD.js";
|
|
32
|
+
import "../chunk-YJMCRXQQ.js";
|
|
33
33
|
|
|
34
34
|
// src/assistant/sse.ts
|
|
35
35
|
var SSEChunkParser = class {
|
|
@@ -45,13 +45,13 @@ import {
|
|
|
45
45
|
} from "../chunk-2TZLCQ5U.js";
|
|
46
46
|
import "../chunk-MCYJON3F.js";
|
|
47
47
|
import "../chunk-LWSJK546.js";
|
|
48
|
-
import "../chunk-
|
|
48
|
+
import "../chunk-5TOV7EDF.js";
|
|
49
49
|
import "../chunk-6A7MYOUI.js";
|
|
50
|
-
import "../chunk-
|
|
50
|
+
import "../chunk-LDCR7MRU.js";
|
|
51
51
|
import "../chunk-UGWQLQDS.js";
|
|
52
52
|
import "../chunk-S5SRJJQG.js";
|
|
53
|
-
import "../chunk-
|
|
54
|
-
import "../chunk-
|
|
53
|
+
import "../chunk-5KFRCVAO.js";
|
|
54
|
+
import "../chunk-CNI46COH.js";
|
|
55
55
|
import {
|
|
56
56
|
ProtectedModelSettlementError
|
|
57
57
|
} from "../chunk-KHRIPDW5.js";
|
|
@@ -64,15 +64,16 @@ import {
|
|
|
64
64
|
rowIdOf,
|
|
65
65
|
storeSupportsDraftPersistence,
|
|
66
66
|
streamChatRouteAsSandboxEvents
|
|
67
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-YFGG722I.js";
|
|
68
|
+
import "../chunk-WWFE5EXY.js";
|
|
68
69
|
import "../chunk-TZEEGDHS.js";
|
|
69
70
|
import "../chunk-3NCPXNBZ.js";
|
|
70
|
-
import "../chunk-WWFE5EXY.js";
|
|
71
71
|
import {
|
|
72
72
|
attachmentInputToPart,
|
|
73
73
|
attachmentKindForMime,
|
|
74
74
|
toChatMessageParts
|
|
75
|
-
} from "../chunk-
|
|
75
|
+
} from "../chunk-4PZE7XAM.js";
|
|
76
|
+
import "../chunk-ZVEEWGDK.js";
|
|
76
77
|
import {
|
|
77
78
|
ChatTurnInputError,
|
|
78
79
|
DISPATCH_MAX_MEDIA_PARTS,
|
|
@@ -94,7 +95,6 @@ import {
|
|
|
94
95
|
promptPartsByteSize,
|
|
95
96
|
validateSandboxMentionPath
|
|
96
97
|
} from "../chunk-X47R2IVO.js";
|
|
97
|
-
import "../chunk-ZVEEWGDK.js";
|
|
98
98
|
import {
|
|
99
99
|
isWorkspaceFileExportable
|
|
100
100
|
} from "../chunk-TXD5HXLE.js";
|
|
@@ -111,11 +111,7 @@ import {
|
|
|
111
111
|
normalizePersistedPart,
|
|
112
112
|
normalizeToolEvent,
|
|
113
113
|
terminalizeDanglingAssistantToolUpdates
|
|
114
|
-
} from "../chunk-
|
|
115
|
-
import {
|
|
116
|
-
parsePlanSubmittedEvent,
|
|
117
|
-
planToPersistedPart
|
|
118
|
-
} from "../chunk-YJMCRXQQ.js";
|
|
114
|
+
} from "../chunk-ZMMIQOFI.js";
|
|
119
115
|
import {
|
|
120
116
|
cancelStatusFor,
|
|
121
117
|
interactionPartKey,
|
|
@@ -126,6 +122,10 @@ import {
|
|
|
126
122
|
parseInteractionCancel,
|
|
127
123
|
parseInteractionRequest
|
|
128
124
|
} from "../chunk-M3K2HVQD.js";
|
|
125
|
+
import {
|
|
126
|
+
parsePlanSubmittedEvent,
|
|
127
|
+
planToPersistedPart
|
|
128
|
+
} from "../chunk-YJMCRXQQ.js";
|
|
129
129
|
import {
|
|
130
130
|
coalesceDeltas,
|
|
131
131
|
createBufferedTurnTap
|
package/dist/chat-store/index.js
CHANGED
|
@@ -19,15 +19,15 @@ import {
|
|
|
19
19
|
mentionInputToPart,
|
|
20
20
|
mentionPartsFromMessageParts,
|
|
21
21
|
toChatMessageParts
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import "../chunk-X47R2IVO.js";
|
|
22
|
+
} from "../chunk-4PZE7XAM.js";
|
|
24
23
|
import "../chunk-ZVEEWGDK.js";
|
|
24
|
+
import "../chunk-X47R2IVO.js";
|
|
25
25
|
import "../chunk-TXD5HXLE.js";
|
|
26
26
|
import {
|
|
27
27
|
attachmentPartKey
|
|
28
|
-
} from "../chunk-
|
|
29
|
-
import "../chunk-YJMCRXQQ.js";
|
|
28
|
+
} from "../chunk-ZMMIQOFI.js";
|
|
30
29
|
import "../chunk-M3K2HVQD.js";
|
|
30
|
+
import "../chunk-YJMCRXQQ.js";
|
|
31
31
|
|
|
32
32
|
// src/chat-store/core.ts
|
|
33
33
|
var BULK_DELETE_MAX_THREADS = 200;
|
|
@@ -273,7 +273,7 @@ function OperationErrorAlert({
|
|
|
273
273
|
"div",
|
|
274
274
|
{
|
|
275
275
|
role: "alert",
|
|
276
|
-
className: "flex shrink-0 items-center justify-between gap-3 border-b border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-
|
|
276
|
+
className: "flex shrink-0 items-center justify-between gap-3 border-b border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-[var(--surface-danger-text)]",
|
|
277
277
|
children: [
|
|
278
278
|
/* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1", children: message }),
|
|
279
279
|
/* @__PURE__ */ jsxs2("div", { className: "flex shrink-0 items-center gap-3", children: [
|
|
@@ -904,7 +904,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
|
|
|
904
904
|
setDeleteError(null);
|
|
905
905
|
setDeleteOpen(true);
|
|
906
906
|
},
|
|
907
|
-
className: "inline-flex h-7 w-7 items-center justify-center rounded text-
|
|
907
|
+
className: "inline-flex h-7 w-7 items-center justify-center rounded text-[var(--surface-danger-text)] transition-colors hover:bg-destructive/10",
|
|
908
908
|
children: /* @__PURE__ */ jsx2(Trash2, { className: "h-4 w-4" })
|
|
909
909
|
}
|
|
910
910
|
)
|
|
@@ -985,7 +985,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
|
|
|
985
985
|
className: "h-9 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground"
|
|
986
986
|
}
|
|
987
987
|
),
|
|
988
|
-
createError && /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-xs text-
|
|
988
|
+
createError && /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-xs text-[var(--surface-danger-text)]", children: createError.message })
|
|
989
989
|
] })
|
|
990
990
|
}
|
|
991
991
|
),
|
|
@@ -1003,7 +1003,7 @@ var VaultPane = forwardRef(function VaultPane2(props, ref) {
|
|
|
1003
1003
|
setDeleteOpen(false);
|
|
1004
1004
|
setDeleteError(null);
|
|
1005
1005
|
},
|
|
1006
|
-
children: deleteError && /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-xs text-
|
|
1006
|
+
children: deleteError && /* @__PURE__ */ jsx2("p", { role: "alert", className: "text-xs text-[var(--surface-danger-text)]", children: deleteError.message })
|
|
1007
1007
|
}
|
|
1008
1008
|
),
|
|
1009
1009
|
/* @__PURE__ */ jsx2(
|
|
@@ -1065,4 +1065,4 @@ export {
|
|
|
1065
1065
|
ConfirmDialog,
|
|
1066
1066
|
VaultPane
|
|
1067
1067
|
};
|
|
1068
|
-
//# sourceMappingURL=chunk-
|
|
1068
|
+
//# sourceMappingURL=chunk-3IATFW4U.js.map
|