@feltdb/feltkit 0.4.0 → 0.5.1

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 (132) hide show
  1. package/dist/agent-engine.d.ts +93 -0
  2. package/dist/agent-engine.js +40 -0
  3. package/dist/agent-engine.js.map +1 -0
  4. package/dist/app.d.ts +153 -4
  5. package/dist/app.js +134 -25
  6. package/dist/app.js.map +1 -1
  7. package/dist/appboundry/build.d.ts +9 -1
  8. package/dist/appboundry/build.js +7 -7
  9. package/dist/appboundry/build.js.map +1 -1
  10. package/dist/appboundry/guest.js +82 -0
  11. package/dist/appboundry/guest.js.map +1 -1
  12. package/dist/appboundry/host.d.ts +21 -0
  13. package/dist/appboundry/host.js +83 -2
  14. package/dist/appboundry/host.js.map +1 -1
  15. package/dist/appboundry/runtime.js +2 -0
  16. package/dist/appboundry/runtime.js.map +1 -1
  17. package/dist/boards/index.d.ts +1258 -0
  18. package/dist/boards/index.js +1410 -0
  19. package/dist/boards/index.js.map +1 -0
  20. package/dist/boards/model.d.ts +177 -0
  21. package/dist/boards/model.js +177 -0
  22. package/dist/boards/model.js.map +1 -0
  23. package/dist/boards/react.d.ts +18 -0
  24. package/dist/boards/react.js +339 -0
  25. package/dist/boards/react.js.map +1 -0
  26. package/dist/cli/deploy-appboundry-self-hosted.js +2 -2
  27. package/dist/cli/deploy.js +19 -6
  28. package/dist/cli/deploy.js.map +1 -1
  29. package/dist/cli/main.js +70 -5
  30. package/dist/cli/main.js.map +1 -1
  31. package/dist/client/index.d.ts +265 -4
  32. package/dist/client/index.js +170 -3
  33. package/dist/client/index.js.map +1 -1
  34. package/dist/cron.d.ts +18 -0
  35. package/dist/cron.js +67 -0
  36. package/dist/cron.js.map +1 -0
  37. package/dist/dashboard/assets/index-CLzg0fuZ.js +14 -0
  38. package/dist/dashboard/assets/index-D2XOWzK9.css +1 -0
  39. package/dist/dashboard/index.html +2 -2
  40. package/dist/docs.d.ts +1 -1
  41. package/dist/docs.js +3 -0
  42. package/dist/docs.js.map +1 -1
  43. package/dist/eve/index.d.ts +77 -0
  44. package/dist/eve/index.js +128 -0
  45. package/dist/eve/index.js.map +1 -0
  46. package/dist/index.d.ts +7 -2
  47. package/dist/index.js +2 -1
  48. package/dist/index.js.map +1 -1
  49. package/dist/native/build.d.ts +112 -0
  50. package/dist/native/build.js +472 -0
  51. package/dist/native/build.js.map +1 -0
  52. package/dist/native/index.d.ts +67 -0
  53. package/dist/native/index.js +113 -0
  54. package/dist/native/index.js.map +1 -0
  55. package/dist/native/instance.d.ts +3 -0
  56. package/dist/native/instance.js +18 -0
  57. package/dist/native/instance.js.map +1 -0
  58. package/dist/react/agent-control.d.ts +2 -0
  59. package/dist/react/agent-control.js +1 -1
  60. package/dist/react/agent-control.js.map +1 -1
  61. package/dist/react/auth.d.ts +15 -1
  62. package/dist/react/auth.js +28 -5
  63. package/dist/react/auth.js.map +1 -1
  64. package/dist/react/hooks.d.ts +88 -0
  65. package/dist/react/hooks.js +188 -0
  66. package/dist/react/hooks.js.map +1 -0
  67. package/dist/react/index.d.ts +5 -88
  68. package/dist/react/index.js +3 -185
  69. package/dist/react/index.js.map +1 -1
  70. package/dist/runtime/agent-control.d.ts +10 -0
  71. package/dist/runtime/agent-control.js +9 -1
  72. package/dist/runtime/agent-control.js.map +1 -1
  73. package/dist/runtime/agent-run.d.ts +166 -0
  74. package/dist/runtime/agent-run.js +431 -0
  75. package/dist/runtime/agent-run.js.map +1 -0
  76. package/dist/runtime/agent.d.ts +158 -1
  77. package/dist/runtime/agent.js +329 -8
  78. package/dist/runtime/agent.js.map +1 -1
  79. package/dist/runtime/assemble.js +14 -1
  80. package/dist/runtime/assemble.js.map +1 -1
  81. package/dist/runtime/authority.d.ts +9 -0
  82. package/dist/runtime/authority.js.map +1 -1
  83. package/dist/runtime/context.d.ts +9 -0
  84. package/dist/runtime/required-capabilities.d.ts +73 -0
  85. package/dist/runtime/required-capabilities.js +69 -0
  86. package/dist/runtime/required-capabilities.js.map +1 -0
  87. package/dist/runtime/runtime.d.ts +70 -1
  88. package/dist/runtime/runtime.js +261 -9
  89. package/dist/runtime/runtime.js.map +1 -1
  90. package/dist/runtime/sessions.d.ts +1 -0
  91. package/dist/runtime/sessions.js +1 -1
  92. package/dist/runtime/sessions.js.map +1 -1
  93. package/dist/runtime/tenancy.d.ts +9 -1
  94. package/dist/runtime/tenancy.js +22 -0
  95. package/dist/runtime/tenancy.js.map +1 -1
  96. package/dist/runtime/transactions.d.ts +3 -1
  97. package/dist/runtime/transactions.js.map +1 -1
  98. package/dist/server/eve.d.ts +287 -0
  99. package/dist/server/eve.js +1071 -0
  100. package/dist/server/eve.js.map +1 -0
  101. package/dist/server/index.d.ts +2 -0
  102. package/dist/server/index.js +61 -4
  103. package/dist/server/index.js.map +1 -1
  104. package/dist/server/mcp.d.ts +7 -7
  105. package/dist/server/project.js +20 -3
  106. package/dist/server/project.js.map +1 -1
  107. package/dist/server/session-http.d.ts +7 -1
  108. package/dist/server/session-http.js +11 -1
  109. package/dist/server/session-http.js.map +1 -1
  110. package/dist/server/tenancy.d.ts +2 -0
  111. package/dist/server/tenancy.js +31 -1
  112. package/dist/server/tenancy.js.map +1 -1
  113. package/dist/testing/index.d.ts +1 -4
  114. package/dist/testing/index.js +2 -1
  115. package/dist/testing/index.js.map +1 -1
  116. package/docs/AGENT-CONTROL.md +36 -0
  117. package/docs/APPBOUNDRY.md +68 -2
  118. package/docs/AUTH.md +2 -0
  119. package/docs/EVE-COMPOSITION.md +75 -0
  120. package/docs/NATIVE-AGENTS.md +353 -0
  121. package/docs/NATIVE.md +137 -0
  122. package/docs/README.md +5 -2
  123. package/package.json +35 -9
  124. package/skills/.claude-plugin/marketplace.json +1 -1
  125. package/skills/.claude-plugin/plugin.json +1 -1
  126. package/skills/feltkit-agent/SKILL.md +1 -1
  127. package/skills/feltkit-build/SKILL.md +1 -1
  128. package/skills/feltkit-data/SKILL.md +1 -1
  129. package/skills/feltkit-operations/SKILL.md +1 -1
  130. package/skills/feltkit-services/SKILL.md +1 -1
  131. package/dist/dashboard/assets/index-BhxrvY37.js +0 -15
  132. package/dist/dashboard/assets/index-CSzYeCo_.css +0 -1
