@feltdb/feltkit 0.3.37 → 0.5.0

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 (184) 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 +306 -7
  5. package/dist/app.js +289 -28
  6. package/dist/app.js.map +1 -1
  7. package/dist/appboundry/build.d.ts +7 -0
  8. package/dist/appboundry/build.js +25 -1
  9. package/dist/appboundry/build.js.map +1 -1
  10. package/dist/appboundry/guest.js +8 -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 +25 -0
  14. package/dist/appboundry/host.js.map +1 -1
  15. package/dist/appboundry/runtime.js +1 -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 +454 -4
  32. package/dist/client/index.js +371 -3
  33. package/dist/client/index.js.map +1 -1
  34. package/dist/clock.d.ts +24 -0
  35. package/dist/clock.js +49 -0
  36. package/dist/clock.js.map +1 -0
  37. package/dist/cron.d.ts +18 -0
  38. package/dist/cron.js +67 -0
  39. package/dist/cron.js.map +1 -0
  40. package/dist/dashboard/assets/index-iIj7SL77.js +15 -0
  41. package/dist/dashboard/index.html +1 -1
  42. package/dist/docs.d.ts +1 -1
  43. package/dist/docs.js +4 -0
  44. package/dist/docs.js.map +1 -1
  45. package/dist/eve/index.d.ts +77 -0
  46. package/dist/eve/index.js +128 -0
  47. package/dist/eve/index.js.map +1 -0
  48. package/dist/event-stage.js +2 -0
  49. package/dist/event-stage.js.map +1 -1
  50. package/dist/index.d.ts +17 -2
  51. package/dist/index.js +3 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/native/build.d.ts +112 -0
  54. package/dist/native/build.js +472 -0
  55. package/dist/native/build.js.map +1 -0
  56. package/dist/native/index.d.ts +67 -0
  57. package/dist/native/index.js +113 -0
  58. package/dist/native/index.js.map +1 -0
  59. package/dist/native/instance.d.ts +3 -0
  60. package/dist/native/instance.js +18 -0
  61. package/dist/native/instance.js.map +1 -0
  62. package/dist/policy.d.ts +9 -1
  63. package/dist/policy.js +16 -3
  64. package/dist/policy.js.map +1 -1
  65. package/dist/presence.d.ts +85 -0
  66. package/dist/presence.js +37 -0
  67. package/dist/presence.js.map +1 -0
  68. package/dist/quota.d.ts +72 -0
  69. package/dist/quota.js +143 -0
  70. package/dist/quota.js.map +1 -0
  71. package/dist/react/agent-control.d.ts +191 -0
  72. package/dist/react/agent-control.js +366 -0
  73. package/dist/react/agent-control.js.map +1 -0
  74. package/dist/react/auth.d.ts +15 -1
  75. package/dist/react/auth.js +28 -5
  76. package/dist/react/auth.js.map +1 -1
  77. package/dist/react/hooks.d.ts +88 -0
  78. package/dist/react/hooks.js +188 -0
  79. package/dist/react/hooks.js.map +1 -0
  80. package/dist/react/index.d.ts +5 -75
  81. package/dist/react/index.js +4 -145
  82. package/dist/react/index.js.map +1 -1
  83. package/dist/runtime/activity.d.ts +8 -0
  84. package/dist/runtime/activity.js.map +1 -1
  85. package/dist/runtime/agent-control.d.ts +28 -0
  86. package/dist/runtime/agent-control.js +43 -2
  87. package/dist/runtime/agent-control.js.map +1 -1
  88. package/dist/runtime/agent-run.d.ts +166 -0
  89. package/dist/runtime/agent-run.js +431 -0
  90. package/dist/runtime/agent-run.js.map +1 -0
  91. package/dist/runtime/agent.d.ts +158 -1
  92. package/dist/runtime/agent.js +345 -12
  93. package/dist/runtime/agent.js.map +1 -1
  94. package/dist/runtime/assemble.js +15 -2
  95. package/dist/runtime/assemble.js.map +1 -1
  96. package/dist/runtime/authority.d.ts +47 -0
  97. package/dist/runtime/authority.js +13 -2
  98. package/dist/runtime/authority.js.map +1 -1
  99. package/dist/runtime/capabilities.js +2 -1
  100. package/dist/runtime/capabilities.js.map +1 -1
  101. package/dist/runtime/changes.d.ts +17 -0
  102. package/dist/runtime/changes.js +65 -2
  103. package/dist/runtime/changes.js.map +1 -1
  104. package/dist/runtime/context.d.ts +123 -0
  105. package/dist/runtime/contract.js +9 -3
  106. package/dist/runtime/contract.js.map +1 -1
  107. package/dist/runtime/events.js +17 -1
  108. package/dist/runtime/events.js.map +1 -1
  109. package/dist/runtime/integrations.js +7 -7
  110. package/dist/runtime/integrations.js.map +1 -1
  111. package/dist/runtime/invocations.d.ts +19 -2
  112. package/dist/runtime/invocations.js +16 -3
  113. package/dist/runtime/invocations.js.map +1 -1
  114. package/dist/runtime/policies.d.ts +5 -2
  115. package/dist/runtime/policies.js.map +1 -1
  116. package/dist/runtime/presence-host.d.ts +84 -0
  117. package/dist/runtime/presence-host.js +303 -0
  118. package/dist/runtime/presence-host.js.map +1 -0
  119. package/dist/runtime/providers.d.ts +5 -1
  120. package/dist/runtime/providers.js +11 -5
  121. package/dist/runtime/providers.js.map +1 -1
  122. package/dist/runtime/required-capabilities.d.ts +73 -0
  123. package/dist/runtime/required-capabilities.js +69 -0
  124. package/dist/runtime/required-capabilities.js.map +1 -0
  125. package/dist/runtime/resource-access.d.ts +137 -0
  126. package/dist/runtime/resource-access.js +177 -0
  127. package/dist/runtime/resource-access.js.map +1 -0
  128. package/dist/runtime/runtime.d.ts +143 -1
  129. package/dist/runtime/runtime.js +853 -44
  130. package/dist/runtime/runtime.js.map +1 -1
  131. package/dist/runtime/sessions.d.ts +12 -0
  132. package/dist/runtime/sessions.js +16 -1
  133. package/dist/runtime/sessions.js.map +1 -1
  134. package/dist/runtime/tenancy.d.ts +68 -1
  135. package/dist/runtime/tenancy.js +150 -0
  136. package/dist/runtime/tenancy.js.map +1 -1
  137. package/dist/runtime/transactions.d.ts +3 -1
  138. package/dist/runtime/transactions.js.map +1 -1
  139. package/dist/runtime/workers.d.ts +123 -0
  140. package/dist/runtime/workers.js +291 -0
  141. package/dist/runtime/workers.js.map +1 -0
  142. package/dist/server/eve.d.ts +287 -0
  143. package/dist/server/eve.js +1071 -0
  144. package/dist/server/eve.js.map +1 -0
  145. package/dist/server/index.d.ts +2 -19
  146. package/dist/server/index.js +102 -5
  147. package/dist/server/index.js.map +1 -1
  148. package/dist/server/mcp.d.ts +15 -22
  149. package/dist/server/mcp.js +40 -3
  150. package/dist/server/mcp.js.map +1 -1
  151. package/dist/server/project.js +26 -8
  152. package/dist/server/project.js.map +1 -1
  153. package/dist/server/tenancy.d.ts +9 -0
  154. package/dist/server/tenancy.js +62 -1
  155. package/dist/server/tenancy.js.map +1 -1
  156. package/dist/server/watch.d.ts +10 -0
  157. package/dist/server/watch.js +88 -0
  158. package/dist/server/watch.js.map +1 -0
  159. package/dist/testing/index.d.ts +4 -5
  160. package/dist/testing/index.js +3 -2
  161. package/dist/testing/index.js.map +1 -1
  162. package/docs/AGENT-CONTROL.md +166 -4
  163. package/docs/APPBOUNDRY.md +73 -0
  164. package/docs/ARCHITECTURE.md +6 -2
  165. package/docs/AUTH.md +37 -0
  166. package/docs/COMPONENTS.md +71 -0
  167. package/docs/EVE-COMPOSITION.md +75 -0
  168. package/docs/GUARANTEES.md +4 -4
  169. package/docs/NATIVE-AGENTS.md +353 -0
  170. package/docs/NATIVE.md +137 -0
  171. package/docs/PRESENCE-AND-SIGNALING-PROPOSAL.md +152 -0
  172. package/docs/README.md +6 -2
  173. package/docs/SECURITY.md +71 -3
  174. package/docs/TRANSACTIONS.md +48 -0
  175. package/docs/UPSTREAM-GAPS.md +16 -2
  176. package/package.json +42 -16
  177. package/skills/.claude-plugin/marketplace.json +1 -1
  178. package/skills/.claude-plugin/plugin.json +1 -1
  179. package/skills/feltkit-agent/SKILL.md +1 -1
  180. package/skills/feltkit-build/SKILL.md +11 -1
  181. package/skills/feltkit-data/SKILL.md +1 -1
  182. package/skills/feltkit-operations/SKILL.md +1 -1
  183. package/skills/feltkit-services/SKILL.md +1 -1
  184. package/dist/dashboard/assets/index-BhxrvY37.js +0 -15
