agentic-assistant 0.4.0 → 0.5.1

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/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 {
@@ -13,6 +13,12 @@ interface AssistantApiOptions {
13
13
  limits?: RunLimits;
14
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
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
+ };
16
22
  /** Most chat turns one principal may run at once. Default 4. */
17
23
  maxConcurrentRuns?: number;
18
24
  }
@@ -34,7 +40,7 @@ interface StaticTokenEntry {
34
40
  scopes: string[];
35
41
  }
36
42
  /**
37
- * 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.
38
44
  * It keeps only SHA-256 digests. It throws on a token shorter than 32 bytes or an entry of the wrong shape.
39
45
  * An empty map is allowed: every request is then a 401.
40
46
  */
package/dist/worker.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createAssistantApi,
4
4
  createStaticTokenAuth,
5
5
  createWorker
6
- } from "./chunk-YMEM57LX.js";
7
- import "./chunk-C44QT474.js";
6
+ } from "./chunk-TOQIHYDH.js";
7
+ import "./chunk-JNZPVHNN.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.4.0",
3
+ "version": "0.5.1",
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.6.0",
77
+ "agentic-identity": "^0.7.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-MESH6X6N.js";
4
- import {
5
- VERSION,
6
- provenanceLabel,
7
- provenanceMarker
8
- } from "./chunk-C44QT474.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-KNUEYFX2.js";
5
- import "./chunk-MESH6X6N.js";
6
- import "./chunk-HYT732TN.js";
7
- import "./chunk-FQD4OK2R.js";
8
- import "./chunk-C44QT474.js";
9
- export {
10
- createAssistantMcpServer,
11
- startAssistantMcp
12
- };