agentic-pi 0.2.4 → 0.2.6

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,73 @@
1
+ /**
2
+ * Centralized OpenTelemetry attribute keys, span names, and metric names.
3
+ *
4
+ * Single source of truth so the still-evolving GenAI semantic conventions
5
+ * (`gen_ai.*`) are pinned in exactly one place. We hand-define the `gen_ai.*`
6
+ * keys as literals rather than importing them from
7
+ * `@opentelemetry/semantic-conventions/incubating`, because that incubating
8
+ * export path is unstable across minor releases — depending on the runtime
9
+ * values, not the package's export surface, keeps us insulated from churn.
10
+ */
11
+ /** Stable GenAI semantic-convention attribute keys. */
12
+ export const GenAI = {
13
+ SYSTEM: "gen_ai.system",
14
+ OPERATION_NAME: "gen_ai.operation.name",
15
+ CONVERSATION_ID: "gen_ai.conversation.id",
16
+ REQUEST_MODEL: "gen_ai.request.model",
17
+ RESPONSE_MODEL: "gen_ai.response.model",
18
+ RESPONSE_ID: "gen_ai.response.id",
19
+ RESPONSE_FINISH_REASONS: "gen_ai.response.finish_reasons",
20
+ USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
21
+ USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
22
+ TOOL_NAME: "gen_ai.tool.name",
23
+ TOOL_CALL_ID: "gen_ai.tool.call.id",
24
+ /** Metric-only dimension: which token bucket a measurement belongs to. */
25
+ TOKEN_TYPE: "gen_ai.token.type",
26
+ /** Content-gated span attributes (only set when includeContent is on). */
27
+ PROMPT: "gen_ai.prompt",
28
+ COMPLETION: "gen_ai.completion",
29
+ };
30
+ /**
31
+ * agentic-pi-specific attribute keys, namespaced under `agentic_pi.*` to
32
+ * avoid colliding with any future standard key. Used where no stable GenAI
33
+ * equivalent exists yet (cache tokens, cost, tool error/args/result).
34
+ */
35
+ export const AgenticPi = {
36
+ CACHE_READ_TOKENS: "agentic_pi.usage.cache_read_tokens",
37
+ CACHE_WRITE_TOKENS: "agentic_pi.usage.cache_write_tokens",
38
+ COST_USD: "agentic_pi.usage.cost_usd",
39
+ TOTAL_TOKENS: "agentic_pi.usage.total_tokens",
40
+ TOOL_IS_ERROR: "agentic_pi.tool.is_error",
41
+ TURN_INDEX: "agentic_pi.turn.index",
42
+ SANDBOX_BACKEND: "agentic_pi.sandbox.backend",
43
+ /** Content-gated tool span attributes. */
44
+ TOOL_ARGUMENTS: "agentic_pi.tool.arguments",
45
+ TOOL_RESULT: "agentic_pi.tool.result",
46
+ };
47
+ /** Metric dimension value for {@link GenAI.TOKEN_TYPE}. */
48
+ export const TokenType = {
49
+ INPUT: "input",
50
+ OUTPUT: "output",
51
+ CACHE_READ: "cache_read",
52
+ CACHE_WRITE: "cache_write",
53
+ };
54
+ /** Span names. Tool/LLM names embed the tool/model per GenAI span-naming guidance. */
55
+ export const SpanName = {
56
+ SESSION: "agentic_pi.session",
57
+ TURN: "agentic_pi.turn",
58
+ tool: (toolName) => `execute_tool ${toolName}`,
59
+ llm: (model) => `chat ${model}`,
60
+ };
61
+ /** Metric instrument names. */
62
+ export const MetricName = {
63
+ LLM_TOKENS: "gen_ai.client.token.usage",
64
+ LLM_DURATION: "gen_ai.client.operation.duration",
65
+ COST: "agentic_pi.cost.usd",
66
+ TOOL_DURATION: "agentic_pi.tool.duration",
67
+ TOOL_INVOCATIONS: "agentic_pi.tool.invocations",
68
+ TOOL_FAILURES: "agentic_pi.tool.failures",
69
+ TURNS: "agentic_pi.turns",
70
+ };
71
+ /** Default OTEL resource service name when neither flag nor env overrides it. */
72
+ export const DEFAULT_SERVICE_NAME = "agentic-pi";
73
+ //# sourceMappingURL=semconv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/telemetry/semconv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,MAAM,EAAE,eAAe;IACvB,cAAc,EAAE,uBAAuB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EAAE,qBAAqB;IAC3B,aAAa,EAAE,0BAA0B;IACzC,gBAAgB,EAAE,6BAA6B;IAC/C,aAAa,EAAE,0BAA0B;IACzC,KAAK,EAAE,kBAAkB;CACjB,CAAC;AAEX,iFAAiF;AACjF,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-pi",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "A drop-in coding-agent harness built on earendil-works/pi, designed to replace opencode in workflow-driven systems like lastlight.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -49,6 +49,15 @@
49
49
  "@ff-labs/pi-fff": "^0.9.4",
50
50
  "@octokit/auth-app": "^7.1.4",
51
51
  "@octokit/rest": "^21.0.2",
52
+ "@opentelemetry/api": "^1.9.0",
53
+ "@opentelemetry/core": "^2.8.0",
54
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.219.0",
55
+ "@opentelemetry/exporter-trace-otlp-http": "^0.219.0",
56
+ "@opentelemetry/resources": "^2.8.0",
57
+ "@opentelemetry/sdk-metrics": "^2.8.0",
58
+ "@opentelemetry/sdk-trace-base": "^2.8.0",
59
+ "@opentelemetry/sdk-trace-node": "^2.8.0",
60
+ "@opentelemetry/semantic-conventions": "^1.41.0",
52
61
  "@sinclair/typebox": "^0.34.0",
53
62
  "@types/jsonwebtoken": "^9.0.10",
54
63
  "jsonwebtoken": "^9.0.3"