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