@providerprotocol/agents 0.0.1 → 0.0.3

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.
Files changed (74) hide show
  1. package/README.md +333 -6
  2. package/dist/checkpoint/index.d.ts +43 -0
  3. package/dist/checkpoint/index.js +64 -0
  4. package/dist/checkpoint/index.js.map +1 -0
  5. package/{src/execution/loop.ts → dist/chunk-4ESYN66B.js} +54 -162
  6. package/dist/chunk-4ESYN66B.js.map +1 -0
  7. package/dist/chunk-EKRXMSDX.js +8 -0
  8. package/dist/chunk-EKRXMSDX.js.map +1 -0
  9. package/dist/chunk-PHI5ULBV.js +427 -0
  10. package/dist/chunk-PHI5ULBV.js.map +1 -0
  11. package/dist/execution/index.d.ts +105 -0
  12. package/dist/execution/index.js +679 -0
  13. package/dist/execution/index.js.map +1 -0
  14. package/dist/index-qsPwbY86.d.ts +65 -0
  15. package/dist/index.d.ts +101 -0
  16. package/dist/index.js +218 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/middleware/index.d.ts +23 -0
  19. package/dist/middleware/index.js +82 -0
  20. package/dist/middleware/index.js.map +1 -0
  21. package/dist/thread-tree/index.d.ts +115 -0
  22. package/dist/thread-tree/index.js +4 -0
  23. package/dist/thread-tree/index.js.map +1 -0
  24. package/dist/types-2Vsthzyu.d.ts +163 -0
  25. package/dist/types-BhX9uD_d.d.ts +91 -0
  26. package/dist/types-DR02gtFv.d.ts +270 -0
  27. package/dist/types-NGQMdnaD.d.ts +65 -0
  28. package/package.json +40 -8
  29. package/.claude/settings.local.json +0 -27
  30. package/AGENTS.md +0 -681
  31. package/CLAUDE.md +0 -681
  32. package/bun.lock +0 -472
  33. package/eslint.config.js +0 -75
  34. package/index.ts +0 -1
  35. package/llms.md +0 -796
  36. package/specs/UAP-1.0.md +0 -2355
  37. package/src/agent/index.ts +0 -384
  38. package/src/agent/types.ts +0 -91
  39. package/src/checkpoint/file.ts +0 -126
  40. package/src/checkpoint/index.ts +0 -40
  41. package/src/checkpoint/types.ts +0 -95
  42. package/src/execution/index.ts +0 -37
  43. package/src/execution/plan.ts +0 -497
  44. package/src/execution/react.ts +0 -340
  45. package/src/execution/tool-ordering.ts +0 -186
  46. package/src/execution/types.ts +0 -315
  47. package/src/index.ts +0 -80
  48. package/src/middleware/index.ts +0 -7
  49. package/src/middleware/logging.ts +0 -123
  50. package/src/middleware/types.ts +0 -69
  51. package/src/state/index.ts +0 -301
  52. package/src/state/types.ts +0 -173
  53. package/src/thread-tree/index.ts +0 -249
  54. package/src/thread-tree/types.ts +0 -29
  55. package/src/utils/uuid.ts +0 -7
  56. package/tests/live/agent-anthropic.test.ts +0 -288
  57. package/tests/live/agent-strategy-hooks.test.ts +0 -268
  58. package/tests/live/checkpoint.test.ts +0 -243
  59. package/tests/live/execution-strategies.test.ts +0 -255
  60. package/tests/live/plan-strategy.test.ts +0 -160
  61. package/tests/live/subagent-events.live.test.ts +0 -249
  62. package/tests/live/thread-tree.test.ts +0 -186
  63. package/tests/unit/agent.test.ts +0 -703
  64. package/tests/unit/checkpoint.test.ts +0 -232
  65. package/tests/unit/execution/equivalence.test.ts +0 -402
  66. package/tests/unit/execution/loop.test.ts +0 -437
  67. package/tests/unit/execution/plan.test.ts +0 -590
  68. package/tests/unit/execution/react.test.ts +0 -604
  69. package/tests/unit/execution/subagent-events.test.ts +0 -235
  70. package/tests/unit/execution/tool-ordering.test.ts +0 -310
  71. package/tests/unit/middleware/logging.test.ts +0 -276
  72. package/tests/unit/state.test.ts +0 -573
  73. package/tests/unit/thread-tree.test.ts +0 -249
  74. package/tsconfig.json +0 -29
