akanjs 3.0.0-alpha.22 → 3.0.0-alpha.24
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/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
- package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-shm +0 -0
- package/package.json +1 -1
- package/server/akanOption.ts +2 -2
- package/server/lifecycle/shutdownManager.ts +1 -1
- package/server/mcp/McpRouter.ts +2 -2
- package/signal/agent.signal.ts +1 -5
- package/signal/guards.ts +3 -11
- package/types/server/akanOption.d.ts +2 -2
- package/types/signal/agent.signal.d.ts +1 -6
- package/types/signal/guards.d.ts +2 -4
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/server/akanOption.ts
CHANGED
|
@@ -54,8 +54,8 @@ export class AkanOption<Env extends BackendEnv = BackendEnv> {
|
|
|
54
54
|
return this;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Who may spend the LLM key through the `runAgentTurn` relay
|
|
58
|
-
*
|
|
57
|
+
* Who may spend the LLM key through the `runAgentTurn` relay. With no policy the call is refused — the same
|
|
58
|
+
* answer `None` gives — because the framework has no account model to gate on. `null` clears the policy.
|
|
59
59
|
*/
|
|
60
60
|
setAgentAccess(policy: AgentRelayPolicy | null) {
|
|
61
61
|
this.#agentAccess = policy;
|
|
@@ -14,7 +14,7 @@ export class ShutdownManager {
|
|
|
14
14
|
|
|
15
15
|
for (const signal of signals) {
|
|
16
16
|
process.on(signal, async () => {
|
|
17
|
-
logger.
|
|
17
|
+
logger.debug(`Received ${signal}, starting graceful shutdown...`);
|
|
18
18
|
try {
|
|
19
19
|
await onShutdown();
|
|
20
20
|
process.exit(0);
|
package/server/mcp/McpRouter.ts
CHANGED
|
@@ -138,13 +138,13 @@ export class McpRouter {
|
|
|
138
138
|
try {
|
|
139
139
|
const { tools, prompts, resourceTemplates, refusals, undescribed } = this.#getDocument();
|
|
140
140
|
const counts = `tools=${tools.length} prompts=${prompts.length} resourceTemplates=${resourceTemplates.length}`;
|
|
141
|
-
McpRouter.logger.
|
|
141
|
+
McpRouter.logger.debug(`MCP catalogue: ${counts}${this.#props.readOnly ? " (read-only deployment)" : ""}`);
|
|
142
142
|
|
|
143
143
|
if (!tools.length && !prompts.length)
|
|
144
144
|
McpRouter.logger.warn(
|
|
145
145
|
"MCP is enabled but published nothing. Every candidate was refused; see the reasons below.",
|
|
146
146
|
);
|
|
147
|
-
for (const { key, reason } of refusals) McpRouter.logger.
|
|
147
|
+
for (const { key, reason } of refusals) McpRouter.logger.verbose(`MCP did not expose "${key}": ${reason}`);
|
|
148
148
|
for (const { key, reason } of undescribed)
|
|
149
149
|
McpRouter.logger.warn(`MCP exposed "${key}" with no description: ${reason}`);
|
|
150
150
|
} catch (error) {
|
package/signal/agent.signal.ts
CHANGED
|
@@ -10,11 +10,7 @@ import { Req } from "./internalArg";
|
|
|
10
10
|
import { serverSignal } from "./serverSignal";
|
|
11
11
|
import { SignalRegistry } from "./signalRegistry";
|
|
12
12
|
|
|
13
|
-
export class AgentInternal extends internal(srv.agent, (
|
|
14
|
-
warnOpenRelay: initialize().exec(() => {
|
|
15
|
-
AgentRelayAccess.warnIfOpen();
|
|
16
|
-
}),
|
|
17
|
-
})) {}
|
|
13
|
+
export class AgentInternal extends internal(srv.agent, () => ({})) {}
|
|
18
14
|
|
|
19
15
|
export class AgentEndpoint extends endpoint(srv.agent, ({ mutation }) => ({
|
|
20
16
|
|
package/signal/guards.ts
CHANGED
|
@@ -24,8 +24,8 @@ export type AgentRelayPolicy = (context: SignalContext) => boolean | Promise<boo
|
|
|
24
24
|
* Gate for the `runAgentTurn` relay. Every tool runs in the caller's own browser session, so the LLM key is the
|
|
25
25
|
* one thing this endpoint spends — ungated, any visitor can bill the app's provider through fetch alone.
|
|
26
26
|
*
|
|
27
|
-
* The framework has no account model to gate on, so with no policy registered it
|
|
28
|
-
*
|
|
27
|
+
* The framework has no account model to gate on, so with no policy registered it refuses every call — the same
|
|
28
|
+
* answer `None` gives. An app opens it at boot, e.g.
|
|
29
29
|
* `AgentRelayAccess.use((context) => !!context.get("account"))`. The policy is the app's; the framework cannot know it.
|
|
30
30
|
*/
|
|
31
31
|
export class AgentRelayAccess implements Guard {
|
|
@@ -44,17 +44,9 @@ export class AgentRelayAccess implements Guard {
|
|
|
44
44
|
return !!AgentRelayAccess.#policy;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/** Runs at boot, after the app entry has evaluated — a module-scope check would fire before `use()` could. */
|
|
48
|
-
static warnIfOpen() {
|
|
49
|
-
if (AgentRelayAccess.#policy) return;
|
|
50
|
-
AgentRelayAccess.#logger.warn(
|
|
51
|
-
'runAgentTurn is open to every caller — anyone can spend the LLM key. Register a policy at boot: AgentRelayAccess.use((context) => !!context.get("account")), or set AKAN_AGENT=false.',
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
47
|
async canPass(context: SignalContext): Promise<boolean> {
|
|
56
48
|
const policy = AgentRelayAccess.#policy;
|
|
57
|
-
if (!policy) return
|
|
49
|
+
if (!policy) return false;
|
|
58
50
|
try {
|
|
59
51
|
return await policy(context);
|
|
60
52
|
} catch (error) {
|
|
@@ -26,8 +26,8 @@ export declare class AkanOption<Env extends BackendEnv = BackendEnv> {
|
|
|
26
26
|
*/
|
|
27
27
|
setMcp(mcp?: boolean | McpServerOption): this;
|
|
28
28
|
/**
|
|
29
|
-
* Who may spend the LLM key through the `runAgentTurn` relay
|
|
30
|
-
*
|
|
29
|
+
* Who may spend the LLM key through the `runAgentTurn` relay. With no policy the call is refused — the same
|
|
30
|
+
* answer `None` gives — because the framework has no account model to gate on. `null` clears the policy.
|
|
31
31
|
*/
|
|
32
32
|
setAgentAccess(policy: AgentRelayPolicy | null): this;
|
|
33
33
|
/** Settings for whichever adaptor fills `LlmAdaptorRole`, injected into it as the `llmOption` use. */
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { Any } from "akanjs/base";
|
|
2
1
|
import { AgentTurn } from "./agentTurn.d.ts";
|
|
3
2
|
declare const AgentInternal_base: import("./internal.d.ts").InternalCls<import("akanjs/service").ServiceModel<typeof import("akanjs/service").AgentService, any, any, {
|
|
4
3
|
agentService: import("akanjs/service").AgentService;
|
|
5
|
-
}>, {
|
|
6
|
-
warnOpenRelay: import("./internalInfo.d.ts").InternalInfo<"init", {
|
|
7
|
-
agentService: import("akanjs/service").AgentService;
|
|
8
|
-
}, [], [], [], typeof Any, void, false>;
|
|
9
|
-
}>;
|
|
4
|
+
}>, {}>;
|
|
10
5
|
export declare class AgentInternal extends AgentInternal_base {
|
|
11
6
|
}
|
|
12
7
|
declare const AgentEndpoint_base: import("./endpoint.d.ts").EndpointCls<import("akanjs/service").ServiceModel<typeof import("akanjs/service").AgentService, any, any, {
|
package/types/signal/guards.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export type AgentRelayPolicy = (context: SignalContext) => boolean | Promise<boo
|
|
|
15
15
|
* Gate for the `runAgentTurn` relay. Every tool runs in the caller's own browser session, so the LLM key is the
|
|
16
16
|
* one thing this endpoint spends — ungated, any visitor can bill the app's provider through fetch alone.
|
|
17
17
|
*
|
|
18
|
-
* The framework has no account model to gate on, so with no policy registered it
|
|
19
|
-
*
|
|
18
|
+
* The framework has no account model to gate on, so with no policy registered it refuses every call — the same
|
|
19
|
+
* answer `None` gives. An app opens it at boot, e.g.
|
|
20
20
|
* `AgentRelayAccess.use((context) => !!context.get("account"))`. The policy is the app's; the framework cannot know it.
|
|
21
21
|
*/
|
|
22
22
|
export declare class AgentRelayAccess implements Guard {
|
|
@@ -25,7 +25,5 @@ export declare class AgentRelayAccess implements Guard {
|
|
|
25
25
|
static scope: GuardScope;
|
|
26
26
|
static use(policy: AgentRelayPolicy | null): void;
|
|
27
27
|
static get hasPolicy(): boolean;
|
|
28
|
-
/** Runs at boot, after the app entry has evaluated — a module-scope check would fire before `use()` could. */
|
|
29
|
-
static warnIfOpen(): void;
|
|
30
28
|
canPass(context: SignalContext): Promise<boolean>;
|
|
31
29
|
}
|