agentic-assistant 0.3.0 → 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.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- export { d as ACTIONS, e as Action, b as Actor, f as ApprovalDecision, g as ApprovalGate, a as ApprovalRequest, h as Approver, i as ApproverKind, A as AssistantEvent, j as AssistantPrincipal, k as DATA_NOTICE, D as DeniedReason, c as DoneReason, P as PrincipalError, l as PrincipalInput, m as Provenance, n as ProvenanceInput, Q as QueueApprovalGate, o as RunLimits, p as RunOptions, R as RunTotals, S as Scope, T as TOOL_RISKS, q as TRAINED_ALGORITHMIC_MEDIA, r as ToolContext, s as ToolDefinition, t as ToolRegistry, u as ToolRisk, v as actorOf, w as assertPrincipal, x as canonicalJson, y as createPrincipal, z as createProvenance, B as defineTool, C as digestCall, E as hasScope, F as parseScope, G as provenanceLabel, H as provenanceMarker, I as runAssistant, J as scopeCovers } from './loop-D4qWbRu6.js';
2
- import { S as Setup } from './chat-CXbhePC5.js';
3
- export { C as ChatConfig, a as ChatIo, b as ConfigError, c as ConnectMcpOptions, M as McpToolInfo, d as McpTools, e as McpTransportConfig, f as buildSetup, g as connectMcpTools, p as parseTarget, r as runChat } from './chat-CXbhePC5.js';
1
+ export { A as ACTIONS, a as Action, b as Actor, c as ApprovalDecision, d as ApprovalGate, e as ApprovalRequest, f as Approver, g as ApproverKind, h as AssistantEvent, i as AssistantPrincipal, D as DATA_NOTICE, j as DeniedReason, k as DoneReason, P as PrincipalError, l as PrincipalInput, m as Provenance, n as ProvenanceInput, Q as QueueApprovalGate, R as RunLimits, o as RunOptions, p as RunTotals, S as Scope, T as TOOL_RISKS, q as TRAINED_ALGORITHMIC_MEDIA, r as ToolContext, s as ToolDefinition, t as ToolRegistry, u as ToolRisk, v as actorOf, w as assertPrincipal, x as canonicalJson, y as createPrincipal, z as createProvenance, B as defineTool, C as digestCall, E as hasScope, F as parseScope, G as provenanceLabel, H as provenanceMarker, I as runAssistant, J as scopeCovers } from './loop-B6aowbyz.js';
2
+ import { S as Setup } from './chat-CGITyrxg.js';
3
+ export { C as ChatConfig, a as ChatIo, b as ConfigError, c as ConnectMcpOptions, M as McpToolInfo, d as McpTools, e as McpTransportConfig, f as buildSetup, g as connectMcpTools, p as parseTarget, r as runChat } from './chat-CGITyrxg.js';
4
4
  import Anthropic from '@anthropic-ai/sdk';
5
5
  import { M as ModelProvider, P as Pricing, a as ModelRequest, b as ModelEvent } from './types-DGH8FS56.js';
6
6
  export { A as AnsweredBy, C as ContentBlock, J as JsonSchema, c as Message, d as ProviderError, S as StopReason, T as ToolSpec, U as Usage } from './types-DGH8FS56.js';
7
7
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
8
+ import { AssistantClient } from './client.js';
8
9
 
9
10
  declare const VERSION: string;
10
11
 
@@ -81,9 +82,16 @@ declare class FallbackProvider implements ModelProvider {
81
82
  stream(request: ModelRequest): AsyncGenerator<ModelEvent>;
82
83
  }
83
84
 
84
- /** An MCP server with one tool, `assistant_chat`. Each call starts a new conversation. */
85
- declare function createAssistantMcpServer(setup: Setup, shutdown?: AbortSignal): Server;
85
+ /**
86
+ * An MCP server with the tool `assistant_chat`. Each call starts a new conversation. With a `remote` client it
87
+ * also serves `assistant_tools`, `assistant_approvals`, and `assistant_deny`. `assistant_approve` needs `allow.approve`.
88
+ */
89
+ declare function createAssistantMcpServer(setup: Setup, shutdown?: AbortSignal, remote?: AssistantClient, allow?: {
90
+ approve?: boolean;
91
+ }): Server;
86
92
  /** Serves on stdio. Resolves when the client closes its input, or the transport closes. */
