@osfactory/otel-hook 0.3.0 → 0.5.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.
- package/dist/{adapter-DXpNtnaf.d.ts → adapter-BS7xHKGQ.d.ts} +9 -3
- package/dist/cli.js +1043 -487
- package/dist/cli.js.map +1 -1
- package/dist/{events-VxBnDFaO.d.ts → events-CzZ5kukS.d.ts} +177 -1
- package/dist/{filesystem-store-J8jjDMTh.d.ts → filesystem-store-BcOveJYY.d.ts} +1 -1
- package/dist/{hook-_mlO3akA.d.ts → hook-DxTakjAD.d.ts} +12 -4
- package/dist/index.d.ts +12 -12
- package/dist/index.js +1171 -599
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +4 -4
- package/dist/install.js +103 -68
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +14 -8
- package/dist/integration.js +547 -121
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +27 -2
- package/dist/lifecycle.js.map +1 -1
- package/dist/{memory-DXVBc8V9.d.ts → memory-DkTohdIa.d.ts} +2 -2
- package/dist/model.d.ts +1 -1
- package/dist/model.js +84 -41
- package/dist/model.js.map +1 -1
- package/dist/{otlp-log-sink-DTSa0KRF.d.ts → otlp-log-sink-DaZDPKnR.d.ts} +3 -3
- package/dist/{payload-BWV5-4n3.d.ts → payload-2lnpKodw.d.ts} +1 -1
- package/dist/{ports-Q8x0ODhs.d.ts → ports-B0rC49b3.d.ts} +28 -2
- package/dist/providers.d.ts +26 -9
- package/dist/providers.js +668 -452
- package/dist/providers.js.map +1 -1
- package/dist/{registry-Dqr3VNmT.d.ts → registry-DVnPA_b6.d.ts} +1 -1
- package/dist/runtime.d.ts +103 -11
- package/dist/runtime.js +416 -67
- package/dist/runtime.js.map +1 -1
- package/dist/{semconv-CIU-2kGO.d.ts → semconv-CtnDdsPk.d.ts} +1 -1
- package/dist/state.d.ts +4 -4
- package/dist/state.js.map +1 -1
- package/dist/telemetry.d.ts +6 -6
- package/dist/telemetry.js +92 -10
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +13 -7
- package/dist/testing.js +821 -492
- package/dist/testing.js.map +1 -1
- package/package.json +4 -1
package/dist/install.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { d as AntigravityHookEventName, m as ClaudeHookEventName, n as CodexHookEventName, o as CursorHookEventName, s as GeminiHookEventName, q as GEMINI_PROVIDER_ID, b as ANTIGRAVITY_PROVIDER_ID, C as CLAUDE_CODE_PROVIDER_ID, h as CODEX_PROVIDER_ID, k as CURSOR_PROVIDER_ID } from './payload-
|
|
2
|
-
import { C as Clock } from './ports-
|
|
1
|
+
import { d as AntigravityHookEventName, m as ClaudeHookEventName, n as CodexHookEventName, o as CursorHookEventName, s as GeminiHookEventName, q as GEMINI_PROVIDER_ID, b as ANTIGRAVITY_PROVIDER_ID, C as CLAUDE_CODE_PROVIDER_ID, h as CODEX_PROVIDER_ID, k as CURSOR_PROVIDER_ID } from './payload-2lnpKodw.js';
|
|
2
|
+
import { C as Clock } from './ports-B0rC49b3.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import './primitives-CJ8-rn-f.js';
|
|
5
|
-
import './adapter-
|
|
5
|
+
import './adapter-BS7xHKGQ.js';
|
|
6
6
|
import './errors.js';
|
|
7
7
|
import './taxonomy-DwhTtuWd.js';
|
|
8
|
-
import './events-
|
|
8
|
+
import './events-CzZ5kukS.js';
|
|
9
9
|
import './identity-BrVBs901.js';
|
|
10
10
|
import './policy-CimmCfRp.js';
|
|
11
11
|
import './content-M9xIKG7h.js';
|
package/dist/install.js
CHANGED
|
@@ -1024,7 +1024,7 @@ var CURSOR_UNREGISTERED_HOOK_EVENTS = Object.freeze({
|
|
|
1024
1024
|
afterShellExecution: "the same shell call also fires postToolUse, which duplicates this tool end and \u2014 unlike this callback \u2014 carries both a tool_use_id and a success/failure signal",
|
|
1025
1025
|
beforeMCPExecution: "an MCP call also fires preToolUse/postToolUse, which additionally carry tool_use_id; registering this one duplicates the tool call",
|
|
1026
1026
|
afterMCPExecution: "the same MCP call also fires postToolUse, which duplicates this tool end and, unlike this callback, reports a success/failure signal",
|
|
1027
|
-
beforeReadFile: "
|
|
1027
|
+
beforeReadFile: "an agent read also fires preToolUse/postToolUse, so registering it by default would report one read twice; opt in with --event for its file_path target evidence",
|
|
1028
1028
|
subagentStart: "subagentStop carries no subagent id to pair with, so no closable delegation lifecycle can be produced",
|
|
1029
1029
|
subagentStop: "it carries no subagent id, so it cannot be paired with the subagentStart it ends",
|
|
1030
1030
|
beforeTabFileRead: "a Tab (inline-completion) hook, not an agent-session hook; not modelled by this adapter",
|
|
@@ -1635,10 +1635,10 @@ var identityClaimSchema = z9.strictObject({
|
|
|
1635
1635
|
});
|
|
1636
1636
|
|
|
1637
1637
|
// src/providers/adapter.ts
|
|
1638
|
-
import { z as
|
|
1638
|
+
import { z as z16 } from "zod";
|
|
1639
1639
|
|
|
1640
1640
|
// src/model/events.ts
|
|
1641
|
-
import { z as
|
|
1641
|
+
import { z as z15 } from "zod";
|
|
1642
1642
|
|
|
1643
1643
|
// src/model/content.ts
|
|
1644
1644
|
import { z as z10 } from "zod";
|
|
@@ -1719,16 +1719,41 @@ var extensionsSchema = z11.record(z11.string(), attributeValueSchema).check((ctx
|
|
|
1719
1719
|
var EMPTY_EXTENSIONS = Object.freeze({});
|
|
1720
1720
|
var emptyExtensions = () => ({});
|
|
1721
1721
|
|
|
1722
|
-
// src/model/
|
|
1722
|
+
// src/model/target.ts
|
|
1723
1723
|
import { z as z12 } from "zod";
|
|
1724
|
-
var
|
|
1725
|
-
var
|
|
1724
|
+
var targetSourceSchema = z12.enum(["tool-path", "shell-cwd", "session-cwd"]);
|
|
1725
|
+
var MAX_TARGET_HINT_PATHS = 8;
|
|
1726
|
+
var MAX_TARGET_PATH_LENGTH = 4096;
|
|
1727
|
+
var localPathSchema = z12.string().min(1).max(MAX_TARGET_PATH_LENGTH).refine((value) => !value.includes("\0"), "path must not contain NUL");
|
|
1728
|
+
var targetHintSchema = z12.strictObject({
|
|
1729
|
+
source: targetSourceSchema,
|
|
1730
|
+
paths: z12.array(localPathSchema).min(1).max(MAX_TARGET_HINT_PATHS).readonly(),
|
|
1731
|
+
/** Absolute directory that relative `paths` resolve against. */
|
|
1732
|
+
baseDirectory: localPathSchema.optional()
|
|
1733
|
+
}).readonly();
|
|
1734
|
+
var worktreeKindSchema = z12.enum(["main", "linked"]);
|
|
1735
|
+
var workspaceTargetSchema = z12.strictObject({
|
|
1736
|
+
workspaceId: workspaceIdSchema,
|
|
1737
|
+
/** Branch checked out in that worktree; absent on a detached HEAD. */
|
|
1738
|
+
vcsBranchName: nonEmptyStringSchema.optional(),
|
|
1739
|
+
source: targetSourceSchema,
|
|
1740
|
+
/** `git-root` handle of the repository's main worktree; absent when there is none to name. */
|
|
1741
|
+
repositoryId: workspaceIdSchema.optional(),
|
|
1742
|
+
worktreeKind: worktreeKindSchema.optional()
|
|
1743
|
+
}).readonly();
|
|
1744
|
+
var SUBAGENT_ID_PATTERN = /^[A-Za-z0-9_.:@+=-]{1,256}$/;
|
|
1745
|
+
var subagentIdSchema = z12.string().regex(SUBAGENT_ID_PATTERN);
|
|
1746
|
+
|
|
1747
|
+
// src/model/usage.ts
|
|
1748
|
+
import { z as z13 } from "zod";
|
|
1749
|
+
var usageTemporalitySchema = z13.enum(["delta", "cumulative"]);
|
|
1750
|
+
var cacheCreationAccountingSchema = z13.enum([
|
|
1726
1751
|
"included-in-input",
|
|
1727
1752
|
"disjoint-from-input",
|
|
1728
1753
|
"not-reported"
|
|
1729
1754
|
]);
|
|
1730
|
-
var providerTotalAgreementSchema =
|
|
1731
|
-
var usageReportSchema =
|
|
1755
|
+
var providerTotalAgreementSchema = z13.enum(["unreported", "agrees", "disagrees"]);
|
|
1756
|
+
var usageReportSchema = z13.strictObject({
|
|
1732
1757
|
temporality: usageTemporalitySchema,
|
|
1733
1758
|
/** Inclusive input tokens. */
|
|
1734
1759
|
inputTokens: tokenCountSchema.optional(),
|
|
@@ -1745,7 +1770,7 @@ var usageReportSchema = z12.strictObject({
|
|
|
1745
1770
|
/** Total exactly as the provider reported it, if it reported one. */
|
|
1746
1771
|
providerTotalTokens: tokenCountSchema.optional()
|
|
1747
1772
|
});
|
|
1748
|
-
var canonicalUsageSchema =
|
|
1773
|
+
var canonicalUsageSchema = z13.strictObject({
|
|
1749
1774
|
temporality: usageTemporalitySchema,
|
|
1750
1775
|
inputTokens: tokenCountSchema,
|
|
1751
1776
|
cachedInputTokens: tokenCountSchema,
|
|
@@ -1900,24 +1925,24 @@ var EMPTY_DELTA_USAGE = Object.freeze(
|
|
|
1900
1925
|
);
|
|
1901
1926
|
|
|
1902
1927
|
// src/model/version.ts
|
|
1903
|
-
import { z as
|
|
1928
|
+
import { z as z14 } from "zod";
|
|
1904
1929
|
var CANONICAL_SCHEMA_VERSION = 1;
|
|
1905
|
-
var canonicalSchemaVersionSchema =
|
|
1930
|
+
var canonicalSchemaVersionSchema = z14.literal(CANONICAL_SCHEMA_VERSION);
|
|
1906
1931
|
|
|
1907
1932
|
// src/model/events.ts
|
|
1908
|
-
var modelDescriptorSchema =
|
|
1933
|
+
var modelDescriptorSchema = z15.strictObject({
|
|
1909
1934
|
modelId: nonEmptyStringSchema,
|
|
1910
1935
|
/** Vendor of the model, e.g. `anthropic`. Distinct from the agent provider. */
|
|
1911
1936
|
vendor: nonEmptyStringSchema.optional(),
|
|
1912
1937
|
family: nonEmptyStringSchema.optional()
|
|
1913
1938
|
});
|
|
1914
|
-
var costFactsSchema =
|
|
1939
|
+
var costFactsSchema = z15.strictObject({
|
|
1915
1940
|
/** ISO 4217 code. */
|
|
1916
|
-
currency:
|
|
1917
|
-
amount:
|
|
1918
|
-
source:
|
|
1941
|
+
currency: z15.string().length(3),
|
|
1942
|
+
amount: z15.number().min(0).finite(),
|
|
1943
|
+
source: z15.enum(["provider-reported", "computed"])
|
|
1919
1944
|
});
|
|
1920
|
-
var canonicalEventTypeSchema =
|
|
1945
|
+
var canonicalEventTypeSchema = z15.enum([
|
|
1921
1946
|
"session.start",
|
|
1922
1947
|
"session.end",
|
|
1923
1948
|
"prompt.submitted",
|
|
@@ -1931,7 +1956,7 @@ var canonicalEventTypeSchema = z14.enum([
|
|
|
1931
1956
|
"error.raised"
|
|
1932
1957
|
]);
|
|
1933
1958
|
var CANONICAL_EVENT_TYPES = canonicalEventTypeSchema.options;
|
|
1934
|
-
var outcomeSchema =
|
|
1959
|
+
var outcomeSchema = z15.enum(["ok", "error", "cancelled", "timeout", "denied", "unknown"]);
|
|
1935
1960
|
var baseEventFields = {
|
|
1936
1961
|
schemaVersion: canonicalSchemaVersionSchema,
|
|
1937
1962
|
eventId: eventIdSchema,
|
|
@@ -1942,39 +1967,45 @@ var baseEventFields = {
|
|
|
1942
1967
|
occurredAt: epochMillisSchema,
|
|
1943
1968
|
provenance: sourceProvenanceSchema,
|
|
1944
1969
|
workspace: workspaceIdentitySchema,
|
|
1970
|
+
/**
|
|
1971
|
+
* The provider's own id for the subagent this event was emitted inside (e.g.
|
|
1972
|
+
* Claude Code's `agent_id`). Absent for the top-level agent. Set by the event
|
|
1973
|
+
* factory, never by hand.
|
|
1974
|
+
*/
|
|
1975
|
+
subagentId: subagentIdSchema.optional(),
|
|
1945
1976
|
extensions: extensionsSchema.default(emptyExtensions)
|
|
1946
1977
|
};
|
|
1947
|
-
var event2 = (shape) =>
|
|
1978
|
+
var event2 = (shape) => z15.strictObject({ ...baseEventFields, ...shape });
|
|
1948
1979
|
var sessionStartEventSchema = event2({
|
|
1949
|
-
type:
|
|
1950
|
-
sessionKind:
|
|
1980
|
+
type: z15.literal("session.start"),
|
|
1981
|
+
sessionKind: z15.enum(["interactive", "non-interactive", "unknown"]),
|
|
1951
1982
|
agentName: nonEmptyStringSchema.optional(),
|
|
1952
1983
|
agentVersion: nonEmptyStringSchema.optional(),
|
|
1953
1984
|
model: modelDescriptorSchema.optional()
|
|
1954
1985
|
});
|
|
1955
1986
|
var sessionEndEventSchema = event2({
|
|
1956
|
-
type:
|
|
1957
|
-
reason:
|
|
1987
|
+
type: z15.literal("session.end"),
|
|
1988
|
+
reason: z15.enum(["completed", "aborted", "error", "timeout", "unknown"]),
|
|
1958
1989
|
durationMillis: durationMillisSchema.optional(),
|
|
1959
1990
|
/** Session totals, typically cumulative. */
|
|
1960
1991
|
usage: canonicalUsageSchema.optional(),
|
|
1961
1992
|
cost: costFactsSchema.optional()
|
|
1962
1993
|
});
|
|
1963
1994
|
var promptSubmittedEventSchema = event2({
|
|
1964
|
-
type:
|
|
1965
|
-
promptSource:
|
|
1995
|
+
type: z15.literal("prompt.submitted"),
|
|
1996
|
+
promptSource: z15.enum(["user", "automation", "resumed", "unknown"]),
|
|
1966
1997
|
content: contentFactSchema.optional(),
|
|
1967
|
-
turnIndex:
|
|
1998
|
+
turnIndex: z15.number().int().min(0).optional()
|
|
1968
1999
|
});
|
|
1969
2000
|
var generationStartEventSchema = event2({
|
|
1970
|
-
type:
|
|
2001
|
+
type: z15.literal("generation.start"),
|
|
1971
2002
|
generationId: nonEmptyStringSchema,
|
|
1972
2003
|
model: modelDescriptorSchema,
|
|
1973
2004
|
requestedMaxOutputTokens: tokenCountSchema.optional(),
|
|
1974
2005
|
inputContent: contentFactsSchema.optional()
|
|
1975
2006
|
});
|
|
1976
2007
|
var generationEndEventSchema = event2({
|
|
1977
|
-
type:
|
|
2008
|
+
type: z15.literal("generation.end"),
|
|
1978
2009
|
generationId: nonEmptyStringSchema,
|
|
1979
2010
|
model: modelDescriptorSchema,
|
|
1980
2011
|
outcome: outcomeSchema,
|
|
@@ -1984,7 +2015,7 @@ var generationEndEventSchema = event2({
|
|
|
1984
2015
|
cost: costFactsSchema.optional(),
|
|
1985
2016
|
outputContent: contentFactsSchema.optional()
|
|
1986
2017
|
});
|
|
1987
|
-
var toolKindSchema =
|
|
2018
|
+
var toolKindSchema = z15.enum([
|
|
1988
2019
|
"read",
|
|
1989
2020
|
"write",
|
|
1990
2021
|
"execute",
|
|
@@ -1995,59 +2026,63 @@ var toolKindSchema = z14.enum([
|
|
|
1995
2026
|
"unknown"
|
|
1996
2027
|
]);
|
|
1997
2028
|
var toolStartEventSchema = event2({
|
|
1998
|
-
type:
|
|
2029
|
+
type: z15.literal("tool.start"),
|
|
1999
2030
|
toolCallId: nonEmptyStringSchema,
|
|
2000
2031
|
toolName: nonEmptyStringSchema,
|
|
2001
2032
|
toolKind: toolKindSchema,
|
|
2002
2033
|
generationId: nonEmptyStringSchema.optional(),
|
|
2003
|
-
input: contentFactSchema.optional()
|
|
2034
|
+
input: contentFactSchema.optional(),
|
|
2035
|
+
/** The git worktree this call targeted, resolved by the core (ADR 0008). */
|
|
2036
|
+
target: workspaceTargetSchema.optional()
|
|
2004
2037
|
});
|
|
2005
2038
|
var toolEndEventSchema = event2({
|
|
2006
|
-
type:
|
|
2039
|
+
type: z15.literal("tool.end"),
|
|
2007
2040
|
toolCallId: nonEmptyStringSchema,
|
|
2008
2041
|
toolName: nonEmptyStringSchema,
|
|
2009
2042
|
outcome: outcomeSchema,
|
|
2010
2043
|
durationMillis: durationMillisSchema.optional(),
|
|
2011
2044
|
/** Present when the host asked for or recorded a permission decision. */
|
|
2012
|
-
permissionDecision:
|
|
2013
|
-
output: contentFactSchema.optional()
|
|
2045
|
+
permissionDecision: z15.enum(["allowed", "denied", "deferred", "not-required"]).optional(),
|
|
2046
|
+
output: contentFactSchema.optional(),
|
|
2047
|
+
/** The git worktree this call targeted, resolved by the core (ADR 0008). */
|
|
2048
|
+
target: workspaceTargetSchema.optional()
|
|
2014
2049
|
});
|
|
2015
2050
|
var subagentStartEventSchema = event2({
|
|
2016
|
-
type:
|
|
2051
|
+
type: z15.literal("subagent.start"),
|
|
2017
2052
|
subagentInvocationId: invocationIdSchema,
|
|
2018
2053
|
subagentType: nonEmptyStringSchema.optional(),
|
|
2019
2054
|
/** 0 for the top-level agent; 1 for its direct children. */
|
|
2020
|
-
delegationDepth:
|
|
2055
|
+
delegationDepth: z15.number().int().min(0).max(64),
|
|
2021
2056
|
model: modelDescriptorSchema.optional()
|
|
2022
2057
|
});
|
|
2023
2058
|
var subagentEndEventSchema = event2({
|
|
2024
|
-
type:
|
|
2059
|
+
type: z15.literal("subagent.end"),
|
|
2025
2060
|
subagentInvocationId: invocationIdSchema,
|
|
2026
2061
|
outcome: outcomeSchema,
|
|
2027
2062
|
durationMillis: durationMillisSchema.optional(),
|
|
2028
2063
|
usage: canonicalUsageSchema.optional()
|
|
2029
2064
|
});
|
|
2030
2065
|
var compactionPerformedEventSchema = event2({
|
|
2031
|
-
type:
|
|
2032
|
-
trigger:
|
|
2066
|
+
type: z15.literal("compaction.performed"),
|
|
2067
|
+
trigger: z15.enum(["automatic", "manual", "unknown"]),
|
|
2033
2068
|
/** Provider-reported context size before and after compaction, if known. */
|
|
2034
2069
|
contextTokensBefore: tokenCountSchema.optional(),
|
|
2035
2070
|
contextTokensAfter: tokenCountSchema.optional(),
|
|
2036
|
-
droppedMessageCount:
|
|
2071
|
+
droppedMessageCount: z15.number().int().min(0).optional(),
|
|
2037
2072
|
usage: canonicalUsageSchema.optional()
|
|
2038
2073
|
});
|
|
2039
2074
|
var errorRaisedEventSchema = event2({
|
|
2040
|
-
type:
|
|
2075
|
+
type: z15.literal("error.raised"),
|
|
2041
2076
|
errorCode: otelHookErrorCodeSchema,
|
|
2042
2077
|
severity: errorSeveritySchema,
|
|
2043
2078
|
phase: errorPhaseSchema,
|
|
2044
|
-
retryable:
|
|
2079
|
+
retryable: z15.boolean(),
|
|
2045
2080
|
/** Error text is content: it is described, never embedded verbatim by default. */
|
|
2046
2081
|
message: contentFactSchema.optional(),
|
|
2047
2082
|
/** Non-sensitive, provider-agnostic short label. */
|
|
2048
2083
|
detail: nonEmptyStringSchema.optional()
|
|
2049
2084
|
});
|
|
2050
|
-
var canonicalEventSchema =
|
|
2085
|
+
var canonicalEventSchema = z15.discriminatedUnion("type", [
|
|
2051
2086
|
sessionStartEventSchema,
|
|
2052
2087
|
sessionEndEventSchema,
|
|
2053
2088
|
promptSubmittedEventSchema,
|
|
@@ -2062,26 +2097,26 @@ var canonicalEventSchema = z14.discriminatedUnion("type", [
|
|
|
2062
2097
|
]);
|
|
2063
2098
|
|
|
2064
2099
|
// src/providers/adapter.ts
|
|
2065
|
-
var providerDetectionSchema =
|
|
2100
|
+
var providerDetectionSchema = z16.strictObject({
|
|
2066
2101
|
providerId: resolvedProviderIdSchema,
|
|
2067
2102
|
confidence: detectionConfidenceSchema,
|
|
2068
2103
|
/**
|
|
2069
2104
|
* Short, non-sensitive justifications, e.g. `"payload.hook_event_name present"`.
|
|
2070
2105
|
* Reasons are exported in diagnostics, so they must not quote payload values.
|
|
2071
2106
|
*/
|
|
2072
|
-
reasons:
|
|
2107
|
+
reasons: z16.array(z16.string().min(1).max(160)).max(8),
|
|
2073
2108
|
providerVersion: nonEmptyStringSchema.optional(),
|
|
2074
2109
|
/** The provider's own name for this event, when the payload states one. */
|
|
2075
2110
|
sourceEventName: nonEmptyStringSchema.optional()
|
|
2076
2111
|
});
|
|
2077
|
-
var deliveryIdentifierSupportSchema =
|
|
2112
|
+
var deliveryIdentifierSupportSchema = z16.enum(["none", "partial", "all"]);
|
|
2078
2113
|
var DELIVERY_COMPONENT_PATTERN = /^[A-Za-z0-9_.:@+=-]{1,256}$/;
|
|
2079
|
-
var deliveryComponentSchema =
|
|
2114
|
+
var deliveryComponentSchema = z16.string().regex(
|
|
2080
2115
|
DELIVERY_COMPONENT_PATTERN,
|
|
2081
2116
|
"delivery component must be identifier-shaped: no whitespace, no path separators"
|
|
2082
2117
|
);
|
|
2083
2118
|
var MAX_DELIVERY_COMPONENTS = 8;
|
|
2084
|
-
var providerDeliveryClaimSchema =
|
|
2119
|
+
var providerDeliveryClaimSchema = z16.strictObject({
|
|
2085
2120
|
/**
|
|
2086
2121
|
* The provider's own session/conversation id. Scopes the callback identity, so
|
|
2087
2122
|
* two sessions reusing one tool-call id never collide.
|
|
@@ -2093,26 +2128,26 @@ var providerDeliveryClaimSchema = z15.strictObject({
|
|
|
2093
2128
|
* Identifier-shaped payload fields that, together with `sourceEventName`,
|
|
2094
2129
|
* name this callback within the session exactly once.
|
|
2095
2130
|
*/
|
|
2096
|
-
components:
|
|
2131
|
+
components: z16.array(deliveryComponentSchema).min(1).max(MAX_DELIVERY_COMPONENTS).readonly(),
|
|
2097
2132
|
/**
|
|
2098
2133
|
* Short, non-sensitive justifications, e.g. `"payload.tool_use_id names one
|
|
2099
2134
|
* tool call"`. Evidence reaches diagnostics, so it must name fields, never
|
|
2100
2135
|
* quote their values.
|
|
2101
2136
|
*/
|
|
2102
|
-
evidence:
|
|
2137
|
+
evidence: z16.array(z16.string().min(1).max(160)).min(1).max(4).readonly()
|
|
2103
2138
|
});
|
|
2104
2139
|
var DELIVERY_GAP_REASON_PATTERN = /^[^\n\r\t\\/]{1,240}$/;
|
|
2105
|
-
var deliveryGapReasonSchema =
|
|
2140
|
+
var deliveryGapReasonSchema = z16.string().regex(
|
|
2106
2141
|
DELIVERY_GAP_REASON_PATTERN,
|
|
2107
2142
|
"delivery gap reason must be one line of prose: no path separators, no control characters"
|
|
2108
2143
|
);
|
|
2109
2144
|
var MAX_DELIVERY_GAPS = 48;
|
|
2110
|
-
var providerDeliveryGapsSchema =
|
|
2145
|
+
var providerDeliveryGapsSchema = z16.record(deliveryComponentSchema, deliveryGapReasonSchema).refine((gaps) => Object.keys(gaps).length <= MAX_DELIVERY_GAPS, {
|
|
2111
2146
|
message: `at most ${String(MAX_DELIVERY_GAPS)} delivery gaps may be declared`
|
|
2112
2147
|
});
|
|
2113
|
-
var providerCapabilitiesSchema =
|
|
2148
|
+
var providerCapabilitiesSchema = z16.strictObject({
|
|
2114
2149
|
/** Event types the adapter can produce. */
|
|
2115
|
-
lifecycleEvents:
|
|
2150
|
+
lifecycleEvents: z16.array(canonicalEventTypeSchema).max(32).readonly(),
|
|
2116
2151
|
usageTemporality: usageTemporalitySchema,
|
|
2117
2152
|
/**
|
|
2118
2153
|
* Which accumulator series a `cumulative` report continues — that is, which
|
|
@@ -2131,32 +2166,32 @@ var providerCapabilitiesSchema = z15.strictObject({
|
|
|
2131
2166
|
* Subagent snapshots keep their own series regardless: a delegated agent's
|
|
2132
2167
|
* counter is not a point on the parent session's curve.
|
|
2133
2168
|
*/
|
|
2134
|
-
cumulativeUsageSeries:
|
|
2135
|
-
reportsCachedInput:
|
|
2136
|
-
reportsCacheCreation:
|
|
2169
|
+
cumulativeUsageSeries: z16.enum(["event-scope", "session-lifetime"]).optional(),
|
|
2170
|
+
reportsCachedInput: z16.boolean(),
|
|
2171
|
+
reportsCacheCreation: z16.boolean(),
|
|
2137
2172
|
cacheCreationAccounting: cacheCreationAccountingSchema,
|
|
2138
|
-
reportsReasoningOutput:
|
|
2139
|
-
reportsProviderTotal:
|
|
2140
|
-
reportsCost:
|
|
2141
|
-
emitsSubagentEvents:
|
|
2142
|
-
emitsCompactionEvents:
|
|
2173
|
+
reportsReasoningOutput: z16.boolean(),
|
|
2174
|
+
reportsProviderTotal: z16.boolean(),
|
|
2175
|
+
reportsCost: z16.boolean(),
|
|
2176
|
+
emitsSubagentEvents: z16.boolean(),
|
|
2177
|
+
emitsCompactionEvents: z16.boolean(),
|
|
2143
2178
|
/** True when the provider reads a structured response from stdout. */
|
|
2144
|
-
requiresHookResponse:
|
|
2179
|
+
requiresHookResponse: z16.boolean(),
|
|
2145
2180
|
/** How much of this provider's hook traffic is replay-identifiable. */
|
|
2146
2181
|
deliveryIdentifier: deliveryIdentifierSupportSchema
|
|
2147
2182
|
});
|
|
2148
|
-
var providerHookResponseSchema =
|
|
2183
|
+
var providerHookResponseSchema = z16.strictObject({
|
|
2149
2184
|
/**
|
|
2150
2185
|
* Always 0. A telemetry hook that can fail the host agent is a liability, so
|
|
2151
2186
|
* the type forbids expressing anything else (ADR 0004).
|
|
2152
2187
|
*/
|
|
2153
|
-
exitCode:
|
|
2188
|
+
exitCode: z16.literal(0),
|
|
2154
2189
|
/** Protocol response text. Omit to write nothing at all. */
|
|
2155
|
-
stdout:
|
|
2190
|
+
stdout: z16.string().max(8192).optional(),
|
|
2156
2191
|
/** Non-sensitive diagnostic text for stderr. */
|
|
2157
|
-
stderr:
|
|
2192
|
+
stderr: z16.string().max(8192).optional(),
|
|
2158
2193
|
/** Declares which of the two stdout contracts this response follows. */
|
|
2159
|
-
contract:
|
|
2194
|
+
contract: z16.enum(["silent", "provider-protocol"])
|
|
2160
2195
|
});
|
|
2161
2196
|
var SILENT_HOOK_RESPONSE = Object.freeze({
|
|
2162
2197
|
exitCode: 0,
|