@nixet/contracts 0.0.0-stage → 0.1.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/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/cjs/domains/agents.d.ts +284 -0
- package/dist/cjs/domains/agents.js +244 -0
- package/dist/cjs/domains/api-keys.d.ts +265 -0
- package/dist/cjs/domains/api-keys.js +87 -0
- package/dist/cjs/domains/billing.d.ts +98 -0
- package/dist/cjs/domains/billing.js +122 -0
- package/dist/cjs/domains/connections.d.ts +101 -0
- package/dist/cjs/domains/connections.js +130 -0
- package/dist/cjs/domains/conversations.d.ts +113 -0
- package/dist/cjs/domains/conversations.js +85 -0
- package/dist/cjs/domains/documents.d.ts +48 -0
- package/dist/cjs/domains/documents.js +64 -0
- package/dist/cjs/domains/guardrails.d.ts +213 -0
- package/dist/cjs/domains/guardrails.js +206 -0
- package/dist/cjs/domains/identity.d.ts +55 -0
- package/dist/cjs/domains/identity.js +26 -0
- package/dist/cjs/domains/knowledge.d.ts +167 -0
- package/dist/cjs/domains/knowledge.js +174 -0
- package/dist/cjs/domains/mcp.d.ts +189 -0
- package/dist/cjs/domains/mcp.js +183 -0
- package/dist/cjs/domains/memory.d.ts +109 -0
- package/dist/cjs/domains/memory.js +92 -0
- package/dist/cjs/domains/redaction.d.ts +181 -0
- package/dist/cjs/domains/redaction.js +166 -0
- package/dist/cjs/domains/runs.d.ts +260 -0
- package/dist/cjs/domains/runs.js +260 -0
- package/dist/cjs/domains/secrets.d.ts +56 -0
- package/dist/cjs/domains/secrets.js +72 -0
- package/dist/cjs/domains/skills.d.ts +70 -0
- package/dist/cjs/domains/skills.js +82 -0
- package/dist/cjs/domains/tasks.d.ts +111 -0
- package/dist/cjs/domains/tasks.js +113 -0
- package/dist/cjs/domains/tools.d.ts +159 -0
- package/dist/cjs/domains/tools.js +203 -0
- package/dist/cjs/domains/users.d.ts +40 -0
- package/dist/cjs/domains/users.js +48 -0
- package/dist/cjs/index.d.ts +25 -0
- package/dist/cjs/index.js +41 -0
- package/dist/cjs/primitives.d.ts +75 -0
- package/dist/cjs/primitives.js +117 -0
- package/dist/esm/domains/agents.js +239 -0
- package/dist/esm/domains/api-keys.js +83 -0
- package/dist/esm/domains/billing.js +116 -0
- package/dist/esm/domains/connections.js +127 -0
- package/dist/esm/domains/conversations.js +82 -0
- package/dist/esm/domains/documents.js +61 -0
- package/dist/esm/domains/guardrails.js +202 -0
- package/dist/esm/domains/identity.js +23 -0
- package/dist/esm/domains/knowledge.js +170 -0
- package/dist/esm/domains/mcp.js +178 -0
- package/dist/esm/domains/memory.js +89 -0
- package/dist/esm/domains/redaction.js +162 -0
- package/dist/esm/domains/runs.js +256 -0
- package/dist/esm/domains/secrets.js +68 -0
- package/dist/esm/domains/skills.js +79 -0
- package/dist/esm/domains/tasks.js +109 -0
- package/dist/esm/domains/tools.js +196 -0
- package/dist/esm/domains/users.js +45 -0
- package/dist/esm/index.js +25 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/primitives.js +114 -0
- package/package.json +47 -4
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Redaction.
|
|
4
|
+
*
|
|
5
|
+
* Personal data is masked in Nixet before a run is dispatched, so the runtime
|
|
6
|
+
* and the model provider receive `[GIVEN_NAME_1]` where a name was. When the
|
|
7
|
+
* policy is reversible the map is sealed in the vault and the reply is restored
|
|
8
|
+
* on the way back out, so the caller still reads a normal answer.
|
|
9
|
+
*
|
|
10
|
+
* Scope is deliberately narrow: run input and output only. Tool arguments and
|
|
11
|
+
* results recorded in the trace are **not** redacted, because the trace is what
|
|
12
|
+
* the product is for. Anything describing this feature has to say so.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Detection categories, as the model reports them.
|
|
16
|
+
*
|
|
17
|
+
* `ORG` is a company rather than a person, so it is excluded unless a caller
|
|
18
|
+
* asks for it. `IMEI` and the other structured labels are checksum-validated.
|
|
19
|
+
*/
|
|
20
|
+
export declare const redactionLabelSchema: z.ZodEnum<{
|
|
21
|
+
GIVEN_NAME: "GIVEN_NAME";
|
|
22
|
+
SURNAME: "SURNAME";
|
|
23
|
+
STREET_NAME: "STREET_NAME";
|
|
24
|
+
BUILDING_NUMBER: "BUILDING_NUMBER";
|
|
25
|
+
SECONDARY_ADDRESS: "SECONDARY_ADDRESS";
|
|
26
|
+
CITY: "CITY";
|
|
27
|
+
STATE: "STATE";
|
|
28
|
+
ZIP_CODE: "ZIP_CODE";
|
|
29
|
+
EMAIL: "EMAIL";
|
|
30
|
+
PHONE: "PHONE";
|
|
31
|
+
CREDIT_CARD: "CREDIT_CARD";
|
|
32
|
+
BANK_ACCOUNT: "BANK_ACCOUNT";
|
|
33
|
+
ROUTING_NUMBER: "ROUTING_NUMBER";
|
|
34
|
+
IP_ADDRESS: "IP_ADDRESS";
|
|
35
|
+
URL: "URL";
|
|
36
|
+
GOVERNMENT_ID: "GOVERNMENT_ID";
|
|
37
|
+
PASSPORT: "PASSPORT";
|
|
38
|
+
DRIVERS_LICENSE: "DRIVERS_LICENSE";
|
|
39
|
+
TAX_ID: "TAX_ID";
|
|
40
|
+
SSN: "SSN";
|
|
41
|
+
IMEI: "IMEI";
|
|
42
|
+
ORG: "ORG";
|
|
43
|
+
}>;
|
|
44
|
+
export type RedactionLabel = z.infer<typeof redactionLabelSchema>;
|
|
45
|
+
/**
|
|
46
|
+
* How much to mask.
|
|
47
|
+
*
|
|
48
|
+
* A mode is all a caller needs; `labels` exists for the rare case where one
|
|
49
|
+
* specific category matters and the rest do not.
|
|
50
|
+
*
|
|
51
|
+
* | mode | masks |
|
|
52
|
+
* | ------------ | -------------------------------------------------- |
|
|
53
|
+
* | `off` | nothing |
|
|
54
|
+
* | `structured` | only checksum-validated identifiers |
|
|
55
|
+
* | `standard` | every personal category |
|
|
56
|
+
* | `strict` | every category, including the company someone works for |
|
|
57
|
+
*
|
|
58
|
+
* `structured` is the only mode whose detections are all checksum-validated —
|
|
59
|
+
* cards against Luhn, IBANs against ISO-13616, national IDs against their own
|
|
60
|
+
* country's rule. Nothing in it depends on the model guessing, and the agent
|
|
61
|
+
* still sees names, so it still works normally.
|
|
62
|
+
*
|
|
63
|
+
* `standard` is the one to reach for: it covers everything that identifies a
|
|
64
|
+
* person. `strict` adds `ORG`, which is a company rather than a person, so it
|
|
65
|
+
* is separate rather than included by default.
|
|
66
|
+
*/
|
|
67
|
+
export declare const redactionModeSchema: z.ZodEnum<{
|
|
68
|
+
standard: "standard";
|
|
69
|
+
off: "off";
|
|
70
|
+
structured: "structured";
|
|
71
|
+
strict: "strict";
|
|
72
|
+
}>;
|
|
73
|
+
export type RedactionMode = z.infer<typeof redactionModeSchema>;
|
|
74
|
+
/** Deterministic labels: every one of these has to pass a real checksum. */
|
|
75
|
+
export declare const STRUCTURED_LABELS: readonly RedactionLabel[];
|
|
76
|
+
/** Everything a person is, excluding the company they work for. */
|
|
77
|
+
export declare const STANDARD_LABELS: readonly RedactionLabel[];
|
|
78
|
+
export declare const STRICT_LABELS: readonly RedactionLabel[];
|
|
79
|
+
/** The labels a mode masks. `labels` on the policy overrides this. */
|
|
80
|
+
export declare function labelsForMode(mode: RedactionMode): readonly RedactionLabel[];
|
|
81
|
+
/** How long a reversible map is kept before it is destroyed. */
|
|
82
|
+
export declare const retentionSchema: z.ZodEnum<{
|
|
83
|
+
"1h": "1h";
|
|
84
|
+
"24h": "24h";
|
|
85
|
+
"7d": "7d";
|
|
86
|
+
"30d": "30d";
|
|
87
|
+
}>;
|
|
88
|
+
export type Retention = z.infer<typeof retentionSchema>;
|
|
89
|
+
export declare const RETENTION_MS: Record<Retention, number>;
|
|
90
|
+
/**
|
|
91
|
+
* A version's redaction policy.
|
|
92
|
+
*
|
|
93
|
+
* Lives on the version rather than the agent, so it is immutable, hashed into
|
|
94
|
+
* the digest and pinned per run. Changing it is a new version, exactly like
|
|
95
|
+
* changing the instructions.
|
|
96
|
+
*/
|
|
97
|
+
export declare const redactionPolicySchema: z.ZodObject<{
|
|
98
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
99
|
+
standard: "standard";
|
|
100
|
+
off: "off";
|
|
101
|
+
structured: "structured";
|
|
102
|
+
strict: "strict";
|
|
103
|
+
}>>;
|
|
104
|
+
reversible: z.ZodDefault<z.ZodBoolean>;
|
|
105
|
+
minimum_confidence: z.ZodDefault<z.ZodNumber>;
|
|
106
|
+
labels: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
107
|
+
GIVEN_NAME: "GIVEN_NAME";
|
|
108
|
+
SURNAME: "SURNAME";
|
|
109
|
+
STREET_NAME: "STREET_NAME";
|
|
110
|
+
BUILDING_NUMBER: "BUILDING_NUMBER";
|
|
111
|
+
SECONDARY_ADDRESS: "SECONDARY_ADDRESS";
|
|
112
|
+
CITY: "CITY";
|
|
113
|
+
STATE: "STATE";
|
|
114
|
+
ZIP_CODE: "ZIP_CODE";
|
|
115
|
+
EMAIL: "EMAIL";
|
|
116
|
+
PHONE: "PHONE";
|
|
117
|
+
CREDIT_CARD: "CREDIT_CARD";
|
|
118
|
+
BANK_ACCOUNT: "BANK_ACCOUNT";
|
|
119
|
+
ROUTING_NUMBER: "ROUTING_NUMBER";
|
|
120
|
+
IP_ADDRESS: "IP_ADDRESS";
|
|
121
|
+
URL: "URL";
|
|
122
|
+
GOVERNMENT_ID: "GOVERNMENT_ID";
|
|
123
|
+
PASSPORT: "PASSPORT";
|
|
124
|
+
DRIVERS_LICENSE: "DRIVERS_LICENSE";
|
|
125
|
+
TAX_ID: "TAX_ID";
|
|
126
|
+
SSN: "SSN";
|
|
127
|
+
IMEI: "IMEI";
|
|
128
|
+
ORG: "ORG";
|
|
129
|
+
}>>>;
|
|
130
|
+
retain_for: z.ZodDefault<z.ZodEnum<{
|
|
131
|
+
"1h": "1h";
|
|
132
|
+
"24h": "24h";
|
|
133
|
+
"7d": "7d";
|
|
134
|
+
"30d": "30d";
|
|
135
|
+
}>>;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
export type RedactionPolicy = z.infer<typeof redactionPolicySchema>;
|
|
138
|
+
export declare const REDACTION_OFF: RedactionPolicy;
|
|
139
|
+
/**
|
|
140
|
+
* What a run reports about its own redaction.
|
|
141
|
+
*
|
|
142
|
+
* Counts per label, never the values: the masked values are the personal data
|
|
143
|
+
* that was just removed, and storing them beside the masked copy would produce
|
|
144
|
+
* a labelled index of every sensitive item in the run.
|
|
145
|
+
*/
|
|
146
|
+
export declare const redactionSummarySchema: z.ZodObject<{
|
|
147
|
+
mode: z.ZodEnum<{
|
|
148
|
+
standard: "standard";
|
|
149
|
+
off: "off";
|
|
150
|
+
structured: "structured";
|
|
151
|
+
strict: "strict";
|
|
152
|
+
}>;
|
|
153
|
+
reversible: z.ZodBoolean;
|
|
154
|
+
counts: z.ZodRecord<z.ZodEnum<{
|
|
155
|
+
GIVEN_NAME: "GIVEN_NAME";
|
|
156
|
+
SURNAME: "SURNAME";
|
|
157
|
+
STREET_NAME: "STREET_NAME";
|
|
158
|
+
BUILDING_NUMBER: "BUILDING_NUMBER";
|
|
159
|
+
SECONDARY_ADDRESS: "SECONDARY_ADDRESS";
|
|
160
|
+
CITY: "CITY";
|
|
161
|
+
STATE: "STATE";
|
|
162
|
+
ZIP_CODE: "ZIP_CODE";
|
|
163
|
+
EMAIL: "EMAIL";
|
|
164
|
+
PHONE: "PHONE";
|
|
165
|
+
CREDIT_CARD: "CREDIT_CARD";
|
|
166
|
+
BANK_ACCOUNT: "BANK_ACCOUNT";
|
|
167
|
+
ROUTING_NUMBER: "ROUTING_NUMBER";
|
|
168
|
+
IP_ADDRESS: "IP_ADDRESS";
|
|
169
|
+
URL: "URL";
|
|
170
|
+
GOVERNMENT_ID: "GOVERNMENT_ID";
|
|
171
|
+
PASSPORT: "PASSPORT";
|
|
172
|
+
DRIVERS_LICENSE: "DRIVERS_LICENSE";
|
|
173
|
+
TAX_ID: "TAX_ID";
|
|
174
|
+
SSN: "SSN";
|
|
175
|
+
IMEI: "IMEI";
|
|
176
|
+
ORG: "ORG";
|
|
177
|
+
}>, z.ZodNumber>;
|
|
178
|
+
item_count: z.ZodNumber;
|
|
179
|
+
expires_at: z.ZodNullable<z.ZodString>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
export type RedactionSummary = z.infer<typeof redactionSummarySchema>;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redactionSummarySchema = exports.REDACTION_OFF = exports.redactionPolicySchema = exports.RETENTION_MS = exports.retentionSchema = exports.STRICT_LABELS = exports.STANDARD_LABELS = exports.STRUCTURED_LABELS = exports.redactionModeSchema = exports.redactionLabelSchema = void 0;
|
|
4
|
+
exports.labelsForMode = labelsForMode;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
/**
|
|
7
|
+
* Redaction.
|
|
8
|
+
*
|
|
9
|
+
* Personal data is masked in Nixet before a run is dispatched, so the runtime
|
|
10
|
+
* and the model provider receive `[GIVEN_NAME_1]` where a name was. When the
|
|
11
|
+
* policy is reversible the map is sealed in the vault and the reply is restored
|
|
12
|
+
* on the way back out, so the caller still reads a normal answer.
|
|
13
|
+
*
|
|
14
|
+
* Scope is deliberately narrow: run input and output only. Tool arguments and
|
|
15
|
+
* results recorded in the trace are **not** redacted, because the trace is what
|
|
16
|
+
* the product is for. Anything describing this feature has to say so.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Detection categories, as the model reports them.
|
|
20
|
+
*
|
|
21
|
+
* `ORG` is a company rather than a person, so it is excluded unless a caller
|
|
22
|
+
* asks for it. `IMEI` and the other structured labels are checksum-validated.
|
|
23
|
+
*/
|
|
24
|
+
exports.redactionLabelSchema = zod_1.z.enum([
|
|
25
|
+
"GIVEN_NAME",
|
|
26
|
+
"SURNAME",
|
|
27
|
+
"STREET_NAME",
|
|
28
|
+
"BUILDING_NUMBER",
|
|
29
|
+
"SECONDARY_ADDRESS",
|
|
30
|
+
"CITY",
|
|
31
|
+
"STATE",
|
|
32
|
+
"ZIP_CODE",
|
|
33
|
+
"EMAIL",
|
|
34
|
+
"PHONE",
|
|
35
|
+
"CREDIT_CARD",
|
|
36
|
+
"BANK_ACCOUNT",
|
|
37
|
+
"ROUTING_NUMBER",
|
|
38
|
+
"IP_ADDRESS",
|
|
39
|
+
"URL",
|
|
40
|
+
"GOVERNMENT_ID",
|
|
41
|
+
"PASSPORT",
|
|
42
|
+
"DRIVERS_LICENSE",
|
|
43
|
+
"TAX_ID",
|
|
44
|
+
"SSN",
|
|
45
|
+
"IMEI",
|
|
46
|
+
"ORG",
|
|
47
|
+
]);
|
|
48
|
+
/**
|
|
49
|
+
* How much to mask.
|
|
50
|
+
*
|
|
51
|
+
* A mode is all a caller needs; `labels` exists for the rare case where one
|
|
52
|
+
* specific category matters and the rest do not.
|
|
53
|
+
*
|
|
54
|
+
* | mode | masks |
|
|
55
|
+
* | ------------ | -------------------------------------------------- |
|
|
56
|
+
* | `off` | nothing |
|
|
57
|
+
* | `structured` | only checksum-validated identifiers |
|
|
58
|
+
* | `standard` | every personal category |
|
|
59
|
+
* | `strict` | every category, including the company someone works for |
|
|
60
|
+
*
|
|
61
|
+
* `structured` is the only mode whose detections are all checksum-validated —
|
|
62
|
+
* cards against Luhn, IBANs against ISO-13616, national IDs against their own
|
|
63
|
+
* country's rule. Nothing in it depends on the model guessing, and the agent
|
|
64
|
+
* still sees names, so it still works normally.
|
|
65
|
+
*
|
|
66
|
+
* `standard` is the one to reach for: it covers everything that identifies a
|
|
67
|
+
* person. `strict` adds `ORG`, which is a company rather than a person, so it
|
|
68
|
+
* is separate rather than included by default.
|
|
69
|
+
*/
|
|
70
|
+
exports.redactionModeSchema = zod_1.z.enum(["off", "structured", "standard", "strict"]);
|
|
71
|
+
/** Deterministic labels: every one of these has to pass a real checksum. */
|
|
72
|
+
exports.STRUCTURED_LABELS = [
|
|
73
|
+
"CREDIT_CARD",
|
|
74
|
+
"BANK_ACCOUNT",
|
|
75
|
+
"ROUTING_NUMBER",
|
|
76
|
+
"GOVERNMENT_ID",
|
|
77
|
+
"PASSPORT",
|
|
78
|
+
"DRIVERS_LICENSE",
|
|
79
|
+
"TAX_ID",
|
|
80
|
+
"SSN",
|
|
81
|
+
"IMEI",
|
|
82
|
+
];
|
|
83
|
+
/** Everything a person is, excluding the company they work for. */
|
|
84
|
+
exports.STANDARD_LABELS = exports.redactionLabelSchema.options.filter((label) => label !== "ORG");
|
|
85
|
+
exports.STRICT_LABELS = exports.redactionLabelSchema.options;
|
|
86
|
+
/** The labels a mode masks. `labels` on the policy overrides this. */
|
|
87
|
+
function labelsForMode(mode) {
|
|
88
|
+
if (mode === "structured")
|
|
89
|
+
return exports.STRUCTURED_LABELS;
|
|
90
|
+
if (mode === "standard")
|
|
91
|
+
return exports.STANDARD_LABELS;
|
|
92
|
+
if (mode === "strict")
|
|
93
|
+
return exports.STRICT_LABELS;
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
/** How long a reversible map is kept before it is destroyed. */
|
|
97
|
+
exports.retentionSchema = zod_1.z.enum(["1h", "24h", "7d", "30d"]);
|
|
98
|
+
exports.RETENTION_MS = {
|
|
99
|
+
"1h": 60 * 60 * 1000,
|
|
100
|
+
"24h": 24 * 60 * 60 * 1000,
|
|
101
|
+
"7d": 7 * 24 * 60 * 60 * 1000,
|
|
102
|
+
"30d": 30 * 24 * 60 * 60 * 1000,
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* A version's redaction policy.
|
|
106
|
+
*
|
|
107
|
+
* Lives on the version rather than the agent, so it is immutable, hashed into
|
|
108
|
+
* the digest and pinned per run. Changing it is a new version, exactly like
|
|
109
|
+
* changing the instructions.
|
|
110
|
+
*/
|
|
111
|
+
exports.redactionPolicySchema = zod_1.z
|
|
112
|
+
.object({
|
|
113
|
+
mode: exports.redactionModeSchema.default("off"),
|
|
114
|
+
/**
|
|
115
|
+
* Keep the placeholder map so the reply can be restored.
|
|
116
|
+
*
|
|
117
|
+
* Off by default. A reversible run stores the real values, encrypted, for
|
|
118
|
+
* as long as `retain_for`; an irreversible one keeps nothing, so there is
|
|
119
|
+
* nothing to leak and nothing to erase.
|
|
120
|
+
*/
|
|
121
|
+
reversible: zod_1.z.boolean().default(false),
|
|
122
|
+
/**
|
|
123
|
+
* Neural confidence floor, `0..1`.
|
|
124
|
+
*
|
|
125
|
+
* Only affects model-inferred labels such as names and cities. The
|
|
126
|
+
* structured labels are checksum-validated and always apply. Raise this to
|
|
127
|
+
* over-mask less; lowering it will not surface a detection the model did
|
|
128
|
+
* not make.
|
|
129
|
+
*/
|
|
130
|
+
minimum_confidence: zod_1.z.number().min(0).max(1).default(0.6),
|
|
131
|
+
/**
|
|
132
|
+
* Narrows the mode to these categories.
|
|
133
|
+
*
|
|
134
|
+
* Rarely needed: a mode already covers a sensible set. This is for the case
|
|
135
|
+
* where a caller wants cards masked and nothing else.
|
|
136
|
+
*/
|
|
137
|
+
labels: zod_1.z.array(exports.redactionLabelSchema).min(1).max(22).optional(),
|
|
138
|
+
retain_for: exports.retentionSchema.default("24h"),
|
|
139
|
+
})
|
|
140
|
+
.strict()
|
|
141
|
+
.refine((policy) => policy.mode !== "off" || !policy.reversible, {
|
|
142
|
+
message: "reversible requires a redaction mode other than off.",
|
|
143
|
+
path: ["reversible"],
|
|
144
|
+
});
|
|
145
|
+
exports.REDACTION_OFF = {
|
|
146
|
+
mode: "off",
|
|
147
|
+
reversible: false,
|
|
148
|
+
minimum_confidence: 0.6,
|
|
149
|
+
retain_for: "24h",
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* What a run reports about its own redaction.
|
|
153
|
+
*
|
|
154
|
+
* Counts per label, never the values: the masked values are the personal data
|
|
155
|
+
* that was just removed, and storing them beside the masked copy would produce
|
|
156
|
+
* a labelled index of every sensitive item in the run.
|
|
157
|
+
*/
|
|
158
|
+
exports.redactionSummarySchema = zod_1.z.object({
|
|
159
|
+
mode: exports.redactionModeSchema,
|
|
160
|
+
reversible: zod_1.z.boolean(),
|
|
161
|
+
/** Detections per label, e.g. `{ "EMAIL": 2, "GIVEN_NAME": 3 }`. */
|
|
162
|
+
counts: zod_1.z.record(exports.redactionLabelSchema, zod_1.z.number().int().positive()),
|
|
163
|
+
item_count: zod_1.z.number().int().nonnegative(),
|
|
164
|
+
/** When the stored map is destroyed. Null when the run kept none. */
|
|
165
|
+
expires_at: zod_1.z.string().nullable(),
|
|
166
|
+
});
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Runs and their event stream.
|
|
4
|
+
*
|
|
5
|
+
* A run is the durable record of one execution: which version produced it, what
|
|
6
|
+
* it returned, what it cost. Events are the live view of the same execution.
|
|
7
|
+
*/
|
|
8
|
+
export declare const runStatusSchema: z.ZodEnum<{
|
|
9
|
+
queued: "queued";
|
|
10
|
+
running: "running";
|
|
11
|
+
completed: "completed";
|
|
12
|
+
failed: "failed";
|
|
13
|
+
cancelled: "cancelled";
|
|
14
|
+
}>;
|
|
15
|
+
export type RunStatus = z.infer<typeof runStatusSchema>;
|
|
16
|
+
export declare const usageSchema: z.ZodObject<{
|
|
17
|
+
input_tokens: z.ZodNumber;
|
|
18
|
+
output_tokens: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type Usage = z.infer<typeof usageSchema>;
|
|
21
|
+
export declare const runSchema: z.ZodObject<{
|
|
22
|
+
id: z.ZodString;
|
|
23
|
+
agent_id: z.ZodString;
|
|
24
|
+
agent_version: z.ZodString;
|
|
25
|
+
variables: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
26
|
+
version_digest: z.ZodString;
|
|
27
|
+
status: z.ZodEnum<{
|
|
28
|
+
queued: "queued";
|
|
29
|
+
running: "running";
|
|
30
|
+
completed: "completed";
|
|
31
|
+
failed: "failed";
|
|
32
|
+
cancelled: "cancelled";
|
|
33
|
+
}>;
|
|
34
|
+
provider: z.ZodEnum<{
|
|
35
|
+
nix: "nix";
|
|
36
|
+
openai: "openai";
|
|
37
|
+
anthropic: "anthropic";
|
|
38
|
+
}>;
|
|
39
|
+
input: z.ZodString;
|
|
40
|
+
output: z.ZodNullable<z.ZodString>;
|
|
41
|
+
redaction: z.ZodNullable<z.ZodObject<{
|
|
42
|
+
mode: z.ZodEnum<{
|
|
43
|
+
standard: "standard";
|
|
44
|
+
off: "off";
|
|
45
|
+
structured: "structured";
|
|
46
|
+
strict: "strict";
|
|
47
|
+
}>;
|
|
48
|
+
reversible: z.ZodBoolean;
|
|
49
|
+
counts: z.ZodRecord<z.ZodEnum<{
|
|
50
|
+
GIVEN_NAME: "GIVEN_NAME";
|
|
51
|
+
SURNAME: "SURNAME";
|
|
52
|
+
STREET_NAME: "STREET_NAME";
|
|
53
|
+
BUILDING_NUMBER: "BUILDING_NUMBER";
|
|
54
|
+
SECONDARY_ADDRESS: "SECONDARY_ADDRESS";
|
|
55
|
+
CITY: "CITY";
|
|
56
|
+
STATE: "STATE";
|
|
57
|
+
ZIP_CODE: "ZIP_CODE";
|
|
58
|
+
EMAIL: "EMAIL";
|
|
59
|
+
PHONE: "PHONE";
|
|
60
|
+
CREDIT_CARD: "CREDIT_CARD";
|
|
61
|
+
BANK_ACCOUNT: "BANK_ACCOUNT";
|
|
62
|
+
ROUTING_NUMBER: "ROUTING_NUMBER";
|
|
63
|
+
IP_ADDRESS: "IP_ADDRESS";
|
|
64
|
+
URL: "URL";
|
|
65
|
+
GOVERNMENT_ID: "GOVERNMENT_ID";
|
|
66
|
+
PASSPORT: "PASSPORT";
|
|
67
|
+
DRIVERS_LICENSE: "DRIVERS_LICENSE";
|
|
68
|
+
TAX_ID: "TAX_ID";
|
|
69
|
+
SSN: "SSN";
|
|
70
|
+
IMEI: "IMEI";
|
|
71
|
+
ORG: "ORG";
|
|
72
|
+
}>, z.ZodNumber>;
|
|
73
|
+
item_count: z.ZodNumber;
|
|
74
|
+
expires_at: z.ZodNullable<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
error: z.ZodNullable<z.ZodString>;
|
|
77
|
+
usage: z.ZodNullable<z.ZodObject<{
|
|
78
|
+
input_tokens: z.ZodNumber;
|
|
79
|
+
output_tokens: z.ZodNumber;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
latency_ms: z.ZodNullable<z.ZodNumber>;
|
|
82
|
+
trace_id: z.ZodNullable<z.ZodString>;
|
|
83
|
+
cost_usd: z.ZodNullable<z.ZodNumber>;
|
|
84
|
+
session_id: z.ZodNullable<z.ZodString>;
|
|
85
|
+
created_at: z.ZodString;
|
|
86
|
+
completed_at: z.ZodNullable<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export type Run = z.infer<typeof runSchema>;
|
|
89
|
+
export declare const MAX_INPUT_LENGTH = 100000;
|
|
90
|
+
export declare const createRunSchema: z.ZodObject<{
|
|
91
|
+
agent_id: z.ZodString;
|
|
92
|
+
input: z.ZodString;
|
|
93
|
+
agent_version: z.ZodOptional<z.ZodString>;
|
|
94
|
+
provider: z.ZodOptional<z.ZodEnum<{
|
|
95
|
+
nix: "nix";
|
|
96
|
+
openai: "openai";
|
|
97
|
+
anthropic: "anthropic";
|
|
98
|
+
}>>;
|
|
99
|
+
session_id: z.ZodOptional<z.ZodString>;
|
|
100
|
+
stream: z.ZodDefault<z.ZodBoolean>;
|
|
101
|
+
conversation_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
user_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
mcp_servers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
104
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
105
|
+
history: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
106
|
+
role: z.ZodString;
|
|
107
|
+
content: z.ZodString;
|
|
108
|
+
}, z.core.$strip>>>;
|
|
109
|
+
memory: z.ZodOptional<z.ZodObject<{
|
|
110
|
+
conversation: z.ZodBoolean;
|
|
111
|
+
user: z.ZodBoolean;
|
|
112
|
+
agent: z.ZodBoolean;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
export type CreateRunRequest = z.infer<typeof createRunSchema>;
|
|
116
|
+
/**
|
|
117
|
+
* What a trace event describes.
|
|
118
|
+
*
|
|
119
|
+
* Coarser than the event type, so a timeline can be grouped or filtered without
|
|
120
|
+
* knowing every individual type. Adding a capability adds types within an
|
|
121
|
+
* existing category far more often than it adds a category.
|
|
122
|
+
*/
|
|
123
|
+
export declare const eventCategorySchema: z.ZodEnum<{
|
|
124
|
+
output: "output";
|
|
125
|
+
model: "model";
|
|
126
|
+
memory: "memory";
|
|
127
|
+
run: "run";
|
|
128
|
+
tool: "tool";
|
|
129
|
+
knowledge: "knowledge";
|
|
130
|
+
reasoning: "reasoning";
|
|
131
|
+
approval: "approval";
|
|
132
|
+
subagent: "subagent";
|
|
133
|
+
workflow: "workflow";
|
|
134
|
+
task: "task";
|
|
135
|
+
session: "session";
|
|
136
|
+
context: "context";
|
|
137
|
+
skill: "skill";
|
|
138
|
+
}>;
|
|
139
|
+
export type EventCategory = z.infer<typeof eventCategorySchema>;
|
|
140
|
+
/**
|
|
141
|
+
* Public event types.
|
|
142
|
+
*
|
|
143
|
+
* A stable surface mapped from the framework's much larger internal vocabulary,
|
|
144
|
+
* so the internals can change without breaking customers. Unmapped internal
|
|
145
|
+
* events are dropped rather than forwarded.
|
|
146
|
+
*/
|
|
147
|
+
export declare const runEventTypeSchema: z.ZodEnum<{
|
|
148
|
+
"run.started": "run.started";
|
|
149
|
+
"run.completed": "run.completed";
|
|
150
|
+
"run.failed": "run.failed";
|
|
151
|
+
"run.cancelled": "run.cancelled";
|
|
152
|
+
"run.paused": "run.paused";
|
|
153
|
+
"run.continued": "run.continued";
|
|
154
|
+
"run.output": "run.output";
|
|
155
|
+
"run.model.started": "run.model.started";
|
|
156
|
+
"run.model.completed": "run.model.completed";
|
|
157
|
+
"run.tool.started": "run.tool.started";
|
|
158
|
+
"run.tool.completed": "run.tool.completed";
|
|
159
|
+
"run.tool.failed": "run.tool.failed";
|
|
160
|
+
"run.knowledge.started": "run.knowledge.started";
|
|
161
|
+
"run.knowledge.completed": "run.knowledge.completed";
|
|
162
|
+
"run.memory.recall.started": "run.memory.recall.started";
|
|
163
|
+
"run.memory.recall.completed": "run.memory.recall.completed";
|
|
164
|
+
"run.memory.update.started": "run.memory.update.started";
|
|
165
|
+
"run.memory.update.completed": "run.memory.update.completed";
|
|
166
|
+
"run.reasoning.started": "run.reasoning.started";
|
|
167
|
+
"run.reasoning.completed": "run.reasoning.completed";
|
|
168
|
+
"run.subagent.spawned": "run.subagent.spawned";
|
|
169
|
+
"run.subagent.completed": "run.subagent.completed";
|
|
170
|
+
"run.subagent.failed": "run.subagent.failed";
|
|
171
|
+
"run.subagent.killed": "run.subagent.killed";
|
|
172
|
+
"run.workflow.step.started": "run.workflow.step.started";
|
|
173
|
+
"run.workflow.step.completed": "run.workflow.step.completed";
|
|
174
|
+
"run.workflow.step.failed": "run.workflow.step.failed";
|
|
175
|
+
"run.workflow.step.skipped": "run.workflow.step.skipped";
|
|
176
|
+
"run.task.created": "run.task.created";
|
|
177
|
+
"run.task.status": "run.task.status";
|
|
178
|
+
"run.session.summarised": "run.session.summarised";
|
|
179
|
+
"run.context.compressed": "run.context.compressed";
|
|
180
|
+
"run.skill.loaded": "run.skill.loaded";
|
|
181
|
+
}>;
|
|
182
|
+
export type RunEventType = z.infer<typeof runEventTypeSchema>;
|
|
183
|
+
/** Where a tool came from: `agent`, or `skill:<name>` if a skill supplied it. */
|
|
184
|
+
export declare const TOOL_SOURCE_AGENT = "agent";
|
|
185
|
+
export declare const skillToolSource: (name: string) => string;
|
|
186
|
+
/** Token counts for one span, where the provider reports them. */
|
|
187
|
+
export declare const eventTokensSchema: z.ZodObject<{
|
|
188
|
+
input: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
output: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
cache_read: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
reasoning: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
export declare const runEventSchema: z.ZodObject<{
|
|
194
|
+
sequence: z.ZodNumber;
|
|
195
|
+
type: z.ZodEnum<{
|
|
196
|
+
"run.started": "run.started";
|
|
197
|
+
"run.completed": "run.completed";
|
|
198
|
+
"run.failed": "run.failed";
|
|
199
|
+
"run.cancelled": "run.cancelled";
|
|
200
|
+
"run.paused": "run.paused";
|
|
201
|
+
"run.continued": "run.continued";
|
|
202
|
+
"run.output": "run.output";
|
|
203
|
+
"run.model.started": "run.model.started";
|
|
204
|
+
"run.model.completed": "run.model.completed";
|
|
205
|
+
"run.tool.started": "run.tool.started";
|
|
206
|
+
"run.tool.completed": "run.tool.completed";
|
|
207
|
+
"run.tool.failed": "run.tool.failed";
|
|
208
|
+
"run.knowledge.started": "run.knowledge.started";
|
|
209
|
+
"run.knowledge.completed": "run.knowledge.completed";
|
|
210
|
+
"run.memory.recall.started": "run.memory.recall.started";
|
|
211
|
+
"run.memory.recall.completed": "run.memory.recall.completed";
|
|
212
|
+
"run.memory.update.started": "run.memory.update.started";
|
|
213
|
+
"run.memory.update.completed": "run.memory.update.completed";
|
|
214
|
+
"run.reasoning.started": "run.reasoning.started";
|
|
215
|
+
"run.reasoning.completed": "run.reasoning.completed";
|
|
216
|
+
"run.subagent.spawned": "run.subagent.spawned";
|
|
217
|
+
"run.subagent.completed": "run.subagent.completed";
|
|
218
|
+
"run.subagent.failed": "run.subagent.failed";
|
|
219
|
+
"run.subagent.killed": "run.subagent.killed";
|
|
220
|
+
"run.workflow.step.started": "run.workflow.step.started";
|
|
221
|
+
"run.workflow.step.completed": "run.workflow.step.completed";
|
|
222
|
+
"run.workflow.step.failed": "run.workflow.step.failed";
|
|
223
|
+
"run.workflow.step.skipped": "run.workflow.step.skipped";
|
|
224
|
+
"run.task.created": "run.task.created";
|
|
225
|
+
"run.task.status": "run.task.status";
|
|
226
|
+
"run.session.summarised": "run.session.summarised";
|
|
227
|
+
"run.context.compressed": "run.context.compressed";
|
|
228
|
+
"run.skill.loaded": "run.skill.loaded";
|
|
229
|
+
}>;
|
|
230
|
+
category: z.ZodEnum<{
|
|
231
|
+
output: "output";
|
|
232
|
+
model: "model";
|
|
233
|
+
memory: "memory";
|
|
234
|
+
run: "run";
|
|
235
|
+
tool: "tool";
|
|
236
|
+
knowledge: "knowledge";
|
|
237
|
+
reasoning: "reasoning";
|
|
238
|
+
approval: "approval";
|
|
239
|
+
subagent: "subagent";
|
|
240
|
+
workflow: "workflow";
|
|
241
|
+
task: "task";
|
|
242
|
+
session: "session";
|
|
243
|
+
context: "context";
|
|
244
|
+
skill: "skill";
|
|
245
|
+
}>;
|
|
246
|
+
run_id: z.ZodString;
|
|
247
|
+
data: z.ZodNullable<z.ZodString>;
|
|
248
|
+
payload: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
249
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
250
|
+
tokens: z.ZodNullable<z.ZodObject<{
|
|
251
|
+
input: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
output: z.ZodOptional<z.ZodNumber>;
|
|
253
|
+
cache_read: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
reasoning: z.ZodOptional<z.ZodNumber>;
|
|
255
|
+
}, z.core.$strip>>;
|
|
256
|
+
cost_usd: z.ZodNullable<z.ZodNumber>;
|
|
257
|
+
parent_event_id: z.ZodNullable<z.ZodString>;
|
|
258
|
+
created_at: z.ZodString;
|
|
259
|
+
}, z.core.$strip>;
|
|
260
|
+
export type RunEvent = z.infer<typeof runEventSchema>;
|