@feltdb/core 0.12.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-runtime.d.ts +64 -2
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +121 -11
- package/dist/agent-state.d.ts +48 -0
- package/dist/agent-state.d.ts.map +1 -1
- package/dist/agent-state.js +174 -12
- package/dist/agent.d.ts +10 -1
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +10 -1
- package/dist/build-identity.json +4 -4
- package/dist/cli/commands.js +34 -7
- package/dist/cli/workspace-integration.js +8 -0
- package/dist/collection.d.ts +3 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +30 -8
- package/dist/create/build-identity.json +4 -4
- package/dist/create/cli.js +47 -38
- package/dist/create/create.js +21 -8
- package/dist/create/package-versions.js +1 -1
- package/dist/create/server-source/Cargo.lock +6 -6
- package/dist/create/server-source/Cargo.toml +1 -1
- package/dist/create/server-source/crates/feltdb/src/lib.rs +126 -35
- package/dist/create/server-source/crates/feltdb/src/state_contract.rs +162 -53
- package/dist/create/server-source/crates/feltdb/src/worker_mesh.rs +341 -2
- package/dist/create/server-source/crates/feltdb/src/workload.rs +2094 -126
- package/dist/create/server-source/crates/feltdb/tests/production_readiness_contract.rs +18 -12
- package/dist/create/server-source/crates/feltdb/tests/workload_envelope_contract.rs +17 -5
- package/dist/create/server-source/crates/feltdb-client/Cargo.toml +1 -1
- package/dist/create/server-source/crates/feltdb-server/Cargo.toml +1 -1
- package/dist/create/server-source/crates/feltdb-server/README.md +6 -1
- package/dist/create/server-source/crates/feltdb-server/src/agent_execution.rs +511 -0
- package/dist/create/server-source/crates/feltdb-server/src/app_state.rs +9 -1
- package/dist/create/server-source/crates/feltdb-server/src/auth.rs +113 -25
- package/dist/create/server-source/crates/feltdb-server/src/backup.rs +4 -0
- package/dist/create/server-source/crates/feltdb-server/src/console_accounts.rs +1009 -0
- package/dist/create/server-source/crates/feltdb-server/src/control_authorization.rs +441 -0
- package/dist/create/server-source/crates/feltdb-server/src/identity.rs +68 -6
- package/dist/create/server-source/crates/feltdb-server/src/key_management.rs +355 -23
- package/dist/create/server-source/crates/feltdb-server/src/lib.rs +4 -0
- package/dist/create/server-source/crates/feltdb-server/src/main.rs +1740 -236
- package/dist/create/server-source/crates/feltdb-server/src/redaction.rs +208 -0
- package/dist/create/server-source/crates/feltdb-server/src/tenancy.rs +198 -19
- package/dist/create/server-source/crates/feltdb-server/tests/transaction_precondition_contract.rs +403 -0
- package/dist/create/setup-summary.js +40 -0
- package/dist/db.d.ts +91 -10
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +170 -31
- package/dist/deployment.d.ts +19 -0
- package/dist/deployment.d.ts.map +1 -1
- package/dist/deployment.js +38 -2
- package/dist/development-runtime-bridge.d.ts +20 -0
- package/dist/development-runtime-bridge.d.ts.map +1 -1
- package/dist/development-runtime-bridge.js +61 -12
- package/dist/embedded-query.d.ts.map +1 -1
- package/dist/embedded-query.js +5 -4
- package/dist/embedded-transaction.d.ts +8 -4
- package/dist/embedded-transaction.d.ts.map +1 -1
- package/dist/embedded-transaction.js +55 -19
- package/dist/error-codes.d.ts +31 -2
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +41 -2
- package/dist/feltdb.d.ts +7 -0
- package/dist/feltdb.d.ts.map +1 -1
- package/dist/file-db.d.ts +27 -0
- package/dist/file-db.d.ts.map +1 -1
- package/dist/file-db.js +145 -7
- package/dist/http-client.d.ts +11 -3
- package/dist/http-client.d.ts.map +1 -1
- package/dist/http-client.js +27 -14
- package/dist/http-db.d.ts +40 -1
- package/dist/http-db.d.ts.map +1 -1
- package/dist/http-db.js +285 -58
- package/dist/index.js +1 -1
- package/dist/local-state-lock.d.ts +34 -0
- package/dist/local-state-lock.d.ts.map +1 -0
- package/dist/local-state-lock.js +225 -0
- package/dist/reactive-graph.d.ts +0 -3
- package/dist/reactive-graph.d.ts.map +1 -1
- package/dist/reactive-graph.js +11 -1
- package/dist/runtime-registry.d.ts +7 -2
- package/dist/runtime-registry.d.ts.map +1 -1
- package/dist/runtime-registry.js +2 -2
- package/dist/studio/{KeyManagementPanel-D5FMvvU9.js → KeyManagementPanel-skUNnKRw.js} +36 -29
- package/dist/studio/app.d.ts +8 -1
- package/dist/studio/app.d.ts.map +1 -1
- package/dist/studio/components/KeyManagementPanel.d.ts.map +1 -1
- package/dist/studio/components/KeyManagementPanel.js +1 -1
- package/dist/studio/components/index.js +2 -2
- package/dist/studio/{components-B4eKIUN5.js → components-CJmzntBi.js} +8 -7
- package/dist/studio/control-plane/Data.d.ts.map +1 -1
- package/dist/studio/control-plane/Instance.d.ts +4 -1
- package/dist/studio/control-plane/Instance.d.ts.map +1 -1
- package/dist/studio/control-plane/Operations.d.ts +4 -1
- package/dist/studio/control-plane/Operations.d.ts.map +1 -1
- package/dist/studio/control-plane/index.js +2 -2
- package/dist/studio/control-plane/primitives.d.ts +16 -0
- package/dist/studio/control-plane/primitives.d.ts.map +1 -1
- package/dist/studio/{control-plane-fxMcJn74.js → control-plane-CaBA7Rgv.js} +448 -424
- package/dist/studio/index.d.ts +1 -0
- package/dist/studio/index.d.ts.map +1 -1
- package/dist/studio/index.js +384 -247
- package/dist/studio/navigation.d.ts +57 -0
- package/dist/studio/navigation.d.ts.map +1 -0
- package/dist/studio/studio.css +1 -1
- package/dist/studio/utils/control-plane-api.d.ts +2 -0
- package/dist/studio/utils/control-plane-api.d.ts.map +1 -1
- package/dist/studio/utils/control-plane-api.js +5 -1
- package/dist/studio-app/assets/{feltdb_wasm-BatwwogY.js → feltdb_wasm-BjM1ylL3.js} +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-TseJn2Ax.wasm +0 -0
- package/dist/studio-app/assets/index-1wd0uKua.js +30 -0
- package/dist/studio-app/assets/{index-CiC8VY-a.css → index-vi21oEQa.css} +1 -1
- package/dist/studio-app/index.html +2 -2
- package/dist/transaction.d.ts +27 -11
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +20 -14
- package/dist/wasm/feltdb_wasm_bg.wasm +0 -0
- package/dist/wasm/package.json +1 -1
- package/dist/workload.d.ts +31 -3
- package/dist/workload.d.ts.map +1 -1
- package/dist/workload.js +28 -3
- package/dist/workspace/local-development-authority.d.ts +19 -0
- package/dist/workspace/local-development-authority.d.ts.map +1 -1
- package/dist/workspace/local-development-authority.js +335 -15
- package/package.json +1 -1
- package/dist/studio-app/assets/feltdb_wasm_bg-BX0newOr.wasm +0 -0
- package/dist/studio-app/assets/index-DoVvbIay.js +0 -30
package/dist/agent-state.js
CHANGED
|
@@ -32,6 +32,13 @@ export const FELTDB_AGENT_CHECKPOINT_COLLECTION = '_feltdb.AgentCheckpoint';
|
|
|
32
32
|
export const FELTDB_AGENT_MEMORY_COLLECTION = '_feltdb.AgentMemory';
|
|
33
33
|
export const FELTDB_AGENT_HANDOFF_COLLECTION = '_feltdb.AgentHandoff';
|
|
34
34
|
export const AGENT_CONTEXT_FORMAT = 'feltdb.agent-context@1';
|
|
35
|
+
/**
|
|
36
|
+
* Index keys written beside every task head so `listTasks` can filter by
|
|
37
|
+
* project with an equality prefix. Derived from `scope.project` and `status`
|
|
38
|
+
* on every task write; never returned as part of an `AgentTask`.
|
|
39
|
+
*/
|
|
40
|
+
const TASK_PROJECT_FIELD = 'list_project';
|
|
41
|
+
const TASK_STATUS_PROJECT_FIELD = 'list_status_project';
|
|
35
42
|
/** Compound indexes every agent-state query is planned against. */
|
|
36
43
|
export const AGENT_STATE_INDEXES = [
|
|
37
44
|
{
|
|
@@ -54,9 +61,73 @@ export const AGENT_STATE_INDEXES = [
|
|
|
54
61
|
persistent: true,
|
|
55
62
|
},
|
|
56
63
|
},
|
|
64
|
+
// listTasks: one index per filter shape, each led by a distinct field, so
|
|
65
|
+
// every shape has exactly one compatible plan and none is a residual filter.
|
|
66
|
+
{
|
|
67
|
+
collection: FELTDB_AGENT_TASK_COLLECTION,
|
|
68
|
+
index: {
|
|
69
|
+
name: 'agent_tasks_by_updated',
|
|
70
|
+
type: 'compound',
|
|
71
|
+
fields: ['updated_at', 'id'],
|
|
72
|
+
directions: ['desc', 'asc'],
|
|
73
|
+
persistent: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
collection: FELTDB_AGENT_TASK_COLLECTION,
|
|
78
|
+
index: {
|
|
79
|
+
name: 'agent_tasks_by_status_updated',
|
|
80
|
+
type: 'compound',
|
|
81
|
+
fields: ['status', 'updated_at', 'id'],
|
|
82
|
+
directions: ['asc', 'desc', 'asc'],
|
|
83
|
+
persistent: true,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
collection: FELTDB_AGENT_TASK_COLLECTION,
|
|
88
|
+
index: {
|
|
89
|
+
name: 'agent_tasks_by_project_updated',
|
|
90
|
+
type: 'compound',
|
|
91
|
+
fields: [TASK_PROJECT_FIELD, 'updated_at', 'id'],
|
|
92
|
+
directions: ['asc', 'desc', 'asc'],
|
|
93
|
+
persistent: true,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
collection: FELTDB_AGENT_TASK_COLLECTION,
|
|
98
|
+
index: {
|
|
99
|
+
name: 'agent_tasks_by_status_project_updated',
|
|
100
|
+
type: 'compound',
|
|
101
|
+
fields: [TASK_STATUS_PROJECT_FIELD, 'updated_at', 'id'],
|
|
102
|
+
directions: ['asc', 'desc', 'asc'],
|
|
103
|
+
persistent: true,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
// listHandoffs
|
|
107
|
+
{
|
|
108
|
+
collection: FELTDB_AGENT_HANDOFF_COLLECTION,
|
|
109
|
+
index: {
|
|
110
|
+
name: 'agent_handoffs_by_created',
|
|
111
|
+
type: 'compound',
|
|
112
|
+
fields: ['created_at', 'id'],
|
|
113
|
+
directions: ['desc', 'asc'],
|
|
114
|
+
persistent: true,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
collection: FELTDB_AGENT_HANDOFF_COLLECTION,
|
|
119
|
+
index: {
|
|
120
|
+
name: 'agent_handoffs_by_status_created',
|
|
121
|
+
type: 'compound',
|
|
122
|
+
fields: ['status', 'created_at', 'id'],
|
|
123
|
+
directions: ['asc', 'desc', 'asc'],
|
|
124
|
+
persistent: true,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
57
127
|
];
|
|
58
128
|
const TASK_STATUSES = ['ready', 'running', 'blocked', 'completed', 'cancelled'];
|
|
59
129
|
const TERMINAL = ['completed', 'cancelled'];
|
|
130
|
+
const HANDOFF_STATUSES = ['open', 'claimed', 'accepted'];
|
|
60
131
|
/** Every refusal. A refused write committed nothing. */
|
|
61
132
|
export class AgentStateError extends Error {
|
|
62
133
|
code;
|
|
@@ -150,6 +221,26 @@ function strip(row) {
|
|
|
150
221
|
const { id: _id, __version, ...rest } = row;
|
|
151
222
|
return { ...rest, revision: typeof __version === 'number' ? __version : 1 };
|
|
152
223
|
}
|
|
224
|
+
/** A task row without its derived index keys. */
|
|
225
|
+
function toTask(row) {
|
|
226
|
+
const { [TASK_PROJECT_FIELD]: _project, [TASK_STATUS_PROJECT_FIELD]: _statusProject, ...task } = strip(row);
|
|
227
|
+
return task;
|
|
228
|
+
}
|
|
229
|
+
/** A task head as written: the task plus the index keys `listTasks` filters on. */
|
|
230
|
+
function taskHead(task) {
|
|
231
|
+
const project = task.scope?.project;
|
|
232
|
+
return {
|
|
233
|
+
...task,
|
|
234
|
+
...(project === undefined ? {} : {
|
|
235
|
+
[TASK_PROJECT_FIELD]: project,
|
|
236
|
+
[TASK_STATUS_PROJECT_FIELD]: statusProjectKey(task.status, project),
|
|
237
|
+
}),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function statusProjectKey(status, project) {
|
|
241
|
+
// A status never contains '|', so the first '|' separates the two.
|
|
242
|
+
return `${status}|${project}`;
|
|
243
|
+
}
|
|
153
244
|
function version(row) {
|
|
154
245
|
return typeof row.__version === 'number' ? row.__version : 1;
|
|
155
246
|
}
|
|
@@ -270,7 +361,7 @@ export class AgentStateStore {
|
|
|
270
361
|
};
|
|
271
362
|
try {
|
|
272
363
|
await this.db.transaction(tx => {
|
|
273
|
-
tx.collection(FELTDB_AGENT_TASK_COLLECTION).set(taskId, task, { requireAbsent: true });
|
|
364
|
+
tx.collection(FELTDB_AGENT_TASK_COLLECTION).set(taskId, taskHead(task), { requireAbsent: true });
|
|
274
365
|
tx.collection(FELTDB_AGENT_CHECKPOINT_COLLECTION).set(checkpoint.checkpoint_id, checkpoint, { requireAbsent: true });
|
|
275
366
|
});
|
|
276
367
|
}
|
|
@@ -286,7 +377,7 @@ export class AgentStateStore {
|
|
|
286
377
|
const row = await this.taskRow(identifier(taskId, 'taskId'));
|
|
287
378
|
if (!row)
|
|
288
379
|
return null;
|
|
289
|
-
const task =
|
|
380
|
+
const task = toTask(row);
|
|
290
381
|
const checkpoint = await this.getCheckpoint(task.task_id, task.checkpoint_version);
|
|
291
382
|
if (!checkpoint) {
|
|
292
383
|
throw fail('NOT_FOUND', `task ${taskId} names checkpoint ${task.checkpoint_version}, which is not committed`);
|
|
@@ -300,6 +391,30 @@ export class AgentStateStore {
|
|
|
300
391
|
const { revision: _revision, ...checkpoint } = strip(row);
|
|
301
392
|
return checkpoint;
|
|
302
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* One bounded page of tasks, most recently updated first (ties by task id),
|
|
396
|
+
* optionally narrowed to a status and/or a project.
|
|
397
|
+
*
|
|
398
|
+
* Every filter shape is answered by one declared compound index with an
|
|
399
|
+
* equality prefix; nothing reads the whole collection. Continue with
|
|
400
|
+
* `cursor: page.nextCursor` and the same filters.
|
|
401
|
+
*/
|
|
402
|
+
async listTasks(input = {}) {
|
|
403
|
+
if (input.status !== undefined && !TASK_STATUSES.includes(input.status)) {
|
|
404
|
+
throw fail('INVALID_REQUEST', `status must be one of ${TASK_STATUSES.join(', ')}`);
|
|
405
|
+
}
|
|
406
|
+
const project = input.project === undefined ? undefined : name(input.project, 'project');
|
|
407
|
+
const where = project === undefined
|
|
408
|
+
? (input.status === undefined ? [] : [{ field: 'status', eq: input.status }])
|
|
409
|
+
: input.status === undefined
|
|
410
|
+
? [{ field: TASK_PROJECT_FIELD, eq: project }]
|
|
411
|
+
: [{ field: TASK_STATUS_PROJECT_FIELD, eq: statusProjectKey(input.status, project) }];
|
|
412
|
+
const page = await this.page(FELTDB_AGENT_TASK_COLLECTION, where, 'updated_at', input.limit, input.cursor);
|
|
413
|
+
return {
|
|
414
|
+
tasks: page.records.map(toTask),
|
|
415
|
+
...(page.nextCursor ? { nextCursor: page.nextCursor } : {}),
|
|
416
|
+
};
|
|
417
|
+
}
|
|
303
418
|
/**
|
|
304
419
|
* Commit checkpoint N+1 atomically with the task head.
|
|
305
420
|
*
|
|
@@ -323,7 +438,7 @@ export class AgentStateStore {
|
|
|
323
438
|
throw fail('INVALID_REQUEST', `evidence must be an array of at most ${LIST_LIMIT} references`);
|
|
324
439
|
}
|
|
325
440
|
const row = await this.requireTask(id);
|
|
326
|
-
const task =
|
|
441
|
+
const task = toTask(row);
|
|
327
442
|
if (input.expectedVersion !== undefined && input.expectedVersion !== task.checkpoint_version) {
|
|
328
443
|
throw fail('VERSION_CONFLICT', `task ${id} is at checkpoint ${task.checkpoint_version}, not ${input.expectedVersion}`, {
|
|
329
444
|
expected: input.expectedVersion, current: task.checkpoint_version,
|
|
@@ -369,7 +484,7 @@ export class AgentStateStore {
|
|
|
369
484
|
};
|
|
370
485
|
try {
|
|
371
486
|
await this.db.transaction(tx => {
|
|
372
|
-
tx.collection(FELTDB_AGENT_TASK_COLLECTION).set(id, head, { ifVersion: version(row) });
|
|
487
|
+
tx.collection(FELTDB_AGENT_TASK_COLLECTION).set(id, taskHead(head), { ifVersion: version(row) });
|
|
373
488
|
tx.collection(FELTDB_AGENT_CHECKPOINT_COLLECTION).set(next.checkpoint_id, next, { requireAbsent: true });
|
|
374
489
|
for (const entry of cited) {
|
|
375
490
|
if (entry.evidence.kind === 'record') {
|
|
@@ -400,7 +515,7 @@ export class AgentStateStore {
|
|
|
400
515
|
*/
|
|
401
516
|
async resume(taskId, input) {
|
|
402
517
|
const row = await this.requireTask(identifier(taskId, 'taskId'));
|
|
403
|
-
this.assertOwner(
|
|
518
|
+
this.assertOwner(toTask(row), name(input.actor, 'actor'));
|
|
404
519
|
return this.assembleContext(taskId, input);
|
|
405
520
|
}
|
|
406
521
|
// --------------------------------------------------------------- memory
|
|
@@ -414,7 +529,7 @@ export class AgentStateStore {
|
|
|
414
529
|
const scopeKey = memoryScopeKey(scope);
|
|
415
530
|
if (taskId || scope.kind === 'task') {
|
|
416
531
|
const owningTask = taskId ?? scope.taskId;
|
|
417
|
-
const task =
|
|
532
|
+
const task = toTask(await this.requireTask(owningTask));
|
|
418
533
|
if (scope.kind === 'task' && scope.taskId !== task.task_id) {
|
|
419
534
|
throw fail('INVALID_REQUEST', `memory for task ${task.task_id} cannot be written to task scope ${scope.taskId}`);
|
|
420
535
|
}
|
|
@@ -481,7 +596,7 @@ export class AgentStateStore {
|
|
|
481
596
|
* its workspace. A memory scoped to another task is never returned.
|
|
482
597
|
*/
|
|
483
598
|
async recallForTask(taskId, input = {}) {
|
|
484
|
-
const task =
|
|
599
|
+
const task = toTask(await this.requireTask(identifier(taskId, 'taskId')));
|
|
485
600
|
const limit = boundedLimit(input.limit, 20, 100);
|
|
486
601
|
const scopes = [
|
|
487
602
|
{ kind: 'task', taskId: task.task_id },
|
|
@@ -572,7 +687,7 @@ export class AgentStateStore {
|
|
|
572
687
|
const actor = name(input.actor, 'actor');
|
|
573
688
|
const to = input.to === undefined ? undefined : name(input.to, 'to');
|
|
574
689
|
const row = await this.requireTask(id);
|
|
575
|
-
const task =
|
|
690
|
+
const task = toTask(row);
|
|
576
691
|
this.assertOwner(task, actor);
|
|
577
692
|
if (TERMINAL.includes(task.status))
|
|
578
693
|
throw fail('INVALID_TRANSITION', `task ${id} is ${task.status}; it cannot be handed off`);
|
|
@@ -633,12 +748,34 @@ export class AgentStateStore {
|
|
|
633
748
|
}
|
|
634
749
|
return resolveHandoff({ ...record, revision: 1 }, task, checkpoint);
|
|
635
750
|
}
|
|
751
|
+
/**
|
|
752
|
+
* One bounded page of handoff records, newest first (ties by handoff id).
|
|
753
|
+
* `open: true` lists the handoffs nobody has claimed yet. Indexed; never a
|
|
754
|
+
* collection scan.
|
|
755
|
+
*/
|
|
756
|
+
async listHandoffs(input = {}) {
|
|
757
|
+
if (input.open === false) {
|
|
758
|
+
throw fail('INVALID_REQUEST', "open: false is ambiguous; pass status: 'claimed' or 'accepted'");
|
|
759
|
+
}
|
|
760
|
+
if (input.status !== undefined && !HANDOFF_STATUSES.includes(input.status)) {
|
|
761
|
+
throw fail('INVALID_REQUEST', `status must be one of ${HANDOFF_STATUSES.join(', ')}`);
|
|
762
|
+
}
|
|
763
|
+
if (input.open && input.status !== undefined && input.status !== 'open') {
|
|
764
|
+
throw fail('INVALID_REQUEST', `open: true contradicts status: '${input.status}'`);
|
|
765
|
+
}
|
|
766
|
+
const status = input.open ? 'open' : input.status;
|
|
767
|
+
const page = await this.page(FELTDB_AGENT_HANDOFF_COLLECTION, status === undefined ? [] : [{ field: 'status', eq: status }], 'created_at', input.limit, input.cursor);
|
|
768
|
+
return {
|
|
769
|
+
handoffs: page.records.map(row => strip(row)),
|
|
770
|
+
...(page.nextCursor ? { nextCursor: page.nextCursor } : {}),
|
|
771
|
+
};
|
|
772
|
+
}
|
|
636
773
|
async getHandoff(handoffId) {
|
|
637
774
|
const row = await this.db.collection(FELTDB_AGENT_HANDOFF_COLLECTION).get(identifier(handoffId, 'handoffId', 128));
|
|
638
775
|
if (!row)
|
|
639
776
|
return null;
|
|
640
777
|
const record = strip(row);
|
|
641
|
-
const task =
|
|
778
|
+
const task = toTask(await this.requireTask(record.task_id));
|
|
642
779
|
const checkpoint = await this.getCheckpoint(record.task_id, record.checkpoint_version);
|
|
643
780
|
if (!checkpoint)
|
|
644
781
|
throw fail('NOT_FOUND', `handoff ${handoffId} references checkpoint ${record.checkpoint_version}, which is not committed`);
|
|
@@ -664,7 +801,7 @@ export class AgentStateStore {
|
|
|
664
801
|
const first = await handoffs.get(id);
|
|
665
802
|
if (!first)
|
|
666
803
|
throw fail('NOT_FOUND', `handoff ${id} does not exist`);
|
|
667
|
-
const task =
|
|
804
|
+
const task = toTask(await this.requireTask(strip(first).task_id));
|
|
668
805
|
// Decide on a handoff read taken after the task read. A claim commits both
|
|
669
806
|
// records together, so this pair can never show a claimed task beside an
|
|
670
807
|
// open handoff, which would misreport a lost race as a stale handoff.
|
|
@@ -710,7 +847,7 @@ export class AgentStateStore {
|
|
|
710
847
|
try {
|
|
711
848
|
await this.db.transaction(tx => {
|
|
712
849
|
tx.collection(FELTDB_AGENT_HANDOFF_COLLECTION).set(id, claimed, { ifVersion: handoff.revision });
|
|
713
|
-
tx.collection(FELTDB_AGENT_TASK_COLLECTION).set(task.task_id, head, { ifVersion: task.revision });
|
|
850
|
+
tx.collection(FELTDB_AGENT_TASK_COLLECTION).set(task.task_id, taskHead(head), { ifVersion: task.revision });
|
|
714
851
|
});
|
|
715
852
|
}
|
|
716
853
|
catch (error) {
|
|
@@ -760,7 +897,7 @@ export class AgentStateStore {
|
|
|
760
897
|
}
|
|
761
898
|
throw error;
|
|
762
899
|
}
|
|
763
|
-
const task =
|
|
900
|
+
const task = toTask(await this.requireTask(handoff.task_id));
|
|
764
901
|
return this.resolveRecord({ ...accepted, revision: handoff.revision + 1 }, task);
|
|
765
902
|
}
|
|
766
903
|
// -------------------------------------------------------------- context
|
|
@@ -894,6 +1031,31 @@ export class AgentStateStore {
|
|
|
894
1031
|
return bundle;
|
|
895
1032
|
}
|
|
896
1033
|
// ------------------------------------------------------------- internal
|
|
1034
|
+
async page(collection, where, newestFirst, limit, cursor) {
|
|
1035
|
+
if (cursor !== undefined && (typeof cursor !== 'string' || !cursor)) {
|
|
1036
|
+
throw fail('INVALID_REQUEST', 'cursor must be the nextCursor of a previous page');
|
|
1037
|
+
}
|
|
1038
|
+
let page;
|
|
1039
|
+
try {
|
|
1040
|
+
page = await this.db.query({
|
|
1041
|
+
collection,
|
|
1042
|
+
...(where.length ? { where } : {}),
|
|
1043
|
+
orderBy: [{ field: newestFirst, direction: 'desc' }],
|
|
1044
|
+
limit: boundedLimit(limit, 50, 1_000),
|
|
1045
|
+
...(cursor ? { cursor } : {}),
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
catch (error) {
|
|
1049
|
+
if (/INVALID_CURSOR/.test(error instanceof Error ? error.message : String(error))) {
|
|
1050
|
+
throw fail('INVALID_REQUEST', 'cursor does not belong to this query; pass the nextCursor of a page with the same filters');
|
|
1051
|
+
}
|
|
1052
|
+
throw error;
|
|
1053
|
+
}
|
|
1054
|
+
return {
|
|
1055
|
+
records: page.records,
|
|
1056
|
+
...(page.nextCursor && !page.exhausted ? { nextCursor: page.nextCursor } : {}),
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
897
1059
|
async taskRow(taskId) {
|
|
898
1060
|
return this.db.collection(FELTDB_AGENT_TASK_COLLECTION).get(taskId);
|
|
899
1061
|
}
|
package/dist/agent.d.ts
CHANGED
|
@@ -19,7 +19,11 @@ export interface AgentRef {
|
|
|
19
19
|
toString(): string;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Lifecycle states for agent execution
|
|
22
|
+
* Lifecycle states for agent execution.
|
|
23
|
+
*
|
|
24
|
+
* `Completed`, `Failed` and `Cancelled` are terminal. `Cancelled` is reachable
|
|
25
|
+
* from every non-terminal state, through `AgentRuntime.cancel` or
|
|
26
|
+
* `transition(execution, Cancelled)`.
|
|
23
27
|
*/
|
|
24
28
|
export declare enum AgentExecutionStatus {
|
|
25
29
|
Created = "Created",
|
|
@@ -113,6 +117,10 @@ export interface AgentExecution {
|
|
|
113
117
|
completedMs?: number;
|
|
114
118
|
/** Optional error message if execution failed */
|
|
115
119
|
error?: string;
|
|
120
|
+
/** The agent-state task this execution works on, when it was created for one. */
|
|
121
|
+
taskId?: string;
|
|
122
|
+
/** Why the execution was cancelled (status `Cancelled`). */
|
|
123
|
+
cancelReason?: string;
|
|
116
124
|
/** Metadata about the execution */
|
|
117
125
|
metadata?: Record<string, any>;
|
|
118
126
|
}
|
|
@@ -120,6 +128,7 @@ export interface AgentExecution {
|
|
|
120
128
|
* Parse an agent reference from its canonical form
|
|
121
129
|
* @example parseAgentRef("flow://agent/researcher@1")
|
|
122
130
|
*/
|
|
131
|
+
export declare const AGENT_EXECUTION_TERMINAL_STATUSES: readonly AgentExecutionStatus[];
|
|
123
132
|
export declare function parseAgentRef(ref: string): AgentRef;
|
|
124
133
|
/**
|
|
125
134
|
* Create an agent reference
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAEhB,0BAA0B;IAC1B,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAEhB,0BAA0B;IAC1B,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,oBAAY,oBAAoB;IAC9B,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,SAAS,cAAc;IAC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* of the same causal graph.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
|
-
* Lifecycle states for agent execution
|
|
9
|
+
* Lifecycle states for agent execution.
|
|
10
|
+
*
|
|
11
|
+
* `Completed`, `Failed` and `Cancelled` are terminal. `Cancelled` is reachable
|
|
12
|
+
* from every non-terminal state, through `AgentRuntime.cancel` or
|
|
13
|
+
* `transition(execution, Cancelled)`.
|
|
10
14
|
*/
|
|
11
15
|
export var AgentExecutionStatus;
|
|
12
16
|
(function (AgentExecutionStatus) {
|
|
@@ -25,6 +29,11 @@ export var AgentExecutionStatus;
|
|
|
25
29
|
* Parse an agent reference from its canonical form
|
|
26
30
|
* @example parseAgentRef("flow://agent/researcher@1")
|
|
27
31
|
*/
|
|
32
|
+
export const AGENT_EXECUTION_TERMINAL_STATUSES = [
|
|
33
|
+
AgentExecutionStatus.Completed,
|
|
34
|
+
AgentExecutionStatus.Failed,
|
|
35
|
+
AgentExecutionStatus.Cancelled,
|
|
36
|
+
];
|
|
28
37
|
export function parseAgentRef(ref) {
|
|
29
38
|
const match = ref.match(/^flow:\/\/agent\/([^@]+)@(\d+)$/);
|
|
30
39
|
if (!match) {
|
package/dist/build-identity.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "feltdb.build-identity.v2",
|
|
3
3
|
"package": "@feltdb/core",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.15.0",
|
|
5
5
|
"git": {
|
|
6
|
-
"sha1": "
|
|
6
|
+
"sha1": "5ad54972a9e31a5459cadbb471428111624ec9c6",
|
|
7
7
|
"dirty": false
|
|
8
8
|
},
|
|
9
9
|
"path_in_vcs": "packages/core",
|
|
10
|
-
"source_digest": "sha256:
|
|
10
|
+
"source_digest": "sha256:01efc5737aae1fef37c976e5841df3bb9b615d034f31d27b038f7fd4ca202428",
|
|
11
11
|
"inputs": [
|
|
12
12
|
"Cargo.lock",
|
|
13
13
|
"Cargo.toml",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"tools/cli",
|
|
21
21
|
"tools/create-feltdb"
|
|
22
22
|
],
|
|
23
|
-
"files":
|
|
23
|
+
"files": 789,
|
|
24
24
|
"build": {
|
|
25
25
|
"command": "npm run build",
|
|
26
26
|
"node": "v24.9.0"
|
package/dist/cli/commands.js
CHANGED
|
@@ -40,6 +40,27 @@ function loadProjectEnvironment(file = path.resolve('.env.local')) {
|
|
|
40
40
|
if (!(key in process.env))
|
|
41
41
|
process.env[key] = value;
|
|
42
42
|
}
|
|
43
|
+
warnBrowserExposedCredentials();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Credentials under a `VITE_` name are inlined into the application's browser
|
|
47
|
+
* bundle by Vite, so they are no longer read as credentials anywhere. Say so,
|
|
48
|
+
* rather than silently dropping authentication a project used to have.
|
|
49
|
+
*/
|
|
50
|
+
function warnBrowserExposedCredentials() {
|
|
51
|
+
for (const name of Object.keys(process.env)) {
|
|
52
|
+
if (/^VITE_[A-Z0-9_]*(?:TOKEN|API_KEY|SECRET)$/.test(name) && process.env[name]) {
|
|
53
|
+
console.warn(`⚠ ${name} is ignored: VITE_* variables are inlined into browser bundles. Move the credential to FELTDB_TOKEN (server-side only).`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The local `feltdb dev` Studio is an operator console on localhost. It
|
|
59
|
+
* receives the developer's server-side key at runtime (no-store), never from a
|
|
60
|
+
* bundled VITE_* value.
|
|
61
|
+
*/
|
|
62
|
+
function studioOperatorToken() {
|
|
63
|
+
return process.env.FELTDB_TOKEN || '';
|
|
43
64
|
}
|
|
44
65
|
async function availablePort(preferred, host = '127.0.0.1') {
|
|
45
66
|
for (let port = preferred; port < preferred + 100; port += 1) {
|
|
@@ -831,8 +852,8 @@ async function handleConnect(args) {
|
|
|
831
852
|
let health;
|
|
832
853
|
try {
|
|
833
854
|
const response = await fetch(`${url}/health`, {
|
|
834
|
-
headers: process.env.FELTDB_TOKEN
|
|
835
|
-
? { Authorization: `Bearer ${process.env.FELTDB_TOKEN
|
|
855
|
+
headers: process.env.FELTDB_TOKEN
|
|
856
|
+
? { Authorization: `Bearer ${process.env.FELTDB_TOKEN}` }
|
|
836
857
|
: {},
|
|
837
858
|
signal: controller.signal,
|
|
838
859
|
});
|
|
@@ -855,14 +876,14 @@ async function handleConnect(args) {
|
|
|
855
876
|
fs.writeFileSync(connFile, JSON.stringify({
|
|
856
877
|
url,
|
|
857
878
|
connected: new Date().toISOString(),
|
|
858
|
-
authenticated: Boolean(process.env.FELTDB_TOKEN
|
|
879
|
+
authenticated: Boolean(process.env.FELTDB_TOKEN),
|
|
859
880
|
namespace: managed.namespace || project.namespace || 'default',
|
|
860
881
|
runtime: project.runtime || 'self-hosted',
|
|
861
882
|
}, null, 2));
|
|
862
883
|
console.log('✅ Connected to FeltDB\n');
|
|
863
884
|
console.log('Endpoint: ' + url);
|
|
864
885
|
console.log(`Namespace: ${managed.namespace || project.namespace || 'default'}`);
|
|
865
|
-
console.log(`Authenticated: ${process.env.FELTDB_TOKEN
|
|
886
|
+
console.log(`Authenticated: ${process.env.FELTDB_TOKEN ? 'yes' : 'no'}`);
|
|
866
887
|
console.log(`Runtime: ${project.runtime || 'self-hosted'}`);
|
|
867
888
|
console.log(`Health: ${health.status || 'healthy'}\n`);
|
|
868
889
|
console.log('Use: feltdb status (to check connection)\n');
|
|
@@ -1834,11 +1855,16 @@ async function handleStudio(args, onReady) {
|
|
|
1834
1855
|
: process.env.VITE_FELTDB_MANAGED_APPLICATION_ID || managedProject.applicationId || '';
|
|
1835
1856
|
const environment = args.includes('--environment')
|
|
1836
1857
|
? args[args.indexOf('--environment') + 1] || 'production'
|
|
1837
|
-
|
|
1858
|
+
// A development session's authority is the local environment; asking it
|
|
1859
|
+
// for `production` names an environment the session does not have.
|
|
1860
|
+
: managedProject.environment || (args.includes('--session-id') && runtime !== 'managed' ? 'local' : 'production');
|
|
1838
1861
|
const appUrl = args.includes('--app-url')
|
|
1839
1862
|
? args[args.indexOf('--app-url') + 1]
|
|
1840
1863
|
: undefined;
|
|
1841
1864
|
const sessionValue = (name) => args.includes(name) ? args[args.indexOf(name) + 1] : undefined;
|
|
1865
|
+
// The connection parameters Studio is opened with. Served to a page opened
|
|
1866
|
+
// without them (a bookmark, a pasted path) so it reconnects to this session.
|
|
1867
|
+
let studioQuery = '';
|
|
1842
1868
|
const session = {
|
|
1843
1869
|
sessionId: sessionValue('--session-id'),
|
|
1844
1870
|
workspaceId: sessionValue('--workspace-id'),
|
|
@@ -1889,7 +1915,7 @@ async function handleStudio(args, onReady) {
|
|
|
1889
1915
|
environment: managedProject.environment || 'production',
|
|
1890
1916
|
publishEndpoint: '/_feltdb/publish',
|
|
1891
1917
|
} : undefined;
|
|
1892
|
-
response.end(JSON.stringify({ token: connectUrl ?
|
|
1918
|
+
response.end(JSON.stringify({ token: connectUrl ? studioOperatorToken() : '', managedPublish, session, studioQuery, sourceSync: { enabled: true, webllmEnabled, previewOnly, token: studioMutationToken, aiModel: publicAiModelConfiguration() } }));
|
|
1893
1919
|
return;
|
|
1894
1920
|
}
|
|
1895
1921
|
if (pathname === '/_feltdb/contract') {
|
|
@@ -1908,7 +1934,7 @@ async function handleStudio(args, onReady) {
|
|
|
1908
1934
|
endpoint.searchParams.set('application_id', applicationId);
|
|
1909
1935
|
endpoint.searchParams.set('environment', managedProject.environment || lastPublished?.environment || 'production');
|
|
1910
1936
|
const headers = {};
|
|
1911
|
-
const credential = process.env.FELTDB_MANAGED_CONTROL_API_KEY || process.env.
|
|
1937
|
+
const credential = process.env.FELTDB_MANAGED_CONTROL_API_KEY || process.env.FELTDB_TOKEN;
|
|
1912
1938
|
if (credential)
|
|
1913
1939
|
headers.authorization = `Bearer ${credential}`;
|
|
1914
1940
|
const discovered = await fetch(endpoint, { headers });
|
|
@@ -2219,6 +2245,7 @@ async function handleStudio(args, onReady) {
|
|
|
2219
2245
|
if (session.pairingUrl)
|
|
2220
2246
|
parameters.set('pairing', session.pairingUrl);
|
|
2221
2247
|
const query = `?${parameters.toString()}`;
|
|
2248
|
+
studioQuery = parameters.toString();
|
|
2222
2249
|
const studioUrl = `http://localhost:${port}/${query}`;
|
|
2223
2250
|
console.log(`FeltDB Studio ready at ${studioUrl}`);
|
|
2224
2251
|
onReady?.(studioUrl);
|
|
@@ -12,6 +12,7 @@ import path from 'path';
|
|
|
12
12
|
import { randomBytes } from 'crypto';
|
|
13
13
|
import http from 'http';
|
|
14
14
|
import { spawnSync } from 'child_process';
|
|
15
|
+
import { developmentConnectionMatches } from '@feltdb/core';
|
|
15
16
|
export const DEVELOPMENT_OBSERVATION_HISTORY_LIMIT = 1000;
|
|
16
17
|
const FELTDB_IGNORE_PATTERN = /^\/?\.feltdb\/?$/;
|
|
17
18
|
/**
|
|
@@ -82,6 +83,12 @@ export function startPairingDiscoveryServer(token, port = 7799, host = '127.0.0.
|
|
|
82
83
|
runtimeJson(response, 409, { error: 'RUNTIME_IDENTITY_MISMATCH' });
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
86
|
+
// The session identity above is echoed back by every client; what the
|
|
87
|
+
// database is actually connected to is the part worth checking.
|
|
88
|
+
if (body.connection && !developmentConnectionMatches(runtimeSession, body.connection)) {
|
|
89
|
+
runtimeJson(response, 409, { error: 'RUNTIME_CONNECTION_MISMATCH', connection: body.connection });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
85
92
|
if (!body.runtimeInstanceId || !body.applicationId) {
|
|
86
93
|
runtimeJson(response, 400, { error: 'RUNTIME_IDENTITY_REQUIRED' });
|
|
87
94
|
return;
|
|
@@ -97,6 +104,7 @@ export function startPairingDiscoveryServer(token, port = 7799, host = '127.0.0.
|
|
|
97
104
|
runtime: runtimeSession.runtime,
|
|
98
105
|
authorityUrl: runtimeSession.authorityUrl,
|
|
99
106
|
applicationUrl: body.applicationUrl || runtimeSession.applicationUrl,
|
|
107
|
+
...(body.connection ? { connection: body.connection } : {}),
|
|
100
108
|
registeredAt: previous?.registeredAt ?? now,
|
|
101
109
|
lastSeenAt: now,
|
|
102
110
|
expiresAt: now + runtimeTtlMs,
|
package/dist/collection.d.ts
CHANGED
|
@@ -359,7 +359,9 @@ export declare class Collection<T> {
|
|
|
359
359
|
/**
|
|
360
360
|
* Refresh data from the database and notify subscribers.
|
|
361
361
|
*/
|
|
362
|
-
refresh(
|
|
362
|
+
refresh(options?: {
|
|
363
|
+
strict?: boolean;
|
|
364
|
+
}): Promise<void>;
|
|
363
365
|
}
|
|
364
366
|
/**
|
|
365
367
|
* Relationship helper for loading related data.
|
package/dist/collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACd,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAE,WAAW,EAAc,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAErF,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAKD,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;AAChD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;AAEjD,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAqCD;;;;;;GAMG;AAC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