@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.
Files changed (140) hide show
  1. package/dist/app.d.ts +17 -3
  2. package/dist/app.js +10 -0
  3. package/dist/app.js.map +1 -1
  4. package/dist/appboundry/build.js +4 -0
  5. package/dist/appboundry/build.js.map +1 -1
  6. package/dist/authorize.d.ts +1 -1
  7. package/dist/cli/main.js +8 -152
  8. package/dist/cli/main.js.map +1 -1
  9. package/dist/client/index.d.ts +83 -4
  10. package/dist/client/index.js +154 -2
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/dashboard/assets/index-BEjtLLYq.js +15 -0
  13. package/dist/dashboard/index.html +1 -1
  14. package/dist/docs.d.ts +1 -1
  15. package/dist/docs.js +1 -0
  16. package/dist/docs.js.map +1 -1
  17. package/dist/index.d.ts +4 -2
  18. package/dist/index.js.map +1 -1
  19. package/dist/platform/approvals.d.ts +102 -0
  20. package/dist/platform/approvals.js +155 -0
  21. package/dist/platform/approvals.js.map +1 -0
  22. package/dist/platform/artifacts.d.ts +126 -0
  23. package/dist/platform/artifacts.js +251 -0
  24. package/dist/platform/artifacts.js.map +1 -0
  25. package/dist/platform/blobs.d.ts +25 -0
  26. package/dist/platform/blobs.js +78 -0
  27. package/dist/platform/blobs.js.map +1 -0
  28. package/dist/platform/diff.d.ts +23 -0
  29. package/dist/platform/diff.js +107 -0
  30. package/dist/platform/diff.js.map +1 -0
  31. package/dist/platform/exec.d.ts +182 -0
  32. package/dist/platform/exec.js +575 -0
  33. package/dist/platform/exec.js.map +1 -0
  34. package/dist/platform/operations.d.ts +30 -13
  35. package/dist/platform/operations.js +8 -17
  36. package/dist/platform/operations.js.map +1 -1
  37. package/dist/platform/permissions.d.ts +15 -0
  38. package/dist/platform/permissions.js +16 -0
  39. package/dist/platform/permissions.js.map +1 -0
  40. package/dist/platform/platform.d.ts +28 -0
  41. package/dist/platform/platform.js +84 -5
  42. package/dist/platform/platform.js.map +1 -1
  43. package/dist/platform/releases.d.ts +110 -0
  44. package/dist/platform/releases.js +344 -0
  45. package/dist/platform/releases.js.map +1 -0
  46. package/dist/platform/review.d.ts +10 -0
  47. package/dist/platform/review.js +109 -0
  48. package/dist/platform/review.js.map +1 -0
  49. package/dist/platform/server.js +7 -0
  50. package/dist/platform/server.js.map +1 -1
  51. package/dist/platform/source.d.ts +2 -0
  52. package/dist/platform/source.js +1 -1
  53. package/dist/platform/source.js.map +1 -1
  54. package/dist/platform/workspace-operations.d.ts +2 -0
  55. package/dist/platform/workspace-operations.js +590 -0
  56. package/dist/platform/workspace-operations.js.map +1 -0
  57. package/dist/platform/workspaces.d.ts +211 -0
  58. package/dist/platform/workspaces.js +435 -0
  59. package/dist/platform/workspaces.js.map +1 -0
  60. package/dist/react/index.d.ts +29 -1
  61. package/dist/react/index.js +50 -0
  62. package/dist/react/index.js.map +1 -1
  63. package/dist/runtime/activity.d.ts +1 -1
  64. package/dist/runtime/agent.d.ts +216 -2
  65. package/dist/runtime/agent.js +333 -7
  66. package/dist/runtime/agent.js.map +1 -1
  67. package/dist/runtime/approval-rules.d.ts +16 -0
  68. package/dist/runtime/approval-rules.js +37 -0
  69. package/dist/runtime/approval-rules.js.map +1 -0
  70. package/dist/runtime/authority.d.ts +18 -1
  71. package/dist/runtime/authority.js +26 -1
  72. package/dist/runtime/authority.js.map +1 -1
  73. package/dist/runtime/browser-inference.d.ts +52 -0
  74. package/dist/runtime/browser-inference.js +53 -0
  75. package/dist/runtime/browser-inference.js.map +1 -0
  76. package/dist/runtime/context.d.ts +110 -0
  77. package/dist/runtime/decisions.d.ts +23 -0
  78. package/dist/runtime/decisions.js +54 -0
  79. package/dist/runtime/decisions.js.map +1 -1
  80. package/dist/runtime/generation.d.ts +94 -0
  81. package/dist/runtime/generation.js +295 -0
  82. package/dist/runtime/generation.js.map +1 -0
  83. package/dist/runtime/runtime.d.ts +10 -2
  84. package/dist/runtime/runtime.js +125 -1
  85. package/dist/runtime/runtime.js.map +1 -1
  86. package/dist/server/admin.d.ts +9 -1
  87. package/dist/server/admin.js +84 -2
  88. package/dist/server/admin.js.map +1 -1
  89. package/dist/server/index.d.ts +1 -1
  90. package/dist/server/index.js +159 -8
  91. package/dist/server/index.js.map +1 -1
  92. package/dist/testing/index.d.ts +11 -0
  93. package/dist/testing/index.js +7 -3
  94. package/dist/testing/index.js.map +1 -1
  95. package/docs/AUTH.md +2 -2
  96. package/docs/GENERATION.md +136 -0
  97. package/docs/README.md +3 -2
  98. package/package.json +2 -4
  99. package/skills/.claude-plugin/marketplace.json +1 -1
  100. package/skills/.claude-plugin/plugin.json +1 -1
  101. package/dist/cli/compose.d.ts +0 -31
  102. package/dist/cli/compose.js +0 -274
  103. package/dist/cli/compose.js.map +0 -1
  104. package/dist/cli/create.d.ts +0 -219
  105. package/dist/cli/create.js +0 -1193
  106. package/dist/cli/create.js.map +0 -1
  107. package/dist/cli/domain.d.ts +0 -174
  108. package/dist/cli/domain.js +0 -1119
  109. package/dist/cli/domain.js.map +0 -1
  110. package/dist/cli/shell.d.ts +0 -7
  111. package/dist/cli/shell.js +0 -59
  112. package/dist/cli/shell.js.map +0 -1
  113. package/dist/composition/catalog.d.ts +0 -3
  114. package/dist/composition/catalog.js +0 -217
  115. package/dist/composition/catalog.js.map +0 -1
  116. package/dist/composition/contract.d.ts +0 -165
  117. package/dist/composition/contract.js +0 -12
  118. package/dist/composition/contract.js.map +0 -1
  119. package/dist/composition/execute.d.ts +0 -110
  120. package/dist/composition/execute.js +0 -350
  121. package/dist/composition/execute.js.map +0 -1
  122. package/dist/composition/generate.d.ts +0 -105
  123. package/dist/composition/generate.js +0 -274
  124. package/dist/composition/generate.js.map +0 -1
  125. package/dist/composition/plan.d.ts +0 -131
  126. package/dist/composition/plan.js +0 -558
  127. package/dist/composition/plan.js.map +0 -1
  128. package/dist/composition/profiles.d.ts +0 -20
  129. package/dist/composition/profiles.js +0 -81
  130. package/dist/composition/profiles.js.map +0 -1
  131. package/dist/composition/reconcile.d.ts +0 -153
  132. package/dist/composition/reconcile.js +0 -282
  133. package/dist/composition/reconcile.js.map +0 -1
  134. package/dist/composition/recover.d.ts +0 -89
  135. package/dist/composition/recover.js +0 -407
  136. package/dist/composition/recover.js.map +0 -1
  137. package/dist/composition/resolve.d.ts +0 -2
  138. package/dist/composition/resolve.js +0 -208
  139. package/dist/composition/resolve.js.map +0 -1
  140. package/dist/dashboard/assets/index-BrC1AtZ1.js +0 -15
