@poncho-ai/harness 0.61.1 → 0.61.2
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +18 -0
- package/dist/index.js +26 -2
- package/package.json +1 -1
- package/src/harness.ts +15 -0
- package/src/orchestrator/orchestrator.ts +19 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/harness@0.61.
|
|
2
|
+
> @poncho-ai/harness@0.61.2 build /home/runner/work/poncho-ai/poncho-ai/packages/harness
|
|
3
3
|
> node scripts/embed-docs.js && tsup src/index.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
[embed-docs] Generated poncho-docs.ts with 4 topics
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
[34mCLI[39m tsup v8.5.1
|
|
9
9
|
[34mCLI[39m Target: es2022
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
11
|
+
[32mESM[39m [1mdist/index.js [22m[32m581.91 KB[39m
|
|
12
12
|
[32mESM[39m [1mdist/isolate-F2PPSUL6.js [22m[32m53.82 KB[39m
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 239ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
|
-
[32mDTS[39m ⚡️ Build success in
|
|
15
|
+
[32mDTS[39m ⚡️ Build success in 7703ms
|
|
16
16
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m110.56 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @poncho-ai/harness
|
|
2
2
|
|
|
3
|
+
## 0.61.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c881cd2`](https://github.com/cesr/poncho-ai/commit/c881cd2cafd4cb70f9614601dd233aafac334b8c) Thanks [@cesr](https://github.com/cesr)! - Telemetry: make context compaction observable and tag subagent runs.
|
|
8
|
+
- When auto-compaction fires mid-run, stamp the active `invoke_agent` span with
|
|
9
|
+
`poncho.compaction.occurred` / `tokens_before` / `tokens_after` /
|
|
10
|
+
`context_window` / `trigger`. Compaction rewrites the message prefix — which
|
|
11
|
+
wipes the per-model prompt cache and forces the next turn to re-create a large
|
|
12
|
+
cached span cold — so "which turns compacted, and what did that cost" was
|
|
13
|
+
previously invisible at the span level. No-op when telemetry is suppressed
|
|
14
|
+
(no active span).
|
|
15
|
+
- Subagent runs spawned by the orchestrator now carry
|
|
16
|
+
`telemetryAttributes` (`poncho.run.kind: "subagent"`, `latitude.tags`,
|
|
17
|
+
and a `latitude.metadata` link to the parent conversation) so subagent spend
|
|
18
|
+
segments out of the parent chat/job on the trace instead of being
|
|
19
|
+
indistinguishable from it.
|
|
20
|
+
|
|
3
21
|
## 0.61.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -11461,6 +11461,13 @@ ${textContent}` };
|
|
|
11461
11461
|
const tokensAfterCompaction = estimateTotalTokens(systemPrompt, messages, toolDefsJsonForEstimate);
|
|
11462
11462
|
latestContextTokens = tokensAfterCompaction;
|
|
11463
11463
|
toolOutputEstimateSinceModel = 0;
|
|
11464
|
+
trace.getActiveSpan()?.setAttributes({
|
|
11465
|
+
"poncho.compaction.occurred": true,
|
|
11466
|
+
"poncho.compaction.tokens_before": effectiveTokens,
|
|
11467
|
+
"poncho.compaction.tokens_after": tokensAfterCompaction,
|
|
11468
|
+
"poncho.compaction.context_window": contextWindow,
|
|
11469
|
+
"poncho.compaction.trigger": compactionConfig.trigger
|
|
11470
|
+
});
|
|
11464
11471
|
yield pushEvent({
|
|
11465
11472
|
type: "compaction:completed",
|
|
11466
11473
|
tokensBefore: effectiveTokens,
|
|
@@ -13707,7 +13714,17 @@ var AgentOrchestrator = class {
|
|
|
13707
13714
|
messages: harnessMessages,
|
|
13708
13715
|
abortSignal: childAbortController.signal,
|
|
13709
13716
|
// Inherit the parent run's telemetry choice (e.g. incognito).
|
|
13710
|
-
suppressTelemetry: conversation.subagentMeta?.suppressTelemetry
|
|
13717
|
+
suppressTelemetry: conversation.subagentMeta?.suppressTelemetry,
|
|
13718
|
+
// Distinguish subagent turns from the parent chat/job on the trace:
|
|
13719
|
+
// `poncho.run.kind` is the queryable attribute PonchOS already sets on
|
|
13720
|
+
// foreground/job runs, and `latitude.tags` (JSON-array string) is what
|
|
13721
|
+
// Latitude reads into its filterable tags field, so subagent spend can
|
|
13722
|
+
// be segmented out. `latitude.metadata` links back to the parent.
|
|
13723
|
+
telemetryAttributes: {
|
|
13724
|
+
"poncho.run.kind": "subagent",
|
|
13725
|
+
"latitude.tags": '["subagent"]',
|
|
13726
|
+
...conversation.parentConversationId ? { "latitude.metadata": JSON.stringify({ parentConversationId: conversation.parentConversationId }) } : {}
|
|
13727
|
+
}
|
|
13711
13728
|
})) {
|
|
13712
13729
|
if (event.type === "run:started") {
|
|
13713
13730
|
latestRunId = event.runId;
|
|
@@ -14200,7 +14217,14 @@ ${resultBody}`,
|
|
|
14200
14217
|
messages: continuationMessages,
|
|
14201
14218
|
abortSignal: childAbortController.signal,
|
|
14202
14219
|
// Inherit the parent run's telemetry choice (e.g. incognito).
|
|
14203
|
-
suppressTelemetry: conversation.subagentMeta?.suppressTelemetry
|
|
14220
|
+
suppressTelemetry: conversation.subagentMeta?.suppressTelemetry,
|
|
14221
|
+
// Tag the subagent continuation the same way as the initial run (see
|
|
14222
|
+
// the fan-out call above) so its spend segments out of the parent's.
|
|
14223
|
+
telemetryAttributes: {
|
|
14224
|
+
"poncho.run.kind": "subagent",
|
|
14225
|
+
"latitude.tags": '["subagent"]',
|
|
14226
|
+
"latitude.metadata": JSON.stringify({ parentConversationId })
|
|
14227
|
+
}
|
|
14204
14228
|
})) {
|
|
14205
14229
|
if (event.type === "run:started") {
|
|
14206
14230
|
const active = this.activeConversationRuns.get(conversationId);
|
package/package.json
CHANGED
package/src/harness.ts
CHANGED
|
@@ -3115,6 +3115,21 @@ Code is wrapped in an async IIFE — use \`return\` to return a value to the too
|
|
|
3115
3115
|
const tokensAfterCompaction = estimateTotalTokens(systemPrompt, messages, toolDefsJsonForEstimate);
|
|
3116
3116
|
latestContextTokens = tokensAfterCompaction;
|
|
3117
3117
|
toolOutputEstimateSinceModel = 0;
|
|
3118
|
+
// Stamp the compaction onto the active OTel span (the invoke_agent
|
|
3119
|
+
// root, active here because run() executes inside its context) so
|
|
3120
|
+
// observability backends can find compacted turns and measure the
|
|
3121
|
+
// cost they cause — a compaction rewrites the message prefix, which
|
|
3122
|
+
// wipes the per-model prompt cache and forces the next turn to
|
|
3123
|
+
// re-create a large cached span cold. Without this, "which turns
|
|
3124
|
+
// compacted, and what did it cost" is invisible at the span level.
|
|
3125
|
+
// No-op when telemetry is off (no active span).
|
|
3126
|
+
trace.getActiveSpan()?.setAttributes({
|
|
3127
|
+
"poncho.compaction.occurred": true,
|
|
3128
|
+
"poncho.compaction.tokens_before": effectiveTokens,
|
|
3129
|
+
"poncho.compaction.tokens_after": tokensAfterCompaction,
|
|
3130
|
+
"poncho.compaction.context_window": contextWindow,
|
|
3131
|
+
"poncho.compaction.trigger": compactionConfig.trigger,
|
|
3132
|
+
});
|
|
3118
3133
|
yield pushEvent({
|
|
3119
3134
|
type: "compaction:completed",
|
|
3120
3135
|
tokensBefore: effectiveTokens,
|
|
@@ -862,6 +862,18 @@ export class AgentOrchestrator {
|
|
|
862
862
|
abortSignal: childAbortController.signal,
|
|
863
863
|
// Inherit the parent run's telemetry choice (e.g. incognito).
|
|
864
864
|
suppressTelemetry: conversation.subagentMeta?.suppressTelemetry,
|
|
865
|
+
// Distinguish subagent turns from the parent chat/job on the trace:
|
|
866
|
+
// `poncho.run.kind` is the queryable attribute PonchOS already sets on
|
|
867
|
+
// foreground/job runs, and `latitude.tags` (JSON-array string) is what
|
|
868
|
+
// Latitude reads into its filterable tags field, so subagent spend can
|
|
869
|
+
// be segmented out. `latitude.metadata` links back to the parent.
|
|
870
|
+
telemetryAttributes: {
|
|
871
|
+
"poncho.run.kind": "subagent",
|
|
872
|
+
"latitude.tags": "[\"subagent\"]",
|
|
873
|
+
...(conversation.parentConversationId
|
|
874
|
+
? { "latitude.metadata": JSON.stringify({ parentConversationId: conversation.parentConversationId }) }
|
|
875
|
+
: {}),
|
|
876
|
+
},
|
|
865
877
|
})) {
|
|
866
878
|
if (event.type === "run:started") {
|
|
867
879
|
latestRunId = event.runId;
|
|
@@ -1452,6 +1464,13 @@ export class AgentOrchestrator {
|
|
|
1452
1464
|
abortSignal: childAbortController.signal,
|
|
1453
1465
|
// Inherit the parent run's telemetry choice (e.g. incognito).
|
|
1454
1466
|
suppressTelemetry: conversation.subagentMeta?.suppressTelemetry,
|
|
1467
|
+
// Tag the subagent continuation the same way as the initial run (see
|
|
1468
|
+
// the fan-out call above) so its spend segments out of the parent's.
|
|
1469
|
+
telemetryAttributes: {
|
|
1470
|
+
"poncho.run.kind": "subagent",
|
|
1471
|
+
"latitude.tags": "[\"subagent\"]",
|
|
1472
|
+
"latitude.metadata": JSON.stringify({ parentConversationId }),
|
|
1473
|
+
},
|
|
1455
1474
|
})) {
|
|
1456
1475
|
if (event.type === "run:started") {
|
|
1457
1476
|
const active = this.activeConversationRuns.get(conversationId);
|