@@ -0,0 +1,287 @@
1
+ import { type IncomingMessage, type ServerResponse } from "node:http";
2
+ import { type EveAgentDeclaration, type FunctionDefinition } from "../app.js";
3
+ import type { Principal } from "../runtime/authority.js";
4
+ import type { Logger } from "../runtime/context.js";
5
+ import type { FeltKitRuntime } from "../runtime/runtime.js";
6
+ export declare const EVE_SESSIONS_COLLECTION = "_feltkit_eve_sessions";
7
+ /** One capability as the agent sees it (`agent/lib/feltkit-capabilities.json`). */
8
+ export interface EveCapability {
9
+ capability: string;
10
+ tool: string;
11
+ description: string;
12
+ inputSchema: Record<string, unknown>;
13
+ approval: "required" | "none";
14
+ }
15
+ export type EveAgentState = "starting" | "ready" | "restarting" | "failed" | "stopped";
16
+ export interface EveSessionRecord {
17
+ id: string;
18
+ agent: string;
19
+ tenantId: string | null;
20
+ createdBy: string;
21
+ createdAt: number;
22
+ title: string;
23
+ /** The agent task this session is (appport.agent-control/1): steering it steers the session. */
24
+ taskId?: string;
25
+ /** People's answers to the agent's approval requests: who, when, and the AppPort approval of the exact call. */
26
+ answers?: Array<{
27
+ interactionId: string;
28
+ decision: "approve" | "deny";
29
+ by: string;
30
+ at: number;
31
+ capability?: string;
32
+ approval?: string;
33
+ }>;
34
+ /** Who stopped the session and when, recorded once the runtime confirmed it ended. */
35
+ stopped?: {
36
+ by: string;
37
+ at: number;
38
+ reason?: string;
39
+ };
40
+ }
41
+ /** A tool name (eve: the tool file's name) for a capability: dots become underscores. */
42
+ export declare function eveToolName(capability: string): string;
43
+ export declare function signEveToken(secret: string, claims: Record<string, unknown>, now?: number): string;
44
+ export declare class EveHost {
45
+ #private;
46
+ constructor(runtime: FeltKitRuntime, projectDir: string, log?: Logger);
47
+ static declared(runtime: FeltKitRuntime): boolean;
48
+ /**
49
+ * The agent's view of its capabilities, generated into its project (`agent/lib/feltkit-capabilities.json`):
50
+ * for each capability the declaration covers, its tool name, description, JSON Schema input and whether it
51
+ * needs a person's approval. Tools are made from it (`feltkitCapability`), so the agent never restates them.
52
+ */
53
+ static writeCapabilities(root: string, declaration: EveAgentDeclaration, functions: ReadonlyMap<string, FunctionDefinition>): string;
54
+ /** `eve build` for every agent: the production server `eve start` runs. */
55
+ /**
56
+ * Every session of a FeltKit agent is an agent task people steer (appport.agent-control/1), so the agent must honour
57
+ * control; and a session is evidence, so ending it must not delete its history. The compiled manifest says both.
58
+ * Refuses a build that does not, with the fix.
59
+ */
60
+ static requireControl(name: string, root: string): void;
61
+ static build(projectDir: string, eve: Record<string, EveAgentDeclaration>, functions: ReadonlyMap<string, FunctionDefinition>, log?: (line: string) => void): Promise<void>;
62
+ /** Start every agent's server. FeltKit must be listening (the agent calls back into it). */
63
+ start(feltkitUrl: string, options?: {
64
+ build?: boolean;
65
+ }): Promise<void>;
66
+ report(): Record<string, {
67
+ state: EveAgentState;
68
+ detail?: string;
69
+ restarts: number;
70
+ }>;
71
+ close(): Promise<void>;
72
+ /** The worker that is this agent in a workspace (or the application, without workspaces). */
73
+ workerName(agent: string, tenantId: string | null): string;
74
+ /** The published capabilities the declaration covers (patterns expanded), with the access each needs. */
75
+ capabilities(name: string): Map<string, {
76
+ fn: string;
77
+ access: string;
78
+ approval: boolean;
79
+ }>;
80
+ /** Activate the agent in the caller's workspace: its worker, and its membership there. Idempotent. */
81
+ activate(name: string, principal: Principal | null): Promise<{
82
+ worker: string;
83
+ activated: boolean;
84
+ }>;
85
+ /** The workspace's sessions with this agent, newest first. */
86
+ sessions(name: string, principal: Principal | null, limit?: number): Promise<EveSessionRecord[]>;
87
+ status(name: string, principal: Principal | null): Promise<Record<string, unknown>>;
88
+ /**
89
+ * `/eve/<name>/…` (a person's traffic, forwarded) and `/_feltkit/eve/<name>/…` (the agent's bridge). Returns false
90
+ * for any other path.
91
+ */
92
+ handle(request: IncomingMessage, response: ServerResponse, pathname: string, identify: () => Promise<{
93
+ principal: Principal | null;
94
+ }>): Promise<boolean>;
95
+ /**
96
+ * Everything recorded about one session, for a person of its workspace who may read agent tasks: what they asked,
97
+ * what the agent was given and did (model steps, tool calls with their inputs, results and whether they changed
98
+ * anything), the approvals it asked for and who answered, the lifecycle (pauses, updates) and its state now. Facts
99
+ * come from the runtime; lifecycle, updates and answers from FeltKit's own records, which outlive the session.
100
+ */
101
+ evidence(name: string, sessionId: string, principal: Principal | null): Promise<{
102
+ session: {
103
+ id: string;
104
+ title: string;
105
+ createdBy: string;
106
+ createdAt: number;
107
+ taskId: string | null;
108
+ };
109
+ state: ExecutionState;
110
+ ended: boolean;
111
+ runtimeHistory: string;
112
+ control: {
113
+ phase: import("../runtime/agent-control.js").ExecutionPhase;
114
+ mode: import("../runtime/agent-control.js").ControlMode;
115
+ reason: string | null;
116
+ revision: string;
117
+ } | null;
118
+ controlHistory: {
119
+ mode: string;
120
+ at: string;
121
+ by: string;
122
+ note?: string;
123
+ }[];
124
+ updates: {
125
+ instructionId: string;
126
+ taskId: string;
127
+ state: import("../runtime/agent-control.js").InstructionState;
128
+ seq: number;
129
+ from: string;
130
+ text?: string;
131
+ note?: string;
132
+ signaledAt?: string;
133
+ receivedAt?: string;
134
+ deliveredAt?: string;
135
+ deliveredAtCheckpoint?: number;
136
+ resolvedAt?: string;
137
+ resolution?: {
138
+ by: string;
139
+ note: string;
140
+ };
141
+ history: Array<{
142
+ state: import("../runtime/agent-control.js").InstructionState;
143
+ at: string;
144
+ by: string;
145
+ note?: string;
146
+ }>;
147
+ turnId?: string;
148
+ turn?: "running" | "completed" | "failed" | "cancelled" | string;
149
+ }[];
150
+ answers: {
151
+ interactionId: string;
152
+ decision: "approve" | "deny";
153
+ by: string;
154
+ at: number;
155
+ capability?: string;
156
+ approval?: string;
157
+ }[];
158
+ stopped: {
159
+ by: string;
160
+ at: number;
161
+ reason?: string;
162
+ } | null;
163
+ timeline: EvidenceEntry[];
164
+ }>;
165
+ /**
166
+ * A person's answer to an approval the agent is waiting on. The call is the one eve recorded for that
167
+ * interaction, never one the request describes. Approve: an AppPort approval of exactly that capability and
168
+ * input, by this person, for the workspace's worker; eve then resumes and the call names it. Deny: eve is told.
169
+ */
170
+ answer(name: string, principal: Principal | null, input: {
171
+ sessionId: string;
172
+ interactionId: string;
173
+ decision: "approve" | "deny";
174
+ }): Promise<{
175
+ approval?: string;
176
+ status: number;
177
+ }>;
178
+ }
179
+ /**
180
+ * What a session is doing now, from the facts the agent runtime recorded: model calls started and not settled
181
+ * (generations), tool calls started and not settled (actions), and whether its turn is held by control.
182
+ */
183
+ export declare function sessionExecution(facts: ReadonlyArray<{
184
+ type?: string;
185
+ data?: unknown;
186
+ }>): {
187
+ generations: string[];
188
+ actions: string[];
189
+ held: boolean;
190
+ };
191
+ /** A fact recording that the session's turn is held by agent control (`turn.held`; never an approval wait). */
192
+ export declare function isControlHold(fact: {
193
+ type?: string;
194
+ data?: unknown;
195
+ }): boolean;
196
+ /** What a session is doing, as one state a person can rely on, and the evidence it rests on. */
197
+ export type ExecutionState = "idle" | "submitted" | "running" | "model" | "tool" | "approval" | "pausing" | "paused" | "interrupting" | "interrupted" | "resuming" | "completed" | "failed" | "stopped";
198
+ /**
199
+ * The session's state from what the runtime recorded (its facts) and what the lifecycle recorded (the task's control
200
+ * phase and mode), never from a client: stopped and held states come from control and the runtime's `turn.held`;
201
+ * the work in progress from facts started and not settled.
202
+ */
203
+ export declare function executionState(facts: ReadonlyArray<{
204
+ type?: string;
205
+ data?: unknown;
206
+ }>, control: {
207
+ phase: string;
208
+ mode: string;
209
+ } | null, ended: boolean): {
210
+ state: ExecutionState;
211
+ since?: string;
212
+ };
213
+ /**
214
+ * Where an update stands, from both records: the lifecycle's (received, delivered, incorporated, …) and, once it was
215
+ * given to the agent, the runtime's: the turn it went into and how that turn ended. `completed` only when that turn
216
+ * completed; a turn that failed or was cancelled says so instead.
217
+ */
218
+ export declare function updateOutcome(instructionId: string, facts: ReadonlyArray<{
219
+ type?: string;
220
+ data?: unknown;
221
+ }>): {
222
+ turnId?: string;
223
+ turn?: "running" | "completed" | "failed" | "cancelled" | string;
224
+ };
225
+ /** One entry of a session's evidence timeline. Never the model's reasoning: what was said, done, asked and decided. */
226
+ export type EvidenceEntry = {
227
+ kind: "message";
228
+ at?: string;
229
+ text: string;
230
+ from?: string;
231
+ } | {
232
+ kind: "update";
233
+ at?: string;
234
+ instructionId: string;
235
+ text: string;
236
+ } | {
237
+ kind: "model";
238
+ at?: string;
239
+ runId: string;
240
+ outcome?: string;
241
+ } | {
242
+ kind: "tool";
243
+ at?: string;
244
+ callId: string;
245
+ tool: string;
246
+ capability: string | null;
247
+ input: unknown;
248
+ outcome?: string;
249
+ output?: unknown;
250
+ effect: "changed" | "attempted" | "not-run" | "read" | "outside" | "unknown";
251
+ approved?: string;
252
+ started?: boolean;
253
+ } | {
254
+ kind: "approval";
255
+ at?: string;
256
+ interactionId: string;
257
+ prompt: string;
258
+ outcome?: string;
259
+ } | {
260
+ kind: "held";
261
+ at?: string;
262
+ boundary?: string;
263
+ reason?: string;
264
+ } | {
265
+ kind: "reply";
266
+ at?: string;
267
+ text: string;
268
+ } | {
269
+ kind: "turn";
270
+ at?: string;
271
+ turnId?: string;
272
+ outcome?: string;
273
+ };
274
+ /**
275
+ * The session's facts as evidence. A tool call that may change the application is "changed" only once the runtime
276
+ * recorded it completed, "attempted" if it started and settled otherwise, "not-run" if it settled without starting
277
+ * (its approval was denied or ended with the session), and "unknown" while no outcome is recorded; reads are
278
+ * "read"; a tool outside the application's capabilities is "outside" (its effect is not the application's to confirm).
279
+ */
280
+ export declare function timeline(facts: ReadonlyArray<{
281
+ type?: string;
282
+ data?: unknown;
283
+ at?: string;
284
+ }>, kindOf: (tool: string) => {
285
+ capability: string | null;
286
+ changes: boolean | null;
287
+ }): EvidenceEntry[];