@@ -0,0 +1,182 @@
1
+ import type { StateFirstDB } from "@feltdb/core";
2
+ import type { Principal } from "../runtime/authority.js";
3
+ import { BlobStore, type Digest } from "./blobs.js";
4
+ export declare const EXECUTIONS = "feltkit.platform.executions";
5
+ export type ExecutionState = "requested" | "running" | "succeeded" | "failed" | "cancelled" | "timed_out" | "interrupted";
6
+ export declare const FINAL_STATES: readonly ExecutionState[];
7
+ export interface ExecutionLimits {
8
+ /** Wall-clock time before the command is stopped (timed_out). */
9
+ timeoutMs: number;
10
+ /** CPU seconds (RLIMIT_CPU). */
11
+ cpuSeconds: number;
12
+ /** Data memory per process (RLIMIT_DATA, which covers V8's heap). */
13
+ memoryBytes: number;
14
+ /** Largest file the command may write (RLIMIT_FSIZE). */
15
+ fileBytes: number;
16
+ /** Processes for its user (RLIMIT_NPROC); enforced only when the command runs as a non-root uid. */
17
+ processes: number;
18
+ /** Open files per process (RLIMIT_NOFILE). */
19
+ openFiles: number;
20
+ /** Output kept per stream; the rest is counted and dropped (truncated). */
21
+ outputBytes: number;
22
+ }
23
+ export declare const DEFAULT_LIMITS: ExecutionLimits;
24
+ export declare const MAX_LIMITS: ExecutionLimits;
25
+ export interface Isolation {
26
+ identity: "per-workspace-uid" | "os-user";
27
+ uid: number | null;
28
+ filesystem: "workspace-only" | "uid-permissions" | "os-user";
29
+ network: "denied" | "allowed" | "not-enforced";
30
+ processes: "pid-namespace" | "process-group";
31
+ rlimits: boolean;
32
+ }
33
+ export interface OutputRef {
34
+ digest: Digest;
35
+ /** Bytes stored (after the cap). */
36
+ bytes: number;
37
+ /** Bytes the command wrote to the stream. */
38
+ totalBytes: number;
39
+ truncated: boolean;
40
+ /** Platform secret values found in the output and replaced. */
41
+ redactions: number;
42
+ }
43
+ export interface ExecutionRecord {
44
+ id: string;
45
+ workspace: {
46
+ id: string;
47
+ dir: string;
48
+ };
49
+ program: string;
50
+ /** The resolved executable that ran (from the allowlist). */
51
+ executable: string;
52
+ args: string[];
53
+ /** Names only: values are not evidence and may be sensitive. */
54
+ envNames: string[];
55
+ network: "none" | "allowed";
56
+ limits: ExecutionLimits;
57
+ isolation: Isolation;
58
+ state: ExecutionState;
59
+ requestedBy: {
60
+ id: string;
61
+ type: string;
62
+ };
63
+ decisionId: string;
64
+ requestId: string;
65
+ idempotencyKey?: string;
66
+ requestedAt: string;
67
+ startedAt?: string;
68
+ finishedAt?: string;
69
+ durationMs?: number;
70
+ exitCode?: number | null;
71
+ /** The signal that ended the program, when it was one. */
72
+ signal?: string | null;
73
+ cpu?: {
74
+ userSeconds: number;
75
+ systemSeconds: number;
76
+ } | null;
77
+ stdout?: OutputRef;
78
+ stderr?: OutputRef;
79
+ failure?: {
80
+ code: string;
81
+ message: string;
82
+ };
83
+ /** The process and its kernel start time, so recovery never signals a reused pid. */
84
+ pid?: number | null;
85
+ pidStart?: string | null;
86
+ cancelledBy?: string;
87
+ __version?: number;
88
+ }
89
+ export interface RunInput {
90
+ workspace: {
91
+ id: string;
92
+ dir: string;
93
+ };
94
+ program: string;
95
+ args?: string[];
96
+ env?: Record<string, string>;
97
+ network?: "none" | "allowed";
98
+ /** `required`: refuse to run unless the filesystem is confined to the workspace. */
99
+ isolation?: "required" | "best-available";
100
+ limits?: Partial<ExecutionLimits>;
101
+ idempotencyKey?: string;
102
+ /** Platform-chosen paths the command may read (a project's node_modules, say): visible, read-only. Never a caller's input. */
103
+ readable?: string[];
104
+ }
105
+ export interface Caller {
106
+ principal: Principal;
107
+ decisionId: string;
108
+ requestId: string;
109
+ }
110
+ /** What this machine can enforce, probed once. FELTKIT_EXEC_ISOLATION=process forces the fallback (tests, policy). */
111
+ export interface Capabilities {
112
+ root: boolean;
113
+ prlimit: boolean;
114
+ setpriv: boolean;
115
+ namespaces: boolean;
116
+ reason?: string;
117
+ }
118
+ export declare function probeCapabilities(): Capabilities;
119
+ /** For tests: probe again (after changing FELTKIT_EXEC_ISOLATION). */
120
+ export declare function resetCapabilities(): void;
121
+ /** A per-workspace uid in [100000, 160000): two workspaces' commands cannot read each other's files. */
122
+ export declare function workspaceUid(workspaceId: string): number;
123
+ export interface ExecutionsOptions {
124
+ /** Where running commands' output is spooled before it is stored. */
125
+ spoolDir: string;
126
+ blobs: BlobStore;
127
+ /** The platform's root and the directories every workspace lives under (covered, except the command's own). */
128
+ root: string;
129
+ /** Allowed programs: name → [executable, ...leading arguments]. */
130
+ programs: Record<string, string[]>;
131
+ /** A program the workspace provides itself (its own FeltKit CLI, say), preferred over `programs` when it resolves. */
132
+ resolve?: (name: string, workspaceDir: string) => string[] | null;
133
+ /** Directories covered in a mount namespace besides the root (default: HOME and the temporary directory). */
134
+ cover?: string[];
135
+ }
136
+ export declare class Executions {
137
+ #private;
138
+ readonly ready: Promise<{
139
+ recovered: string[];
140
+ }>;
141
+ constructor(db: StateFirstDB, options: ExecutionsOptions);
142
+ /** What a command would run with here: the probe's result. */
143
+ capabilities(): Capabilities;
144
+ /** Start a command; the record once it is running (or refused). `wait()` for the end. */
145
+ start(input: RunInput, caller: Caller): Promise<ExecutionRecord>;
146
+ /** Run a command to its end. */
147
+ run(input: RunInput, caller: Caller): Promise<ExecutionRecord>;
148
+ /** The record once the command has ended (it may already have). */
149
+ wait(id: string): Promise<ExecutionRecord>;
150
+ /** One execution, for its requester (or a viewer who may see all): others get NOT_FOUND. */
151
+ get(id: string, viewer: {
152
+ id: string;
153
+ all?: boolean;
154
+ }): Promise<ExecutionRecord>;
155
+ list(viewer: {
156
+ id: string;
157
+ all?: boolean;
158
+ }, filter?: {
159
+ workspace?: string;
160
+ state?: ExecutionState;
161
+ limit?: number;
162
+ }): Promise<ExecutionRecord[]>;
163
+ /** A stream's stored output (verified against its digest), a byte range of it. */
164
+ output(id: string, stream: "stdout" | "stderr", viewer: {
165
+ id: string;
166
+ all?: boolean;
167
+ }, range?: {
168
+ offset?: number;
169
+ limit?: number;
170
+ }): Promise<{
171
+ text: string;
172
+ offset: number;
173
+ bytes: number;
174
+ total: number;
175
+ truncated: boolean;
176
+ digest: Digest | null;
177
+ }>;
178
+ /** Cancel a running command (its requester, or a viewer who may act on all). */
179
+ cancel(id: string, caller: Caller, all?: boolean): Promise<ExecutionRecord>;
180
+ /** Stop everything this process started (the platform is closing): each ends cancelled. */
181
+ close(): Promise<void>;
182
+ }