87
- declare function startAssistantMcp(setup: Setup): Promise<void>;
93
+ declare function startAssistantMcp(setup: Setup, remote?: AssistantClient, allow?: {
94
+ approve?: boolean;
95
+ }): Promise<void>;
88
96
 
89
97
  export { AnthropicProvider, type AnthropicProviderOptions, DEFAULT_ANTHROPIC_MODEL, FallbackProvider, ModelEvent, ModelProvider, ModelRequest, type OpenAICompatibleOptions, OpenAICompatibleProvider, PRICING_CHECKED_ON, Pricing, Setup, VERSION, createAssistantMcpServer, startAssistantMcp };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createAssistantMcpServer,
3
3
  startAssistantMcp
4
- } from "./chunk-T5WVSGYQ.js";
4
+ } from "./chunk-Q3GGWNW5.js";
5
5
  import {
6
6
  ConfigError,
7
7
  FallbackProvider,
@@ -10,13 +10,13 @@ import {
10
10
  connectMcpTools,
11
11
  parseTarget,
12
12
  runChat
13
- } from "./chunk-3X6KU636.js";
13
+ } from "./chunk-KSVH5NNA.js";
14
14
  import "./chunk-HYT732TN.js";
15
15
  import {
16
16
  AnthropicProvider,
17
17
  DEFAULT_ANTHROPIC_MODEL,
18
18
  PRICING_CHECKED_ON
19
- } from "./chunk-DXTIEMOT.js";
19
+ } from "./chunk-XSRGG7SB.js";
20
20
  import {
21
21
  ACTIONS,
22
22
  DATA_NOTICE,
@@ -40,7 +40,8 @@ import {
40
40
  provenanceMarker,
41
41
  runAssistant,
42
42
  scopeCovers
43
- } from "./chunk-3LKTJJ75.js";
43
+ } from "./chunk-RHGVOR6N.js";
44
+ import "./chunk-QTIEDY3V.js";
44
45
  export {
45
46
  ACTIONS,
46
47
  AnthropicProvider,
@@ -287,4 +287,4 @@ declare const DATA_NOTICE: string;
287
287
  */
288
288
  declare function runAssistant(options: RunOptions): AsyncGenerator<AssistantEvent>;
289
289
 
290
- export { type AssistantEvent as A, defineTool as B, digestCall as C, type DeniedReason as D, hasScope as E, parseScope as F, provenanceLabel as G, provenanceMarker as H, runAssistant as I, scopeCovers as J, PrincipalError as P, QueueApprovalGate as Q, type RunTotals as R, type Scope as S, TOOL_RISKS as T, type ApprovalRequest as a, type Actor as b, type DoneReason as c, ACTIONS as d, type Action as e, type ApprovalDecision as f, type ApprovalGate as g, type Approver as h, type ApproverKind as i, type AssistantPrincipal as j, DATA_NOTICE as k, type PrincipalInput as l, type Provenance as m, type ProvenanceInput as n, type RunLimits as o, type RunOptions as p, TRAINED_ALGORITHMIC_MEDIA as q, type ToolContext as r, type ToolDefinition as s, ToolRegistry as t, type ToolRisk as u, actorOf as v, assertPrincipal as w, canonicalJson as x, createPrincipal as y, createProvenance as z };
290
+ export { ACTIONS as A, defineTool as B, digestCall as C, DATA_NOTICE as D, hasScope as E, parseScope as F, provenanceLabel as G, provenanceMarker as H, runAssistant as I, scopeCovers as J, PrincipalError as P, QueueApprovalGate as Q, type RunLimits as R, type Scope as S, TOOL_RISKS as T, type Action as a, type Actor as b, type ApprovalDecision as c, type ApprovalGate as d, type ApprovalRequest as e, type Approver as f, type ApproverKind as g, type AssistantEvent as h, type AssistantPrincipal as i, type DeniedReason as j, type DoneReason as k, type PrincipalInput as l, type Provenance as m, type ProvenanceInput as n, type RunOptions as o, type RunTotals as p, TRAINED_ALGORITHMIC_MEDIA as q, type ToolContext as r, type ToolDefinition as s, ToolRegistry as t, type ToolRisk as u, actorOf as v, assertPrincipal as w, canonicalJson as x, createPrincipal as y, createProvenance as z };
@@ -0,0 +1,13 @@
1
+ import {
2
+ createAssistantMcpServer,
3
+ startAssistantMcp
4
+ } from "./chunk-Q3GGWNW5.js";
5
+ import "./chunk-KSVH5NNA.js";
6
+ import "./chunk-HYT732TN.js";
7
+ import "./chunk-XSRGG7SB.js";
8
+ import "./chunk-RHGVOR6N.js";
9
+ import "./chunk-QTIEDY3V.js";
10
+ export {
11
+ createAssistantMcpServer,
12
+ startAssistantMcp
13
+ };
package/dist/react.css CHANGED
@@ -1,19 +1,22 @@
1
- /* Plain CSS variables. Set them on .aa-panel or a parent to match your app. Every pair below meets
2
- WCAG 2.2 AA contrast; src/react/styles.test.ts checks it. No remote fonts or images. */
1
+ /* Plain CSS variables. They read the agentic-design tokens (--ad-color-*), so load
2
+ agentic-design/tokens.css once on the page. Override --aa-* on .aa-panel or a parent to match your app.
3
+ Without the tokens, each variable falls back to a system color, so focus and borders stay visible.
4
+ Every token pair meets WCAG 2.2 AA contrast in light and dark; src/react/styles.test.ts checks it.
5
+ No remote fonts or images. */
3
6
  .aa-panel {
4
- --aa-bg: #ffffff;
5
- --aa-fg: #1b1b1b;
6
- --aa-muted: #4d4d4d;
7
- --aa-border: #767676;
8
- --aa-accent: #0b57d0;
9
- --aa-accent-fg: #ffffff;
10
- --aa-focus: #0b57d0;
11
- --aa-machine-bg: #e8eefc;
12
- --aa-machine-fg: #0a2a6b;
13
- --aa-card-bg: #f4f4f4;
14
- --aa-warn-bg: #fff4d6;
15
- --aa-warn-fg: #5c3d00;
16
- --aa-danger: #b3261e;
7
+ --aa-bg: var(--ad-color-surface, Canvas);
8
+ --aa-fg: var(--ad-color-text, CanvasText);
9
+ --aa-muted: var(--ad-color-text-muted, CanvasText);
10
+ --aa-border: var(--ad-color-border-strong, CanvasText);
11
+ --aa-accent: var(--ad-color-accent, LinkText);
12
+ --aa-accent-fg: var(--ad-color-text-on-accent, Canvas);
13
+ --aa-focus: var(--ad-color-focus, LinkText);
14
+ --aa-machine-bg: var(--ad-color-accent-subtle, Canvas);
15
+ --aa-machine-fg: var(--ad-color-accent-text, CanvasText);
16
+ --aa-card-bg: var(--ad-color-surface-sunken, Canvas);
17
+ --aa-warn-bg: var(--ad-color-warning-subtle, Canvas);
18
+ --aa-warn-fg: var(--ad-color-warning-text, CanvasText);
19
+ --aa-danger: var(--ad-color-danger, LinkText);
17
20
 
18
21
  display: flex;
19
22
  flex-direction: column;
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { A as AssistantEvent, u as ToolRisk } from './loop-D4qWbRu6.js';
2
+ import { h as AssistantEvent, u as ToolRisk } from './loop-B6aowbyz.js';
3
3
  import { c as Message } from './types-DGH8FS56.js';
4
4
 
5
5
  type PanelItem = {
package/dist/worker.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Auth } from 'agentic-identity';
2
- import { t as ToolRegistry, o as RunLimits } from './loop-D4qWbRu6.js';
2
+ import { t as ToolRegistry, R as RunLimits } from './loop-B6aowbyz.js';
3
3
  import { M as ModelProvider } from './types-DGH8FS56.js';
4
4
 
5
5
  interface AssistantApiOptions {
@@ -11,6 +11,14 @@ interface AssistantApiOptions {
11
11
  registry: ToolRegistry;
12
12
  system?: string;
13
13
  limits?: RunLimits;
14
+ /** Origins (such as `https://app.example.org`) that may send a write signed in with a session cookie. A write with a cookie from any other origin is a 403. A Bearer key needs no origin. */
15
+ origins?: readonly string[];
16
+ /** A scope a caller must hold for each route group. A caller without it gets a 403. A group left out needs no extra scope. `approvals` covers list, approve, and deny. */
17
+ routeScopes?: {
18
+ tools?: string;
19
+ chat?: string;
20
+ approvals?: string;
21
+ };
14
22
  /** Most chat turns one principal may run at once. Default 4. */
15
23
  maxConcurrentRuns?: number;
16
24
  }
@@ -32,7 +40,7 @@ interface StaticTokenEntry {
32
40
  scopes: string[];
33
41
  }
34
42
  /**
35
- * An `agentic-identity` Auth that reads `Authorization: Bearer <token>` against a fixed map.
43
+ * An `agentic-identity` Auth (`createStoreAuth` over a memory Store) for a fixed map of bearer tokens.
36
44
  * It keeps only SHA-256 digests. It throws on a token shorter than 32 bytes or an entry of the wrong shape.
37
45
  * An empty map is allowed: every request is then a 401.
38
46
  */
package/dist/worker.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createAssistantApi,
4
4
  createStaticTokenAuth,
5
5
  createWorker
6
- } from "./chunk-GLU222OQ.js";
7
- import "./chunk-3LKTJJ75.js";
6
+ } from "./chunk-PRQTL5VS.js";
7
+ import "./chunk-RHGVOR6N.js";
8
8
  export {
9
9
  APPROVER_SCOPE,
10
10
  createAssistantApi,
package/llms.txt CHANGED
@@ -5,11 +5,11 @@ An AI assistant that acts inside your apps with the user's own permissions.
5
5
  Keywords: assistant,ai,agent,tools,mcp,sdk,side-panel,approvals,eu,model-port.
6
6
 
7
7
  - SDK: import { runAssistant, ToolRegistry, createPrincipal } from "agentic-assistant".
8
- - CLI: agentic-assistant chat --tools <mcp-url> --scope <s> --tool-scope <s> "message". MCP server: agentic-assistant mcp.
8
+ - CLI: agentic-assistant chat --tools <mcp-url> --scope <s> --tool-scope <s> "message". MCP server: agentic-assistant mcp. Remote: agentic-assistant tools|approvals|approve <id> --digest <d>|deny <id> --api <url> --api-token-env <NAME>.
9
9
  - HTTP API: import { createWorker } from "agentic-assistant/worker". Routes under /api/v1: GET /tools, POST /chat (SSE), GET /approvals, POST /approvals/:id/approve|deny. Sign-in with agentic-identity principals. Chat responses carry x-ai-generated: true. Demo: https://agentic-assistant-demo.hello-fd1.workers.dev (needs a bearer key; no model key set, so chat answers 503 not_configured).
10
10
  - HTTP client: import { createClient, AssistantApiError } from "agentic-assistant/client"; createClient({ baseUrl, token, fetch? }) gives health, tools, chat (async generator of events), approvals, approve(id, digest), deny(id, reason?). Typed errors with code and status.
11
11
  - AI marking: events carry `provenance`; use provenanceLabel and provenanceMarker (JSON-LD, IPTC trainedAlgorithmicMedia). Also in HTTP, CLI --json and MCP results.
12
- - Panel: import { AssistantPanel } from "agentic-assistant/react"; import "agentic-assistant/react.css".
12
+ - Panel: import { AssistantPanel } from "agentic-assistant/react"; import "agentic-design/tokens.css"; import "agentic-assistant/react.css" (colors are agentic-design tokens).
13
13
  - Test provider: import { ScriptedProvider } from "agentic-assistant/testing".
14
14
 
15
15
  ## Docs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-assistant",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "An AI assistant that acts inside your apps with the user's own permissions.",
5
5
  "keywords": [
6
6
  "assistant",
@@ -74,7 +74,7 @@
74
74
  "dependencies": {
75
75
  "@anthropic-ai/sdk": "^1.3.0",
76
76
  "@modelcontextprotocol/sdk": "^1.32.2",
77
- "agentic-identity": "^0.4.0",
77
+ "agentic-identity": "^0.6.0",
78
78
  "ajv": "^8.20.0"
79
79
  },
80
80
  "devDependencies": {
@@ -84,6 +84,7 @@
84
84
  "@types/node": "^22.0.0",
85
85
  "@types/react": "^19.3.0",
86
86
  "@types/react-dom": "^19.3.0",
87
+ "agentic-design": "^0.3.1",
87
88
  "jsdom": "^30.1.3",
88
89
  "react": "^19.3.1",
89
90
  "react-dom": "^19.3.1",
@@ -93,9 +94,13 @@
93
94
  "wrangler": "^4.155.0"
94
95
  },
95
96
  "peerDependencies": {
97
+ "agentic-design": "^0.3.1",
96
98
  "react": ">=18"
97
99
  },
98
100
  "peerDependenciesMeta": {
101
+ "agentic-design": {
102
+ "optional": true
103
+ },
99
104
  "react": {
100
105
  "optional": true
101
106
  }
@@ -1,82 +0,0 @@
1
- import {
2
- runChat
3
- } from "./chunk-3X6KU636.js";
4
- import {
5
- VERSION,
6
- provenanceLabel,
7
- provenanceMarker
8
- } from "./chunk-3LKTJJ75.js";
9
-
10
- // src/mcp-server.ts
11
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
12
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
- import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
14
- var MAX_MESSAGE_CHARS = 1e4;
15
- var TOOL = {
16
- name: "assistant_chat",
17
- description: "Send one message to the assistant. It acts for a person with the scopes the host gave it. A risky action runs only if the host pre-approved that exact call. The reply says it is machine-made.",
18
- inputSchema: {
19
- type: "object",
20
- properties: { message: { type: "string", minLength: 1, maxLength: MAX_MESSAGE_CHARS, description: "What to ask the assistant." } },
21
- required: ["message"],
22
- additionalProperties: false
23
- },
24
- annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true }
25
- };
26
- var fail = (text) => ({ isError: true, content: [{ type: "text", text }] });
27
- function createAssistantMcpServer(setup, shutdown) {
28
- const server = new Server({ name: "agentic-assistant", version: VERSION }, { capabilities: { tools: {} } });
29
- server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [TOOL] }));
30
- server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
31
- if (request.params.name !== TOOL.name) return fail(`unknown tool "${request.params.name}"`);
32
- const message = request.params.arguments?.message;
33
- if (typeof message !== "string" || message.trim() === "" || message.length > MAX_MESSAGE_CHARS) {
34
- return fail(`message must be a text of 1 to ${MAX_MESSAGE_CHARS} characters`);
35
- }
36
- const call = new AbortController();
37
- const stop = () => call.abort();
38
- extra.signal.addEventListener("abort", stop, { once: true });
39
- shutdown?.addEventListener("abort", stop, { once: true });
40
- if (extra.signal.aborted || shutdown?.aborted) stop();
41
- let reply = "";
42
- const toolCalls = [];
43
- let outcome;
44
- for await (const event of runChat(setup, [{ role: "user", content: [{ type: "text", text: message }] }], call.signal)) {
45
- if (event.type === "text_delta") reply += event.text;
46
- else if (event.type === "turn_start") reply = "";
47
- else if (event.type === "tool_result") toolCalls.push({ name: event.name, isError: event.isError, ...event.denied ? { denied: event.denied } : {}, ...event.provenance ? { provenance: event.provenance } : {} });
48
- else if (event.type === "done") outcome = { reason: event.reason, totals: event.totals, provenance: event.provenance };
49
- }
50
- extra.signal.removeEventListener("abort", stop);
51
- shutdown?.removeEventListener("abort", stop);
52
- const provenance = outcome?.provenance;
53
- const result = {
54
- machineMade: true,
55
- reply,
56
- reason: outcome?.reason ?? "unknown",
57
- toolCalls,
58
- totals: outcome?.totals,
59
- ...provenance ? { provenance, label: provenanceLabel(provenance), marker: provenanceMarker(provenance) } : {}
60
- };
61
- return { ...outcome?.reason === "end_turn" ? {} : { isError: true }, content: [{ type: "text", text: JSON.stringify(result) }] };
62
- });
63
- return server;
64
- }
65
- async function startAssistantMcp(setup) {
66
- const shutdown = new AbortController();
67
- const server = createAssistantMcpServer(setup, shutdown.signal);
68
- const ended = new Promise((resolve) => {
69
- server.onclose = resolve;
70
- process.stdin.once("end", resolve);
71
- process.stdin.once("close", resolve);
72
- });
73
- await server.connect(new StdioServerTransport());
74
- await ended;
75
- shutdown.abort();
76
- await server.close().catch(() => void 0);
77
- }
78
-
79
- export {
80
- createAssistantMcpServer,
81
- startAssistantMcp
82
- };
@@ -1,12 +0,0 @@
1
- import {
2
- createAssistantMcpServer,
3
- startAssistantMcp
4
- } from "./chunk-T5WVSGYQ.js";
5
- import "./chunk-3X6KU636.js";
6
- import "./chunk-HYT732TN.js";
7
- import "./chunk-DXTIEMOT.js";
8
- import "./chunk-3LKTJJ75.js";
9
- export {
10
- createAssistantMcpServer,
11
- startAssistantMcp
12
- };