agentic-assistant 0.4.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/CHANGELOG.md +25 -0
- package/README.md +19 -2
- package/SKILL.md +2 -1
- package/dist/{chat-CXbhePC5.d.ts → chat-CGITyrxg.d.ts} +1 -1
- package/dist/{chunk-MESH6X6N.js → chunk-KSVH5NNA.js} +58 -12
- package/dist/{chunk-YMEM57LX.js → chunk-PRQTL5VS.js} +12 -18
- package/dist/chunk-Q3GGWNW5.js +167 -0
- package/dist/chunk-QTIEDY3V.js +196 -0
- package/dist/{chunk-C44QT474.js → chunk-RHGVOR6N.js} +1 -1
- package/dist/{chunk-FQD4OK2R.js → chunk-XSRGG7SB.js} +1 -1
- package/dist/cli.d.ts +24 -3
- package/dist/cli.js +64 -9
- package/dist/client.d.ts +2 -2
- package/dist/client.js +4 -191
- package/dist/demo.js +10 -5
- package/dist/index.d.ts +14 -6
- package/dist/index.js +5 -4
- package/dist/{loop-D4qWbRu6.d.ts → loop-B6aowbyz.d.ts} +1 -1
- package/dist/mcp-server-U3UQIB7H.js +13 -0
- package/dist/react.css +18 -15
- package/dist/react.d.ts +1 -1
- package/dist/worker.d.ts +8 -2
- package/dist/worker.js +2 -2
- package/llms.txt +2 -2
- package/package.json +6 -1
- package/dist/chunk-KNUEYFX2.js +0 -82
- package/dist/mcp-server-LXGWKEHG.js +0 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { S as Setup } from './chat-
|
|
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-
|
|
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
|
-
/**
|
|
85
|
-
|
|
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
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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 {
|
|
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.
|
|
2
|
-
|
|
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:
|
|
5
|
-
--aa-fg:
|
|
6
|
-
--aa-muted:
|
|
7
|
-
--aa-border:
|
|
8
|
-
--aa-accent:
|
|
9
|
-
--aa-accent-fg:
|
|
10
|
-
--aa-focus:
|
|
11
|
-
--aa-machine-bg:
|
|
12
|
-
--aa-machine-fg:
|
|
13
|
-
--aa-card-bg:
|
|
14
|
-
--aa-warn-bg:
|
|
15
|
-
--aa-warn-fg:
|
|
16
|
-
--aa-danger:
|
|
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
package/dist/worker.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Auth } from 'agentic-identity';
|
|
2
|
-
import { t as ToolRegistry,
|
|
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
|
|
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
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
|
+
"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",
|
|
@@ -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
|
}
|
package/dist/chunk-KNUEYFX2.js
DELETED
|
@@ -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
|
-
};
|