agentic-assistant 0.0.0-stage → 0.1.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.
@@ -0,0 +1,29 @@
1
+ import { M as ModelProvider, P as Pricing, a as ModelRequest, S as StopReason, U as Usage, b as ModelEvent } from './types-C47SyHH5.js';
2
+
3
+ interface ScriptedTurn {
4
+ text?: string;
5
+ toolCalls?: {
6
+ name: string;
7
+ input: unknown;
8
+ id?: string;
9
+ }[];
10
+ /** Default: "tool_use" when there are tool calls, else "end_turn". */
11
+ stopReason?: StopReason;
12
+ usage?: Usage;
13
+ }
14
+ /**
15
+ * A model that replays a fixed script, one turn per request. Use it in E2E
16
+ * tests so runs are deterministic. It records each request it receives.
17
+ */
18
+ declare class ScriptedProvider implements ModelProvider {
19
+ private readonly script;
20
+ readonly pricing?: Pricing | undefined;
21
+ readonly name = "scripted";
22
+ readonly model = "scripted-1";
23
+ readonly requests: ModelRequest[];
24
+ private next;
25
+ constructor(script: readonly ScriptedTurn[], pricing?: Pricing | undefined);
26
+ stream(request: ModelRequest): AsyncGenerator<ModelEvent>;
27
+ }
28
+
29
+ export { ScriptedProvider, type ScriptedTurn };
@@ -0,0 +1,35 @@
1
+ // src/testing.ts
2
+ var ScriptedProvider = class {
3
+ constructor(script, pricing) {
4
+ this.script = script;
5
+ this.pricing = pricing;
6
+ }
7
+ script;
8
+ pricing;
9
+ name = "scripted";
10
+ model = "scripted-1";
11
+ requests = [];
12
+ next = 0;
13
+ async *stream(request) {
14
+ this.requests.push({ ...request, messages: structuredClone(request.messages) });
15
+ const turn = this.script[this.next++];
16
+ if (turn === void 0) throw new Error(`scripted provider ran out of turns at request ${this.next}`);
17
+ const content = [];
18
+ if (turn.text !== void 0) {
19
+ for (const word of turn.text.split(/(?<= )/)) yield { type: "text_delta", text: word };
20
+ content.push({ type: "text", text: turn.text });
21
+ }
22
+ for (const [index, call] of (turn.toolCalls ?? []).entries()) {
23
+ content.push({ type: "tool_use", id: call.id ?? `call_${this.next}_${index}`, name: call.name, input: call.input });
24
+ }
25
+ yield {
26
+ type: "message",
27
+ content,
28
+ stopReason: turn.stopReason ?? (turn.toolCalls?.length ? "tool_use" : "end_turn"),
29
+ usage: turn.usage ?? { inputTokens: 10, outputTokens: 5 }
30
+ };
31
+ }
32
+ };
33
+ export {
34
+ ScriptedProvider
35
+ };
@@ -0,0 +1,72 @@
1
+ /** A JSON Schema object that describes one tool's input. */
2
+ type JsonSchema = Record<string, unknown>;
3
+ type ContentBlock = {
4
+ type: "text";
5
+ text: string;
6
+ } | {
7
+ type: "tool_use";
8
+ id: string;
9
+ name: string;
10
+ input: unknown;
11
+ } | {
12
+ type: "tool_result";
13
+ toolUseId: string;
14
+ content: string;
15
+ isError?: boolean;
16
+ }
17
+ /** A block only the named provider reads (for example reasoning). Adapters send it back unchanged. */
18
+ | {
19
+ type: "provider_block";
20
+ provider: string;
21
+ raw: unknown;
22
+ };
23
+ interface Message {
24
+ role: "user" | "assistant";
25
+ content: ContentBlock[];
26
+ }
27
+ interface ToolSpec {
28
+ name: string;
29
+ description: string;
30
+ inputSchema: JsonSchema;
31
+ }
32
+ interface Usage {
33
+ inputTokens: number;
34
+ outputTokens: number;
35
+ }
36
+ type StopReason = "end_turn" | "tool_use" | "max_tokens" | "refusal" | "other";
37
+ interface ModelRequest {
38
+ system?: string;
39
+ messages: Message[];
40
+ tools: ToolSpec[];
41
+ maxOutputTokens: number;
42
+ signal?: AbortSignal;
43
+ }
44
+ type ModelEvent = {
45
+ type: "text_delta";
46
+ text: string;
47
+ } | {
48
+ type: "message";
49
+ content: ContentBlock[];
50
+ stopReason: StopReason;
51
+ usage: Usage;
52
+ };
53
+ /** Prices in US dollars per million tokens. */
54
+ interface Pricing {
55
+ inputPerMTok: number;
56
+ outputPerMTok: number;
57
+ }
58
+ /**
59
+ * The model port. An adapter streams text deltas, then yields one final
60
+ * `message` event with the whole assistant turn, the stop reason, and usage.
61
+ */
62
+ interface ModelProvider {
63
+ readonly name: string;
64
+ readonly model: string;
65
+ readonly pricing?: Pricing;
66
+ stream(request: ModelRequest): AsyncIterable<ModelEvent>;
67
+ }
68
+ declare class ProviderError extends Error {
69
+ constructor(message: string);
70
+ }
71
+
72
+ export { type ContentBlock as C, type JsonSchema as J, type ModelProvider as M, type Pricing as P, type StopReason as S, type ToolSpec as T, type Usage as U, type ModelRequest as a, type ModelEvent as b, type Message as c, ProviderError as d };
@@ -0,0 +1,8 @@
1
+ interface WorkerEnv {
2
+ PACK_NAME?: string;
3
+ }
4
+ declare const _default: {
5
+ fetch(request: Request, env: WorkerEnv): Promise<Response>;
6
+ };
7
+
8
+ export { type WorkerEnv, _default as default };
package/dist/worker.js ADDED
@@ -0,0 +1,17 @@
1
+ import {
2
+ VERSION
3
+ } from "./chunk-4QE7E5UQ.js";
4
+
5
+ // src/worker.ts
6
+ var worker_default = {
7
+ async fetch(request, env) {
8
+ const url = new URL(request.url);
9
+ if (request.method === "GET" && url.pathname === "/health") {
10
+ return Response.json({ ok: true, pack: env.PACK_NAME ?? "agentic-assistant", version: VERSION });
11
+ }
12
+ return Response.json({ error: "not found" }, { status: 404 });
13
+ }
14
+ };
15
+ export {
16
+ worker_default as default
17
+ };
package/llms.txt ADDED
@@ -0,0 +1,14 @@
1
+ # agentic-assistant
2
+
3
+ An AI assistant that acts inside your apps with the user's own permissions.
4
+
5
+ Keywords: assistant,ai,agent,tools,mcp,sdk,side-panel,approvals,eu,model-port.
6
+
7
+ - SDK: import { runAssistant, ToolRegistry, createPrincipal } from "agentic-assistant".
8
+ - Panel: import { AssistantPanel } from "agentic-assistant/react"; import "agentic-assistant/react.css".
9
+ - Test provider: import { ScriptedProvider } from "agentic-assistant/testing".
10
+
11
+ ## Docs
12
+
13
+ - README: https://github.com/pooriaarab/agentic-assistant
14
+ - License: MIT
package/package.json CHANGED
@@ -1,6 +1,90 @@
1
1
  {
2
2
  "name": "agentic-assistant",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "An AI assistant that acts inside your apps with the user's own permissions.",
5
+ "keywords": [
6
+ "assistant",
7
+ "ai",
8
+ "agent",
9
+ "tools",
10
+ "mcp",
11
+ "sdk",
12
+ "side-panel",
13
+ "approvals",
14
+ "eu",
15
+ "model-port"
16
+ ],
17
+ "license": "MIT",
18
+ "author": "Pooria Arab",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/pooriaarab/agentic-assistant.git"
22
+ },
23
+ "type": "module",
24
+ "private": false,
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "llms.txt",
31
+ "SKILL.md"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "main": "./dist/index.js",
37
+ "types": "./dist/index.d.ts",
38
+ "exports": {
39
+ ".": {
40
+ "types": "./dist/index.d.ts",
41
+ "import": "./dist/index.js"
42
+ },
43
+ "./testing": {
44
+ "types": "./dist/testing.d.ts",
45
+ "import": "./dist/testing.js"
46
+ },
47
+ "./react": {
48
+ "types": "./dist/react.d.ts",
49
+ "import": "./dist/react.js"
50
+ },
51
+ "./react.css": "./dist/react.css"
52
+ },
53
+ "bin": {
54
+ "agentic-assistant": "./dist/cli.js"
55
+ },
56
+ "scripts": {
57
+ "build": "tsup",
58
+ "typecheck": "tsc --noEmit",
59
+ "test": "vitest run",
60
+ "clean": "rm -rf dist",
61
+ "ci:local": "npm run build && npm run typecheck && npm test"
62
+ },
63
+ "dependencies": {
64
+ "@anthropic-ai/sdk": "^1.3.0",
65
+ "@modelcontextprotocol/sdk": "^1.32.2",
66
+ "ajv": "^8.20.0"
67
+ },
68
+ "devDependencies": {
69
+ "@testing-library/dom": "^10.4.2",
70
+ "@testing-library/react": "^16.3.3",
71
+ "@testing-library/user-event": "^14.6.8",
72
+ "@types/node": "^22.0.0",
73
+ "@types/react": "^19.3.0",
74
+ "@types/react-dom": "^19.3.0",
75
+ "jsdom": "^30.1.3",
76
+ "react": "^19.3.1",
77
+ "react-dom": "^19.3.1",
78
+ "tsup": "^8.0.0",
79
+ "typescript": "^5.6.0",
80
+ "vitest": "^3.0.0"
81
+ },
82
+ "peerDependencies": {
83
+ "react": ">=18"
84
+ },
85
+ "peerDependenciesMeta": {
86
+ "react": {
87
+ "optional": true
88
+ }
89
+ }
90
+ }