@@ -0,0 +1,65 @@
1
+ import { Message } from '@providerprotocol/ai';
2
+ import { A as AgentState } from './index-qsPwbY86.js';
3
+ import { G as GenerateResult } from './types-DR02gtFv.js';
4
+
5
+ /**
6
+ * Forward declaration of Agent for use in MiddlewareContext.
7
+ */
8
+ interface AgentRef {
9
+ id: string;
10
+ system?: string;
11
+ }
12
+ /**
13
+ * Context passed to middleware functions.
14
+ */
15
+ interface MiddlewareContext {
16
+ /** The agent being executed */
17
+ agent: AgentRef;
18
+ /** User input message */
19
+ input: Message;
20
+ /** Current state */
21
+ state: AgentState;
22
+ /** Request metadata (mutable within middleware) */
23
+ metadata: Map<string, unknown>;
24
+ }
25
+ /**
26
+ * Middleware interface for cross-cutting concerns.
27
+ *
28
+ * Middleware executes in order for `before`, reverse order for `after`:
29
+ * - before: first -> second -> third
30
+ * - after: third -> second -> first
31
+ */
32
+ interface Middleware {
33
+ /** Middleware name */
34
+ name: string;
35
+ /**
36
+ * Called before agent execution.
37
+ * Can modify context or short-circuit by returning a modified context.
38
+ */
39
+ before?(context: MiddlewareContext): Promise<MiddlewareContext | void>;
40
+ /**
41
+ * Called after agent execution.
42
+ * Can modify the result before returning.
43
+ */
44
+ after?(context: MiddlewareContext, result: GenerateResult): Promise<GenerateResult>;
45
+ /**
46
+ * Called when an error occurs during execution.
47
+ * Can return a result to recover, or void to let the error propagate.
48
+ */
49
+ onError?(context: MiddlewareContext, error: Error): Promise<GenerateResult | void>;
50
+ }
51
+ /**
52
+ * Options for the logging middleware.
53
+ */
54
+ interface LoggingOptions {
55
+ /** Log level. Default: 'info' */
56
+ level?: 'debug' | 'info' | 'warn' | 'error';
57
+ /** Custom logger function. Default: console.log */
58
+ logger?: (message: string) => void;
59
+ /** Include full message content. Default: false */
60
+ includeMessages?: boolean;
61
+ /** Include execution timing. Default: true */
62
+ includeTiming?: boolean;
63
+ }
64
+
65
+ export type { LoggingOptions as L, Middleware as M, MiddlewareContext as a };
package/package.json CHANGED
@@ -1,21 +1,52 @@
1
1
  {
2
2
  "name": "@providerprotocol/agents",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Unified Agent Protocol (UAP) 1.0 implementation for @providerprotocol/ai",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "Provider Protocol"
8
8
  },
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/providerprotocol/agents"
13
+ },
9
14
  "publishConfig": {
10
15
  "access": "public"
11
16
  },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "main": "./dist/index.js",
23
+ "module": "./dist/index.js",
24
+ "types": "./dist/index.d.ts",
12
25
  "exports": {
13
- ".": "./src/index.ts",
14
- "./execution": "./src/execution/index.ts",
15
- "./middleware": "./src/middleware/index.ts",
16
- "./thread-tree": "./src/thread-tree/index.ts"
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ },
30
+ "./execution": {
31
+ "types": "./dist/execution/index.d.ts",
32
+ "import": "./dist/execution/index.js"
33
+ },
34
+ "./middleware": {
35
+ "types": "./dist/middleware/index.d.ts",
36
+ "import": "./dist/middleware/index.js"
37
+ },
38
+ "./thread-tree": {
39
+ "types": "./dist/thread-tree/index.d.ts",
40
+ "import": "./dist/thread-tree/index.js"
41
+ },
42
+ "./checkpoint": {
43
+ "types": "./dist/checkpoint/index.d.ts",
44
+ "import": "./dist/checkpoint/index.js"
45
+ }
17
46
  },
18
47
  "scripts": {
48
+ "build": "tsup",
49
+ "prepublishOnly": "bun run build",
19
50
  "test": "bun test",
20
51
  "test:unit": "bun test tests/unit",
21
52
  "test:live": "bun test tests/live",
@@ -23,8 +54,7 @@
23
54
  "typecheck": "tsc --noEmit"
24
55
  },
25
56
  "peerDependencies": {
26
- "@providerprotocol/ai": ">=0.0.11",
27
- "typescript": "^5.9.3"
57
+ "@providerprotocol/ai": ">=0.0.11"
28
58
  },
29
59
  "devDependencies": {
30
60
  "@providerprotocol/ai": "^0.0.11",
@@ -32,6 +62,8 @@
32
62
  "@typescript-eslint/eslint-plugin": "^8.52.0",
33
63
  "@typescript-eslint/parser": "^8.52.0",
34
64
  "eslint": "^9.39.2",
35
- "eslint-plugin-import": "^2.32.0"
65
+ "eslint-plugin-import": "^2.32.0",
66
+ "tsup": "^8.5.1",
67
+ "typescript": "^5.7.3"
36
68
  }
37
69
  }
@@ -1,27 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(tree:*)",
5
- "Bash(bun test:*)",
6
- "Bash(bun run typecheck:*)",
7
- "Bash(bun run lint)",
8
- "Bash(ls:*)",
9
- "Bash(cat:*)",
10
- "Bash(find:*)",
11
- "Bash(bun test:live:*)",
12
- "WebSearch",
13
- "WebFetch(domain:arxiv.org)",
14
- "WebFetch(domain:www.microsoft.com)",
15
- "WebFetch(domain:docs.anthropic.com)",
16
- "WebFetch(domain:blog.jetbrains.com)",
17
- "Bash(grep:*)",
18
- "Bash(bun install:*)",
19
- "Bash(bun update:*)",
20
- "Bash(timeout 2 bun:*)",
21
- "WebFetch(domain:www.npmjs.com)",
22
- "WebFetch(domain:github.com)",
23
- "WebFetch(domain:raw.githubusercontent.com)",
24
- "Bash(bun add:*)"
25
- ]
26
- }
27
- }