promptlayer 1.1.0 → 1.2.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.
Files changed (64) hide show
  1. package/README.md +22 -0
  2. package/dist/claude-agents.d.mts +20 -0
  3. package/dist/claude-agents.d.ts +20 -0
  4. package/dist/claude-agents.js +2 -0
  5. package/dist/claude-agents.js.map +1 -0
  6. package/dist/esm/{chunk-SWBNW72U.js → chunk-DFBRFJOL.js} +2 -2
  7. package/dist/esm/{chunk-SWBNW72U.js.map → chunk-DFBRFJOL.js.map} +1 -1
  8. package/dist/esm/claude-agents.js +2 -0
  9. package/dist/esm/claude-agents.js.map +1 -0
  10. package/dist/esm/index.js +1 -1
  11. package/dist/esm/openai-agents.js +2 -2
  12. package/dist/esm/openai-agents.js.map +1 -1
  13. package/dist/index.js +2 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/openai-agents.js +2 -2
  16. package/dist/openai-agents.js.map +1 -1
  17. package/package.json +18 -1
  18. package/vendor/claude-agents/trace/.claude-plugin/plugin.json +8 -0
  19. package/vendor/claude-agents/trace/hooks/hook_utils.py +38 -0
  20. package/vendor/claude-agents/trace/hooks/hooks.json +60 -0
  21. package/vendor/claude-agents/trace/hooks/lib.sh +577 -0
  22. package/vendor/claude-agents/trace/hooks/parse_stop_transcript.py +375 -0
  23. package/vendor/claude-agents/trace/hooks/post_tool_use.sh +41 -0
  24. package/vendor/claude-agents/trace/hooks/session_end.sh +37 -0
  25. package/vendor/claude-agents/trace/hooks/session_start.sh +57 -0
  26. package/vendor/claude-agents/trace/hooks/stop_hook.sh +123 -0
  27. package/vendor/claude-agents/trace/hooks/user_prompt_submit.sh +25 -0
  28. package/vendor/claude-agents/vendor_metadata.json +5 -0
  29. package/.github/CODEOWNERS +0 -1
  30. package/.github/workflows/node.js.yml +0 -30
  31. package/.github/workflows/npm-publish.yml +0 -35
  32. package/src/groups.ts +0 -16
  33. package/src/index.ts +0 -383
  34. package/src/integrations/openai-agents/helpers.test.ts +0 -254
  35. package/src/integrations/openai-agents/ids.ts +0 -27
  36. package/src/integrations/openai-agents/index.ts +0 -8
  37. package/src/integrations/openai-agents/instrumentation.test.ts +0 -46
  38. package/src/integrations/openai-agents/instrumentation.ts +0 -47
  39. package/src/integrations/openai-agents/mapping.ts +0 -714
  40. package/src/integrations/openai-agents/otlp-json.ts +0 -120
  41. package/src/integrations/openai-agents/processor.test.ts +0 -509
  42. package/src/integrations/openai-agents/processor.ts +0 -388
  43. package/src/integrations/openai-agents/time.ts +0 -56
  44. package/src/integrations/openai-agents/types.ts +0 -49
  45. package/src/integrations/openai-agents/url.ts +0 -9
  46. package/src/openai-agents.ts +0 -1
  47. package/src/promptlayer.ts +0 -125
  48. package/src/run-error-tracking.test.ts +0 -146
  49. package/src/span-exporter.ts +0 -120
  50. package/src/span-wrapper.ts +0 -51
  51. package/src/templates.ts +0 -37
  52. package/src/tracing.ts +0 -20
  53. package/src/track.ts +0 -84
  54. package/src/types.ts +0 -689
  55. package/src/utils/blueprint-builder.test.ts +0 -727
  56. package/src/utils/blueprint-builder.ts +0 -1453
  57. package/src/utils/errors.test.ts +0 -68
  58. package/src/utils/errors.ts +0 -62
  59. package/src/utils/streaming.test.ts +0 -498
  60. package/src/utils/streaming.ts +0 -1402
  61. package/src/utils/utils.ts +0 -1228
  62. package/tsconfig.json +0 -115
  63. package/tsup.config.ts +0 -20
  64. package/vitest.config.ts +0 -9
