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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "3.0.0-alpha.22",
3
+ "version": "3.0.0-alpha.24",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -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 the `AgentRelayAccess` policy, which defaults to
58
- * allowing everyone because the framework has no account model to gate on. `null` reopens it.
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.info(`Received ${signal}, starting graceful shutdown...`);
17
+ logger.debug(`Received ${signal}, starting graceful shutdown...`);
18
18
  try {
19
19
  await onShutdown();
20
20
  process.exit(0);
@@ -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.info(`MCP catalogue: ${counts}${this.#props.readOnly ? " (read-only deployment)" : ""}`);
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.warn(`MCP did not expose "${key}": ${reason}`);
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) {
@@ -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, ({ initialize }) => ({
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 allows everyonewhat `Public`
28
- * said before, but with a seam: a product hardens it at boot, e.g.
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 true;
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 the `AgentRelayAccess` policy, which defaults to
30
- * allowing everyone because the framework has no account model to gate on. `null` reopens it.
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, {
@@ -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 allows everyonewhat `Public`
19
- * said before, but with a seam: a product hardens it at boot, e.g.
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
  }