@feltdb/feltkit 0.3.21 → 0.3.23
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/app.d.ts +17 -3
- package/dist/app.js +10 -0
- package/dist/app.js.map +1 -1
- package/dist/appboundry/build.js +4 -0
- package/dist/appboundry/build.js.map +1 -1
- package/dist/authorize.d.ts +1 -1
- package/dist/cli/main.js +8 -152
- package/dist/cli/main.js.map +1 -1
- package/dist/client/index.d.ts +83 -4
- package/dist/client/index.js +154 -2
- package/dist/client/index.js.map +1 -1
- package/dist/dashboard/assets/index-BEjtLLYq.js +15 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +1 -0
- package/dist/docs.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js.map +1 -1
- package/dist/platform/approvals.d.ts +102 -0
- package/dist/platform/approvals.js +155 -0
- package/dist/platform/approvals.js.map +1 -0
- package/dist/platform/artifacts.d.ts +126 -0
- package/dist/platform/artifacts.js +251 -0
- package/dist/platform/artifacts.js.map +1 -0
- package/dist/platform/blobs.d.ts +25 -0
- package/dist/platform/blobs.js +78 -0
- package/dist/platform/blobs.js.map +1 -0
- package/dist/platform/diff.d.ts +23 -0
- package/dist/platform/diff.js +107 -0
- package/dist/platform/diff.js.map +1 -0
- package/dist/platform/exec.d.ts +182 -0
- package/dist/platform/exec.js +575 -0
- package/dist/platform/exec.js.map +1 -0
- package/dist/platform/operations.d.ts +30 -13
- package/dist/platform/operations.js +8 -17
- package/dist/platform/operations.js.map +1 -1
- package/dist/platform/permissions.d.ts +15 -0
- package/dist/platform/permissions.js +16 -0
- package/dist/platform/permissions.js.map +1 -0
- package/dist/platform/platform.d.ts +28 -0
- package/dist/platform/platform.js +84 -5
- package/dist/platform/platform.js.map +1 -1
- package/dist/platform/releases.d.ts +110 -0
- package/dist/platform/releases.js +344 -0
- package/dist/platform/releases.js.map +1 -0
- package/dist/platform/review.d.ts +10 -0
- package/dist/platform/review.js +109 -0
- package/dist/platform/review.js.map +1 -0
- package/dist/platform/server.js +7 -0
- package/dist/platform/server.js.map +1 -1
- package/dist/platform/source.d.ts +2 -0
- package/dist/platform/source.js +1 -1
- package/dist/platform/source.js.map +1 -1
- package/dist/platform/workspace-operations.d.ts +2 -0
- package/dist/platform/workspace-operations.js +590 -0
- package/dist/platform/workspace-operations.js.map +1 -0
- package/dist/platform/workspaces.d.ts +211 -0
- package/dist/platform/workspaces.js +435 -0
- package/dist/platform/workspaces.js.map +1 -0
- package/dist/react/index.d.ts +29 -1
- package/dist/react/index.js +50 -0
- package/dist/react/index.js.map +1 -1
- package/dist/runtime/activity.d.ts +1 -1
- package/dist/runtime/agent.d.ts +216 -2
- package/dist/runtime/agent.js +333 -7
- package/dist/runtime/agent.js.map +1 -1
- package/dist/runtime/approval-rules.d.ts +16 -0
- package/dist/runtime/approval-rules.js +37 -0
- package/dist/runtime/approval-rules.js.map +1 -0
- package/dist/runtime/authority.d.ts +18 -1
- package/dist/runtime/authority.js +26 -1
- package/dist/runtime/authority.js.map +1 -1
- package/dist/runtime/browser-inference.d.ts +52 -0
- package/dist/runtime/browser-inference.js +53 -0
- package/dist/runtime/browser-inference.js.map +1 -0
- package/dist/runtime/context.d.ts +110 -0
- package/dist/runtime/decisions.d.ts +23 -0
- package/dist/runtime/decisions.js +54 -0
- package/dist/runtime/decisions.js.map +1 -1
- package/dist/runtime/generation.d.ts +94 -0
- package/dist/runtime/generation.js +295 -0
- package/dist/runtime/generation.js.map +1 -0
- package/dist/runtime/runtime.d.ts +10 -2
- package/dist/runtime/runtime.js +125 -1
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/server/admin.d.ts +9 -1
- package/dist/server/admin.js +84 -2
- package/dist/server/admin.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +159 -8
- package/dist/server/index.js.map +1 -1
- package/dist/testing/index.d.ts +11 -0
- package/dist/testing/index.js +7 -3
- package/dist/testing/index.js.map +1 -1
- package/docs/AUTH.md +2 -2
- package/docs/GENERATION.md +136 -0
- package/docs/README.md +3 -2
- package/package.json +2 -4
- package/skills/.claude-plugin/marketplace.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/dist/cli/compose.d.ts +0 -31
- package/dist/cli/compose.js +0 -274
- package/dist/cli/compose.js.map +0 -1
- package/dist/cli/create.d.ts +0 -219
- package/dist/cli/create.js +0 -1193
- package/dist/cli/create.js.map +0 -1
- package/dist/cli/domain.d.ts +0 -174
- package/dist/cli/domain.js +0 -1119
- package/dist/cli/domain.js.map +0 -1
- package/dist/cli/shell.d.ts +0 -7
- package/dist/cli/shell.js +0 -59
- package/dist/cli/shell.js.map +0 -1
- package/dist/composition/catalog.d.ts +0 -3
- package/dist/composition/catalog.js +0 -217
- package/dist/composition/catalog.js.map +0 -1
- package/dist/composition/contract.d.ts +0 -165
- package/dist/composition/contract.js +0 -12
- package/dist/composition/contract.js.map +0 -1
- package/dist/composition/execute.d.ts +0 -110
- package/dist/composition/execute.js +0 -350
- package/dist/composition/execute.js.map +0 -1
- package/dist/composition/generate.d.ts +0 -105
- package/dist/composition/generate.js +0 -274
- package/dist/composition/generate.js.map +0 -1
- package/dist/composition/plan.d.ts +0 -131
- package/dist/composition/plan.js +0 -558
- package/dist/composition/plan.js.map +0 -1
- package/dist/composition/profiles.d.ts +0 -20
- package/dist/composition/profiles.js +0 -81
- package/dist/composition/profiles.js.map +0 -1
- package/dist/composition/reconcile.d.ts +0 -153
- package/dist/composition/reconcile.js +0 -282
- package/dist/composition/reconcile.js.map +0 -1
- package/dist/composition/recover.d.ts +0 -89
- package/dist/composition/recover.js +0 -407
- package/dist/composition/recover.js.map +0 -1
- package/dist/composition/resolve.d.ts +0 -2
- package/dist/composition/resolve.js +0 -208
- package/dist/composition/resolve.js.map +0 -1
- package/dist/dashboard/assets/index-BrC1AtZ1.js +0 -15
package/dist/runtime/agent.d.ts
CHANGED
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
import { type AgentCheckpoint, type AgentTask, type StateFirstDB } from "@feltdb/core";
|
|
35
35
|
import { type Principal } from "./authority.js";
|
|
36
36
|
import type { FeltKitRuntime } from "./runtime.js";
|
|
37
|
+
import type { FinishReason, GenerationResult, ToolCall } from "./generation.js";
|
|
38
|
+
import type { ModelResolution } from "./decisions.js";
|
|
37
39
|
export declare const AGENT_NAME = "feltkit";
|
|
38
40
|
export declare const AGENT_VERSION = 1;
|
|
39
41
|
/** Permissions for using the agent itself. Actions still need their own permissions. */
|
|
@@ -58,6 +60,8 @@ export interface AgentTool {
|
|
|
58
60
|
invoke?: "direct" | "propose";
|
|
59
61
|
/** `"required"`: a consequential call by this principal runs only after a person approves it. */
|
|
60
62
|
approval?: "required";
|
|
63
|
+
/** JSON Schema of the input, for application capabilities (what a model is given as the tool's parameters). */
|
|
64
|
+
inputSchema?: Record<string, unknown>;
|
|
61
65
|
}
|
|
62
66
|
export interface ProposedAction {
|
|
63
67
|
actionId: string;
|
|
@@ -75,6 +79,109 @@ export interface ProposedAction {
|
|
|
75
79
|
provider: string;
|
|
76
80
|
model?: string;
|
|
77
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* When a model's tool call is the proposal (ctx.agent.propose from an action): the proposer is
|
|
84
|
+
* the model (`proposedBy: "model:<provider>/<model>"`) acting for this principal, the task owner,
|
|
85
|
+
* whose authority it runs with. A person approving is then never the proposer.
|
|
86
|
+
*/
|
|
87
|
+
onBehalfOf?: string;
|
|
88
|
+
/** The generation whose tool call this is, and the provider's id for the call. */
|
|
89
|
+
generation?: {
|
|
90
|
+
generationId?: string;
|
|
91
|
+
memoryId: string;
|
|
92
|
+
toolCallId: string;
|
|
93
|
+
};
|
|
94
|
+
/** After this, the proposal can no longer be approved (it is cancelled as expired). */
|
|
95
|
+
expiresAt?: string;
|
|
96
|
+
/**
|
|
97
|
+
* sha256 over the capability, its version and the exact input (actionDigest). An approval may
|
|
98
|
+
* name the digest it reviewed, and execution recomputes it: an operation that changed after it
|
|
99
|
+
* was proposed is never run under that approval. Absent on records made before it existed.
|
|
100
|
+
*/
|
|
101
|
+
inputDigest?: string;
|
|
102
|
+
}
|
|
103
|
+
export { actionDigest, canonicalJson } from "./approval-rules.js";
|
|
104
|
+
/**
|
|
105
|
+
* Where a proposed input carries credential material (paths only, never values): a FeltKit or
|
|
106
|
+
* AppPort token, or a string under a key that names a secret. A proposal is stored and executed
|
|
107
|
+
* exactly as proposed, so such an input is refused rather than recorded or silently rewritten;
|
|
108
|
+
* pass a reference (a credential id or ref://) instead.
|
|
109
|
+
*/
|
|
110
|
+
export declare function credentialPaths(value: unknown, path?: string, depth?: number, out?: string[]): string[];
|
|
111
|
+
/**
|
|
112
|
+
* A generation's lifecycle. Every attempt has a record from the moment it is requested; it ends
|
|
113
|
+
* completed, failed, cancelled, or (after a restart while it ran) interrupted. Never silently absent.
|
|
114
|
+
*/
|
|
115
|
+
export type GenerationState = "requested" | "running" | "completed" | "failed" | "cancelled" | "interrupted";
|
|
116
|
+
/** What a generation ran on: resolved before any provider contact. Never a secret. */
|
|
117
|
+
export interface GenerationModel {
|
|
118
|
+
provider: string;
|
|
119
|
+
model: string;
|
|
120
|
+
protocol: string;
|
|
121
|
+
endpoint: string;
|
|
122
|
+
source: "resolver" | "intelligence";
|
|
123
|
+
/** The credential's reference (credential-ref:… or ref://…), never its value. */
|
|
124
|
+
credential: string | null;
|
|
125
|
+
resolution?: ModelResolution;
|
|
126
|
+
}
|
|
127
|
+
export interface GenerationRecord {
|
|
128
|
+
generationId: string;
|
|
129
|
+
taskId: string;
|
|
130
|
+
state: GenerationState;
|
|
131
|
+
seq: number;
|
|
132
|
+
/** The task owner the generation ran for. */
|
|
133
|
+
requestedFor: string;
|
|
134
|
+
requestedAt: string;
|
|
135
|
+
startedAt?: string;
|
|
136
|
+
finishedAt?: string;
|
|
137
|
+
durationMs?: number;
|
|
138
|
+
/** The input, by reference: a digest of the messages and tool names, their count and roles (the application keeps the conversation). */
|
|
139
|
+
input: {
|
|
140
|
+
digest: string;
|
|
141
|
+
messages: number;
|
|
142
|
+
roles: Record<string, number>;
|
|
143
|
+
tools: string[];
|
|
144
|
+
};
|
|
145
|
+
model?: GenerationModel;
|
|
146
|
+
/** The output (bounded), including what streamed before a failure or cancellation. */
|
|
147
|
+
output?: {
|
|
148
|
+
text: string;
|
|
149
|
+
truncated?: number;
|
|
150
|
+
toolCalls: Array<{
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
input: unknown;
|
|
154
|
+
}>;
|
|
155
|
+
};
|
|
156
|
+
finish?: FinishReason;
|
|
157
|
+
usage?: GenerationResult["usage"];
|
|
158
|
+
/** failed: the model problem (timeout, unavailable, credential_refused, provider_error, malformed, …) and whether trying again may help. */
|
|
159
|
+
failure?: {
|
|
160
|
+
code: string;
|
|
161
|
+
problem: string | null;
|
|
162
|
+
message: string;
|
|
163
|
+
retryable: boolean;
|
|
164
|
+
};
|
|
165
|
+
/** cancelled / interrupted: why. */
|
|
166
|
+
reason?: string;
|
|
167
|
+
history: Array<{
|
|
168
|
+
state: GenerationState;
|
|
169
|
+
at: string;
|
|
170
|
+
by: string;
|
|
171
|
+
}>;
|
|
172
|
+
}
|
|
173
|
+
/** The live handle of one generation, held by the process running it. */
|
|
174
|
+
export interface GenerationHandle {
|
|
175
|
+
readonly generationId: string;
|
|
176
|
+
readonly taskId: string;
|
|
177
|
+
running(model: GenerationModel): Promise<void>;
|
|
178
|
+
completed(result: GenerationResult): Promise<string>;
|
|
179
|
+
cancelled(reason: string, partial: {
|
|
180
|
+
text: string;
|
|
181
|
+
toolCalls?: ToolCall[];
|
|
182
|
+
usage?: GenerationResult["usage"];
|
|
183
|
+
}): Promise<string>;
|
|
184
|
+
failed(error: unknown, partialText?: string): Promise<string>;
|
|
78
185
|
}
|
|
79
186
|
/**
|
|
80
187
|
* A decision for the agent to put to the environment's model: application code supplies
|
|
@@ -112,6 +219,12 @@ export interface ActionOutcome {
|
|
|
112
219
|
durationMs: number;
|
|
113
220
|
/** Set when the call was abandoned before it answered; its effect may still happen. */
|
|
114
221
|
aborted?: "timeout" | "cancelled";
|
|
222
|
+
/** An observation a model asked for: which generation and tool call. */
|
|
223
|
+
generation?: {
|
|
224
|
+
generationId?: string;
|
|
225
|
+
memoryId: string;
|
|
226
|
+
toolCallId: string;
|
|
227
|
+
};
|
|
115
228
|
}
|
|
116
229
|
export type ActionState = "proposed" | "rejected" | "approved" | "executing" | "succeeded" | "failed" | "cancelled" | "interrupted";
|
|
117
230
|
/** States that still need something: approval, completion, or a person to settle them. */
|
|
@@ -182,7 +295,8 @@ export interface TaskView {
|
|
|
182
295
|
actions: ActionRecord[];
|
|
183
296
|
playbook?: string;
|
|
184
297
|
}
|
|
185
|
-
export declare const PLAYBOOKS: readonly ["diagnose-job", "diagnose-delivery", "inspect-app", "invoke", "decide", "handoff"];
|
|
298
|
+
export declare const PLAYBOOKS: readonly ["diagnose-job", "diagnose-delivery", "inspect-app", "invoke", "decide", "handoff", "assist"];
|
|
299
|
+
export declare const DEFAULT_PROPOSAL_TTL_MS: number;
|
|
186
300
|
export type Playbook = (typeof PLAYBOOKS)[number];
|
|
187
301
|
/** Remove credential material from anything recorded or returned. */
|
|
188
302
|
export declare function redact(value: unknown, depth?: number): unknown;
|
|
@@ -268,7 +382,100 @@ export declare class AgentHost {
|
|
|
268
382
|
input?: Record<string, unknown>;
|
|
269
383
|
reason: string;
|
|
270
384
|
decision?: ProposedAction["decision"];
|
|
385
|
+
/** The same key on the same task is the same proposal: a retried request returns it instead of proposing again. */
|
|
386
|
+
idempotencyKey?: string;
|
|
387
|
+
/** Application code only (ctx.agent.propose): the model whose tool call this is, proposing for `principal`. */
|
|
388
|
+
model?: {
|
|
389
|
+
provider: string;
|
|
390
|
+
model: string;
|
|
391
|
+
generation?: {
|
|
392
|
+
generationId?: string;
|
|
393
|
+
memoryId: string;
|
|
394
|
+
toolCallId: string;
|
|
395
|
+
};
|
|
396
|
+
};
|
|
271
397
|
}, principal: Principal | null): Promise<TaskView>;
|
|
398
|
+
/**
|
|
399
|
+
* The task for one conversation turn, owned by `principal`. Idempotent: the same key from the same
|
|
400
|
+
* owner is the same task, so a retried turn request does not open a second one.
|
|
401
|
+
*/
|
|
402
|
+
openTask(input: {
|
|
403
|
+
principal: Principal | null;
|
|
404
|
+
objective: string;
|
|
405
|
+
key: string;
|
|
406
|
+
}): Promise<{
|
|
407
|
+
taskId: string;
|
|
408
|
+
created: boolean;
|
|
409
|
+
}>;
|
|
410
|
+
/**
|
|
411
|
+
* Record that a generation is requested, before any provider is contacted, and return the handle
|
|
412
|
+
* the running process advances. Requires the task's owner.
|
|
413
|
+
*/
|
|
414
|
+
beginGeneration(taskId: string, principal: Principal | null, input: GenerationRecord["input"]): Promise<GenerationHandle>;
|
|
415
|
+
/**
|
|
416
|
+
* The generations of a task, oldest first, each with its current record (the final one is the
|
|
417
|
+
* evidence a checkpoint cites) and the proposals and observations its tool calls led to.
|
|
418
|
+
*/
|
|
419
|
+
generations(taskId: string, principal: Principal | null | "admin"): Promise<Array<{
|
|
420
|
+
memoryId: string;
|
|
421
|
+
createdAt: string;
|
|
422
|
+
content: GenerationRecord;
|
|
423
|
+
actions: Array<{
|
|
424
|
+
actionId: string;
|
|
425
|
+
capability: string;
|
|
426
|
+
effect: ActionEffect;
|
|
427
|
+
state: string;
|
|
428
|
+
toolCallId: string;
|
|
429
|
+
}>;
|
|
430
|
+
}>>;
|
|
431
|
+
/**
|
|
432
|
+
* The signed-in person's own actions: those on tasks they own, newest first. `state` filters
|
|
433
|
+
* (e.g. "proposed" for what waits for them). The app-facing view; Studio lists every task.
|
|
434
|
+
*/
|
|
435
|
+
actionsOwnedBy(principal: Principal | null, filter?: {
|
|
436
|
+
state?: ActionState;
|
|
437
|
+
limit?: number;
|
|
438
|
+
}): Promise<Array<{
|
|
439
|
+
taskId: string;
|
|
440
|
+
objective: string;
|
|
441
|
+
action: ActionRecord;
|
|
442
|
+
}>>;
|
|
443
|
+
/**
|
|
444
|
+
* Where a keyed proposal stands, for the application that made it: its state (proposed, or the
|
|
445
|
+
* outcome of an observation that ran) and, for an observation, its output.
|
|
446
|
+
*/
|
|
447
|
+
proposalOutcome(taskId: string, idempotencyKey: string, principal: Principal | null): Promise<{
|
|
448
|
+
taskId: string;
|
|
449
|
+
actionId: string;
|
|
450
|
+
capability: string;
|
|
451
|
+
effect: ActionEffect;
|
|
452
|
+
state: string;
|
|
453
|
+
output?: unknown;
|
|
454
|
+
error?: {
|
|
455
|
+
code: string;
|
|
456
|
+
message: string;
|
|
457
|
+
};
|
|
458
|
+
}>;
|
|
459
|
+
/** Every action of one of your turns: consequential ones (with their state) and observations that ran, oldest first. */
|
|
460
|
+
turnActions(taskId: string, principal: Principal | null): Promise<Array<{
|
|
461
|
+
taskId: string;
|
|
462
|
+
actionId: string;
|
|
463
|
+
capability: string;
|
|
464
|
+
effect: ActionEffect;
|
|
465
|
+
state: string;
|
|
466
|
+
output?: unknown;
|
|
467
|
+
error?: {
|
|
468
|
+
code: string;
|
|
469
|
+
message: string;
|
|
470
|
+
};
|
|
471
|
+
at: string;
|
|
472
|
+
}>>;
|
|
473
|
+
/** Approve one of your own tasks' actions. The same server-side rules as approve(), plus ownership. */
|
|
474
|
+
approveOwn(taskId: string, actionId: string, principal: Principal | null, reviewed?: {
|
|
475
|
+
inputDigest?: string;
|
|
476
|
+
}): Promise<TaskView>;
|
|
477
|
+
/** Reject one of your own tasks' actions. */
|
|
478
|
+
rejectOwn(taskId: string, actionId: string, principal: Principal | null, reason?: string): Promise<TaskView>;
|
|
272
479
|
/**
|
|
273
480
|
* Approve a proposed action, then run it as the task owner. Everything that can refuse
|
|
274
481
|
* is checked before the proposal is consumed: the approver is a person with
|
|
@@ -276,7 +483,9 @@ export declare class AgentHost {
|
|
|
276
483
|
* may perform it. A refusal is recorded on the action, which stays proposed. A
|
|
277
484
|
* duplicate or concurrent approval of the same action never runs it twice.
|
|
278
485
|
*/
|
|
279
|
-
approve(taskId: string, actionId: string, approver: Principal | null
|
|
486
|
+
approve(taskId: string, actionId: string, approver: Principal | null, reviewed?: {
|
|
487
|
+
inputDigest?: string;
|
|
488
|
+
}): Promise<TaskView>;
|
|
280
489
|
/**
|
|
281
490
|
* For each proposed action of a task: whether `principal` may approve it now, and if not, why
|
|
282
491
|
* (the same checks approve() makes; nothing changes). Studio shows Approve only when it may.
|
|
@@ -320,6 +529,11 @@ export declare class AgentHost {
|
|
|
320
529
|
to: ActionState;
|
|
321
530
|
determinedBy: string;
|
|
322
531
|
}>;
|
|
532
|
+
generations: Array<{
|
|
533
|
+
taskId: string;
|
|
534
|
+
generationId: string;
|
|
535
|
+
from: GenerationState;
|
|
536
|
+
}>;
|
|
323
537
|
}>;
|
|
324
538
|
/** Finish a task. The summary is the owner's; evidence is what the checkpoints cite. */
|
|
325
539
|
complete(taskId: string, summary: string, principal: Principal | null): Promise<TaskView>;
|