@akilium/telemetry-collector 0.1.9 → 0.1.11
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/README.md +28 -1
- package/bin/akilium-telemetry.mjs +0 -0
- package/bin/status-reporter.mjs +1 -1
- package/dist/instrumentation/src/client.d.ts +77 -0
- package/dist/instrumentation/src/client.js +237 -0
- package/dist/instrumentation/src/codex-cli.d.ts +20 -0
- package/dist/instrumentation/src/codex-cli.js +92 -0
- package/dist/instrumentation/src/codex-execution.d.ts +27 -0
- package/dist/instrumentation/src/codex-execution.js +123 -0
- package/dist/instrumentation/src/index.d.ts +11 -0
- package/dist/instrumentation/src/index.js +11 -0
- package/dist/instrumentation/src/persisted-file.d.ts +18 -0
- package/dist/instrumentation/src/persisted-file.js +65 -0
- package/dist/instrumentation/src/posting-wrappers.d.ts +49 -0
- package/dist/instrumentation/src/posting-wrappers.js +76 -0
- package/dist/instrumentation/src/wrappers.d.ts +68 -0
- package/dist/instrumentation/src/wrappers.js +76 -0
- package/dist/integration-contracts/src/action-lineage.d.ts +120 -0
- package/dist/integration-contracts/src/action-lineage.js +208 -0
- package/dist/integration-contracts/src/activity-classification.d.ts +251 -0
- package/dist/integration-contracts/src/activity-classification.js +406 -0
- package/dist/integration-contracts/src/ai-execution.d.ts +62 -0
- package/dist/integration-contracts/src/ai-execution.js +244 -0
- package/dist/integration-contracts/src/ai-session.d.ts +282 -0
- package/dist/integration-contracts/src/ai-session.js +192 -0
- package/dist/integration-contracts/src/artifact-lineage.d.ts +140 -0
- package/dist/integration-contracts/src/artifact-lineage.js +236 -0
- package/dist/integration-contracts/src/lineage-validation.d.ts +14 -0
- package/dist/integration-contracts/src/lineage-validation.js +64 -0
- package/dist/integration-contracts/src/posting-lineage.d.ts +105 -0
- package/dist/integration-contracts/src/posting-lineage.js +147 -0
- package/lib/execution-capture.mjs +1 -1
- package/lib/session-activity.mjs +130 -0
- package/lib/session-titles.mjs +13 -1
- package/package.json +16 -25
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { artifactIdentityKey, parseArtifactIdentity, parseArtifactRevision, parseIntegrity, parseLineageAuthority, } from "./artifact-lineage.js";
|
|
2
|
+
import { choice, fail, fields, id, nullable, timestamp, uuid, version } from "./lineage-validation.js";
|
|
3
|
+
export const ACTION_LINEAGE_CONTRACT_VERSION = "1.0.0";
|
|
4
|
+
export const ACTION_LINEAGE_CAPABILITY = "artifact_lineage_v1";
|
|
5
|
+
export const ACTION_LINEAGE_ENHANCED_CONTRACT_VERSION = "1.1.0";
|
|
6
|
+
export const ACTION_LINEAGE_PRESENTATION_CAPABILITY = "artifact_presentation_v1";
|
|
7
|
+
export const ACTION_LINEAGE_LIMITS = { maxBytes: 65536, maxArtifacts: 32, maxIdentifierLength: 128 };
|
|
8
|
+
export function parseActionCollectionGap(value) {
|
|
9
|
+
const gap = fields(value, ["contractVersion", "kind", "gapId", "gapStart", "gapEnd", "reason"], "collectionGap");
|
|
10
|
+
if (gap.contractVersion !== ACTION_LINEAGE_CONTRACT_VERSION || gap.kind !== "collection_gap")
|
|
11
|
+
fail("collectionGap.version");
|
|
12
|
+
const gapStart = timestamp(gap.gapStart, "collectionGap.gapStart");
|
|
13
|
+
const gapEnd = timestamp(gap.gapEnd, "collectionGap.gapEnd");
|
|
14
|
+
if (gapStart >= gapEnd || Date.parse(gapEnd) - Date.parse(gapStart) > 90 * 86400000)
|
|
15
|
+
fail("collectionGap.window");
|
|
16
|
+
return { contractVersion: ACTION_LINEAGE_CONTRACT_VERSION, kind: "collection_gap",
|
|
17
|
+
gapId: uuid(gap.gapId, "collectionGap.gapId"), gapStart, gapEnd,
|
|
18
|
+
reason: choice(gap.reason, ["queue_overflow", "queue_expired", "operator_reported"], "collectionGap.reason") };
|
|
19
|
+
}
|
|
20
|
+
export function parseActionLineageEnvelope(value, approvedLocatorOrigins = []) {
|
|
21
|
+
const e = fields(value, ["contractVersion", "reportId", "actionId", "attemptId", "phase",
|
|
22
|
+
"executionStatus", "startedAt", "completedAt", "occurredAt", "correlation", "adapter",
|
|
23
|
+
"metadata", "artifacts"], "action");
|
|
24
|
+
if (e.contractVersion !== ACTION_LINEAGE_CONTRACT_VERSION)
|
|
25
|
+
fail("action.contractVersion");
|
|
26
|
+
const reportId = uuid(e.reportId, "action.reportId");
|
|
27
|
+
const actionId = id(e.actionId, "action.actionId");
|
|
28
|
+
const attemptId = id(e.attemptId, "action.attemptId");
|
|
29
|
+
const phase = choice(e.phase, ["started", "completed", "artifact_result"], "action.phase");
|
|
30
|
+
const executionStatus = choice(e.executionStatus, ["in_progress", "succeeded", "failed", "cancelled", "unknown"], "action.executionStatus");
|
|
31
|
+
const startedAt = nullable(e.startedAt, (v) => timestamp(v, "action.startedAt"));
|
|
32
|
+
const completedAt = nullable(e.completedAt, (v) => timestamp(v, "action.completedAt"));
|
|
33
|
+
const occurredAt = nullable(e.occurredAt, (v) => timestamp(v, "action.occurredAt"));
|
|
34
|
+
if (startedAt !== null && completedAt !== null && startedAt > completedAt)
|
|
35
|
+
fail("action.completedAt");
|
|
36
|
+
if ((phase === "started" && (executionStatus !== "in_progress" || completedAt !== null)) ||
|
|
37
|
+
(phase === "completed" && executionStatus === "in_progress"))
|
|
38
|
+
fail("action.phase");
|
|
39
|
+
const c = fields(e.correlation, ["namespace", "runId", "sessionId", "parentRunId",
|
|
40
|
+
"toolCallId", "completionReference"], "action.correlation");
|
|
41
|
+
const correlation = {
|
|
42
|
+
namespace: choice(c.namespace, ["explicit-sdk-v1", "codex-cli-jsonl-v1", "codex-otel-tool-result-v1"], "action.correlation.namespace"),
|
|
43
|
+
runId: nullable(c.runId, (v) => id(v, "action.correlation.runId")),
|
|
44
|
+
sessionId: nullable(c.sessionId, (v) => id(v, "action.correlation.sessionId")),
|
|
45
|
+
parentRunId: nullable(c.parentRunId, (v) => id(v, "action.correlation.parentRunId")),
|
|
46
|
+
toolCallId: nullable(c.toolCallId, (v) => id(v, "action.correlation.toolCallId")),
|
|
47
|
+
completionReference: nullable(c.completionReference, (v) => id(v, "action.correlation.completionReference")),
|
|
48
|
+
};
|
|
49
|
+
const a = fields(e.adapter, ["name", "version", "sourceVersion"], "action.adapter");
|
|
50
|
+
const adapter = {
|
|
51
|
+
name: choice(a.name, ["explicit_sdk", "codex_exec_jsonl", "codex_otel_tool_result"], "action.adapter.name"),
|
|
52
|
+
version: version(a.version, "action.adapter.version"),
|
|
53
|
+
sourceVersion: nullable(a.sourceVersion, (v) => version(v, "action.adapter.sourceVersion")),
|
|
54
|
+
};
|
|
55
|
+
if ((adapter.name === "explicit_sdk" && correlation.namespace !== "explicit-sdk-v1") ||
|
|
56
|
+
(adapter.name === "codex_exec_jsonl" &&
|
|
57
|
+
(correlation.namespace !== "codex-cli-jsonl-v1" || adapter.sourceVersion !== "0.160.0")) ||
|
|
58
|
+
(adapter.name === "codex_otel_tool_result" &&
|
|
59
|
+
(correlation.namespace !== "codex-otel-tool-result-v1" || adapter.sourceVersion === null)))
|
|
60
|
+
fail("action.adapter");
|
|
61
|
+
const m = fields(e.metadata, ["toolKind", "exitCode", "errorCode"], "action.metadata");
|
|
62
|
+
if (m.exitCode !== null && (typeof m.exitCode !== "number" || !Number.isSafeInteger(m.exitCode) ||
|
|
63
|
+
m.exitCode < -255 || m.exitCode > 65535))
|
|
64
|
+
fail("action.metadata.exitCode");
|
|
65
|
+
const metadata = {
|
|
66
|
+
toolKind: choice(m.toolKind, ["commit", "pull_request", "linear_ticket", "persisted_result", "command", "custom"], "action.metadata.toolKind"),
|
|
67
|
+
exitCode: m.exitCode,
|
|
68
|
+
errorCode: nullable(m.errorCode, (v) => choice(v, ["tool_failed", "cancelled", "unknown"], "action.metadata.errorCode")),
|
|
69
|
+
};
|
|
70
|
+
if (!Array.isArray(e.artifacts) || e.artifacts.length > ACTION_LINEAGE_LIMITS.maxArtifacts)
|
|
71
|
+
fail("action.artifacts");
|
|
72
|
+
if ((phase === "started" && e.artifacts.length !== 0) ||
|
|
73
|
+
(phase === "artifact_result" && e.artifacts.length === 0) ||
|
|
74
|
+
(adapter.name === "codex_exec_jsonl" && (e.artifacts.length !== 0 || metadata.toolKind !== "command")))
|
|
75
|
+
fail("action.artifacts");
|
|
76
|
+
const references = new Set();
|
|
77
|
+
const artifacts = e.artifacts.map((value) => {
|
|
78
|
+
const r = fields(value, ["resultReferenceId", "artifact", "relationship", "revision"], "action.artifactResult");
|
|
79
|
+
const resultReferenceId = id(r.resultReferenceId, "action.artifactResult.resultReferenceId");
|
|
80
|
+
if (references.has(resultReferenceId))
|
|
81
|
+
fail("action.artifactResult.resultReferenceId");
|
|
82
|
+
references.add(resultReferenceId);
|
|
83
|
+
const artifact = parseArtifactIdentity(r.artifact, approvedLocatorOrigins);
|
|
84
|
+
const relationship = choice(r.relationship, ["created", "modified", "read", "referenced"], "action.artifactResult.relationship");
|
|
85
|
+
const revision = parseArtifactRevision(r.revision);
|
|
86
|
+
if (artifact.kind === "commit" && (relationship === "modified" ||
|
|
87
|
+
(revision.headCommitSha !== null && revision.headCommitSha !== artifact.sha) ||
|
|
88
|
+
(revision.sourceRevisionId !== null && revision.sourceRevisionId.toLowerCase() !== artifact.sha)))
|
|
89
|
+
fail("action.artifactResult.revision");
|
|
90
|
+
return { resultReferenceId, artifact, relationship, revision };
|
|
91
|
+
});
|
|
92
|
+
return { contractVersion: ACTION_LINEAGE_CONTRACT_VERSION, reportId, actionId, attemptId, phase,
|
|
93
|
+
executionStatus, startedAt, completedAt, occurredAt, correlation, adapter, metadata, artifacts };
|
|
94
|
+
}
|
|
95
|
+
/** Receiver verifies credentials before supplying context; this function cannot authenticate. */
|
|
96
|
+
export function bindActionLineageEnvelope(value, context) {
|
|
97
|
+
if (!context.capabilities.includes(ACTION_LINEAGE_CAPABILITY))
|
|
98
|
+
fail("authority.capabilities");
|
|
99
|
+
const authority = parseLineageAuthority(context.authority);
|
|
100
|
+
const envelope = parseActionLineageEnvelope(value, context.approvedLocatorOrigins);
|
|
101
|
+
return {
|
|
102
|
+
authority, envelope,
|
|
103
|
+
reportKey: JSON.stringify([ACTION_LINEAGE_CONTRACT_VERSION, authority.tenantId, authority.sourceId, envelope.reportId]),
|
|
104
|
+
attemptKey: JSON.stringify([ACTION_LINEAGE_CONTRACT_VERSION, authority.tenantId, authority.sourceId, envelope.actionId, envelope.attemptId]),
|
|
105
|
+
runCorrelation: "unresolved",
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** Parse bounded JSON before accepting reports; the HTTP receiver must also bound body reads. */
|
|
109
|
+
export function parseActionLineageJson(text, context) {
|
|
110
|
+
if (new TextEncoder().encode(text).byteLength > ACTION_LINEAGE_LIMITS.maxBytes)
|
|
111
|
+
fail("action.bytes");
|
|
112
|
+
let value;
|
|
113
|
+
try {
|
|
114
|
+
value = JSON.parse(text);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
fail("action.json");
|
|
118
|
+
}
|
|
119
|
+
return bindActionLineageEnvelope(value, context);
|
|
120
|
+
}
|
|
121
|
+
export function actionArtifactResultKey(result, bound) {
|
|
122
|
+
return JSON.stringify([bound.attemptKey, result.resultReferenceId, artifactIdentityKey(result.artifact, bound.authority)]);
|
|
123
|
+
}
|
|
124
|
+
/** Enhanced parser is capability-gated separately; v1 parsing remains byte-for-byte strict. */
|
|
125
|
+
export function parseActionLineageEnvelopeV1_1(value, approvedLocatorOrigins = []) {
|
|
126
|
+
const root = fields(value, ["contractVersion", "reportId", "actionId", "attemptId", "phase", "executionStatus", "startedAt",
|
|
127
|
+
"completedAt", "occurredAt", "correlation", "adapter", "metadata", "artifacts"], "actionV1_1");
|
|
128
|
+
if (root.contractVersion !== ACTION_LINEAGE_ENHANCED_CONTRACT_VERSION || !Array.isArray(root.artifacts) || root.artifacts.length > ACTION_LINEAGE_LIMITS.maxArtifacts)
|
|
129
|
+
fail("actionV1_1.contractVersion");
|
|
130
|
+
const artifacts = root.artifacts.map((raw) => {
|
|
131
|
+
const result = fields(raw, ["resultReferenceId", "artifact", "relationship", "revision", "presentation", "verification"], "actionV1_1.artifactResult");
|
|
132
|
+
const base = { resultReferenceId: result.resultReferenceId, artifact: result.artifact, relationship: result.relationship, revision: result.revision };
|
|
133
|
+
const parsed = parseActionLineageEnvelope({ ...root, contractVersion: ACTION_LINEAGE_CONTRACT_VERSION, artifacts: [base] }, approvedLocatorOrigins);
|
|
134
|
+
const artifact = parsed.artifacts[0];
|
|
135
|
+
const presentation = parseActionPresentation(result.presentation, approvedLocatorOrigins);
|
|
136
|
+
const verification = result.verification === null ? null : parsePersistedOutputVerification(result.verification);
|
|
137
|
+
if (artifact.artifact.kind === "persisted_tool_result" && verification === null)
|
|
138
|
+
fail("actionV1_1.artifactResult.verification");
|
|
139
|
+
if (artifact.artifact.kind !== "persisted_tool_result" && verification !== null)
|
|
140
|
+
fail("actionV1_1.artifactResult.verification");
|
|
141
|
+
if (artifact.artifact.kind === "persisted_tool_result" && verification !== null &&
|
|
142
|
+
((verification.stableResultId !== null && verification.stableResultId !== artifact.artifact.resultId) ||
|
|
143
|
+
(verification.integrity !== null && verification.integrity.value !== artifact.artifact.integrity?.value) ||
|
|
144
|
+
(artifact.artifact.locator.kind === "source_reference" && artifact.artifact.locator.reference !== verification.persistedReference)))
|
|
145
|
+
fail("actionV1_1.artifactResult.verification.identity");
|
|
146
|
+
return { ...artifact, presentation, verification };
|
|
147
|
+
});
|
|
148
|
+
const base = parseActionLineageEnvelope({ ...root, contractVersion: ACTION_LINEAGE_CONTRACT_VERSION,
|
|
149
|
+
artifacts: artifacts.map(({ presentation: _p, verification: _v, ...artifact }) => artifact) }, approvedLocatorOrigins);
|
|
150
|
+
return { ...base, contractVersion: ACTION_LINEAGE_ENHANCED_CONTRACT_VERSION, artifacts };
|
|
151
|
+
}
|
|
152
|
+
function boundedActionText(value, limit, path) {
|
|
153
|
+
if (value === null)
|
|
154
|
+
return null;
|
|
155
|
+
if (typeof value !== "string" || value.length === 0 || value.length > limit || value.trim() !== value)
|
|
156
|
+
fail(path);
|
|
157
|
+
return value;
|
|
158
|
+
}
|
|
159
|
+
function parseActionPresentation(value, approvedLocatorOrigins) {
|
|
160
|
+
if (value === null)
|
|
161
|
+
return null;
|
|
162
|
+
const p = fields(value, ["sourceContext", "repositoryLabel", "pullRequestNumber", "issueKey", "filename", "sourcePath", "copyReference", "destination"], "actionV1_1.presentation");
|
|
163
|
+
const destination = boundedActionText(p.destination, 1024, "actionV1_1.presentation.destination");
|
|
164
|
+
if (destination !== null) {
|
|
165
|
+
let url;
|
|
166
|
+
try {
|
|
167
|
+
url = new URL(destination);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
fail("actionV1_1.presentation.destination");
|
|
171
|
+
}
|
|
172
|
+
if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash || !approvedLocatorOrigins.includes(url.origin))
|
|
173
|
+
fail("actionV1_1.presentation.destination");
|
|
174
|
+
}
|
|
175
|
+
const pullRequestNumber = p.pullRequestNumber === null ? null : p.pullRequestNumber;
|
|
176
|
+
if (pullRequestNumber !== null && (!Number.isSafeInteger(pullRequestNumber) || pullRequestNumber < 1))
|
|
177
|
+
fail("actionV1_1.presentation.pullRequestNumber");
|
|
178
|
+
return { sourceContext: boundedActionText(p.sourceContext, 256, "actionV1_1.presentation.sourceContext"),
|
|
179
|
+
repositoryLabel: boundedActionText(p.repositoryLabel, 256, "actionV1_1.presentation.repositoryLabel"), pullRequestNumber,
|
|
180
|
+
issueKey: boundedActionText(p.issueKey, 128, "actionV1_1.presentation.issueKey"),
|
|
181
|
+
filename: boundedActionText(p.filename, 256, "actionV1_1.presentation.filename"),
|
|
182
|
+
sourcePath: boundedActionText(p.sourcePath, 1024, "actionV1_1.presentation.sourcePath"),
|
|
183
|
+
copyReference: boundedActionText(p.copyReference, 1024, "actionV1_1.presentation.copyReference"), destination };
|
|
184
|
+
}
|
|
185
|
+
function parsePersistedOutputVerification(value) {
|
|
186
|
+
const v = fields(value, ["persistedReference", "stableResultId", "integrity", "verifiedAt", "basis", "priorExistence"], "actionV1_1.verification");
|
|
187
|
+
const integrity = nullable(v.integrity, parseIntegrity);
|
|
188
|
+
const stableResultId = nullable(v.stableResultId, (raw) => id(raw, "actionV1_1.verification.stableResultId"));
|
|
189
|
+
if (stableResultId === null && integrity === null)
|
|
190
|
+
fail("actionV1_1.verification.identity");
|
|
191
|
+
return { persistedReference: id(v.persistedReference, "actionV1_1.verification.persistedReference"), stableResultId, integrity,
|
|
192
|
+
verifiedAt: timestamp(v.verifiedAt, "actionV1_1.verification.verifiedAt"),
|
|
193
|
+
basis: choice(v.basis, ["post_write_lookup", "create_operation", "trusted_pre_state"], "actionV1_1.verification.basis"),
|
|
194
|
+
priorExistence: choice(v.priorExistence, ["absent", "present", "unknown"], "actionV1_1.verification.priorExistence") };
|
|
195
|
+
}
|
|
196
|
+
export function bindActionLineageEnvelopeV1_1(value, context) {
|
|
197
|
+
if (!context.capabilities.includes(ACTION_LINEAGE_CAPABILITY) || !context.capabilities.includes(ACTION_LINEAGE_PRESENTATION_CAPABILITY))
|
|
198
|
+
fail("authority.capabilities");
|
|
199
|
+
const authority = parseLineageAuthority(context.authority), envelope = parseActionLineageEnvelopeV1_1(value, context.approvedLocatorOrigins);
|
|
200
|
+
return { authority, envelope,
|
|
201
|
+
reportKey: JSON.stringify([ACTION_LINEAGE_ENHANCED_CONTRACT_VERSION, authority.tenantId, authority.sourceId, envelope.reportId]),
|
|
202
|
+
attemptKey: JSON.stringify([ACTION_LINEAGE_ENHANCED_CONTRACT_VERSION, authority.tenantId, authority.sourceId, envelope.actionId, envelope.attemptId]),
|
|
203
|
+
runCorrelation: "unresolved" };
|
|
204
|
+
}
|
|
205
|
+
export function isConfirmedPersistedCreation(result) {
|
|
206
|
+
return result.artifact.kind === "persisted_tool_result" && result.relationship === "created" &&
|
|
207
|
+
result.verification?.priorExistence === "absent";
|
|
208
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { type LineageAuthorityV1, type LineageOwningScopeV1 } from "./artifact-lineage.ts";
|
|
2
|
+
/** Purpose and output evidence are independent, optional capabilities. */
|
|
3
|
+
export declare const ACTIVITY_CLASSIFICATION_CONTRACT_VERSION: "1.1.0";
|
|
4
|
+
export declare const ACTIVITY_PURPOSE_CAPABILITY: "activity_purpose_v1";
|
|
5
|
+
export declare const ACTIVITY_OUTPUT_CAPABILITY: "activity_output_v1";
|
|
6
|
+
export declare const CODE_CONTRIBUTION_CAPABILITY: "code_contribution_v1";
|
|
7
|
+
export declare const ACTIVITY_CLASSIFICATION_LIMITS: {
|
|
8
|
+
readonly maxBytes: 65536;
|
|
9
|
+
readonly maxReports: 100;
|
|
10
|
+
readonly maxExamples: 32;
|
|
11
|
+
readonly maxSupportingReferences: 32;
|
|
12
|
+
readonly maxStringLength: 2048;
|
|
13
|
+
};
|
|
14
|
+
export type ActivityPurposeCode = "research" | "exploration" | "learning" | "planning" | "decision_support" | "analysis" | "debugging" | "review" | "creation" | "transformation" | "communication" | "operations" | "other" | "unknown" | "mixed";
|
|
15
|
+
export type ActivityPurposeBucketCode = ActivityPurposeCode | "pending";
|
|
16
|
+
export type ActivityAssignmentMethod = "manual" | "declared" | "inherited" | "deterministic" | "heuristic" | "provider_inferred";
|
|
17
|
+
export type ActivityOutputKind = "answer" | "draft" | "code" | "report" | "file" | "tool_result" | "other";
|
|
18
|
+
export type ActivityOutputLifetime = "session" | "transient" | "temporary_storage";
|
|
19
|
+
export type ActivityOutputOrigin = "instrumented" | "adapter_reported" | "reviewed" | "inferred";
|
|
20
|
+
export type ActivityOutputQualification = "established" | "reported" | "inferred" | "disputed";
|
|
21
|
+
export interface ActivityCategoryReferenceV1 {
|
|
22
|
+
categoryId: string;
|
|
23
|
+
categoryVersion: number;
|
|
24
|
+
scope: "shared" | "tenant" | "team";
|
|
25
|
+
tenantId: string | null;
|
|
26
|
+
teamId: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface ActivityCategoryVersionV1 {
|
|
29
|
+
contractVersion: typeof ACTIVITY_CLASSIFICATION_CONTRACT_VERSION;
|
|
30
|
+
categoryId: string;
|
|
31
|
+
version: number;
|
|
32
|
+
scope: "shared" | "tenant" | "team";
|
|
33
|
+
tenantId: string | null;
|
|
34
|
+
teamId: string | null;
|
|
35
|
+
parent: ActivityCategoryReferenceV1 | null;
|
|
36
|
+
name: string;
|
|
37
|
+
definition: string;
|
|
38
|
+
inclusionCriteria: string[];
|
|
39
|
+
exclusionCriteria: string[];
|
|
40
|
+
positiveExamples: string[];
|
|
41
|
+
counterExamples: string[];
|
|
42
|
+
permittedEvidenceFields: string[];
|
|
43
|
+
methods: Array<"declaration" | "membership" | "deterministic" | "heuristic" | "semantic" | "manual">;
|
|
44
|
+
semanticRubric: string | null;
|
|
45
|
+
precedence: number;
|
|
46
|
+
owner: LineageOwningScopeV1 | {
|
|
47
|
+
kind: "shared";
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface ActivityPurposeDeclarationV1 {
|
|
51
|
+
declarationId: string;
|
|
52
|
+
category: ActivityCategoryReferenceV1;
|
|
53
|
+
declaredAt: string;
|
|
54
|
+
evidenceReferences: string[];
|
|
55
|
+
}
|
|
56
|
+
export interface ActivityWorkContextMembershipV1 {
|
|
57
|
+
membershipId: string;
|
|
58
|
+
contextId: string;
|
|
59
|
+
contextKind: "phase" | "session";
|
|
60
|
+
actionId: string;
|
|
61
|
+
attemptId: string;
|
|
62
|
+
establishedAt: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ActivityEphemeralOutputV1 {
|
|
65
|
+
assertionId: string;
|
|
66
|
+
outputId: string;
|
|
67
|
+
actionId: string;
|
|
68
|
+
attemptId: string;
|
|
69
|
+
kind: ActivityOutputKind;
|
|
70
|
+
lifetime: ActivityOutputLifetime;
|
|
71
|
+
occurredAt: string;
|
|
72
|
+
origin: Exclude<ActivityOutputOrigin, "inferred">;
|
|
73
|
+
qualification: Exclude<ActivityOutputQualification, "inferred">;
|
|
74
|
+
evidenceReference: string | null;
|
|
75
|
+
}
|
|
76
|
+
export interface ActivityNoOutputAssertionV1 {
|
|
77
|
+
assertionId: string;
|
|
78
|
+
actionId: string;
|
|
79
|
+
attemptId: string;
|
|
80
|
+
occurredAt: string;
|
|
81
|
+
origin: Exclude<ActivityOutputOrigin, "inferred">;
|
|
82
|
+
qualification: Exclude<ActivityOutputQualification, "inferred">;
|
|
83
|
+
evidenceReference: string | null;
|
|
84
|
+
supersedesAssertionId: string | null;
|
|
85
|
+
}
|
|
86
|
+
export interface ActivityPurposeReportV1 {
|
|
87
|
+
contractVersion: typeof ACTIVITY_CLASSIFICATION_CONTRACT_VERSION;
|
|
88
|
+
reportId: string;
|
|
89
|
+
actionId: string;
|
|
90
|
+
attemptId: string;
|
|
91
|
+
purpose: ActivityPurposeDeclarationV1 | null;
|
|
92
|
+
membership: ActivityWorkContextMembershipV1 | null;
|
|
93
|
+
outputs: ActivityEphemeralOutputV1[];
|
|
94
|
+
noOutput: ActivityNoOutputAssertionV1 | null;
|
|
95
|
+
}
|
|
96
|
+
export interface BoundActivityPurposeReportV1 {
|
|
97
|
+
authority: LineageAuthorityV1;
|
|
98
|
+
report: ActivityPurposeReportV1;
|
|
99
|
+
reportKey: string;
|
|
100
|
+
/** Shared with action 1.0.0 so optional metadata never creates another logical attempt. */
|
|
101
|
+
attemptKey: string;
|
|
102
|
+
}
|
|
103
|
+
export interface ActivityAssignmentV1 {
|
|
104
|
+
assignmentId: string;
|
|
105
|
+
tenantId: string;
|
|
106
|
+
owner: LineageOwningScopeV1;
|
|
107
|
+
subject: {
|
|
108
|
+
sourceId: string;
|
|
109
|
+
actionId: string;
|
|
110
|
+
attemptId: string;
|
|
111
|
+
eventRecordId: string | null;
|
|
112
|
+
contextId: string | null;
|
|
113
|
+
};
|
|
114
|
+
category: ActivityCategoryReferenceV1 | null;
|
|
115
|
+
purpose: ActivityPurposeCode;
|
|
116
|
+
method: ActivityAssignmentMethod;
|
|
117
|
+
precedence: "manual" | "action_declaration" | "phase_declaration" | "session_declaration" | "deterministic" | "provider_inferred";
|
|
118
|
+
qualification: "established" | "reported" | "inferred" | "disputed";
|
|
119
|
+
evidenceReferences: string[];
|
|
120
|
+
evidenceRevision: number;
|
|
121
|
+
evaluationGeneration: number;
|
|
122
|
+
recordedAt: string;
|
|
123
|
+
supersedesAssignmentId: string | null;
|
|
124
|
+
}
|
|
125
|
+
export interface ActivityClassificationJobV1 {
|
|
126
|
+
jobId: string;
|
|
127
|
+
tenantId: string;
|
|
128
|
+
owner: LineageOwningScopeV1;
|
|
129
|
+
provider: "jev" | "openai_decisions";
|
|
130
|
+
model: string;
|
|
131
|
+
status: "previewed" | "queued" | "running" | "completed" | "partial" | "failed" | "cancelled";
|
|
132
|
+
subjectCount: number;
|
|
133
|
+
requestLimit: number;
|
|
134
|
+
inputTokenLimit: number;
|
|
135
|
+
createdAt: string;
|
|
136
|
+
}
|
|
137
|
+
export interface ActivityPurposeAggregateV1 {
|
|
138
|
+
contractVersion: typeof ACTIVITY_CLASSIFICATION_CONTRACT_VERSION;
|
|
139
|
+
asOf: string;
|
|
140
|
+
windowStart: string;
|
|
141
|
+
windowEnd: string;
|
|
142
|
+
unit: "eligible_action_event_records";
|
|
143
|
+
eligibleActionCount: number;
|
|
144
|
+
pendingCount: number;
|
|
145
|
+
coverage: "complete" | "partial" | "unavailable";
|
|
146
|
+
purposes: Array<{
|
|
147
|
+
category: ActivityCategoryReferenceV1 | null;
|
|
148
|
+
purpose: ActivityPurposeBucketCode;
|
|
149
|
+
count: number;
|
|
150
|
+
}>;
|
|
151
|
+
outputs: Array<{
|
|
152
|
+
status: "durable" | "ephemeral" | "both" | "no_output" | "unknown";
|
|
153
|
+
count: number;
|
|
154
|
+
}>;
|
|
155
|
+
}
|
|
156
|
+
export type ActivityPurposeOutputStatus = "durable" | "ephemeral" | "both" | "no_output" | "unknown";
|
|
157
|
+
export interface ActivityPurposeOutputFlowV1 {
|
|
158
|
+
sourceId: string;
|
|
159
|
+
purpose: ActivityPurposeBucketCode;
|
|
160
|
+
category: (ActivityCategoryReferenceV1 & {
|
|
161
|
+
categoryKey?: string;
|
|
162
|
+
name?: string;
|
|
163
|
+
}) | null;
|
|
164
|
+
output: ActivityPurposeOutputStatus;
|
|
165
|
+
count: number;
|
|
166
|
+
}
|
|
167
|
+
export interface ActivityPurposeOutputAggregateV1 {
|
|
168
|
+
contractVersion: typeof ACTIVITY_CLASSIFICATION_CONTRACT_VERSION;
|
|
169
|
+
asOf: string;
|
|
170
|
+
windowStart: string;
|
|
171
|
+
windowEnd: string;
|
|
172
|
+
unit: "eligible_action_event_records";
|
|
173
|
+
eligibleActionCount: number;
|
|
174
|
+
authorizedEligibleActionCount: number;
|
|
175
|
+
artifactSubset: boolean;
|
|
176
|
+
pendingCount: number;
|
|
177
|
+
coverage: "complete" | "partial";
|
|
178
|
+
purposes: Array<{
|
|
179
|
+
category: ActivityPurposeOutputFlowV1["category"];
|
|
180
|
+
purpose: ActivityPurposeBucketCode;
|
|
181
|
+
count: number;
|
|
182
|
+
}>;
|
|
183
|
+
outputs: Array<{
|
|
184
|
+
status: ActivityPurposeOutputStatus;
|
|
185
|
+
count: number;
|
|
186
|
+
}>;
|
|
187
|
+
outputConflictCount: number;
|
|
188
|
+
sources: Array<{
|
|
189
|
+
sourceId: string;
|
|
190
|
+
count: number;
|
|
191
|
+
}>;
|
|
192
|
+
flows: ActivityPurposeOutputFlowV1[];
|
|
193
|
+
knownCollectionGapIntervals: number;
|
|
194
|
+
}
|
|
195
|
+
export interface ActivityPurposeOutputBucketItemV1 {
|
|
196
|
+
attemptRecordId: string;
|
|
197
|
+
eventRecordId: string;
|
|
198
|
+
sourceId: string;
|
|
199
|
+
occurredAt: string;
|
|
200
|
+
purpose: ActivityPurposeBucketCode;
|
|
201
|
+
category: ActivityCategoryReferenceV1 | null;
|
|
202
|
+
output: ActivityPurposeOutputStatus;
|
|
203
|
+
outputConflict: boolean;
|
|
204
|
+
assignment: {
|
|
205
|
+
assignmentId: string;
|
|
206
|
+
method: ActivityAssignmentMethod;
|
|
207
|
+
precedence: string;
|
|
208
|
+
qualification: string;
|
|
209
|
+
evidenceReferences: string[];
|
|
210
|
+
categoryId: string | null;
|
|
211
|
+
categoryVersion: number | null;
|
|
212
|
+
contextId: string | null;
|
|
213
|
+
eventRecordId: string;
|
|
214
|
+
} | null;
|
|
215
|
+
}
|
|
216
|
+
export interface ActivityPurposeOutputBucketPageV1 {
|
|
217
|
+
context: {
|
|
218
|
+
contractVersion: typeof ACTIVITY_CLASSIFICATION_CONTRACT_VERSION;
|
|
219
|
+
scope: "authorized_slice";
|
|
220
|
+
from: string;
|
|
221
|
+
to: string;
|
|
222
|
+
asOf: string;
|
|
223
|
+
evidenceFilter: "established" | "include_inferred" | "inferred_only";
|
|
224
|
+
artifactSubset: boolean;
|
|
225
|
+
};
|
|
226
|
+
items: ActivityPurposeOutputBucketItemV1[];
|
|
227
|
+
continuation: {
|
|
228
|
+
occurredAt: string;
|
|
229
|
+
attemptRecordId: string;
|
|
230
|
+
} | null;
|
|
231
|
+
}
|
|
232
|
+
export declare function parseActivityPurposeOutputAggregate(value: unknown): ActivityPurposeOutputAggregateV1;
|
|
233
|
+
export declare function parseActivityPurposeOutputBucketPage(value: unknown): ActivityPurposeOutputBucketPageV1;
|
|
234
|
+
export declare function parseActivityCategoryVersion(value: unknown, authority?: LineageAuthorityV1): ActivityCategoryVersionV1;
|
|
235
|
+
export declare function parseActivityAssignment(value: unknown, authorityValue: unknown): ActivityAssignmentV1;
|
|
236
|
+
/** Bind payload references to authenticated source and tenant context; never trust payload scope claims. */
|
|
237
|
+
export declare function parseActivityPurposeReport(value: unknown, context: {
|
|
238
|
+
authority: LineageAuthorityV1;
|
|
239
|
+
capabilities: readonly string[];
|
|
240
|
+
}): ActivityPurposeReportV1;
|
|
241
|
+
export declare function parseActivityPurposeJson(text: string, context: {
|
|
242
|
+
authority: LineageAuthorityV1;
|
|
243
|
+
capabilities: readonly string[];
|
|
244
|
+
}): ActivityPurposeReportV1;
|
|
245
|
+
export declare function bindActivityPurposeReport(value: unknown, context: {
|
|
246
|
+
authority: LineageAuthorityV1;
|
|
247
|
+
capabilities: readonly string[];
|
|
248
|
+
}): BoundActivityPurposeReportV1;
|
|
249
|
+
/** Parse persisted read contracts without allowing unbounded chart payloads or invented units. */
|
|
250
|
+
export declare function parseActivityPurposeAggregate(value: unknown): ActivityPurposeAggregateV1;
|
|
251
|
+
export declare function parseActivityClassificationJob(value: unknown): ActivityClassificationJobV1;
|