@feltdb/feltkit 0.3.28 → 0.3.30
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 +90 -9
- package/dist/app.js +95 -1
- package/dist/app.js.map +1 -1
- package/dist/appboundry/build.js.map +1 -1
- package/dist/appboundry/guest-tenancy.d.ts +2 -2
- package/dist/appboundry/guest-tenancy.js.map +1 -1
- package/dist/appboundry/guest.js +4 -1
- package/dist/appboundry/guest.js.map +1 -1
- package/dist/appboundry/host.js +3 -0
- package/dist/appboundry/host.js.map +1 -1
- package/dist/authorize.d.ts +23 -1
- package/dist/authorize.js +37 -0
- package/dist/authorize.js.map +1 -1
- package/dist/cli/deploy-appboundry.d.ts +1 -1
- package/dist/cli/deploy-appboundry.js.map +1 -1
- package/dist/cli/deploy.js.map +1 -1
- package/dist/cli/main.js +71 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/dashboard/assets/index-9rMS3yBm.js +15 -0
- package/dist/dashboard/assets/index-DkiYTUMR.css +1 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/docs.d.ts +1 -1
- package/dist/docs.js +3 -0
- package/dist/docs.js.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/event-stage.js.map +1 -1
- package/dist/execution.d.ts +186 -0
- package/dist/execution.js +105 -0
- package/dist/execution.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/measure/index.js.map +1 -1
- package/dist/platform/approvals.js.map +1 -1
- package/dist/platform/artifacts.js.map +1 -1
- package/dist/platform/changes.d.ts +54 -54
- package/dist/platform/changes.js.map +1 -1
- package/dist/platform/deployments.d.ts +32 -32
- package/dist/platform/exec.js.map +1 -1
- package/dist/platform/platform.js.map +1 -1
- package/dist/platform/releases.js.map +1 -1
- package/dist/platform/server.js.map +1 -1
- package/dist/platform/workspaces.js.map +1 -1
- package/dist/react/auth.d.ts +10 -10
- package/dist/react/auth.js +1 -1
- package/dist/react/auth.js.map +1 -1
- package/dist/react/context.d.ts +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/runtime/accounts.js.map +1 -1
- package/dist/runtime/activity.d.ts +1 -1
- package/dist/runtime/activity.js.map +1 -1
- package/dist/runtime/agent.d.ts +3 -3
- package/dist/runtime/agent.js +9 -3
- package/dist/runtime/agent.js.map +1 -1
- package/dist/runtime/application-authority.d.ts +22 -3
- package/dist/runtime/application-authority.js +25 -7
- package/dist/runtime/application-authority.js.map +1 -1
- package/dist/runtime/audit.js.map +1 -1
- package/dist/runtime/authboundry.d.ts +17 -0
- package/dist/runtime/authboundry.js +8 -1
- package/dist/runtime/authboundry.js.map +1 -1
- package/dist/runtime/authority.d.ts +10 -0
- package/dist/runtime/authority.js +17 -0
- package/dist/runtime/authority.js.map +1 -1
- package/dist/runtime/backup-environment.js.map +1 -1
- package/dist/runtime/backup.js.map +1 -1
- package/dist/runtime/changes.js.map +1 -1
- package/dist/runtime/claims.js.map +1 -1
- package/dist/runtime/collections.js.map +1 -1
- package/dist/runtime/content.d.ts +27 -2
- package/dist/runtime/content.js +55 -5
- package/dist/runtime/content.js.map +1 -1
- package/dist/runtime/context.d.ts +153 -0
- package/dist/runtime/contract.js +9 -1
- package/dist/runtime/contract.js.map +1 -1
- package/dist/runtime/credentials.d.ts +122 -13
- package/dist/runtime/credentials.js +304 -42
- package/dist/runtime/credentials.js.map +1 -1
- package/dist/runtime/crypto-token.js.map +1 -1
- package/dist/runtime/data.js.map +1 -1
- package/dist/runtime/decisions.js.map +1 -1
- package/dist/runtime/deployment.js.map +1 -1
- package/dist/runtime/execution-host.d.ts +54 -0
- package/dist/runtime/execution-host.js +54 -0
- package/dist/runtime/execution-host.js.map +1 -0
- package/dist/runtime/generation.js.map +1 -1
- package/dist/runtime/instance.js.map +1 -1
- package/dist/runtime/integrations.d.ts +22 -7
- package/dist/runtime/integrations.js +76 -9
- package/dist/runtime/integrations.js.map +1 -1
- package/dist/runtime/invocations.d.ts +313 -0
- package/dist/runtime/invocations.js +493 -0
- package/dist/runtime/invocations.js.map +1 -0
- package/dist/runtime/loader.js.map +1 -1
- package/dist/runtime/local-authority.d.ts +50 -0
- package/dist/runtime/local-authority.js +214 -0
- package/dist/runtime/local-authority.js.map +1 -0
- package/dist/runtime/oauth-credentials.d.ts +40 -3
- package/dist/runtime/oauth-credentials.js +158 -79
- package/dist/runtime/oauth-credentials.js.map +1 -1
- package/dist/runtime/outbox.js +3 -0
- package/dist/runtime/outbox.js.map +1 -1
- package/dist/runtime/projects.d.ts +1 -1
- package/dist/runtime/readiness.js +33 -0
- package/dist/runtime/readiness.js.map +1 -1
- package/dist/runtime/runtime.d.ts +48 -5
- package/dist/runtime/runtime.js +150 -19
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/services.d.ts +43 -0
- package/dist/runtime/services.js +202 -3
- package/dist/runtime/services.js.map +1 -1
- package/dist/runtime/sessions.js.map +1 -1
- package/dist/runtime/state-contract.js.map +1 -1
- package/dist/runtime/storage-check.js.map +1 -1
- package/dist/runtime/targets.d.ts +1 -1
- package/dist/runtime/tenancy.js.map +1 -1
- package/dist/runtime/transactions.d.ts +15 -0
- package/dist/runtime/transactions.js +5 -0
- package/dist/runtime/transactions.js.map +1 -1
- package/dist/schema.js.map +1 -1
- package/dist/server/admin.d.ts +51 -51
- package/dist/server/admin.js +83 -3
- package/dist/server/admin.js.map +1 -1
- package/dist/server/components.js.map +1 -1
- package/dist/server/index.js +43 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/management.js.map +1 -1
- package/dist/server/mcp.d.ts +59 -37
- package/dist/server/mcp.js +24 -1
- package/dist/server/mcp.js.map +1 -1
- package/dist/server/operators.js.map +1 -1
- package/dist/server/ports.d.ts +7 -0
- package/dist/server/ports.js +17 -0
- package/dist/server/ports.js.map +1 -1
- package/dist/server/production.js.map +1 -1
- package/dist/server/project.js.map +1 -1
- package/dist/server/session-http.js.map +1 -1
- package/dist/server/tenancy.js.map +1 -1
- package/dist/surfaces.d.ts +153 -0
- package/dist/surfaces.js +228 -0
- package/dist/surfaces.js.map +1 -0
- package/dist/testing/index.js.map +1 -1
- package/docs/CONNECTIONS.md +151 -0
- package/docs/EXECUTION.md +271 -0
- package/docs/GUARANTEES.md +54 -2
- package/docs/INVOCATIONS.md +170 -0
- package/docs/README.md +5 -2
- package/package.json +19 -15
- package/skills/.claude-plugin/marketplace.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
- package/skills/feltkit-services/SKILL.md +1 -1
- package/dist/dashboard/assets/index-BehzsQOa.css +0 -1
- package/dist/dashboard/assets/index-Clsfddp8.js +0 -15
package/dist/runtime/content.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
2
2
|
import { FeltKitError } from "../errors.js";
|
|
3
|
+
import { readAll } from "./paged-read.js";
|
|
3
4
|
/** Outstanding file links (download and upload), keyed by the SHA-256 of their token. */
|
|
4
5
|
export const FILE_LINK_COLLECTION = "_feltkit_file_links";
|
|
5
6
|
const LINK_PREFIX = "fkf_";
|
|
@@ -18,11 +19,46 @@ export class FileContent {
|
|
|
18
19
|
const id = randomUUID();
|
|
19
20
|
await this.#db.transaction({
|
|
20
21
|
operations: [
|
|
21
|
-
{ collection: FILE_CONTENT_COLLECTION, id, requireAbsent: true, value: { id, data: Buffer.from(bytes).toString("base64"), size: bytes.byteLength, checksum } },
|
|
22
|
+
{ collection: FILE_CONTENT_COLLECTION, id, requireAbsent: true, value: { id, data: Buffer.from(bytes).toString("base64"), size: bytes.byteLength, checksum, storedAt: Date.now() } },
|
|
22
23
|
],
|
|
23
24
|
});
|
|
24
25
|
return { storageKey: `${PREFIX}${id}`, checksum };
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Remove a file's bytes, keeping what was removed so the caller can put it back (a byte release
|
|
29
|
+
* that finds, after the removal, a reference that appeared during it). Version-checked: bytes
|
|
30
|
+
* changed meanwhile are refused. `removed: false` when they were already gone.
|
|
31
|
+
*/
|
|
32
|
+
async take(storageKey) {
|
|
33
|
+
if (!storageKey.startsWith(PREFIX))
|
|
34
|
+
return { removed: false };
|
|
35
|
+
const id = storageKey.slice(PREFIX.length);
|
|
36
|
+
const row = (await this.#db.collection(FILE_CONTENT_COLLECTION).get(id)) ?? null;
|
|
37
|
+
if (!row)
|
|
38
|
+
return { removed: false };
|
|
39
|
+
await this.#db.transaction({ operations: [{ collection: FILE_CONTENT_COLLECTION, id, ifVersion: row.__version }] });
|
|
40
|
+
const { __version: _version, ...value } = row;
|
|
41
|
+
return {
|
|
42
|
+
removed: true,
|
|
43
|
+
restore: async () => {
|
|
44
|
+
await this.#db.transaction({ operations: [{ collection: FILE_CONTENT_COLLECTION, id, requireAbsent: true, value: value }] });
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** Whether bytes are stored under a storage key. */
|
|
49
|
+
async has(storageKey) {
|
|
50
|
+
if (!storageKey.startsWith(PREFIX))
|
|
51
|
+
return false;
|
|
52
|
+
return Boolean(await this.#db.collection(FILE_CONTENT_COLLECTION).get(storageKey.slice(PREFIX.length)));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Every stored row's storage key, and when it was stored (rows written before `storedAt` existed
|
|
56
|
+
* have none). Reads every row, bytes included: FeltDB has no projection.
|
|
57
|
+
*/
|
|
58
|
+
async stored() {
|
|
59
|
+
const rows = (await readAll(this.#db, { collection: FILE_CONTENT_COLLECTION }));
|
|
60
|
+
return rows.map((row) => ({ storageKey: `${PREFIX}${row.id}`, ...(typeof row.storedAt === "number" ? { storedAt: row.storedAt } : {}), size: Number(row.size ?? 0) }));
|
|
61
|
+
}
|
|
26
62
|
/** The bytes behind a storage key, verified against their digest. */
|
|
27
63
|
async read(fileId, storageKey, checksum) {
|
|
28
64
|
if (!storageKey.startsWith(PREFIX))
|
|
@@ -37,14 +73,28 @@ export class FileContent {
|
|
|
37
73
|
}
|
|
38
74
|
return { bytes, collection: FILE_CONTENT_COLLECTION };
|
|
39
75
|
}
|
|
40
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Remove a file's bytes: after the file is deleted, or when its metadata could not be committed.
|
|
78
|
+
* Idempotent: `true` when this call removed them, `false` when they were already gone.
|
|
79
|
+
*/
|
|
41
80
|
async release(storageKey) {
|
|
42
81
|
if (!storageKey.startsWith(PREFIX))
|
|
43
|
-
return;
|
|
82
|
+
return false;
|
|
44
83
|
const id = storageKey.slice(PREFIX.length);
|
|
45
|
-
const
|
|
46
|
-
|
|
84
|
+
const rows = this.#db.collection(FILE_CONTENT_COLLECTION);
|
|
85
|
+
const row = await rows.get(id);
|
|
86
|
+
if (!row)
|
|
87
|
+
return false;
|
|
88
|
+
try {
|
|
47
89
|
await this.#db.transaction({ operations: [{ collection: FILE_CONTENT_COLLECTION, id, ifVersion: row.__version }] });
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
// Removed concurrently (another release of the same bytes) is the same outcome: gone.
|
|
94
|
+
if (!(await rows.get(id)))
|
|
95
|
+
return false;
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
48
98
|
}
|
|
49
99
|
/**
|
|
50
100
|
* Issue an opaque link token for `grant`. Only its SHA-256 is stored, so the stored row cannot
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/runtime/content.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/runtime/content.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,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AC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;YACnH,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,OAAO,EAAE,CAAC,CAAC,wCAAwC;YAC3D,CAAC;YACD,IAAI,GAAG,CAAC,SAAS,IAAI,GAAG;gBAAE,MAAM,OAAO,EAAE,CAAC;QAC5C,CAAC;QACD,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,GAAG,GAAyD,CAAC;QACpG,OAAQ,KAAyB,CAAC,EAAE,CAAC;QACrC,OAAO,KAAsB,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -42,7 +42,109 @@ export interface TenancyReader {
|
|
|
42
42
|
email?: string;
|
|
43
43
|
}>>;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* The platform invocation store (runtime/invocations.ts), as the caller: invocations from registered
|
|
47
|
+
* surfaces (app.surface), their lifecycle, dispatch and recovery. An invocation is visible to the
|
|
48
|
+
* person it is for and to the principal that delivered it; to anyone else it does not exist.
|
|
49
|
+
*/
|
|
50
|
+
export interface InvocationsReader {
|
|
51
|
+
get(id: string): Promise<import("./invocations.js").InvocationView>;
|
|
52
|
+
list(filter?: {
|
|
53
|
+
state?: import("../surfaces.js").InvocationState;
|
|
54
|
+
surface?: string;
|
|
55
|
+
limit?: number;
|
|
56
|
+
}): Promise<import("./invocations.js").InvocationView[]>;
|
|
57
|
+
}
|
|
58
|
+
export interface InvocationsWorker extends InvocationsReader {
|
|
59
|
+
/**
|
|
60
|
+
* Claim execution (the dispatched work's first step) as a new attempt, recorded with its environment
|
|
61
|
+
* and worker. proceed: false when there is nothing to run. `previous` lists earlier attempts; one whose
|
|
62
|
+
* outcome is `unknown` may have partly happened, so reconcile before repeating an external effect.
|
|
63
|
+
*/
|
|
64
|
+
start(id: string, options?: {
|
|
65
|
+
leaseMs?: number;
|
|
66
|
+
environment?: string;
|
|
67
|
+
worker?: string;
|
|
68
|
+
}): Promise<{
|
|
69
|
+
proceed: boolean;
|
|
70
|
+
claim?: string;
|
|
71
|
+
attempt?: number;
|
|
72
|
+
attemptId?: string;
|
|
73
|
+
execution?: string;
|
|
74
|
+
environment?: string;
|
|
75
|
+
previous?: Array<{
|
|
76
|
+
attempt: string;
|
|
77
|
+
outcome: string;
|
|
78
|
+
}>;
|
|
79
|
+
state: import("../surfaces.js").InvocationState;
|
|
80
|
+
reason?: string;
|
|
81
|
+
}>;
|
|
82
|
+
/** Report progress on the attempt holding `claim` (evidence on the attempt; renews its lease). */
|
|
83
|
+
progress(id: string, options: {
|
|
84
|
+
claim: string;
|
|
85
|
+
note?: string;
|
|
86
|
+
data?: unknown;
|
|
87
|
+
}): Promise<{
|
|
88
|
+
leaseUntil: number;
|
|
89
|
+
}>;
|
|
90
|
+
/** After approval: awaiting_approval → running, with a new claim (a new attempt). */
|
|
91
|
+
resume(id: string, options?: {
|
|
92
|
+
leaseMs?: number;
|
|
93
|
+
environment?: string;
|
|
94
|
+
worker?: string;
|
|
95
|
+
}): Promise<{
|
|
96
|
+
proceed: boolean;
|
|
97
|
+
claim?: string;
|
|
98
|
+
attemptId?: string;
|
|
99
|
+
state: import("../surfaces.js").InvocationState;
|
|
100
|
+
reason?: string;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* running → awaiting_approval | completed | failed (needs the current claim from running). `result`: a
|
|
104
|
+
* small reference (≤ 4 KB), never the application's data. An external effect whose outcome can't be
|
|
105
|
+
* known: fail with error code OUTCOME_UNKNOWN (the attempt reads `unknown`); never complete it.
|
|
106
|
+
*/
|
|
107
|
+
transition(id: string, to: "awaiting_approval" | "completed" | "failed", options?: {
|
|
108
|
+
claim?: string;
|
|
109
|
+
note?: string;
|
|
110
|
+
result?: unknown;
|
|
111
|
+
error?: {
|
|
112
|
+
code: string;
|
|
113
|
+
message: string;
|
|
114
|
+
};
|
|
115
|
+
}): Promise<import("./invocations.js").InvocationView>;
|
|
116
|
+
/** The person cancels their own; terminal states are final. */
|
|
117
|
+
cancel(id: string, options?: {
|
|
118
|
+
reason?: string;
|
|
119
|
+
}): Promise<import("./invocations.js").InvocationView>;
|
|
120
|
+
}
|
|
121
|
+
export interface InvocationsWriter extends InvocationsWorker {
|
|
122
|
+
/**
|
|
123
|
+
* Accept an invocation from a registered surface. The record and its dispatch (`dispatch.job`, run
|
|
124
|
+
* as the caller after the commit, with `{ ...payload, invocation: <id> }`) are staged in this
|
|
125
|
+
* mutation's transaction: both commit or neither. A resubmission of the same request answers the
|
|
126
|
+
* stored receipt (`replayed: true`) and dispatches nothing. `person`: a bridge surface's resolved person.
|
|
127
|
+
*
|
|
128
|
+
* Before dispatch: the caller must hold what the job's function requires (FORBIDDEN otherwise), and the
|
|
129
|
+
* work is placed (src/execution.ts) by its `requirements` and `placement` constraints among the
|
|
130
|
+
* registered execution environments under the operator's policy; unplaceable work is refused
|
|
131
|
+
* (FAILED_PRECONDITION, details.reason UNPLACEABLE, with the decision). Placement never adds authority.
|
|
132
|
+
*/
|
|
133
|
+
accept(input: {
|
|
134
|
+
surface: string;
|
|
135
|
+
envelope: unknown;
|
|
136
|
+
person?: string;
|
|
137
|
+
dispatch: {
|
|
138
|
+
job: string;
|
|
139
|
+
payload?: Record<string, unknown>;
|
|
140
|
+
requirements?: Partial<import("../execution.js").ExecutionRequirements>;
|
|
141
|
+
placement?: import("../execution.js").PlacementConstraints;
|
|
142
|
+
};
|
|
143
|
+
}): Promise<import("./invocations.js").Receipt>;
|
|
144
|
+
}
|
|
45
145
|
export interface QueryCtx {
|
|
146
|
+
/** Invocations from registered surfaces, read-only (runtime/invocations.ts). */
|
|
147
|
+
readonly invocations: InvocationsReader;
|
|
46
148
|
/** Read-only. Queries cannot write. */
|
|
47
149
|
readonly db: DatabaseReader;
|
|
48
150
|
readonly auth: AuthContext;
|
|
@@ -60,6 +162,8 @@ export interface QueryCtx {
|
|
|
60
162
|
readonly crypto: CryptoContext;
|
|
61
163
|
}
|
|
62
164
|
export interface MutationCtx {
|
|
165
|
+
/** Invocations from registered surfaces: accept (with its dispatch, in this transaction), read, move, cancel. */
|
|
166
|
+
readonly invocations: InvocationsWriter;
|
|
63
167
|
/** Writes are buffered and commit atomically when the handler returns. */
|
|
64
168
|
readonly db: DatabaseWriter;
|
|
65
169
|
readonly auth: AuthContext;
|
|
@@ -154,6 +258,8 @@ export interface AgentWriter {
|
|
|
154
258
|
* environment's model and stream to its caller.
|
|
155
259
|
*/
|
|
156
260
|
export interface ActionCtx {
|
|
261
|
+
/** Invocations from registered surfaces: read, claim, move, cancel. */
|
|
262
|
+
readonly invocations: InvocationsWorker;
|
|
157
263
|
readonly auth: AuthContext;
|
|
158
264
|
readonly environment: EnvironmentInfo;
|
|
159
265
|
readonly requestId: string;
|
|
@@ -184,6 +290,28 @@ export interface ActionCtx {
|
|
|
184
290
|
* custody references, resolved for the request and never returned, logged or recorded.
|
|
185
291
|
*/
|
|
186
292
|
export interface ApplicationAuthority {
|
|
293
|
+
/**
|
|
294
|
+
* The caller's grants to the application's executor (authority.local): what this person allows the
|
|
295
|
+
* application to do for them. Always the caller's own; a person, signed in.
|
|
296
|
+
*/
|
|
297
|
+
grants: {
|
|
298
|
+
list(): Promise<Array<{
|
|
299
|
+
id: string;
|
|
300
|
+
capabilities: string[];
|
|
301
|
+
expiresAt: number | null;
|
|
302
|
+
status: string;
|
|
303
|
+
}>>;
|
|
304
|
+
grant(input: {
|
|
305
|
+
capabilities: string[];
|
|
306
|
+
expiresAt?: number;
|
|
307
|
+
}): Promise<{
|
|
308
|
+
id: string;
|
|
309
|
+
capabilities: string[];
|
|
310
|
+
expiresAt: number | null;
|
|
311
|
+
status: string;
|
|
312
|
+
}>;
|
|
313
|
+
revoke(id: string): Promise<void>;
|
|
314
|
+
};
|
|
187
315
|
decide(request: {
|
|
188
316
|
capability: string;
|
|
189
317
|
onBehalfOf?: string;
|
|
@@ -206,6 +334,11 @@ export interface ApplicationAuthorityDecision {
|
|
|
206
334
|
onBehalfOf: string | null;
|
|
207
335
|
/** The delegation that decided an on-behalf allow. */
|
|
208
336
|
delegationId: string | null;
|
|
337
|
+
/**
|
|
338
|
+
* How the executor was established: `proven` only when AuthBoundry authenticated the executor's
|
|
339
|
+
* agent credential for this decision; otherwise `asserted` (the application named it). Never a secret.
|
|
340
|
+
*/
|
|
341
|
+
executorProof: import("./authboundry.js").ExecutorProof;
|
|
209
342
|
}
|
|
210
343
|
/**
|
|
211
344
|
* `ctx.integrations.invoke("<integration>.<operation>", input)`: the operation's own `access`
|
|
@@ -214,9 +347,29 @@ export interface ApplicationAuthorityDecision {
|
|
|
214
347
|
* and errors never carry the credential.
|
|
215
348
|
*/
|
|
216
349
|
export interface IntegrationInvoker {
|
|
350
|
+
/**
|
|
351
|
+
* `onBehalfOf` (a person's id): for an integration each person connects themselves
|
|
352
|
+
* (`credential.owner: "person"`), the person whose connection the application's own principal (a
|
|
353
|
+
* service, an agent, a system job) uses. A signed-in person always uses their own and can name no
|
|
354
|
+
* one else. AuthBoundry decides every such call on that person's behalf.
|
|
355
|
+
*/
|
|
217
356
|
invoke(capability: string, input: Record<string, unknown>, options?: {
|
|
218
357
|
idempotencyKey?: string;
|
|
358
|
+
onBehalfOf?: string;
|
|
219
359
|
}): Promise<unknown>;
|
|
360
|
+
/** The signed-in person's own connections (credential.owner: "person"). Never anyone else's; never a token. */
|
|
361
|
+
readonly connections: {
|
|
362
|
+
list(): Promise<import("./oauth-credentials.js").ConnectionStatus[]>;
|
|
363
|
+
/** Start connecting: the provider's authorization URL to open. It returns to FeltKit's callback. */
|
|
364
|
+
connect(integration: string): Promise<{
|
|
365
|
+
url: string;
|
|
366
|
+
expiresAt: string;
|
|
367
|
+
}>;
|
|
368
|
+
disconnect(integration: string): Promise<{
|
|
369
|
+
disconnected: boolean;
|
|
370
|
+
providerRevocation: "yes" | "no-endpoint" | "failed" | "none";
|
|
371
|
+
}>;
|
|
372
|
+
};
|
|
220
373
|
}
|
|
221
374
|
export interface ActionModel {
|
|
222
375
|
/** The environment's model: where it comes from and whether it is ready. Never a secret. */
|
package/dist/runtime/contract.js
CHANGED
|
@@ -43,6 +43,8 @@ import { INVITATIONS_COLLECTION, MEMBERSHIPS_COLLECTION, TENANTS_COLLECTION } fr
|
|
|
43
43
|
import { COLLECTION_MARKERS, MIGRATIONS_COLLECTION, SEQUENCES_COLLECTION } from "./data.js";
|
|
44
44
|
import { IDEMPOTENCY_COLLECTION } from "./idempotency.js";
|
|
45
45
|
import { INTEGRATION_CALLS } from "./integrations.js";
|
|
46
|
+
import { INVOCATIONS_COLLECTION } from "./invocations.js";
|
|
47
|
+
import { CREDENTIALS_COLLECTION } from "./credentials.js";
|
|
46
48
|
import { SAVED_MODELS } from "./decisions.js";
|
|
47
49
|
import { SESSIONS_COLLECTION } from "./sessions.js";
|
|
48
50
|
import { FILE_CONTENT_COLLECTION, FILE_LINK_COLLECTION } from "./content.js";
|
|
@@ -83,7 +85,12 @@ const PLATFORM_COLLECTIONS = {
|
|
|
83
85
|
"integration", "operation", "capability", "effect", "state", "principal", "idempotencyKey", "request", "input",
|
|
84
86
|
"startedAt", "finishedAt", "status", "output", "error", "determinedBy", "verification", "environment",
|
|
85
87
|
],
|
|
88
|
+
// Invocations from registered surfaces (runtime/invocations.ts): the execution lifecycle and its evidence, never the application's data.
|
|
89
|
+
[INVOCATIONS_COLLECTION]: ["person", "tenantId", "surface", "deliveredBy", "invocation", "digest", "state", "history", "dispatch", "execution", "executions", "outcome", "createdAt", "updatedAt"],
|
|
86
90
|
_feltkit_operator_grants: ["subject", "usedAt", "expiresAt"],
|
|
91
|
+
// Stored credentials with FELTKIT_CREDENTIAL_VAULT=database: each entry encrypted (iv, tag, data) under
|
|
92
|
+
// the host's key; lease records coordinate OAuth renewals. Never a value in the clear.
|
|
93
|
+
[CREDENTIALS_COLLECTION]: ["kind", "name", "iv", "tag", "data", "holder", "until", "updatedAt"],
|
|
87
94
|
[SAVED_MODELS]: ["provider", "model", "endpoint", "credentialRef", "savedAt", "savedBy"],
|
|
88
95
|
};
|
|
89
96
|
const ID = { name: "id", type: "text", required: true, nullable: false };
|
|
@@ -127,7 +134,8 @@ export function feltdbContract(app) {
|
|
|
127
134
|
collections.push({ name, fields: [ID, ...fields.map((field) => ({ name: field, type: "json", required: false, nullable: true }))] });
|
|
128
135
|
}
|
|
129
136
|
if (services.includes("files")) {
|
|
130
|
-
|
|
137
|
+
// storedAt: when the bytes were stored (an orphan reclaim excludes bytes an upload in flight has not recorded yet).
|
|
138
|
+
collections.push({ name: FILE_CONTENT_COLLECTION, fields: [ID, ...["data", "size", "checksum", "storedAt"].map((field) => ({ name: field, type: "json", required: false, nullable: true }))] });
|
|
131
139
|
// File links (files.link / uploadLink): keyed by the token's digest.
|
|
132
140
|
collections.push({ name: FILE_LINK_COLLECTION, fields: [ID, ...["kind", "fileId", "expiresAt", "disposition", "principal", "name", "contentType", "maxBytes", "metadata"].map((field) => ({ name: field, type: "json", required: false, nullable: true }))] });
|
|
133
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/runtime/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,EAAE,2BAA2B,EAAwE,MAAM,cAAc,CAAC;AACjI,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,E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B,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,eAAe;YACtB,YAAY,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAAC,GAAe;IAC7C,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACzG,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAE,aAAmC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1F,IAAI,OAAO,CAAC,MAAM;QAAE,MAAM,IAAI,YAAY,CAAC,eAAe,EAAE,wDAAwD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,aAAa,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/L,OAAO,EAAmB,CAAC;AAC7B,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,cAAc,CAAC,QAAwB;IACrD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAClD,CAAC"}
|
|
@@ -3,6 +3,16 @@ export declare const OAUTH2_KIND = "oauth2";
|
|
|
3
3
|
/** The environment variable that holds the value for a credential id. */
|
|
4
4
|
export declare function credentialVariable(secretId: string): string;
|
|
5
5
|
/** `credential-ref:<id>` or a bare id → the id, or null when it is not a valid reference. */
|
|
6
|
+
/**
|
|
7
|
+
* A person's connection to an integration (`credential.owner: "person"`) is kept at an id of its own,
|
|
8
|
+
* `connection:<integration>:<digest of the person's id>`, which the public custody contract (store,
|
|
9
|
+
* remove, withSecret: what AppPort's credential.store, Studio and the CLI use) refuses. Only the OAuth
|
|
10
|
+
* lifecycle, acting for that person, writes, reads or erases it; no application-level configuration or
|
|
11
|
+
* administrator reaches it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CONNECTION_PREFIX = "connection:";
|
|
14
|
+
export declare const isConnectionId: (id: string) => boolean;
|
|
15
|
+
export declare function connectionId(integration: string, person: string): string;
|
|
6
16
|
export declare function credentialId(ref: string): string | null;
|
|
7
17
|
/** A provider name or reference → the reference (`anthropic` → `credential-ref:anthropic`). */
|
|
8
18
|
export declare function toCredentialRef(refOrProvider: string): string;
|
|
@@ -25,6 +35,8 @@ interface VaultEntry {
|
|
|
25
35
|
updatedAt: string;
|
|
26
36
|
provider?: string;
|
|
27
37
|
kind?: string;
|
|
38
|
+
/** A person's connection: the principal it belongs to (runtime/oauth-credentials.ts). */
|
|
39
|
+
owner?: string;
|
|
28
40
|
/** Version numbers and times only; earlier values are not kept. */
|
|
29
41
|
history: Array<{
|
|
30
42
|
version: number;
|
|
@@ -34,6 +46,26 @@ interface VaultEntry {
|
|
|
34
46
|
interface VaultDocument {
|
|
35
47
|
entries: Record<string, VaultEntry>;
|
|
36
48
|
}
|
|
49
|
+
/** A vault: one encrypted entry per credential id, changed atomically. */
|
|
50
|
+
export interface VaultStore {
|
|
51
|
+
readonly kind: "file" | "database";
|
|
52
|
+
/** For display ("local encrypted vault", "encrypted in this environment's FeltDB"). */
|
|
53
|
+
readonly location: string;
|
|
54
|
+
/** The entry as this process last read it (a file vault reads the file each time). */
|
|
55
|
+
get(id: string): VaultEntry | null;
|
|
56
|
+
/** The entry as storage holds it now. */
|
|
57
|
+
getFresh(id: string): Promise<VaultEntry | null>;
|
|
58
|
+
ids(): string[];
|
|
59
|
+
/** Read what other processes stored. */
|
|
60
|
+
refresh(): Promise<void>;
|
|
61
|
+
/** Change one entry atomically: `change` sees the current entry and returns the new one (or none: unchanged). */
|
|
62
|
+
updateEntry<T>(id: string, change: (entry: VaultEntry | null) => {
|
|
63
|
+
entry?: VaultEntry;
|
|
64
|
+
result: T;
|
|
65
|
+
}): Promise<T>;
|
|
66
|
+
/** One holder at a time per key across the processes sharing this vault; a holder that died loses it after staleMs. */
|
|
67
|
+
lock(key: string, staleMs: number, waitMs: number): Promise<() => Promise<void>>;
|
|
68
|
+
}
|
|
37
69
|
export interface VaultOptions {
|
|
38
70
|
/** Directory holding credentials.vault (and credentials.key unless `key` is given). */
|
|
39
71
|
dir: string;
|
|
@@ -47,13 +79,24 @@ export interface VaultOptions {
|
|
|
47
79
|
* visible to a running server at once); every write is read-modify-write under a lock
|
|
48
80
|
* file, to a temporary 0600 file that is fsynced and renamed over the vault.
|
|
49
81
|
*/
|
|
50
|
-
export declare class CredentialVault {
|
|
82
|
+
export declare class CredentialVault implements VaultStore {
|
|
51
83
|
#private;
|
|
84
|
+
readonly kind: "file";
|
|
85
|
+
readonly location = "local encrypted vault";
|
|
52
86
|
readonly file: string;
|
|
53
87
|
readonly keyFile: string | null;
|
|
54
88
|
constructor(options: VaultOptions);
|
|
55
89
|
read(): VaultDocument;
|
|
56
90
|
get(id: string): VaultEntry | null;
|
|
91
|
+
getFresh(id: string): Promise<VaultEntry | null>;
|
|
92
|
+
ids(): string[];
|
|
93
|
+
refresh(): Promise<void>;
|
|
94
|
+
updateEntry<T>(id: string, change: (entry: VaultEntry | null) => {
|
|
95
|
+
entry?: VaultEntry;
|
|
96
|
+
result: T;
|
|
97
|
+
}): Promise<T>;
|
|
98
|
+
/** A lock file next to the vault, created exclusively; one left by a dead process expires after staleMs. */
|
|
99
|
+
lock(key: string, staleMs: number, waitMs: number): Promise<() => Promise<void>>;
|
|
57
100
|
/** Apply `change` to the current document under the lock and write it back. */
|
|
58
101
|
update<T>(change: (doc: VaultDocument) => T): T;
|
|
59
102
|
}
|
|
@@ -148,7 +191,7 @@ export declare function parseGrant(text: string, now?: number): OAuthGrant;
|
|
|
148
191
|
export interface HostCredentialsOptions {
|
|
149
192
|
env?: NodeJS.ProcessEnv;
|
|
150
193
|
/** The writable vault, when this environment has one. */
|
|
151
|
-
vault?:
|
|
194
|
+
vault?: VaultStore | null;
|
|
152
195
|
/** Why there is no vault (shown with CUSTODY_READ_ONLY). */
|
|
153
196
|
readOnlyReason?: string;
|
|
154
197
|
}
|
|
@@ -164,6 +207,15 @@ export declare class HostCredentials {
|
|
|
164
207
|
get writable(): boolean;
|
|
165
208
|
/** Where stored values go, for display. */
|
|
166
209
|
get location(): string;
|
|
210
|
+
/** A file vault's path (null for a database vault or none). @internal */
|
|
211
|
+
get vaultFile(): string | null;
|
|
212
|
+
/** Where the vault is, and what kind ("file" | "database"), for readiness; null without one. @internal */
|
|
213
|
+
get vaultInfo(): {
|
|
214
|
+
kind: VaultStore["kind"];
|
|
215
|
+
location: string;
|
|
216
|
+
} | null;
|
|
217
|
+
/** Read what other processes stored (a database vault's view is otherwise the last one read). */
|
|
218
|
+
refresh(): Promise<void>;
|
|
167
219
|
withSecret<T>(input: {
|
|
168
220
|
reference: {
|
|
169
221
|
secretId: string;
|
|
@@ -188,6 +240,18 @@ export declare class HostCredentials {
|
|
|
188
240
|
version: number;
|
|
189
241
|
storedAt: string;
|
|
190
242
|
}>;
|
|
243
|
+
/**
|
|
244
|
+
* A person's connection, stored by the OAuth lifecycle for that person (never through the custody
|
|
245
|
+
* contract). It replaces their earlier grant; another person's entry at this id is refused.
|
|
246
|
+
* @internal
|
|
247
|
+
*/
|
|
248
|
+
storeConnection(id: string, owner: string, input: {
|
|
249
|
+
value: string;
|
|
250
|
+
provider: string;
|
|
251
|
+
}): Promise<{
|
|
252
|
+
version: number;
|
|
253
|
+
storedAt: string;
|
|
254
|
+
}>;
|
|
191
255
|
status(input: {
|
|
192
256
|
reference: {
|
|
193
257
|
secretId: string;
|
|
@@ -203,29 +267,73 @@ export declare class HostCredentials {
|
|
|
203
267
|
};
|
|
204
268
|
context?: CredentialAccessContext;
|
|
205
269
|
}): Promise<void>;
|
|
206
|
-
/**
|
|
270
|
+
/**
|
|
271
|
+
* Erase a person's connection (disconnect), only for its owner. The entry reads "revoked" afterwards.
|
|
272
|
+
* @internal
|
|
273
|
+
*/
|
|
274
|
+
removeConnection(id: string, owner: string): Promise<boolean>;
|
|
275
|
+
/** Every reference the vault holds material or history for. People's connections are not listed: they are theirs. */
|
|
207
276
|
stored(): string[];
|
|
208
277
|
/** Whether a reference resolves, from where, and its version. Never returns the value. */
|
|
209
278
|
describe(ref: string): CredentialDescription;
|
|
210
279
|
/**
|
|
211
|
-
* The OAuth lifecycle's own access (runtime/oauth-credentials.ts): the stored grant and its version
|
|
212
|
-
*
|
|
280
|
+
* The OAuth lifecycle's own access (runtime/oauth-credentials.ts): the stored grant and its version,
|
|
281
|
+
* read from storage now (another process may have renewed it). Not part of the custody contract
|
|
282
|
+
* AppPort Services sees, and never reachable from application code.
|
|
213
283
|
* @internal
|
|
214
284
|
*/
|
|
215
|
-
grantOf(id: string): {
|
|
285
|
+
grantOf(id: string, owner?: string): Promise<{
|
|
216
286
|
grant: OAuthGrant;
|
|
217
287
|
version: number;
|
|
218
|
-
} | null
|
|
288
|
+
} | null>;
|
|
219
289
|
/**
|
|
220
290
|
* Replace a grant only if it is still at `expectedVersion` (a refresh, a failure mark): a newer grant
|
|
221
|
-
* (a reconnect, another process's refresh) is never overwritten with an older one. Atomic
|
|
222
|
-
* vault's
|
|
223
|
-
* grant changed (or went away) in the meantime.
|
|
291
|
+
* (a reconnect, another process's refresh) is never overwritten with an older one. Atomic in the
|
|
292
|
+
* vault's storage. Returns the new version, or null when the grant changed (or went away) meanwhile.
|
|
224
293
|
* @internal
|
|
225
294
|
*/
|
|
226
|
-
replaceGrant(id: string, expectedVersion: number, grant: OAuthGrant): number | null
|
|
227
|
-
/**
|
|
228
|
-
|
|
295
|
+
replaceGrant(id: string, expectedVersion: number, grant: OAuthGrant): Promise<number | null>;
|
|
296
|
+
/** One holder at a time for `key` among every process sharing this vault (OAuth renewal). @internal */
|
|
297
|
+
lock(key: string, staleMs: number, waitMs: number): Promise<() => Promise<void>>;
|
|
298
|
+
}
|
|
299
|
+
/** FeltKit's collection of stored credentials (one encrypted record per credential id, plus lock leases). */
|
|
300
|
+
export declare const CREDENTIALS_COLLECTION = "_feltkit_credentials";
|
|
301
|
+
interface CredentialsDb {
|
|
302
|
+
collection<T>(name: string): {
|
|
303
|
+
get(id: string): Promise<(T & {
|
|
304
|
+
__version?: number;
|
|
305
|
+
}) | null>;
|
|
306
|
+
};
|
|
307
|
+
transaction(input: {
|
|
308
|
+
operations: Array<Record<string, unknown>>;
|
|
309
|
+
}): Promise<unknown>;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Stored credentials in the environment's own FeltDB, so every process of the environment (several
|
|
313
|
+
* machines, a redeploy) sees the same values and the same OAuth grant. Each entry is one record,
|
|
314
|
+
* encrypted on its own (AES-256-GCM) with the host's key (FELTKIT_CREDENTIAL_VAULT_KEY, which never
|
|
315
|
+
* enters FeltDB), bound to this application, environment and credential id (associated data): a record
|
|
316
|
+
* copied to another environment or another id does not decrypt. Changes are conditional on the
|
|
317
|
+
* record's version, so concurrent writers cannot overwrite each other. Locks are lease records.
|
|
318
|
+
*/
|
|
319
|
+
export declare class DatabaseVault implements VaultStore {
|
|
320
|
+
#private;
|
|
321
|
+
readonly kind: "database";
|
|
322
|
+
readonly location = "encrypted in this environment's FeltDB";
|
|
323
|
+
constructor(options: {
|
|
324
|
+
db: CredentialsDb;
|
|
325
|
+
key: Buffer;
|
|
326
|
+
scope: string;
|
|
327
|
+
});
|
|
328
|
+
get(id: string): VaultEntry | null;
|
|
329
|
+
getFresh(id: string): Promise<VaultEntry | null>;
|
|
330
|
+
ids(): string[];
|
|
331
|
+
refresh(): Promise<void>;
|
|
332
|
+
updateEntry<T>(id: string, change: (entry: VaultEntry | null) => {
|
|
333
|
+
entry?: VaultEntry;
|
|
334
|
+
result: T;
|
|
335
|
+
}): Promise<T>;
|
|
336
|
+
lock(key: string, staleMs: number, waitMs: number): Promise<() => Promise<void>>;
|
|
229
337
|
}
|
|
230
338
|
/** Environment-variable custody only (no vault): what production uses without the opt-in. */
|
|
231
339
|
export declare class EnvironmentCredentials extends HostCredentials {
|
|
@@ -246,5 +354,6 @@ export declare function credentialsFor(options: {
|
|
|
246
354
|
dir: string;
|
|
247
355
|
scope: string;
|
|
248
356
|
env?: NodeJS.ProcessEnv;
|
|
357
|
+
db?: CredentialsDb;
|
|
249
358
|
}): HostCredentials;
|
|
250
359
|
export {};
|