@feltdb/feltkit 0.5.2 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eve/index.d.ts +7 -0
- package/dist/eve/index.js +1 -0
- package/dist/eve/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/runtime/context.d.ts +45 -0
- package/dist/runtime/runtime.d.ts +20 -2
- package/dist/runtime/runtime.js +13 -0
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/server/eve.d.ts +40 -0
- package/dist/server/eve.js +127 -0
- package/dist/server/eve.js.map +1 -1
- package/docs/README.md +2 -2
- package/package.json +2 -2
- package/skills/.claude-plugin/marketplace.json +1 -1
- package/skills/.claude-plugin/plugin.json +1 -1
package/dist/eve/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* Entries come from `agent/lib/feltkit-capabilities.json`, which FeltKit generates from the application.
|
|
13
13
|
*/
|
|
14
14
|
import { type AuthFn } from "eve/channels/auth";
|
|
15
|
+
import { type ToolModelOutput } from "eve/tools";
|
|
15
16
|
/** A JSON value. */
|
|
16
17
|
export type FeltKitJson = string | number | boolean | null | FeltKitJson[] | {
|
|
17
18
|
[key: string]: FeltKitJson;
|
|
@@ -45,6 +46,12 @@ export declare function feltkitAuth(): AuthFn<Request>;
|
|
|
45
46
|
*/
|
|
46
47
|
export declare function feltkitCapability(entry: FeltKitCapabilityEntry, options?: {
|
|
47
48
|
prompt?: (input: Record<string, unknown>) => string;
|
|
49
|
+
/**
|
|
50
|
+
* What the model sees of the capability's output, when not its JSON: for example an image the capability
|
|
51
|
+
* returns as base64, handed to the model as vision input (`toolOutput.content([toolOutputPart.file(...)])` from
|
|
52
|
+
* `eve/tools`). The recorded output is unchanged.
|
|
53
|
+
*/
|
|
54
|
+
toModelOutput?: (output: unknown) => ToolModelOutput | Promise<ToolModelOutput>;
|
|
48
55
|
}): import("eve/tools").ToolDefinition<Record<string, unknown>, unknown> & {
|
|
49
56
|
execute(input: Record<string, unknown>, ctx: import("eve/tools").ToolContext): Promise<unknown>;
|
|
50
57
|
};
|
package/dist/eve/index.js
CHANGED
|
@@ -69,6 +69,7 @@ export function feltkitCapability(entry, options = {}) {
|
|
|
69
69
|
return defineTool({
|
|
70
70
|
description: entry.description,
|
|
71
71
|
inputSchema: entry.inputSchema,
|
|
72
|
+
...(options.toModelOutput ? { toModelOutput: options.toModelOutput } : {}),
|
|
72
73
|
...(entry.approval === "required"
|
|
73
74
|
? {
|
|
74
75
|
approval: {
|
package/dist/eve/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eve/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAe,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eve/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAe,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,UAAU,EAAwB,MAAM,WAAW,CAAC;AAc7D,qGAAqG;AACrG,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACtC,IAAI,CAAS;IACtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,GAAG,CAAC,IAAY;IACvB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG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CAAC,CAAC;QAC7E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type { Doc, InferShape, Schema, ShapeInput, ShapeSchema } from "./schema.
|
|
|
14
14
|
export type { AuthorityMode } from "./runtime/authority-contract.js";
|
|
15
15
|
export { FeltKitError, fail, isFeltKitError } from "./errors.js";
|
|
16
16
|
export type { FeltKitErrorCode, FeltKitErrorJSON } from "./errors.js";
|
|
17
|
-
export type { QueryCtx, MutationCtx, ActionCtx, ActionModel, ActionAgent, AgentCatalogEntry, ActionProposal, AgentCtx, AgentTrigger, Logger, EnvironmentInfo } from "./runtime/context.js";
|
|
17
|
+
export type { QueryCtx, MutationCtx, ActionCtx, ActionModel, ActionAgent, AgentSessionOrigin, AgentCatalogEntry, ActionProposal, AgentCtx, AgentTrigger, Logger, EnvironmentInfo } from "./runtime/context.js";
|
|
18
18
|
export type { GenerationMessage, GenerationResult, GenerationReceipt, ToolCall, ToolDefinition, FinishReason } from "./runtime/generation.js";
|
|
19
19
|
export type { CallerContext } from "./runtime/authority.js";
|
|
20
20
|
export type { CryptoContext } from "./runtime/crypto-token.js";
|
|
@@ -700,6 +700,51 @@ export interface ActionAgent {
|
|
|
700
700
|
outcome: "incorporated" | "conflict";
|
|
701
701
|
note: string;
|
|
702
702
|
}): Promise<import("./agent-control.js").InstructionRecord>;
|
|
703
|
+
/**
|
|
704
|
+
* Start a session of one of this application's project agents (`feltkit({ eve })`, `app.agent(name, { project })`)
|
|
705
|
+
* under a standing delegation, from server code: a trusted caller (another application's server, a schedule) asks
|
|
706
|
+
* for work no signed-in person started here. `delegation` is a work grant a person of the caller's workspace issued
|
|
707
|
+
* to the agent's worker; it must be active, and that person must still hold every capability it covers. The
|
|
708
|
+
* session then runs exactly as one that person started: each call is authorized under the grant and consequential
|
|
709
|
+
* calls need a person's approval of the exact call. `origin` says where the request came from (recorded, never
|
|
710
|
+
* authority). The same `key` from the same caller returns the session it started. Needs feltkit.agent.delegated.
|
|
711
|
+
*/
|
|
712
|
+
startSession(agent: string, input: {
|
|
713
|
+
delegation: string;
|
|
714
|
+
message: string;
|
|
715
|
+
origin: AgentSessionOrigin;
|
|
716
|
+
key?: string;
|
|
717
|
+
}): Promise<{
|
|
718
|
+
sessionId: string;
|
|
719
|
+
created: boolean;
|
|
720
|
+
}>;
|
|
721
|
+
/**
|
|
722
|
+
* Deliver new work into a session this caller started with `startSession` (a message the agent takes a turn for).
|
|
723
|
+
* The delegation is checked again first: a revoked or lapsed one delivers nothing. Needs feltkit.agent.delegated.
|
|
724
|
+
*/
|
|
725
|
+
sendToSession(agent: string, sessionId: string, message: string): Promise<{
|
|
726
|
+
delivered: boolean;
|
|
727
|
+
}>;
|
|
728
|
+
/** End a session started with `startSession` (the caller that started it, or a person of its workspace). Needs feltkit.agent.delegated. */
|
|
729
|
+
endSession(agent: string, sessionId: string, reason?: string): Promise<{
|
|
730
|
+
ended: boolean;
|
|
731
|
+
}>;
|
|
732
|
+
}
|
|
733
|
+
/** Where a delegated agent session's request came from (`ctx.agent.startSession`): context for people, never authority. */
|
|
734
|
+
export interface AgentSessionOrigin {
|
|
735
|
+
/** The application the request came from, e.g. "meetings". */
|
|
736
|
+
application: string;
|
|
737
|
+
/** What in it, e.g. "meeting". */
|
|
738
|
+
kind: string;
|
|
739
|
+
/** Its identifier there, e.g. the meeting code. */
|
|
740
|
+
ref: string;
|
|
741
|
+
/** Who asked there, as that application identifies them. */
|
|
742
|
+
requestedBy?: {
|
|
743
|
+
id: string;
|
|
744
|
+
name?: string;
|
|
745
|
+
};
|
|
746
|
+
/** Anything else that helps a person read the record: at most 20 short entries. */
|
|
747
|
+
detail?: Record<string, string>;
|
|
703
748
|
}
|
|
704
749
|
export interface ActionProposal {
|
|
705
750
|
taskId: string;
|
|
@@ -218,6 +218,24 @@ export interface FunctionInfo {
|
|
|
218
218
|
approval?: "required";
|
|
219
219
|
}
|
|
220
220
|
export declare const silentLogger: Logger;
|
|
221
|
+
/** What the project agents' host offers application code: delegated sessions (server/eve.ts). */
|
|
222
|
+
export interface ProjectAgentSessions {
|
|
223
|
+
start(agent: string, caller: Principal | null, input: {
|
|
224
|
+
delegation: string;
|
|
225
|
+
message: string;
|
|
226
|
+
origin: import("./context.js").AgentSessionOrigin;
|
|
227
|
+
key?: string;
|
|
228
|
+
}): Promise<{
|
|
229
|
+
sessionId: string;
|
|
230
|
+
created: boolean;
|
|
231
|
+
}>;
|
|
232
|
+
send(agent: string, caller: Principal | null, sessionId: string, message: string): Promise<{
|
|
233
|
+
delivered: boolean;
|
|
234
|
+
}>;
|
|
235
|
+
end(agent: string, caller: Principal | null, sessionId: string, reason?: string): Promise<{
|
|
236
|
+
ended: boolean;
|
|
237
|
+
}>;
|
|
238
|
+
}
|
|
221
239
|
export declare class FeltKitRuntime {
|
|
222
240
|
#private;
|
|
223
241
|
readonly environment: EnvironmentDescriptor;
|
|
@@ -568,8 +586,8 @@ export declare class FeltKitRuntime {
|
|
|
568
586
|
principal: Principal;
|
|
569
587
|
expiresAt?: string;
|
|
570
588
|
}>;
|
|
571
|
-
/**
|
|
572
|
-
|
|
589
|
+
/** The project agents' host (server/eve.ts) offers delegated sessions to application code (ctx.agent.startSession). */
|
|
590
|
+
useProjectAgentSessions(sessions: ProjectAgentSessions): void;
|
|
573
591
|
grantsFor(principal: Principal | null): ActionCtx["grants"];
|
|
574
592
|
/** Record an authentication event (sign-in failures, revocations, membership changes) in the activity log. */
|
|
575
593
|
recordAuth(name: string, principal: Principal | null, detail: Record<string, unknown>, outcome?: "success" | "denied" | "error", via?: ActivityVia): void;
|
package/dist/runtime/runtime.js
CHANGED
|
@@ -1967,6 +1967,16 @@ export class FeltKitRuntime {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
/** ctx.grants for one call: guest links and agent grants for records the caller can see, issued as a person. */
|
|
1969
1969
|
/** `ctx.grants` as this principal, outside a function: the same rules (FeltKit's own surfaces, e.g. eve agents). */
|
|
1970
|
+
#projectAgentSessions = null;
|
|
1971
|
+
/** The project agents' host (server/eve.ts) offers delegated sessions to application code (ctx.agent.startSession). */
|
|
1972
|
+
useProjectAgentSessions(sessions) {
|
|
1973
|
+
this.#projectAgentSessions = sessions;
|
|
1974
|
+
}
|
|
1975
|
+
#agentSessions() {
|
|
1976
|
+
if (!this.#projectAgentSessions)
|
|
1977
|
+
throw new FeltKitError("FAILED_PRECONDITION", "This application runs no project agents here (feltkit({ eve }) on a FeltKit server).");
|
|
1978
|
+
return this.#projectAgentSessions;
|
|
1979
|
+
}
|
|
1970
1980
|
grantsFor(principal) {
|
|
1971
1981
|
return this.#grantsApi(principal, applicationView(new Reader(this.instance.handle("app"), this.#resolver)));
|
|
1972
1982
|
}
|
|
@@ -2674,6 +2684,9 @@ export class FeltKitRuntime {
|
|
|
2674
2684
|
actions: async (taskId) => (await agent.turnActions(taskId, signedIn())).map(({ at: _at, ...a }) => a),
|
|
2675
2685
|
checkpoint: (taskId) => agent.control.checkpoint(taskId, signedIn()),
|
|
2676
2686
|
acknowledge: (taskId, instructionId, input) => agent.control.acknowledge(taskId, instructionId, input, signedIn()),
|
|
2687
|
+
startSession: (agentName, input) => this.#agentSessions().start(agentName, principal, input),
|
|
2688
|
+
sendToSession: (agentName, sessionId, message) => this.#agentSessions().send(agentName, principal, sessionId, message),
|
|
2689
|
+
endSession: (agentName, sessionId, reason) => this.#agentSessions().end(agentName, principal, sessionId, reason),
|
|
2677
2690
|
propose: async (taskId, proposal) => {
|
|
2678
2691
|
const p = signedIn();
|
|
2679
2692
|
await agent.propose(taskId, proposal, p);
|