@@ -34,9 +34,17 @@ type RefFor<D> = D extends {
34
34
  $args?: infer A;
35
35
  $result?: infer R;
36
36
  } ? FunctionReference<K, A, R> : never;
37
- type ModuleRefs<M> = {
37
+ type OwnRefs<M> = {
38
38
  [E in keyof M as M[E] extends Definition ? E : never]: RefFor<M[E]>;
39
39
  };
40
+ type UnionToIntersection<U> = (U extends unknown ? (u: U) => void : never) extends (i: infer I) => void ? I : never;
41
+ /** Function groups (`functionGroup`, e.g. Boards): their members are the module's functions too. */
42
+ type GroupRefs<M> = UnionToIntersection<{
43
+ [E in keyof M]: M[E] extends {
44
+ readonly $functionGroup: true;
45
+ } ? OwnRefs<M[E]> : never;
46
+ }[keyof M]>;
47
+ type ModuleRefs<M> = [GroupRefs<M>] extends [never] ? OwnRefs<M> : OwnRefs<M> & GroupRefs<M>;
40
48
  export type Api<Modules> = {
41
49
  [K in keyof Modules]: ModuleRefs<Modules[K]>;
42
50
  };
@@ -68,6 +76,10 @@ export interface SessionInfo {
68
76
  type: string;
69
77
  displayName?: string;
70
78
  roles: string[];
79
+ preview?: {
80
+ role: string;
81
+ actualRole: string;
82
+ };
71
83
  } | null;
72
84
  permissions: string[];
73
85
  application: string;
@@ -184,7 +196,7 @@ export interface InvitationInfo {
184
196
  id: string;
185
197
  email: string;
186
198
  role: string;
187
- status: "open" | "accepted" | "revoked" | "expired";
199
+ status: "open" | "accepted" | "revoked" | "declined" | "expired";
188
200
  invitedBy: string;
189
201
  inviterName?: string;
190
202
  createdAt: string;
@@ -196,7 +208,7 @@ export interface InvitationPreview {
196
208
  role: string;
197
209
  inviterName?: string;
198
210
  email: string;
199
- status: "open" | "accepted" | "revoked" | "expired";
211
+ status: "open" | "accepted" | "revoked" | "declined" | "expired";
200
212
  expiresAt: string;
201
213
  }
202
214
  export interface AccountInfo {
@@ -256,6 +268,87 @@ export interface ActionStreamOptions {
256
268
  signal?: AbortSignal;
257
269
  }
258
270
  /** An agent action of the signed-in person, as /api/agent/actions shows it. */
271
+ /**
272
+ * What happened to one of your calls (AppPort `appport.invocation.status@1`, spec §13.5), from the runtime's
273
+ * records: `succeeded`, `failed`, `unknown` (an effect started and has no definite outcome; settle it before doing
274
+ * anything else), `in_progress` (claimed, no answer yet), `unrecorded` (nothing is recorded: never arrived, refused,
275
+ * or failed with a known outcome; a retry with the same idempotency key runs it).
276
+ */
277
+ export interface InvocationStatus {
278
+ status: "succeeded" | "failed" | "unknown" | "in_progress" | "unrecorded";
279
+ requestId?: string;
280
+ capability?: {
281
+ name: string;
282
+ version: number;
283
+ };
284
+ output?: unknown;
285
+ error?: {
286
+ code: string;
287
+ message: string;
288
+ details?: unknown;
289
+ };
290
+ effect?: {
291
+ outcome?: "succeeded" | "failed" | "unknown";
292
+ startedAt: string;
293
+ finishedAt?: string;
294
+ };
295
+ settlement?: {
296
+ outcome: "succeeded" | "failed";
297
+ determinedBy: "verification" | "person";
298
+ settledAt: string;
299
+ };
300
+ }
301
+ /** Name one call: its request id, or the idempotency key you sent with the capability it was for. */
302
+ export type InvocationStatusQuery = {
303
+ requestId: string;
304
+ } | {
305
+ idempotencyKey: string;
306
+ capability: {
307
+ name: string;
308
+ version?: number;
309
+ };
310
+ };
311
+ /**
312
+ * Whether an error says the call may or may not have taken effect (an external effect with no definite answer):
313
+ * never repeat it blindly; ask `client.invocationStatus` and settle it.
314
+ */
315
+ export declare function isOutcomeUnknown(error: unknown): boolean;
316
+ /** The call an unknown outcome is about (its request id), when the error names it. */
317
+ export declare function unknownCallId(error: unknown): string | undefined;
318
+ /**
319
+ * A proposal by one of the application's agents (app.agent), as /api/agent/approvals shows it to a person who may
320
+ * decide it. Send `attempt` and `inputDigest` back with decideAgentApproval: the decision binds to what you reviewed.
321
+ */
322
+ export interface AgentApproval extends Omit<OwnAction, "objective"> {
323
+ /** The proposal's attempt: a retry after a failure is a new attempt, reviewed and approved again. */
324
+ attempt: number;
325
+ agent: {
326
+ name: string;
327
+ displayName?: string;
328
+ };
329
+ run: {
330
+ taskId: string;
331
+ objective: string;
332
+ status: string;
333
+ workspace: string | null;
334
+ };
335
+ /** Whether you may approve it now, and if not, why (the server decides again when you do). */
336
+ approvable: {
337
+ allowed: boolean;
338
+ reason?: string;
339
+ };
340
+ }
341
+ /** One proposal with what you need to decide it: the agent's own words for the call, the run's input, its history. */
342
+ export interface AgentApprovalDetail extends AgentApproval {
343
+ explanation: string | null;
344
+ runInput: unknown;
345
+ history: Array<{
346
+ state: string;
347
+ at: string;
348
+ by: string;
349
+ note?: string;
350
+ }>;
351
+ }
259
352
  export interface OwnAction {
260
353
  taskId: string;
261
354
  objective?: string;
@@ -289,6 +382,65 @@ export interface OwnAction {
289
382
  /** What an approval binds to: the operation and its exact input. Send it back with approveAction. */
290
383
  inputDigest?: string;
291
384
  }
385
+ /** The derived phase of a steered agent task (docs/AGENT-CONTROL.md). Reported by the server, never guessed. */
386
+ export type AgentControlPhase = "running" | "pausing" | "paused" | "interrupted" | "blocked" | "completed" | "stopped";
387
+ export type AgentUpdateState = "signaled" | "received" | "delivered" | "incorporated" | "conflict" | "withdrawn" | "abandoned";
388
+ /** One update a person sent an agent, as the server records it. */
389
+ export interface AgentUpdate {
390
+ instructionId: string;
391
+ taskId: string;
392
+ state: AgentUpdateState;
393
+ seq: number;
394
+ /** Who signaled or submitted it (`type:id`). */
395
+ from: string;
396
+ text?: string;
397
+ note?: string;
398
+ signaledAt?: string;
399
+ receivedAt?: string;
400
+ deliveredAt?: string;
401
+ deliveredAtCheckpoint?: number;
402
+ resolvedAt?: string;
403
+ /** incorporated / conflict: what the agent said; withdrawn / abandoned: why. */
404
+ resolution?: {
405
+ by: string;
406
+ note: string;
407
+ };
408
+ history: Array<{
409
+ state: AgentUpdateState;
410
+ at: string;
411
+ by: string;
412
+ note?: string;
413
+ }>;
414
+ }
415
+ /** A task's control state: `GET /api/agent/tasks/:id/control`, and every `control` frame of its event stream. */
416
+ export interface AgentControlState {
417
+ taskId: string;
418
+ objective: string;
419
+ owner: string;
420
+ phase: AgentControlPhase;
421
+ mode: "running" | "paused" | "interrupted";
422
+ reason: string | null;
423
+ inFlight: {
424
+ generations: string[];
425
+ actions: string[];
426
+ };
427
+ /** Updates signaled and not yet submitted. */
428
+ signaled: number;
429
+ /** Every update, oldest first. */
430
+ instructions: AgentUpdate[];
431
+ checkpoint: number;
432
+ /** Changes whenever anything changes. */
433
+ revision: string;
434
+ }
435
+ /** A tenant's public branding (K5), as `resolveTenant` answers it. */
436
+ export interface TenantBranding {
437
+ displayName?: string;
438
+ logoUrl?: string;
439
+ primaryColor?: string;
440
+ accentColor?: string;
441
+ backgroundColor?: string;
442
+ tagline?: string;
443
+ }
292
444
  /** `keys`: per collection, opaque keys of the changed records (absent: the whole collection may have changed). */
293
445
  type ChangeListener = (collections: string[], keys?: Record<string, string[]>) => void;
294
446
  /** A query's read set: collections read wholly, and opaque predicate keys by collection. */
@@ -307,6 +459,12 @@ export declare class FeltKitClient {
307
459
  /** "cookie" or "bearer": see ClientOptions.session. */
308
460
  readonly mode: "cookie" | "bearer";
309
461
  constructor(options?: ClientOptions);
462
+ /**
463
+ * Reconnect the live streams now instead of after their back-off. A browser tells the client itself (`online`,
464
+ * `visibilitychange`); a host with no such events (React Native: the app returning to the foreground, the network
465
+ * coming back) calls this. Harmless when nothing is waiting.
466
+ */
467
+ wake(): void;
310
468
  get connected(): boolean;
311
469
  /** The absolute URL of a file link (`ctx.services.files.link`), for `<a href>` or `<img src>`. */
312
470
  fileUrl(link: {
@@ -343,6 +501,28 @@ export declare class FeltKitClient {
343
501
  version?: number;
344
502
  idempotencyKey?: string;
345
503
  }): Promise<T>;
504
+ /**
505
+ * What happened to one of your calls (`appport.invocation.status@1`): by the request id an unknown outcome named
506
+ * (`unknownCallId(error)`, or the `requestId` a call returned), or by the idempotency key you sent. Only your own
507
+ * calls are answered; anyone else's reads `unrecorded`. It never runs anything.
508
+ */
509
+ invocationStatus(query: InvocationStatusQuery): Promise<InvocationStatus>;
510
+ /** Ask the external system what happened to an unknown call (its capability's `verify`); a definite answer settles it. */
511
+ verifyCall(callId: string): Promise<{
512
+ verification: {
513
+ outcome: "succeeded" | "failed" | "unknown";
514
+ evidence?: unknown;
515
+ reason?: string;
516
+ };
517
+ }>;
518
+ /**
519
+ * Settle an unknown call, saying what you checked. Only a person who may make the call settles it, once; the external
520
+ * system's answer comes first (a contradicting decision is refused). Nothing runs.
521
+ */
522
+ settleCall(callId: string, input: {
523
+ outcome: "succeeded" | "failed";
524
+ note: string;
525
+ }): Promise<void>;
346
526
  /** Run a mutation. Resolves after its writes have committed. */
347
527
  mutation<F extends FunctionReference<"mutation">>(fn: F, args?: ArgsOf<F>): Promise<ResultOf<F>>;
348
528
  /**
@@ -363,12 +543,57 @@ export declare class FeltKitClient {
363
543
  watchOwnActions(filter: {
364
544
  state?: OwnAction["state"];
365
545
  }, listener: (actions: OwnAction[]) => void, onError?: (error: FeltKitClientError) => void): () => void;
546
+ /**
547
+ * Proposals by the application's agents that you may decide: in your workspace, for capabilities you may perform
548
+ * yourself. Default: those waiting (`state: "proposed"`); `"all"` includes decided ones.
549
+ */
550
+ agentApprovals(filter?: {
551
+ state?: AgentApproval["state"] | "all";
552
+ limit?: number;
553
+ }): Promise<AgentApproval[]>;
554
+ /** One agent proposal, with the agent's explanation, the run's input and the proposal's history. NOT_FOUND unless you may decide it. */
555
+ agentApproval(taskId: string, actionId: string): Promise<AgentApprovalDetail>;
556
+ /**
557
+ * Approve or reject an agent's proposal, as you, bound to what you reviewed (`attempt`, and `inputDigest` to
558
+ * approve). Approving runs it (as the agent, through AppPort) before this resolves; the agent's run then resumes.
559
+ * Deciding what is already decided answers its current state. A different attempt or input is refused
560
+ * (FAILED_PRECONDITION): review it again.
561
+ */
562
+ decideAgentApproval(approval: Pick<AgentApproval, "taskId" | "actionId" | "attempt"> & {
563
+ inputDigest?: string;
564
+ }, decision: "approve" | "reject", reason?: string): Promise<AgentApproval>;
366
565
  /** Approve one of your own proposed actions. It runs (as you, through AppPort) before this resolves. */
367
566
  approveAction(taskId: string, actionId: string, reviewed?: {
368
567
  inputDigest?: string;
369
568
  }): Promise<OwnAction | null>;
370
569
  /** Reject one of your own proposed actions. Nothing runs. */
371
570
  rejectAction(taskId: string, actionId: string, reason?: string): Promise<OwnAction | null>;
571
+ /** The task's control state now. */
572
+ agentControl(taskId: string): Promise<AgentControlState>;
573
+ /** Say an update is coming. The agent keeps working. Returns the signaled update (fill it with `submitAgentUpdate({ instructionId })`). */
574
+ signalAgentUpdate(taskId: string, options?: {
575
+ note?: string;
576
+ idempotencyKey?: string;
577
+ }): Promise<AgentUpdate>;
578
+ /**
579
+ * Send an update. It is *received* (stored) when this resolves, not yet incorporated. `instructionId` fills your own
580
+ * signal; `idempotencyKey` makes a retry (or a double click) the same update: the same key with other text is refused
581
+ * (IDEMPOTENCY_KEY_REUSED).
582
+ */
583
+ submitAgentUpdate(taskId: string, text: string, options?: {
584
+ instructionId?: string;
585
+ idempotencyKey?: string;
586
+ }): Promise<AgentUpdate>;
587
+ /** Take back a signaled or received update (its sender or the task owner). */
588
+ withdrawAgentUpdate(taskId: string, instructionId: string, reason?: string): Promise<AgentUpdate>;
589
+ /** pause, resume, interrupt or stop the task. Answers the state after the change, as the server reads it back. */
590
+ controlAgent(taskId: string, op: "pause" | "resume" | "interrupt" | "stop", reason?: string): Promise<AgentControlState>;
591
+ /**
592
+ * Follow a task's control state live (`GET …/control/events`). Level-triggered: `listener` gets the whole state on
593
+ * connect and after every change; a frame whose revision is one already shown, or that arrives out of order after a
594
+ * newer one, is dropped. Reconnects after a dropped stream; stops on a refusal (signed out, no access). Returns stop().
595
+ */
596
+ watchAgentControl(taskId: string, listener: (state: AgentControlState) => void, onError?: (error: FeltKitClientError) => void): () => void;
372
597
  session(): Promise<SessionInfo>;
373
598
  /** Development only: sign in as a dev user declared in feltkit({ dev: { users } }). */
374
599
  signInAsDevUser(userId: string): Promise<SessionInfo["principal"]>;
@@ -423,12 +648,33 @@ export declare class FeltKitClient {
423
648
  signOutEverywhere(options?: {
424
649
  keepCurrent?: boolean;
425
650
  }): Promise<number>;
651
+ /**
652
+ * An agent this application runs on the agent runtime (`app.agent(name, { project })`), as the signed-in person in
653
+ * their workspace: its state, activating it, the workspace's sessions with it, sending messages, reading and
654
+ * following a session's history (messages, calls, approvals, turns), and answering an approval (recorded as an
655
+ * AppPort approval of exactly the call waiting).
656
+ */
657
+ agent(name: string): AgentClient;
658
+ /**
659
+ * The same as `agent(name)`, under the runtime's internal name.
660
+ * @deprecated Use `agent(name)`.
661
+ * An eve agent this application runs (`feltkit({ eve })`), as the signed-in person in their workspace: its state,
662
+ * activating it, the workspace's sessions with it, sending messages, reading and following a session's history
663
+ * (eve's facts: messages, calls, approvals, turns), and answering an approval (recorded as an AppPort approval of
664
+ * exactly the call waiting).
665
+ */
666
+ eve(agent: string): EveAgentClient;
426
667
  /** Your tenants, the one this session works in, and what you may do there. */
427
668
  tenants(): Promise<TenantsInfo>;
428
669
  /** Create a tenant (you hold its top role) and switch to it. */
429
670
  createTenant(name: string): Promise<TenantInfo>;
430
671
  /** Work in another of your tenants (null: none). Every live query re-runs for it. */
431
672
  switchTenant(tenantId: string | null): Promise<TenantInfo | null>;
673
+ /**
674
+ * See the application as a lower role of yours in this tenant (`role`), read-only: the server answers every call as
675
+ * that role, and refuses every change until the preview ends (`null`). Owners use it to check what each role sees.
676
+ */
677
+ previewRole(role: string | null): Promise<TenantInfo | null>;
432
678
  members(): Promise<TenantMember[]>;
433
679
  setMemberRole(principalId: string, role: string): Promise<void>;
434
680
  /** Add an agent or service (an operator-issued identity) to the current tenant. People are invited instead. */
@@ -438,6 +684,33 @@ export declare class FeltKitClient {
438
684
  /** Leave the current tenant; the session moves to your next one (or none). */
439
685
  leaveTenant(): Promise<TenantInfo | null>;
440
686
  renameTenant(name: string): Promise<void>;
687
+ /**
688
+ * Which tenant a slug or custom domain names, as its public branding (K5). No sign-in needed: for a join or
689
+ * sign-in page that must be branded first. With neither, the page's own host. Null when nothing matches.
690
+ */
691
+ resolveTenant(by?: {
692
+ slug?: string;
693
+ domain?: string;
694
+ }): Promise<{
695
+ slug: string | null;
696
+ branding: TenantBranding;
697
+ } | null>;
698
+ /** The current tenant's slug, custom domains and branding (members). */
699
+ tenantPublic(): Promise<{
700
+ slug: string | null;
701
+ domains: string[];
702
+ branding: TenantBranding;
703
+ }>;
704
+ /** Set the current tenant's slug, domains and branding (tenant.update); null clears one. */
705
+ setTenantPublic(input: {
706
+ slug?: string | null;
707
+ domains?: string[] | null;
708
+ branding?: TenantBranding | null;
709
+ }): Promise<{
710
+ slug: string | null;
711
+ domains: string[];
712
+ branding: TenantBranding;
713
+ }>;
441
714
  invitations(): Promise<InvitationInfo[]>;
442
715
  /** Invite an address with a role. `link` is the invitation link (to share yourself); `sent` says whether it was e-mailed. */
443
716
  invite(input: {
@@ -453,6 +726,8 @@ export declare class FeltKitClient {
453
726
  revokeInvitation(id: string): Promise<void>;
454
727
  /** What an invitation link is for, before accepting it (no sign-in needed). */
455
728
  previewInvitation(token: string): Promise<InvitationPreview>;
729
+ /** Decline an invitation (its holder; no sign-in needed). A declined invitation cannot be accepted. */
730
+ declineInvitation(token: string): Promise<void>;
456
731
  /** Accept an invitation (signed in with the invited address) and switch to its tenant. */
457
732
  acceptInvitation(token: string): Promise<TenantInfo | null>;
458
733
  /** Magic link: e-mail a sign-in link and code to this address (same answer whether or not it can sign in). */
@@ -526,6 +801,181 @@ export declare function waitOrWake(ms: number, signal: AbortSignal, target?: {
526
801
  visibilityState?: string;
527
802
  addEventListener?: (t: string, l: () => void) => void;
528
803
  removeEventListener?: (t: string, l: () => void) => void;
529
- } | undefined): Promise<boolean>;
804
+ } | undefined, wakers?: Set<() => void>): Promise<boolean>;
530
805
  export declare function createClient(options?: ClientOptions): FeltKitClient;
806
+ /**
807
+ * Which control frames to show. A revision is a digest, not a counter, so order comes from the state itself: the
808
+ * checkpoint count and every record's sequence only grow. A frame is stale when it shows nothing newer than the
809
+ * last one shown and something older; a frame that repeats the last revision changes nothing.
810
+ */
811
+ export declare function controlRevisions(): {
812
+ accept(state: AgentControlState): boolean;
813
+ };
814
+ /** One fact of an eve session's history (`type`: e.g. `turn.started`, `call.requested`, `interaction.opened`). */
815
+ export interface EveFact {
816
+ type: string;
817
+ data?: Record<string, unknown>;
818
+ scope?: {
819
+ runId?: string;
820
+ turnId?: string;
821
+ };
822
+ }
823
+ export interface EveAgentStatus {
824
+ agent: string;
825
+ displayName: string;
826
+ state: "starting" | "ready" | "restarting" | "failed" | "stopped";
827
+ detail?: string;
828
+ activated: boolean;
829
+ worker: string;
830
+ capabilities: Array<{
831
+ capability: string;
832
+ approval: "required" | "none";
833
+ allowed: boolean;
834
+ }>;
835
+ }
836
+ export interface EveSessionInfo {
837
+ id: string;
838
+ agent: string;
839
+ tenantId: string | null;
840
+ createdBy: string;
841
+ createdAt: number;
842
+ title: string;
843
+ /** The agent task this session is: steer it with useAgentControl(taskId), <AgentControlBar>, <AgentUpdateComposer>. */
844
+ taskId?: string;
845
+ }
846
+ /** `client.eve(name)`: an eve agent of the application, as the signed-in person. */
847
+ export interface EveAgentClient {
848
+ status(): Promise<EveAgentStatus>;
849
+ /** Make the agent a member of your workspace (needs tenant.members.manage and feltkit.workers.write). */
850
+ activate(): Promise<{
851
+ worker: string;
852
+ activated: boolean;
853
+ }>;
854
+ sessions(): Promise<EveSessionInfo[]>;
855
+ start(message: string): Promise<{
856
+ sessionId: string;
857
+ deliveryId: string;
858
+ }>;
859
+ send(sessionId: string, message: string): Promise<{
860
+ deliveryId: string;
861
+ }>;
862
+ /** The session's history so far. */
863
+ history(sessionId: string): Promise<EveFact[]>;
864
+ /** Follow the session: `onFacts` gets its whole history each time it grows. Returns stop(). */
865
+ follow(sessionId: string, onFacts: (facts: EveFact[]) => void, onError?: (error: unknown) => void): () => void;
866
+ /** Approve or deny a call the agent is waiting on. */
867
+ answer(sessionId: string, interactionId: string, decision: "approve" | "deny"): Promise<{
868
+ approval?: string;
869
+ }>;
870
+ /**
871
+ * Everything recorded about a session, readable after it ended: its state now, the timeline (messages, updates,
872
+ * model steps, tool calls with whether they changed anything, approvals, replies, turns), the lifecycle's history,
873
+ * each update's progress, and who answered which approval.
874
+ */
875
+ evidence(sessionId: string): Promise<AgentEvidence>;
876
+ }
877
+ /** What a session is doing now, from the runtime's facts and the lifecycle's record. */
878
+ export type AgentExecutionState = "idle" | "submitted" | "running" | "model" | "tool" | "approval" | "pausing" | "paused" | "interrupting" | "interrupted" | "resuming" | "completed" | "failed" | "stopped";
879
+ /** One entry of a session's evidence timeline (never the model's reasoning). */
880
+ export type AgentEvidenceEntry = {
881
+ kind: "message";
882
+ at?: string;
883
+ text: string;
884
+ from?: string;
885
+ } | {
886
+ kind: "update";
887
+ at?: string;
888
+ instructionId: string;
889
+ text: string;
890
+ } | {
891
+ kind: "model";
892
+ at?: string;
893
+ runId: string;
894
+ outcome?: string;
895
+ } | {
896
+ kind: "tool";
897
+ at?: string;
898
+ callId: string;
899
+ tool: string;
900
+ capability: string | null;
901
+ input: unknown;
902
+ outcome?: string;
903
+ output?: unknown;
904
+ effect: "changed" | "attempted" | "not-run" | "read" | "outside" | "unknown";
905
+ approved?: string;
906
+ started?: boolean;
907
+ } | {
908
+ kind: "approval";
909
+ at?: string;
910
+ interactionId: string;
911
+ prompt: string;
912
+ outcome?: string;
913
+ } | {
914
+ kind: "held";
915
+ at?: string;
916
+ boundary?: string;
917
+ reason?: string;
918
+ } | {
919
+ kind: "reply";
920
+ at?: string;
921
+ text: string;
922
+ } | {
923
+ kind: "turn";
924
+ at?: string;
925
+ turnId?: string;
926
+ outcome?: string;
927
+ };
928
+ /** `client.agent(name).evidence(sessionId)`. */
929
+ export interface AgentEvidence {
930
+ session: {
931
+ id: string;
932
+ title: string;
933
+ createdBy: string;
934
+ createdAt: number;
935
+ taskId: string | null;
936
+ };
937
+ state: AgentExecutionState;
938
+ ended: boolean;
939
+ /** Whether the runtime still holds the session's history ("gone" only for sessions ended before history was kept). */
940
+ runtimeHistory: "available" | "gone" | "unavailable";
941
+ control: {
942
+ phase: string;
943
+ mode: string;
944
+ reason: string | null;
945
+ revision: string;
946
+ } | null;
947
+ controlHistory: Array<{
948
+ mode: string;
949
+ at: string;
950
+ by: string;
951
+ note?: string;
952
+ }>;
953
+ /** Who stopped it and when (pause, interrupt and resume are in `controlHistory`). */
954
+ stopped: {
955
+ by: string;
956
+ at: number;
957
+ reason?: string;
958
+ } | null;
959
+ updates: Array<AgentUpdate & {
960
+ turnId?: string;
961
+ turn?: string;
962
+ }>;
963
+ answers: Array<{
964
+ interactionId: string;
965
+ decision: "approve" | "deny";
966
+ by: string;
967
+ at: number;
968
+ capability?: string;
969
+ approval?: string;
970
+ }>;
971
+ timeline: AgentEvidenceEntry[];
972
+ }
973
+ /** A recorded fact of an agent session (a message, a call, an approval, a turn). */
974
+ export type AgentFact = EveFact;
975
+ /** An agent's state for the signed-in person: running, activated in their workspace, its capabilities. */
976
+ export type AgentStatus = EveAgentStatus;
977
+ /** One of the workspace's sessions with an agent. */
978
+ export type AgentSessionInfo = EveSessionInfo;
979
+ /** `client.agent(name)`: an agent this application runs on the agent runtime. */
980
+ export type AgentClient = EveAgentClient;
531
981
  export {};