@feltdb/feltkit 0.3.11 → 0.3.13
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/README.md +4 -3
- package/dist/app.d.ts +98 -3
- package/dist/app.js +63 -0
- package/dist/app.js.map +1 -1
- package/dist/appboundry/build.d.ts +39 -1
- package/dist/appboundry/build.js +57 -6
- package/dist/appboundry/build.js.map +1 -1
- package/dist/appboundry/guest.js +46 -5
- package/dist/appboundry/guest.js.map +1 -1
- package/dist/appboundry/host.d.ts +24 -5
- package/dist/appboundry/host.js +234 -141
- package/dist/appboundry/host.js.map +1 -1
- package/dist/appboundry/runtime.d.ts +44 -0
- package/dist/appboundry/runtime.js +99 -0
- package/dist/appboundry/runtime.js.map +1 -0
- package/dist/cli/entry.d.ts +1 -0
- package/dist/cli/entry.js +4 -0
- package/dist/cli/entry.js.map +1 -0
- package/dist/cli/main.d.ts +5 -0
- package/dist/cli/main.js +550 -13
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/test-reporter.d.ts +9 -0
- package/dist/cli/test-reporter.js +26 -0
- package/dist/cli/test-reporter.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -1
- package/dist/dashboard/assets/index-BSnW2DC-.js +15 -0
- package/dist/dashboard/assets/{index-91I1zDK-.css → index-BXTNQAg1.css} +1 -1
- package/dist/dashboard/index.html +3 -3
- package/dist/docs.d.ts +12 -0
- package/dist/docs.js +42 -0
- package/dist/docs.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/platform/changes.d.ts +340 -0
- package/dist/platform/changes.js +355 -0
- package/dist/platform/changes.js.map +1 -0
- package/dist/platform/deployments.d.ts +653 -0
- package/dist/platform/deployments.js +532 -0
- package/dist/platform/deployments.js.map +1 -0
- package/dist/platform/operations.d.ts +74 -0
- package/dist/platform/operations.js +198 -0
- package/dist/platform/operations.js.map +1 -0
- package/dist/platform/platform.d.ts +78 -0
- package/dist/platform/platform.js +264 -0
- package/dist/platform/platform.js.map +1 -0
- package/dist/platform/server.d.ts +25 -0
- package/dist/platform/server.js +165 -0
- package/dist/platform/server.js.map +1 -0
- package/dist/platform/source.d.ts +27 -0
- package/dist/platform/source.js +142 -0
- package/dist/platform/source.js.map +1 -0
- package/dist/runtime/activity.d.ts +25 -0
- package/dist/runtime/activity.js +38 -12
- package/dist/runtime/activity.js.map +1 -1
- package/dist/runtime/agent.d.ts +16 -0
- package/dist/runtime/agent.js +92 -28
- package/dist/runtime/agent.js.map +1 -1
- package/dist/runtime/backup-environment.d.ts +32 -0
- package/dist/runtime/backup-environment.js +92 -0
- package/dist/runtime/backup-environment.js.map +1 -0
- package/dist/runtime/backup.d.ts +129 -0
- package/dist/runtime/backup.js +344 -0
- package/dist/runtime/backup.js.map +1 -0
- package/dist/runtime/capabilities.js +4 -2
- package/dist/runtime/capabilities.js.map +1 -1
- package/dist/runtime/changes.js +2 -2
- package/dist/runtime/changes.js.map +1 -1
- package/dist/runtime/contract.js +4 -3
- package/dist/runtime/contract.js.map +1 -1
- package/dist/runtime/data.d.ts +36 -5
- package/dist/runtime/data.js +165 -55
- package/dist/runtime/data.js.map +1 -1
- package/dist/runtime/decisions.js +2 -1
- package/dist/runtime/decisions.js.map +1 -1
- package/dist/runtime/instance.js +17 -0
- package/dist/runtime/instance.js.map +1 -1
- package/dist/runtime/integrations.js +14 -6
- package/dist/runtime/integrations.js.map +1 -1
- package/dist/runtime/loader.js +28 -4
- package/dist/runtime/loader.js.map +1 -1
- package/dist/runtime/migration-context.d.ts +25 -0
- package/dist/runtime/migration-context.js +69 -0
- package/dist/runtime/migration-context.js.map +1 -0
- package/dist/runtime/outbox.d.ts +6 -82
- package/dist/runtime/outbox.js +14 -59
- package/dist/runtime/outbox.js.map +1 -1
- package/dist/runtime/readiness.js +18 -1
- package/dist/runtime/readiness.js.map +1 -1
- package/dist/runtime/runtime.d.ts +84 -8
- package/dist/runtime/runtime.js +372 -131
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/services.d.ts +41 -5
- package/dist/runtime/services.js +49 -4
- package/dist/runtime/services.js.map +1 -1
- package/dist/runtime/sessions.js +4 -3
- package/dist/runtime/sessions.js.map +1 -1
- package/dist/runtime/state-contract.d.ts +167 -0
- package/dist/runtime/state-contract.js +438 -0
- package/dist/runtime/state-contract.js.map +1 -0
- package/dist/runtime/transactions.d.ts +199 -0
- package/dist/runtime/transactions.js +246 -0
- package/dist/runtime/transactions.js.map +1 -0
- package/dist/schema.d.ts +13 -1
- package/dist/schema.js +21 -2
- package/dist/schema.js.map +1 -1
- package/dist/server/admin.d.ts +3 -2
- package/dist/server/admin.js +62 -10
- package/dist/server/admin.js.map +1 -1
- package/dist/server/index.d.ts +6 -1
- package/dist/server/index.js +90 -9
- package/dist/server/index.js.map +1 -1
- package/dist/server/mcp.js +1 -1
- package/dist/server/mcp.js.map +1 -1
- package/dist/server/project.d.ts +5 -0
- package/dist/server/project.js +13 -2
- package/dist/server/project.js.map +1 -1
- package/dist/testing/index.d.ts +10 -3
- package/dist/testing/index.js +33 -7
- package/dist/testing/index.js.map +1 -1
- package/docs/AGENT-OPERATIONS.md +515 -0
- package/docs/APPBOUNDRY.md +240 -0
- package/docs/ARCHITECTURE.md +126 -0
- package/docs/BACKUP.md +115 -0
- package/docs/GUARANTEES.md +457 -0
- package/docs/PATH-TO-PRODUCTION.md +117 -0
- package/docs/README.md +15 -0
- package/docs/SECURITY.md +182 -0
- package/docs/TRANSACTIONS.md +216 -0
- package/docs/UPSTREAM-GAPS.md +270 -0
- package/docs/WHY-FELTKIT.md +64 -0
- package/docs/assets/feltkit-logo-dark.png +0 -0
- package/docs/assets/feltkit-logo.png +0 -0
- package/package.json +10 -8
- package/skills/.claude-plugin/marketplace.json +1 -1
- package/skills/.claude-plugin/plugin.json +3 -3
- package/skills/feltkit-agent/SKILL.md +9 -5
- package/skills/feltkit-build/SKILL.md +16 -4
- package/skills/feltkit-data/SKILL.md +20 -3
- package/skills/feltkit-services/SKILL.md +13 -7
- package/dist/dashboard/assets/index-BhFOquA7.js +0 -15
- package/dist/dashboard/theme.js +0 -11
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FeltKit's development and operations capabilities (docs/AGENT-OPERATIONS.md), defined once.
|
|
3
|
+
* Each is an AppPort capability of the application `dev.feltkit.platform`: typed input and
|
|
4
|
+
* output, its effect, the permission it requires, and an integration descriptor (purpose,
|
|
5
|
+
* preconditions, failures, whether approval is required). The CLI (`feltkit op`), MCP (`/mcp`)
|
|
6
|
+
* and AppPort (`/appport`) adapters all dispatch to these definitions through one AppPort
|
|
7
|
+
* application, so an agent and a person use the same operations, checked the same way.
|
|
8
|
+
*
|
|
9
|
+
* What runs the work is FeltKit's own CLI, the one a person runs, in a child process: the
|
|
10
|
+
* platform never imports a project's code (which an agent may have written) into its own
|
|
11
|
+
* process. A child process is not a sandbox: it runs with the operating-system user's
|
|
12
|
+
* permissions (docs/AGENT-OPERATIONS.md §6).
|
|
13
|
+
*/
|
|
14
|
+
import { type Schema } from "../schema.js";
|
|
15
|
+
import { type Caller, type ChangeSets } from "./changes.js";
|
|
16
|
+
import type { Deployments } from "./deployments.js";
|
|
17
|
+
/** The permissions the operations require; the authority profiles grant them (platform.ts). */
|
|
18
|
+
export declare const PLATFORM_PERMISSIONS: {
|
|
19
|
+
readonly read: "feltkit.platform.read";
|
|
20
|
+
readonly develop: "feltkit.platform.develop";
|
|
21
|
+
/** A deployment's server logs (develop and deploy profiles; not inspect). */
|
|
22
|
+
readonly logs: "feltkit.platform.logs";
|
|
23
|
+
/** Apply a verified change set. The deploy profile also holds the scoped permission (deployScope). */
|
|
24
|
+
readonly deploy: "feltkit.platform.deploy";
|
|
25
|
+
/** Issue, list and revoke platform sessions (the workspace owner). */
|
|
26
|
+
readonly admin: "feltkit.platform.admin";
|
|
27
|
+
};
|
|
28
|
+
/** The permission scoping a deploy to one project and environment: `feltkit.platform.deploy:<project>/<environment>`. */
|
|
29
|
+
export declare const deployScope: (project: string, environment: string) => string;
|
|
30
|
+
export interface OperationContext {
|
|
31
|
+
/** The project as named (relative to the root) and its directory, inside the root (checked). */
|
|
32
|
+
project: string;
|
|
33
|
+
projectDir: string;
|
|
34
|
+
/** Who is calling, and the authority decision that allowed it. */
|
|
35
|
+
caller: Caller;
|
|
36
|
+
changes: ChangeSets;
|
|
37
|
+
deployments: Deployments;
|
|
38
|
+
/** Run FeltKit's CLI in `projectDir` with `args`; its JSON output and exit code. */
|
|
39
|
+
cli(args: string[]): Promise<{
|
|
40
|
+
code: number;
|
|
41
|
+
json: unknown;
|
|
42
|
+
stderr: string;
|
|
43
|
+
stdout: string;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export interface PlatformOperation {
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly version: number;
|
|
49
|
+
readonly description: string;
|
|
50
|
+
readonly effect: "observation" | "consequential";
|
|
51
|
+
readonly permission: string;
|
|
52
|
+
/** A narrower permission this invocation also requires, from its input (checked before anything runs). */
|
|
53
|
+
readonly scope?: (input: Record<string, unknown>) => string;
|
|
54
|
+
readonly input: Schema;
|
|
55
|
+
readonly output: Schema;
|
|
56
|
+
/** AppPort `appport.integration/1`: what a caller may know before invoking. */
|
|
57
|
+
readonly integration: {
|
|
58
|
+
purpose: string;
|
|
59
|
+
effects: Array<{
|
|
60
|
+
type: string;
|
|
61
|
+
description: string;
|
|
62
|
+
}>;
|
|
63
|
+
approval: {
|
|
64
|
+
required: boolean;
|
|
65
|
+
};
|
|
66
|
+
failures: Array<{
|
|
67
|
+
code: string;
|
|
68
|
+
retry: "safe" | "unsafe" | "after-verification";
|
|
69
|
+
effect: "none" | "possible" | "unknown";
|
|
70
|
+
}>;
|
|
71
|
+
};
|
|
72
|
+
run(context: OperationContext, input: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
73
|
+
}
|
|
74
|
+
export declare const OPERATIONS: readonly PlatformOperation[];
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FeltKit's development and operations capabilities (docs/AGENT-OPERATIONS.md), defined once.
|
|
3
|
+
* Each is an AppPort capability of the application `dev.feltkit.platform`: typed input and
|
|
4
|
+
* output, its effect, the permission it requires, and an integration descriptor (purpose,
|
|
5
|
+
* preconditions, failures, whether approval is required). The CLI (`feltkit op`), MCP (`/mcp`)
|
|
6
|
+
* and AppPort (`/appport`) adapters all dispatch to these definitions through one AppPort
|
|
7
|
+
* application, so an agent and a person use the same operations, checked the same way.
|
|
8
|
+
*
|
|
9
|
+
* What runs the work is FeltKit's own CLI, the one a person runs, in a child process: the
|
|
10
|
+
* platform never imports a project's code (which an agent may have written) into its own
|
|
11
|
+
* process. A child process is not a sandbox: it runs with the operating-system user's
|
|
12
|
+
* permissions (docs/AGENT-OPERATIONS.md §6).
|
|
13
|
+
*/
|
|
14
|
+
import { s, shapeToObjectSchema } from "../schema.js";
|
|
15
|
+
import { CHANGE_ENVIRONMENTS } from "./changes.js";
|
|
16
|
+
import { sourceRevision } from "./source.js";
|
|
17
|
+
/** The permissions the operations require; the authority profiles grant them (platform.ts). */
|
|
18
|
+
export const PLATFORM_PERMISSIONS = {
|
|
19
|
+
read: "feltkit.platform.read",
|
|
20
|
+
develop: "feltkit.platform.develop",
|
|
21
|
+
/** A deployment's server logs (develop and deploy profiles; not inspect). */
|
|
22
|
+
logs: "feltkit.platform.logs",
|
|
23
|
+
/** Apply a verified change set. The deploy profile also holds the scoped permission (deployScope). */
|
|
24
|
+
deploy: "feltkit.platform.deploy",
|
|
25
|
+
/** Issue, list and revoke platform sessions (the workspace owner). */
|
|
26
|
+
admin: "feltkit.platform.admin",
|
|
27
|
+
};
|
|
28
|
+
/** The permission scoping a deploy to one project and environment: `feltkit.platform.deploy:<project>/<environment>`. */
|
|
29
|
+
export const deployScope = (project, environment) => `${PLATFORM_PERMISSIONS.deploy}:${project}/${environment}`;
|
|
30
|
+
const project = { project: s.string() };
|
|
31
|
+
const json = s.record(s.unknown());
|
|
32
|
+
/** A CLI run whose JSON is the operation's answer; a run that produced none is an operation failure. */
|
|
33
|
+
async function answer(context, args, what) {
|
|
34
|
+
const { code, json: value, stderr, stdout } = await context.cli(args);
|
|
35
|
+
if (!value || typeof value !== "object") {
|
|
36
|
+
// What the CLI said, as a person running it would have seen it.
|
|
37
|
+
const said = `${stdout}\n${stderr}`.replace(/\x1b\[[0-9;]*m/g, "").trim().split("\n").filter(Boolean).slice(-4).join(" ");
|
|
38
|
+
throw Object.assign(new Error(`${what} failed (exit ${code}): ${said || "no output"}`), { code: "feltkit.EXECUTION_FAILED" });
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
const NONE = [{ code: "FORBIDDEN", retry: "unsafe", effect: "none" }, { code: "NOT_FOUND", retry: "unsafe", effect: "none" }];
|
|
43
|
+
export const OPERATIONS = Object.freeze([
|
|
44
|
+
{
|
|
45
|
+
name: "project.inspect",
|
|
46
|
+
version: 1,
|
|
47
|
+
description: "A project as FeltKit sees it: application, functions and capabilities, collections, schema status, services, environment state and readiness.",
|
|
48
|
+
effect: "observation",
|
|
49
|
+
permission: PLATFORM_PERMISSIONS.read,
|
|
50
|
+
input: shapeToObjectSchema(project),
|
|
51
|
+
output: json,
|
|
52
|
+
integration: { purpose: "Understand an application before changing or operating it.", effects: [], approval: { required: false }, failures: NONE },
|
|
53
|
+
run: (context) => answer(context, ["inspect", "--json"], "feltkit inspect"),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "schema.inspect",
|
|
57
|
+
version: 1,
|
|
58
|
+
description: "The schema the project's collections declare against the one installed in its development environment: the changes, the migrations, and the records that would fail.",
|
|
59
|
+
effect: "observation",
|
|
60
|
+
permission: PLATFORM_PERMISSIONS.read,
|
|
61
|
+
input: shapeToObjectSchema(project),
|
|
62
|
+
output: json,
|
|
63
|
+
integration: { purpose: "Know what a schema change requires before making it.", effects: [], approval: { required: false }, failures: NONE },
|
|
64
|
+
run: (context) => answer(context, ["migrate", "--dry-run", "--json"], "feltkit migrate --dry-run"),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "test.run",
|
|
68
|
+
version: 1,
|
|
69
|
+
description: "Run the project's tests (or the given files) and report each test: outcome, duration, and for a failure its message, expected and actual values.",
|
|
70
|
+
effect: "observation",
|
|
71
|
+
permission: PLATFORM_PERMISSIONS.develop,
|
|
72
|
+
input: shapeToObjectSchema({ ...project, files: s.optional(s.array(s.string())) }),
|
|
73
|
+
output: shapeToObjectSchema({ ok: s.boolean(), passed: s.number(), failed: s.number(), skipped: s.number(), files: s.array(s.string()), tests: s.array(json), error: s.optional(s.string()) }),
|
|
74
|
+
integration: { purpose: "Verify behavior; the report is the test runner's, not a model's.", effects: [{ type: "execution", description: "Runs the project's test code in a child process." }], approval: { required: false }, failures: NONE },
|
|
75
|
+
run: (context, input) => {
|
|
76
|
+
const files = Array.isArray(input.files) ? input.files : [];
|
|
77
|
+
for (const file of files)
|
|
78
|
+
if (file.startsWith("-"))
|
|
79
|
+
throw Object.assign(new Error(`Not a test file: ${file}`), { code: "INVALID_INPUT" });
|
|
80
|
+
return answer(context, ["test", "--json", ...files], "feltkit test");
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "build.run",
|
|
85
|
+
version: 1,
|
|
86
|
+
description: "Build the project as `feltkit build` does (bundle, schema contract, frontend) and report the bundle's SHA-256 and the schema hash.",
|
|
87
|
+
effect: "observation",
|
|
88
|
+
permission: PLATFORM_PERMISSIONS.develop,
|
|
89
|
+
input: shapeToObjectSchema(project),
|
|
90
|
+
output: json,
|
|
91
|
+
integration: { purpose: "Produce and identify a verified build.", effects: [{ type: "write", description: "Writes the project's build output (.feltkit/build)." }], approval: { required: false }, failures: NONE },
|
|
92
|
+
run: (context) => answer(context, ["build", "--json"], "feltkit build"),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "change.propose",
|
|
96
|
+
version: 1,
|
|
97
|
+
description: "Propose an application change: the files it writes (content null deletes one) in a project, for an environment. Recorded durably against the project's current source revision, with a content digest the platform computes.",
|
|
98
|
+
effect: "consequential",
|
|
99
|
+
permission: PLATFORM_PERMISSIONS.develop,
|
|
100
|
+
input: shapeToObjectSchema({ ...project, environment: s.enum(CHANGE_ENVIRONMENTS), files: s.array(shapeToObjectSchema({ path: s.string(), content: s.nullable(s.string()) })), summary: s.optional(s.string()), idempotencyKey: s.optional(s.string()) }),
|
|
101
|
+
output: json,
|
|
102
|
+
integration: { purpose: "Record a proposed change; nothing in the project changes until it is verified and applied.", effects: [{ type: "write", description: "Writes a change-set record to the platform's store." }], approval: { required: false }, failures: [...NONE, { code: "INVALID_INPUT", retry: "unsafe", effect: "none" }, { code: "CONFLICT", retry: "unsafe", effect: "none" }] },
|
|
103
|
+
run: (context, input) => context.changes.propose({ project: context.project, projectDir: context.projectDir, environment: String(input.environment), files: input.files, ...(typeof input.summary === "string" ? { summary: input.summary } : {}), ...(typeof input.idempotencyKey === "string" ? { idempotencyKey: input.idempotencyKey } : {}) }, context.caller),
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "change.inspect",
|
|
107
|
+
version: 1,
|
|
108
|
+
description: "A change set: its files and content, base revision (and whether the project has moved past it), affected kinds and schema changes, status, latest verification, receipt, and its whole history.",
|
|
109
|
+
effect: "observation",
|
|
110
|
+
permission: PLATFORM_PERMISSIONS.read,
|
|
111
|
+
input: shapeToObjectSchema({ ...project, change: s.string() }),
|
|
112
|
+
output: json,
|
|
113
|
+
integration: { purpose: "Review a change and its evidence before deciding.", effects: [], approval: { required: false }, failures: NONE },
|
|
114
|
+
run: (context, input) => context.changes.inspect(String(input.change), context.project, context.projectDir),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "change.verify",
|
|
118
|
+
version: 1,
|
|
119
|
+
description: "Verify a change set in an isolated workspace: FeltKit builds it, runs its tests, and plans its schema change against a copy of the development state. The result is bound to the change set's content digest and base revision.",
|
|
120
|
+
effect: "consequential",
|
|
121
|
+
permission: PLATFORM_PERMISSIONS.develop,
|
|
122
|
+
input: shapeToObjectSchema({ ...project, change: s.string() }),
|
|
123
|
+
output: json,
|
|
124
|
+
integration: { purpose: "Establish, independently of any model, whether a change builds, passes its tests and can migrate.", effects: [{ type: "execution", description: "Runs the project's build and test code, with the change, in a child process (not a sandbox)." }, { type: "write", description: "Records the verification in the platform's store." }], approval: { required: false }, failures: [...NONE, { code: "feltkit.STALE_BASE", retry: "unsafe", effect: "none" }, { code: "CONFLICT", retry: "after-verification", effect: "none" }] },
|
|
125
|
+
run: (context, input) => context.changes.verify(String(input.change), context.project, context.projectDir, context.caller),
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "change.apply",
|
|
129
|
+
version: 1,
|
|
130
|
+
description: "Apply a verified change set: its files are written to the project and it is deployed through `feltkit deploy` (local production, the container target). The receipt is written only after that deploy's health check passed; a failed deploy restores the source and writes no receipt.",
|
|
131
|
+
effect: "consequential",
|
|
132
|
+
permission: PLATFORM_PERMISSIONS.deploy,
|
|
133
|
+
scope: (input) => deployScope(String(input.project ?? ""), String(input.environment ?? "")),
|
|
134
|
+
input: shapeToObjectSchema({ ...project, change: s.string(), environment: s.enum(CHANGE_ENVIRONMENTS), expectedContentDigest: s.optional(s.string()) }),
|
|
135
|
+
output: json,
|
|
136
|
+
integration: { purpose: "Change the application, with a receipt as the proof.", effects: [{ type: "write", description: "Writes the change's files to the project." }, { type: "deploy", description: "Replaces the project's deployment artifact (.feltkit/deploy) when its health check passes." }], approval: { required: false }, failures: [...NONE, { code: "feltkit.NOT_VERIFIED", retry: "unsafe", effect: "none" }, { code: "feltkit.CONTENT_CHANGED", retry: "unsafe", effect: "none" }, { code: "feltkit.STALE_BASE", retry: "unsafe", effect: "none" }, { code: "feltkit.WRONG_TARGET", retry: "unsafe", effect: "none" }, { code: "feltkit.DEPLOY_FAILED", retry: "after-verification", effect: "none" }] },
|
|
137
|
+
run: (context, input) => context.changes.apply(String(input.change), { project: context.project, environment: String(input.environment), ...(typeof input.expectedContentDigest === "string" ? { expectedContentDigest: input.expectedContentDigest } : {}) }, context.projectDir, context.caller),
|
|
138
|
+
}, {
|
|
139
|
+
name: "deploy.apply",
|
|
140
|
+
version: 1,
|
|
141
|
+
description: "Deploy the project's current source to local production: its tests, a candidate release (build and isolated boot check), cutover on the persistent volume, and live verification of the running process. The receipt is written only when the running process passed every check; otherwise the previous deployment is restored.",
|
|
142
|
+
effect: "consequential",
|
|
143
|
+
permission: PLATFORM_PERMISSIONS.deploy,
|
|
144
|
+
scope: (input) => deployScope(String(input.project ?? ""), String(input.environment ?? "")),
|
|
145
|
+
input: shapeToObjectSchema({ ...project, environment: s.enum(CHANGE_ENVIRONMENTS), expectedRevision: s.optional(s.string()) }),
|
|
146
|
+
output: json,
|
|
147
|
+
integration: { purpose: "Run the application in production, with a receipt as the proof that it was running.", effects: [{ type: "deploy", description: "Stops the running deployment, starts the candidate on the production volume; restores the previous one if the candidate fails." }, { type: "execution", description: "Runs the project's tests and code (not a sandbox)." }], approval: { required: false }, failures: [...NONE, { code: "feltkit.STALE_BASE", retry: "unsafe", effect: "none" }, { code: "feltkit.TESTS_FAILED", retry: "unsafe", effect: "none" }, { code: "CONFLICT", retry: "after-verification", effect: "none" }, { code: "feltkit.STARTUP_FAILED", retry: "after-verification", effect: "possible" }, { code: "feltkit.READINESS_TIMEOUT", retry: "after-verification", effect: "possible" }, { code: "feltkit.WRONG_ARTIFACT", retry: "after-verification", effect: "possible" }] },
|
|
148
|
+
run: async (context, input) => {
|
|
149
|
+
const revision = sourceRevision(context.projectDir);
|
|
150
|
+
if (typeof input.expectedRevision === "string" && input.expectedRevision !== revision)
|
|
151
|
+
throw Object.assign(new Error(`${context.project} is at ${revision}, not the ${input.expectedRevision} the caller expected.`), { code: "feltkit.STALE_BASE", details: { currentRevision: revision } });
|
|
152
|
+
const environment = String(input.environment);
|
|
153
|
+
// The same revision, running and verifying: that deployment's receipt, nothing redeployed.
|
|
154
|
+
const current = await context.deployments.current(context.project, environment, revision, context.projectDir);
|
|
155
|
+
if (current)
|
|
156
|
+
return current;
|
|
157
|
+
const ran = await context.cli(["test", "--json"]);
|
|
158
|
+
const t = ran.json;
|
|
159
|
+
if (ran.code !== 0 || !t || (t.failed ?? 1) > 0)
|
|
160
|
+
throw Object.assign(new Error(`The project's tests did not pass (${t ? `${t.failed} failed` : "no report"}); nothing was deployed.`), { code: "feltkit.TESTS_FAILED", details: { failures: (t?.tests ?? []).filter((x) => !x.ok && !x.skipped).slice(0, 10) } });
|
|
161
|
+
return context.deployments.deploy({ project: context.project, projectDir: context.projectDir, environment, kind: "deploy", source: { revision, contentDigest: null, changeId: null, tests: { passed: t.passed, failed: t.failed, skipped: t.skipped } } }, context.caller);
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "deploy.status",
|
|
166
|
+
version: 1,
|
|
167
|
+
description: "The environment's deployment state: its active deployment, any deployment in progress, the latest deployment with its whole history (stages, checks, rollback), and recent deployments with their outcomes.",
|
|
168
|
+
effect: "observation",
|
|
169
|
+
permission: PLATFORM_PERMISSIONS.read,
|
|
170
|
+
input: shapeToObjectSchema({ ...project, environment: s.enum(CHANGE_ENVIRONMENTS) }),
|
|
171
|
+
output: json,
|
|
172
|
+
integration: { purpose: "Know what is deployed and what happened to the last deployment.", effects: [], approval: { required: false }, failures: NONE },
|
|
173
|
+
run: (context, input) => context.deployments.status(context.project, String(input.environment)),
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "runtime.inspect",
|
|
177
|
+
version: 1,
|
|
178
|
+
description: "The running production deployment, checked now: its deployment id, revision and bundle digest as the process reports them (and whether they match the record), health, schema, state location, and the last deployment's result.",
|
|
179
|
+
effect: "observation",
|
|
180
|
+
permission: PLATFORM_PERMISSIONS.read,
|
|
181
|
+
input: shapeToObjectSchema({ ...project, environment: s.enum(CHANGE_ENVIRONMENTS) }),
|
|
182
|
+
output: json,
|
|
183
|
+
integration: { purpose: "See what is actually running, not what was last recorded.", effects: [], approval: { required: false }, failures: NONE },
|
|
184
|
+
run: (context, input) => context.deployments.inspect(context.project, String(input.environment)),
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: "runtime.logs",
|
|
188
|
+
version: 1,
|
|
189
|
+
description: "The last lines (at most 500, from the last 64 KB) of a deployment's server output: the active deployment's, or the one named.",
|
|
190
|
+
effect: "observation",
|
|
191
|
+
permission: PLATFORM_PERMISSIONS.logs,
|
|
192
|
+
input: shapeToObjectSchema({ ...project, environment: s.enum(CHANGE_ENVIRONMENTS), lines: s.optional(s.number()), deployment: s.optional(s.string()) }),
|
|
193
|
+
output: json,
|
|
194
|
+
integration: { purpose: "Diagnose a running or failed deployment.", effects: [], approval: { required: false }, failures: NONE },
|
|
195
|
+
run: (context, input) => context.deployments.logs(context.project, String(input.environment), { ...(typeof input.lines === "number" ? { lines: input.lines } : {}), ...(typeof input.deployment === "string" ? { deployment: input.deployment } : {}) }),
|
|
196
|
+
},
|
|
197
|
+
]);
|
|
198
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/platform/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,CAAC,EAAE,mBAAmB,EAAe,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAgC,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,0BAA0B;IACnC,6EAA6E;IAC7E,IAAI,EAAE,uBAAuB;IA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AAU,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;KACzP;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type AppPortApplication } from "@appport/sdk";
|
|
2
|
+
import { ActivityLog } from "../runtime/activity.js";
|
|
3
|
+
import { Authority, type Principal } from "../runtime/authority.js";
|
|
4
|
+
import { type StateInstance } from "../runtime/instance.js";
|
|
5
|
+
import { FeltDbSessionStore } from "../runtime/sessions.js";
|
|
6
|
+
import { ChangeSets, type FaultHook } from "./changes.js";
|
|
7
|
+
import { Deployments, type DeployFault } from "./deployments.js";
|
|
8
|
+
export declare const PLATFORM_APPLICATION = "dev.feltkit.platform";
|
|
9
|
+
export interface PlatformOptions {
|
|
10
|
+
/** Test seams (changes.ts, deployments.ts): simulate the process stopping at a named point. */
|
|
11
|
+
fault?: FaultHook;
|
|
12
|
+
deployFault?: DeployFault;
|
|
13
|
+
/** How long a started production process has to become ready (default 60 s). */
|
|
14
|
+
readinessTimeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Authority profiles: permission sets on FeltKit's authority (docs/AGENT-OPERATIONS.md §2), not
|
|
18
|
+
* another permission system. `deploy:<project>/<environment>` is one profile per target: it holds
|
|
19
|
+
* develop's permissions and may apply change sets to that project and environment only.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PROFILES: Record<string, string[]>;
|
|
22
|
+
/** A profile name: one of PROFILES, or a deploy profile for a project and environment. */
|
|
23
|
+
export declare const isProfile: (role: string) => boolean;
|
|
24
|
+
/** The MCP tool name of an operation (AppPort's projection: dots become underscores). */
|
|
25
|
+
export declare const toolName: (operation: string) => string;
|
|
26
|
+
export interface InvokeResult {
|
|
27
|
+
ok: boolean;
|
|
28
|
+
output?: Record<string, unknown>;
|
|
29
|
+
error?: {
|
|
30
|
+
code: string;
|
|
31
|
+
message: string;
|
|
32
|
+
details?: unknown;
|
|
33
|
+
};
|
|
34
|
+
decisionId?: string;
|
|
35
|
+
requestId: string;
|
|
36
|
+
}
|
|
37
|
+
export declare class Platform {
|
|
38
|
+
#private;
|
|
39
|
+
readonly root: string;
|
|
40
|
+
readonly instance: StateInstance;
|
|
41
|
+
readonly sessions: FeltDbSessionStore;
|
|
42
|
+
readonly authority: Authority;
|
|
43
|
+
readonly activity: ActivityLog;
|
|
44
|
+
readonly appport: AppPortApplication;
|
|
45
|
+
readonly changes: ChangeSets;
|
|
46
|
+
readonly deployments: Deployments;
|
|
47
|
+
/** `fault` is a test seam (changes.ts): it simulates the process stopping at a named point. */
|
|
48
|
+
static open(root: string, options?: PlatformOptions): Platform;
|
|
49
|
+
private constructor();
|
|
50
|
+
/** A project directory inside the root: never outside it, and it must be a FeltKit project. */
|
|
51
|
+
projectDir(project: string): string;
|
|
52
|
+
/** Invoke an operation as `principal` (the CLI adapter), through the same AppPort pipeline. */
|
|
53
|
+
invoke(name: string, input: unknown, options?: {
|
|
54
|
+
principal?: Principal;
|
|
55
|
+
session?: unknown;
|
|
56
|
+
transport?: string;
|
|
57
|
+
}): Promise<InvokeResult>;
|
|
58
|
+
/** MCP tools a session may call: the operations its profile grants, nothing else. */
|
|
59
|
+
toolsFor(principal: Principal | null): (session: unknown) => {
|
|
60
|
+
tools: import("@appport/sdk").McpTool[];
|
|
61
|
+
call: (name: string, args: unknown) => Promise<import("@appport/sdk").McpToolResult>;
|
|
62
|
+
};
|
|
63
|
+
/** Whether `principal` holds `permission` under the profiles (wildcards included). */
|
|
64
|
+
holds(principal: Principal | null | undefined, permission: string): boolean;
|
|
65
|
+
/** Issue a platform session for an agent or person holding `profile`. Returns the token once. */
|
|
66
|
+
issue(input: {
|
|
67
|
+
id: string;
|
|
68
|
+
type: "agent" | "user" | "service";
|
|
69
|
+
profile: keyof typeof PROFILES | string;
|
|
70
|
+
ttlMs?: number;
|
|
71
|
+
label?: string;
|
|
72
|
+
}): Promise<import("@appport/protocol").Session>;
|
|
73
|
+
close(): Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
/** The local CLI acts as the workspace's owner (its filesystem access is its authority). */
|
|
76
|
+
export declare function localOwner(): Principal;
|
|
77
|
+
/** How this FeltKit's CLI is run in a child process: [executable, ...leading arguments]. */
|
|
78
|
+
export declare function cliCommand(): string[];
|