package/package.json CHANGED
@@ -1,16 +1,28 @@
1
1
  {
2
2
  "name": "promptlayer",
3
3
  "license": "MIT",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "vendor/claude-agents",
11
+ "vendor/claude-agents/trace/.claude-plugin",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
8
15
  "exports": {
9
16
  ".": {
10
17
  "types": "./dist/index.d.ts",
11
18
  "require": "./dist/index.js",
12
19
  "import": "./dist/esm/index.js"
13
20
  },
21
+ "./claude-agents": {
22
+ "types": "./dist/claude-agents.d.ts",
23
+ "require": "./dist/claude-agents.js",
24
+ "import": "./dist/esm/claude-agents.js"
25
+ },
14
26
  "./openai-agents": {
15
27
  "types": "./dist/openai-agents.d.ts",
16
28
  "require": "./dist/openai-agents.js",
@@ -26,6 +38,7 @@
26
38
  "build": "tsup-node",
27
39
  "lint": "tsc",
28
40
  "test": "vitest run",
41
+ "vendor:claude-agents": "node scripts/vendor-claude-agents-plugin.mjs",
29
42
  "release": "npm run build && npm publish"
30
43
  },
31
44
  "devDependencies": {
@@ -53,9 +66,13 @@
53
66
  "p-retry": "^6.2.0"
54
67
  },
55
68
  "peerDependencies": {
69
+ "@anthropic-ai/claude-agent-sdk": "^0.2.1",
56
70
  "@openai/agents": "^0.7.2"
57
71
  },
58
72
  "peerDependenciesMeta": {
73
+ "@anthropic-ai/claude-agent-sdk": {
74
+ "optional": true
75
+ },
59
76
  "@openai/agents": {
60
77
  "optional": true
61
78
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "trace",
3
+ "description": "Automatically trace Claude Code conversations to PromptLayer. Captures user messages, assistant responses, and tool calls as structured spans.",
4
+ "version": "1.0.0",
5
+ "author": {
6
+ "name": "PromptLayer"
7
+ }
8
+ }
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import base64
4
+ import binascii
5
+ import sys
6
+ import time
7
+
8
+
9
+ def hex_to_base64(hex_value: str) -> int:
10
+ raw = binascii.unhexlify(hex_value)
11
+ print(base64.b64encode(raw).decode("ascii"))
12
+ return 0
13
+
14
+
15
+ def now_ns() -> int:
16
+ print(time.time_ns())
17
+ return 0
18
+
19
+
20
+ def main() -> int:
21
+ if len(sys.argv) < 2:
22
+ raise SystemExit("usage: hook_utils.py <command> [args]")
23
+
24
+ command = sys.argv[1]
25
+ if command == "hex_to_base64":
26
+ if len(sys.argv) != 3:
27
+ raise SystemExit("usage: hook_utils.py hex_to_base64 <hex>")
28
+ return hex_to_base64(sys.argv[2])
29
+ if command == "now_ns":
30
+ if len(sys.argv) != 2:
31
+ raise SystemExit("usage: hook_utils.py now_ns")
32
+ return now_ns()
33
+
34
+ raise SystemExit(f"unknown command: {command}")
35
+
36
+
37
+ if __name__ == "__main__":
38
+ raise SystemExit(main())
@@ -0,0 +1,60 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/session_start.sh",
9
+ "async": false
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "UserPromptSubmit": [
15
+ {
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/user_prompt_submit.sh",
20
+ "async": false
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "PostToolUse": [
26
+ {
27
+ "matcher": "*",
28
+ "hooks": [
29
+ {
30
+ "type": "command",
31
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/post_tool_use.sh",
32
+ "async": false
33
+ }
34
+ ]
35
+ }
36
+ ],
37
+ "Stop": [
38
+ {
39
+ "hooks": [
40
+ {
41
+ "type": "command",
42
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/stop_hook.sh",
43
+ "async": false
44
+ }
45
+ ]
46
+ }
47
+ ],
48
+ "SessionEnd": [
49
+ {
50
+ "hooks": [
51
+ {
52
+ "type": "command",
53
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/session_end.sh",
54
+ "async": false
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ }