@opengeni/contracts 1.0.1 → 2.2.0-canary.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/agent-authored-durable-text.d.ts +64 -0
- package/dist/atlassian.d.ts +1 -0
- package/dist/atlassian.js +14 -13
- package/dist/{chunk-Y3MLSLB4.js → chunk-3SIZGL3O.js} +42 -30
- package/dist/chunk-3SIZGL3O.js.map +1 -0
- package/dist/{chunk-JBCIY7QD.js → chunk-7RMTKFJW.js} +45 -22
- package/dist/chunk-7RMTKFJW.js.map +1 -0
- package/dist/{chunk-NX5JNF4L.js → chunk-7ZZ3R27P.js} +9322 -5798
- package/dist/chunk-7ZZ3R27P.js.map +1 -0
- package/dist/{chunk-5UDNP7AO.js → chunk-MRWYRAS5.js} +56 -8
- package/dist/chunk-MRWYRAS5.js.map +1 -0
- package/dist/{chunk-LW7OH6CS.js → chunk-N6GRVXAJ.js} +6 -5
- package/dist/chunk-N6GRVXAJ.js.map +1 -0
- package/dist/{chunk-TZ6YEYN4.js → chunk-NVJMJWLL.js} +3 -1
- package/dist/chunk-NVJMJWLL.js.map +1 -0
- package/dist/chunk-PX3VCKAU.js +29 -0
- package/dist/chunk-PX3VCKAU.js.map +1 -0
- package/dist/{chunk-LSB7GRLG.js → chunk-TXTQIYCV.js} +15 -11
- package/dist/chunk-TXTQIYCV.js.map +1 -0
- package/dist/{chunk-CADSX6UN.js → chunk-Y3KNXVTD.js} +2 -2
- package/dist/chunk-YBW5JSA3.js +251 -0
- package/dist/chunk-YBW5JSA3.js.map +1 -0
- package/dist/company-brain-governed-writes.d.ts +475 -0
- package/dist/company-brain.d.ts +398 -0
- package/dist/company-profile.d.ts +268 -0
- package/dist/connection-authority.d.ts +501 -0
- package/dist/connection-authority.js +364 -0
- package/dist/connection-authority.js.map +1 -0
- package/dist/connector-attachments.d.ts +95 -0
- package/dist/connector-attachments.js +51 -0
- package/dist/connector-attachments.js.map +1 -0
- package/dist/editable-artifact-codec-registry.d.ts +16 -7
- package/dist/editable-artifact-codec-registry.js +18 -8
- package/dist/editable-artifact-committed-transaction.d.ts +2 -2
- package/dist/editable-artifact-committed-transaction.js +2 -2
- package/dist/editable-artifact-live.d.ts +11 -12
- package/dist/editable-artifact-live.js +111 -46
- package/dist/editable-artifact-live.js.map +1 -1
- package/dist/editable-artifact-serialized-commit.d.ts +2 -1
- package/dist/editable-artifact-serialized-commit.js +9 -8
- package/dist/editable-artifact-versions.d.ts +20 -5
- package/dist/editable-artifact-versions.js +23 -5
- package/dist/editable-artifacts.d.ts +2 -0
- package/dist/editable-artifacts.js +51 -39
- package/dist/google-drive.d.ts +1 -0
- package/dist/google-drive.js +14 -13
- package/dist/google-drive.js.map +1 -1
- package/dist/governed-learning-activation.d.ts +154 -0
- package/dist/governed-learning-evaluator.d.ts +152 -0
- package/dist/index.d.ts +12224 -1328
- package/dist/index.js +831 -115
- package/dist/interaction.d.ts +68 -0
- package/dist/knowledge.d.ts +119 -0
- package/dist/organization-membership-lifecycle.d.ts +516 -0
- package/dist/permissions.d.ts +52 -0
- package/dist/personal-github.d.ts +319 -0
- package/dist/personal-github.js +209 -0
- package/dist/personal-github.js.map +1 -0
- package/dist/preference-registry.d.ts +17 -0
- package/dist/remember.d.ts +331 -0
- package/dist/sandbox-file-artifacts.d.ts +56 -0
- package/dist/sandbox-snapshots.d.ts +21 -0
- package/dist/slack-bot-scopes.d.ts +34 -14
- package/dist/slack-bot-scopes.js +5 -1
- package/dist/spreadsheet-artifact-commands.d.ts +2 -3
- package/dist/spreadsheet-artifact-commands.js +4 -2
- package/dist/spreadsheet-artifact-query.js +3 -2
- package/dist/task-notes.d.ts +42 -1
- package/dist/tool-result-spill.d.ts +16 -0
- package/dist/workspace-instruction-policies.d.ts +81 -0
- package/dist/workspace-learning-administration.d.ts +289 -0
- package/package.json +13 -1
- package/src/agent-authored-durable-text.ts +105 -0
- package/src/company-brain-governed-writes.ts +356 -0
- package/src/company-brain.ts +201 -0
- package/src/company-profile.ts +122 -1
- package/src/connection-authority.ts +413 -0
- package/src/connector-attachments.ts +327 -0
- package/src/editable-artifact-codec-registry.ts +55 -17
- package/src/editable-artifact-committed-transaction.ts +44 -31
- package/src/editable-artifact-live.ts +123 -57
- package/src/editable-artifact-serialized-commit.ts +2 -1
- package/src/editable-artifact-versions.ts +26 -5
- package/src/editable-artifacts.ts +2 -0
- package/src/governed-learning-activation.ts +191 -0
- package/src/governed-learning-evaluator.ts +176 -0
- package/src/index.ts +3033 -392
- package/src/interaction.ts +55 -1
- package/src/knowledge.ts +118 -6
- package/src/organization-membership-lifecycle.ts +330 -0
- package/src/permissions.ts +55 -0
- package/src/personal-github.ts +267 -0
- package/src/preference-registry.ts +17 -0
- package/src/remember.ts +242 -0
- package/src/sandbox-file-artifacts.ts +65 -0
- package/src/sandbox-snapshots.ts +78 -0
- package/src/slack-bot-scopes.ts +81 -9
- package/src/spreadsheet-artifact-commands.ts +12 -13
- package/src/task-notes.ts +14 -1
- package/src/tool-result-spill.ts +35 -0
- package/src/workspace-instruction-policies.ts +30 -0
- package/src/workspace-learning-administration.ts +88 -0
- package/dist/chunk-5UDNP7AO.js.map +0 -1
- package/dist/chunk-BVGIYW7D.js +0 -11
- package/dist/chunk-BVGIYW7D.js.map +0 -1
- package/dist/chunk-JBCIY7QD.js.map +0 -1
- package/dist/chunk-LSB7GRLG.js.map +0 -1
- package/dist/chunk-LW7OH6CS.js.map +0 -1
- package/dist/chunk-NX5JNF4L.js.map +0 -1
- package/dist/chunk-TZ6YEYN4.js.map +0 -1
- package/dist/chunk-Y3MLSLB4.js.map +0 -1
- /package/dist/{chunk-CADSX6UN.js.map → chunk-Y3KNXVTD.js.map} +0 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_MAX_CHARS,
|
|
4
|
+
AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_TOO_LONG_MESSAGE,
|
|
5
|
+
AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS,
|
|
6
|
+
AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE,
|
|
7
|
+
} from "./agent-authored-durable-text";
|
|
8
|
+
import {
|
|
9
|
+
PREFERENCE_REGISTRY_DESCRIPTOR_DESCRIPTION_MAX_CHARS,
|
|
10
|
+
PREFERENCE_REGISTRY_STABLE_KEY_MAX_CHARS,
|
|
11
|
+
PREFERENCE_REGISTRY_TITLE_MAX_CHARS,
|
|
12
|
+
PreferenceRegistryConflictStrategy,
|
|
13
|
+
PreferenceRegistryStableKey,
|
|
14
|
+
} from "./preference-registry";
|
|
15
|
+
import { GovernedLearningActivationDestination } from "./governed-learning-activation";
|
|
16
|
+
import {
|
|
17
|
+
GovernedLearningDecisionOutcome,
|
|
18
|
+
GovernedLearningDecisionReason,
|
|
19
|
+
} from "./governed-learning-evaluator";
|
|
20
|
+
import { WorkspaceInstructionPolicyTarget } from "./workspace-instruction-policies";
|
|
21
|
+
import { WorkspaceLearningPolicyEffectiveMode } from "./workspace-learning-policy";
|
|
22
|
+
|
|
23
|
+
const boundedReason = z.string().trim().min(1).max(4_096);
|
|
24
|
+
const operationId = z.string().uuid();
|
|
25
|
+
const exactEvidence = {
|
|
26
|
+
claimId: z.string().uuid(),
|
|
27
|
+
evidenceId: z.string().uuid(),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** Exact accepted-attempt authority. It is validated again inside the write transaction. */
|
|
31
|
+
export const CompanyBrainGovernedWriteAttempt = z
|
|
32
|
+
.object({
|
|
33
|
+
accountId: z.string().uuid(),
|
|
34
|
+
workspaceId: z.string().uuid(),
|
|
35
|
+
sessionId: z.string().uuid(),
|
|
36
|
+
turnId: z.string().uuid(),
|
|
37
|
+
attemptId: z.string().uuid(),
|
|
38
|
+
executionGeneration: z.number().int().positive(),
|
|
39
|
+
})
|
|
40
|
+
.strict();
|
|
41
|
+
export type CompanyBrainGovernedWriteAttempt = z.infer<typeof CompanyBrainGovernedWriteAttempt>;
|
|
42
|
+
|
|
43
|
+
export const ProposeWorkspaceKnowledgeClaimRequest = z
|
|
44
|
+
.object({
|
|
45
|
+
kind: z.literal("propose_knowledge"),
|
|
46
|
+
operationId,
|
|
47
|
+
...exactEvidence,
|
|
48
|
+
reason: boundedReason,
|
|
49
|
+
})
|
|
50
|
+
.strict();
|
|
51
|
+
export type ProposeWorkspaceKnowledgeClaimRequest = z.infer<
|
|
52
|
+
typeof ProposeWorkspaceKnowledgeClaimRequest
|
|
53
|
+
>;
|
|
54
|
+
|
|
55
|
+
export const CorrectWorkspaceKnowledgeClaimRequest = z
|
|
56
|
+
.object({
|
|
57
|
+
kind: z.literal("correct_knowledge"),
|
|
58
|
+
operationId,
|
|
59
|
+
...exactEvidence,
|
|
60
|
+
replacesClaimId: z.string().uuid(),
|
|
61
|
+
reason: boundedReason,
|
|
62
|
+
})
|
|
63
|
+
.strict();
|
|
64
|
+
export type CorrectWorkspaceKnowledgeClaimRequest = z.infer<
|
|
65
|
+
typeof CorrectWorkspaceKnowledgeClaimRequest
|
|
66
|
+
>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Promote one still-active task-tree note into a normalized, workspace-local
|
|
70
|
+
* Knowledge claim proposal. The note text is the exact fact value and source
|
|
71
|
+
* evidence; callers may describe the subject and predicate but cannot widen
|
|
72
|
+
* authority or supply replacement source bytes.
|
|
73
|
+
*/
|
|
74
|
+
export const PromoteTaskNoteKnowledgeRequest = z
|
|
75
|
+
.object({
|
|
76
|
+
kind: z.literal("promote_task_note_knowledge"),
|
|
77
|
+
operationId,
|
|
78
|
+
noteId: z.string().uuid(),
|
|
79
|
+
expectedNoteVersion: z.literal(1),
|
|
80
|
+
entityType: z
|
|
81
|
+
.string()
|
|
82
|
+
.trim()
|
|
83
|
+
.min(1)
|
|
84
|
+
.max(96)
|
|
85
|
+
.regex(/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/),
|
|
86
|
+
normalizedKey: z.string().trim().min(1).max(512),
|
|
87
|
+
displayName: z.string().trim().min(1).max(512),
|
|
88
|
+
predicateKey: z
|
|
89
|
+
.string()
|
|
90
|
+
.trim()
|
|
91
|
+
.min(1)
|
|
92
|
+
.max(128)
|
|
93
|
+
.regex(/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/),
|
|
94
|
+
confidenceBps: z.number().int().min(0).max(10_000),
|
|
95
|
+
reason: boundedReason,
|
|
96
|
+
})
|
|
97
|
+
.strict();
|
|
98
|
+
export type PromoteTaskNoteKnowledgeRequest = z.infer<typeof PromoteTaskNoteKnowledgeRequest>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Promote the exact immutable Task-note bytes into an inactive mandatory-rule
|
|
102
|
+
* draft. The caller selects only the governed target and active-head baseline;
|
|
103
|
+
* it cannot replace the source content or activate the draft.
|
|
104
|
+
*/
|
|
105
|
+
export const PromoteTaskNoteInstructionPolicyRequest = z
|
|
106
|
+
.strictObject({
|
|
107
|
+
kind: z.literal("promote_task_note_instruction_policy"),
|
|
108
|
+
operationId,
|
|
109
|
+
noteId: z.string().uuid(),
|
|
110
|
+
expectedNoteVersion: z.literal(1),
|
|
111
|
+
entityType: z
|
|
112
|
+
.string()
|
|
113
|
+
.trim()
|
|
114
|
+
.min(1)
|
|
115
|
+
.max(96)
|
|
116
|
+
.regex(/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/),
|
|
117
|
+
normalizedKey: z.string().trim().min(1).max(512),
|
|
118
|
+
displayName: z.string().trim().min(1).max(512),
|
|
119
|
+
predicateKey: z
|
|
120
|
+
.string()
|
|
121
|
+
.trim()
|
|
122
|
+
.min(1)
|
|
123
|
+
.max(128)
|
|
124
|
+
.regex(/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/),
|
|
125
|
+
confidenceBps: z.number().int().min(0).max(10_000),
|
|
126
|
+
target: WorkspaceInstructionPolicyTarget,
|
|
127
|
+
expectedCurrentRevisionId: z.string().uuid().nullable(),
|
|
128
|
+
expectedActivationVersion: z.number().int().nonnegative(),
|
|
129
|
+
reason: boundedReason,
|
|
130
|
+
})
|
|
131
|
+
.superRefine((value, context) => {
|
|
132
|
+
const target = WorkspaceInstructionPolicyTarget.safeParse(value.target);
|
|
133
|
+
if (!target.success) {
|
|
134
|
+
for (const issue of target.error.issues) {
|
|
135
|
+
context.addIssue({ ...issue, path: ["target", ...issue.path] });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
export type PromoteTaskNoteInstructionPolicyRequest = z.infer<
|
|
140
|
+
typeof PromoteTaskNoteInstructionPolicyRequest
|
|
141
|
+
>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Promote the exact immutable Task-note bytes into an inactive workspace
|
|
145
|
+
* preference proposal. Descriptor metadata is caller-supplied and bounded,
|
|
146
|
+
* while the full proposal content always comes from the admitted note.
|
|
147
|
+
*/
|
|
148
|
+
export const PromoteTaskNotePreferenceRequest = z.strictObject({
|
|
149
|
+
kind: z.literal("promote_task_note_preference"),
|
|
150
|
+
operationId,
|
|
151
|
+
noteId: z.string().uuid(),
|
|
152
|
+
expectedNoteVersion: z.literal(1),
|
|
153
|
+
entityType: z
|
|
154
|
+
.string()
|
|
155
|
+
.trim()
|
|
156
|
+
.min(1)
|
|
157
|
+
.max(96)
|
|
158
|
+
.regex(/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/),
|
|
159
|
+
normalizedKey: z.string().trim().min(1).max(512),
|
|
160
|
+
displayName: z.string().trim().min(1).max(512),
|
|
161
|
+
predicateKey: z
|
|
162
|
+
.string()
|
|
163
|
+
.trim()
|
|
164
|
+
.min(1)
|
|
165
|
+
.max(128)
|
|
166
|
+
.regex(/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/),
|
|
167
|
+
confidenceBps: z.number().int().min(0).max(10_000),
|
|
168
|
+
stableKey: PreferenceRegistryStableKey.max(PREFERENCE_REGISTRY_STABLE_KEY_MAX_CHARS),
|
|
169
|
+
title: z.string().trim().min(1).max(PREFERENCE_REGISTRY_TITLE_MAX_CHARS),
|
|
170
|
+
description: z.string().trim().min(1).max(PREFERENCE_REGISTRY_DESCRIPTOR_DESCRIPTION_MAX_CHARS),
|
|
171
|
+
precedenceRank: z.number().int().min(-1_000).max(1_000).default(0),
|
|
172
|
+
conflictStrategy: PreferenceRegistryConflictStrategy.default("override"),
|
|
173
|
+
conflictsWith: z.array(PreferenceRegistryStableKey).max(32).default([]),
|
|
174
|
+
expiresAt: z.string().datetime({ offset: true }).nullable().default(null),
|
|
175
|
+
reason: boundedReason,
|
|
176
|
+
});
|
|
177
|
+
export type PromoteTaskNotePreferenceRequest = z.infer<typeof PromoteTaskNotePreferenceRequest>;
|
|
178
|
+
|
|
179
|
+
export const ProposeWorkspaceInstructionPolicyRequest = z
|
|
180
|
+
.strictObject({
|
|
181
|
+
kind: z.literal("propose_instruction_policy"),
|
|
182
|
+
operationId,
|
|
183
|
+
...exactEvidence,
|
|
184
|
+
target: WorkspaceInstructionPolicyTarget,
|
|
185
|
+
// Agent-authored: this draft becomes prompt text in every session once a
|
|
186
|
+
// human activates it, so it is bounded far below the human editor limit.
|
|
187
|
+
content: z
|
|
188
|
+
.string()
|
|
189
|
+
.min(1)
|
|
190
|
+
.max(
|
|
191
|
+
AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_MAX_CHARS,
|
|
192
|
+
AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_TOO_LONG_MESSAGE,
|
|
193
|
+
)
|
|
194
|
+
.refine((value) => value.trim().length > 0, "instruction proposal must not be blank"),
|
|
195
|
+
expectedCurrentRevisionId: z.string().uuid().nullable(),
|
|
196
|
+
expectedActivationVersion: z.number().int().nonnegative(),
|
|
197
|
+
reason: boundedReason,
|
|
198
|
+
})
|
|
199
|
+
.superRefine((value, context) => {
|
|
200
|
+
const target = WorkspaceInstructionPolicyTarget.safeParse(value.target);
|
|
201
|
+
if (!target.success) {
|
|
202
|
+
for (const issue of target.error.issues) {
|
|
203
|
+
context.addIssue({ ...issue, path: ["target", ...issue.path] });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
export type ProposeWorkspaceInstructionPolicyRequest = z.infer<
|
|
208
|
+
typeof ProposeWorkspaceInstructionPolicyRequest
|
|
209
|
+
>;
|
|
210
|
+
|
|
211
|
+
export const ProposeWorkspacePreferenceRequest = z.strictObject({
|
|
212
|
+
kind: z.literal("propose_preference"),
|
|
213
|
+
operationId,
|
|
214
|
+
...exactEvidence,
|
|
215
|
+
stableKey: PreferenceRegistryStableKey.max(PREFERENCE_REGISTRY_STABLE_KEY_MAX_CHARS),
|
|
216
|
+
title: z.string().trim().min(1).max(PREFERENCE_REGISTRY_TITLE_MAX_CHARS),
|
|
217
|
+
description: z.string().trim().min(1).max(PREFERENCE_REGISTRY_DESCRIPTOR_DESCRIPTION_MAX_CHARS),
|
|
218
|
+
// Agent-authored: the descriptor pair is prompt-composed in every session and
|
|
219
|
+
// the content is retrieved on demand, so it stays short.
|
|
220
|
+
content: z
|
|
221
|
+
.string()
|
|
222
|
+
.min(1)
|
|
223
|
+
.max(
|
|
224
|
+
AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS,
|
|
225
|
+
AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE,
|
|
226
|
+
)
|
|
227
|
+
.refine((value) => value.trim().length > 0, "preference proposal must not be blank"),
|
|
228
|
+
precedenceRank: z.number().int().min(-1_000).max(1_000).default(0),
|
|
229
|
+
conflictStrategy: PreferenceRegistryConflictStrategy.default("override"),
|
|
230
|
+
conflictsWith: z.array(PreferenceRegistryStableKey).max(32).default([]),
|
|
231
|
+
expiresAt: z.string().datetime({ offset: true }).nullable().default(null),
|
|
232
|
+
reason: boundedReason,
|
|
233
|
+
});
|
|
234
|
+
export type ProposeWorkspacePreferenceRequest = z.infer<typeof ProposeWorkspacePreferenceRequest>;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Destination selection is explicit and structured. There is deliberately no
|
|
238
|
+
* generic "remember" operation, classifier, personal scope, or active authority.
|
|
239
|
+
*/
|
|
240
|
+
export const CompanyBrainGovernedWriteRequest = z.discriminatedUnion("kind", [
|
|
241
|
+
ProposeWorkspaceKnowledgeClaimRequest,
|
|
242
|
+
CorrectWorkspaceKnowledgeClaimRequest,
|
|
243
|
+
PromoteTaskNoteKnowledgeRequest,
|
|
244
|
+
PromoteTaskNoteInstructionPolicyRequest,
|
|
245
|
+
PromoteTaskNotePreferenceRequest,
|
|
246
|
+
ProposeWorkspaceInstructionPolicyRequest,
|
|
247
|
+
ProposeWorkspacePreferenceRequest,
|
|
248
|
+
]);
|
|
249
|
+
export type CompanyBrainGovernedWriteRequest = z.infer<typeof CompanyBrainGovernedWriteRequest>;
|
|
250
|
+
|
|
251
|
+
export const CompanyBrainGovernedWriteDestination = z.enum([
|
|
252
|
+
"knowledge",
|
|
253
|
+
"instruction_policy",
|
|
254
|
+
"preference",
|
|
255
|
+
]);
|
|
256
|
+
export type CompanyBrainGovernedWriteDestination = z.infer<
|
|
257
|
+
typeof CompanyBrainGovernedWriteDestination
|
|
258
|
+
>;
|
|
259
|
+
|
|
260
|
+
export const CompanyBrainGovernedWriteReceipt = z.object({
|
|
261
|
+
operationId,
|
|
262
|
+
inputHash: z.string().regex(/^[0-9a-f]{64}$/),
|
|
263
|
+
workspaceId: z.string().uuid(),
|
|
264
|
+
destination: CompanyBrainGovernedWriteDestination,
|
|
265
|
+
outcome: z.literal("proposed"),
|
|
266
|
+
claimId: z.string().uuid(),
|
|
267
|
+
evidenceId: z.string().uuid(),
|
|
268
|
+
relationId: z.string().uuid().nullable(),
|
|
269
|
+
reviewId: z.string().uuid().nullable(),
|
|
270
|
+
knowledgeChangeProposalId: z.string().uuid().nullable(),
|
|
271
|
+
destinationProposalId: z.string().uuid().nullable(),
|
|
272
|
+
destinationRevisionId: z.string().uuid().nullable(),
|
|
273
|
+
taskNoteSource: z
|
|
274
|
+
.object({
|
|
275
|
+
noteId: z.string().uuid(),
|
|
276
|
+
rootSessionId: z.string().uuid(),
|
|
277
|
+
noteVersion: z.literal(1),
|
|
278
|
+
textHash: z.string().regex(/^[0-9a-f]{64}$/),
|
|
279
|
+
})
|
|
280
|
+
.nullable()
|
|
281
|
+
.optional(),
|
|
282
|
+
effectiveBoundary: z.literal("human_review_required"),
|
|
283
|
+
rollback: z.object({
|
|
284
|
+
supported: z.literal(false),
|
|
285
|
+
mechanism: z.literal("not_applicable_proposal_only"),
|
|
286
|
+
}),
|
|
287
|
+
});
|
|
288
|
+
export type CompanyBrainGovernedWriteReceipt = z.infer<typeof CompanyBrainGovernedWriteReceipt>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Policy routing is deliberately separate from destination admission. The
|
|
292
|
+
* immutable accepted-attempt snapshot decides whether derived evidence may
|
|
293
|
+
* create a proposal; the destination still owns activation and rollback.
|
|
294
|
+
*/
|
|
295
|
+
export const CompanyBrainLearningPolicyDecision = z.enum([
|
|
296
|
+
"blocked",
|
|
297
|
+
"proposal_created",
|
|
298
|
+
"activation_requested",
|
|
299
|
+
"activated",
|
|
300
|
+
]);
|
|
301
|
+
export type CompanyBrainLearningPolicyDecision = z.infer<typeof CompanyBrainLearningPolicyDecision>;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Content-free summary of the governed-learning decision receipt recorded for
|
|
305
|
+
* a Ways-of-working proposal (instruction policy or preference). Knowledge
|
|
306
|
+
* destinations create no `knowledge_change_proposals` row and are therefore
|
|
307
|
+
* never evaluated; they report `null`.
|
|
308
|
+
*/
|
|
309
|
+
export const CompanyBrainLearningDecisionSummary = z.object({
|
|
310
|
+
receiptId: z.string().uuid(),
|
|
311
|
+
outcome: GovernedLearningDecisionOutcome,
|
|
312
|
+
automaticEligible: z.boolean(),
|
|
313
|
+
reasons: z.array(GovernedLearningDecisionReason).max(16),
|
|
314
|
+
});
|
|
315
|
+
export type CompanyBrainLearningDecisionSummary = z.infer<
|
|
316
|
+
typeof CompanyBrainLearningDecisionSummary
|
|
317
|
+
>;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Bounded, content-free reason why evaluation or activation did not complete.
|
|
321
|
+
* The proposal write itself remains durable regardless.
|
|
322
|
+
*/
|
|
323
|
+
export const CompanyBrainLearningStepFailure = z.object({
|
|
324
|
+
stage: z.enum(["evaluation", "activation"]),
|
|
325
|
+
code: z.enum(["authority", "conflict", "invalid_operation", "unavailable"]),
|
|
326
|
+
});
|
|
327
|
+
export type CompanyBrainLearningStepFailure = z.infer<typeof CompanyBrainLearningStepFailure>;
|
|
328
|
+
|
|
329
|
+
export const CompanyBrainLearningPolicyRouteReceipt = z.object({
|
|
330
|
+
operationId,
|
|
331
|
+
workspaceId: z.string().uuid(),
|
|
332
|
+
effectivePolicy: WorkspaceLearningPolicyEffectiveMode,
|
|
333
|
+
decision: CompanyBrainLearningPolicyDecision,
|
|
334
|
+
write: CompanyBrainGovernedWriteReceipt.nullable(),
|
|
335
|
+
learning: CompanyBrainLearningDecisionSummary.nullable().default(null),
|
|
336
|
+
learningFailure: CompanyBrainLearningStepFailure.nullable().default(null),
|
|
337
|
+
activation: z.object({
|
|
338
|
+
requested: z.boolean(),
|
|
339
|
+
activated: z.boolean(),
|
|
340
|
+
boundary: z.enum([
|
|
341
|
+
"policy_off",
|
|
342
|
+
"human_review",
|
|
343
|
+
"destination_authority",
|
|
344
|
+
"not_eligible",
|
|
345
|
+
"human_activation_required",
|
|
346
|
+
"activated",
|
|
347
|
+
]),
|
|
348
|
+
receiptId: z.string().uuid().nullable().default(null),
|
|
349
|
+
destination: GovernedLearningActivationDestination.nullable().default(null),
|
|
350
|
+
destinationRevisionId: z.string().uuid().nullable().default(null),
|
|
351
|
+
effectiveAt: z.string().datetime().nullable().default(null),
|
|
352
|
+
}),
|
|
353
|
+
});
|
|
354
|
+
export type CompanyBrainLearningPolicyRouteReceipt = z.infer<
|
|
355
|
+
typeof CompanyBrainLearningPolicyRouteReceipt
|
|
356
|
+
>;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
import { WorkspaceStateKnowledge } from "./workspace-state";
|
|
4
|
+
|
|
5
|
+
export const COMPANY_BRAIN_OKF_SCHEMA_VERSION = 1 as const;
|
|
6
|
+
export const COMPANY_BRAIN_GUIDANCE_MAX_ENTRIES = 512;
|
|
7
|
+
export const COMPANY_BRAIN_GUIDANCE_CONTENT_MAX_CHARS = 262_144;
|
|
8
|
+
export const COMPANY_BRAIN_GUIDANCE_MAX_CONTENT_BYTES = 4 * 1024 * 1024;
|
|
9
|
+
export const COMPANY_BRAIN_INSPECTOR_DEFAULT_LIMIT = 20;
|
|
10
|
+
export const COMPANY_BRAIN_INSPECTOR_MAX_LIMIT = 50;
|
|
11
|
+
export const COMPANY_BRAIN_INSPECTOR_CURSOR_MAX_CHARS = 1_024;
|
|
12
|
+
export const COMPANY_BRAIN_PROPOSAL_CONTENT_MAX_BYTES = 16 * 1_024;
|
|
13
|
+
export const COMPANY_BRAIN_PROPOSAL_RESPONSE_MAX_BYTES = 64 * 1_024;
|
|
14
|
+
|
|
15
|
+
const utf8Bytes = (value: string): number => new TextEncoder().encode(value).byteLength;
|
|
16
|
+
const boundedUtf8 = (maxBytes: number) =>
|
|
17
|
+
z.string().superRefine((value, context) => {
|
|
18
|
+
if (utf8Bytes(value) > maxBytes) {
|
|
19
|
+
context.addIssue({
|
|
20
|
+
code: z.ZodIssueCode.custom,
|
|
21
|
+
message: `must be at most ${maxBytes} UTF-8 bytes`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const CompanyBrainContextReceipt = z
|
|
27
|
+
.object({
|
|
28
|
+
id: z.string().uuid(),
|
|
29
|
+
sessionId: z.string().uuid(),
|
|
30
|
+
rootSessionId: z.string().uuid(),
|
|
31
|
+
turnId: z.string().uuid(),
|
|
32
|
+
acceptedAt: z.string().datetime(),
|
|
33
|
+
createdAt: z.string().datetime(),
|
|
34
|
+
sessionRole: z.enum(["root", "child"]),
|
|
35
|
+
memoryEnabled: z.boolean(),
|
|
36
|
+
// Snapshots are immutable: a turn accepted before the standing block was
|
|
37
|
+
// retired recorded `legacy_standing` and still reads back that way. This
|
|
38
|
+
// is a historical fact about that turn, not a mode anyone can select.
|
|
39
|
+
memoryPromptMode: z.enum(["legacy_standing", "retrieval_only"]),
|
|
40
|
+
companyProfileIncluded: z.boolean(),
|
|
41
|
+
instructionPolicyEntryHash: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
42
|
+
preferenceDescriptorHash: z
|
|
43
|
+
.string()
|
|
44
|
+
.regex(/^[0-9a-f]{64}$/u)
|
|
45
|
+
.nullable(),
|
|
46
|
+
companyProfileSnapshotHash: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
47
|
+
turnContextSnapshotId: z.string().uuid(),
|
|
48
|
+
turnContextSnapshotHash: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
49
|
+
turnContextSnapshotSource: z.enum(["accepted_turn", "legacy_first_claim"]),
|
|
50
|
+
selectionHash: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
51
|
+
selectedMemoryCount: z.number().int().nonnegative().max(50),
|
|
52
|
+
renderedMemoryCount: z.number().int().nonnegative().max(50),
|
|
53
|
+
budgetOmittedMemoryCount: z.number().int().nonnegative().max(50),
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
export type CompanyBrainContextReceipt = z.infer<typeof CompanyBrainContextReceipt>;
|
|
57
|
+
|
|
58
|
+
export const CompanyBrainContextReceiptPage = z
|
|
59
|
+
.object({
|
|
60
|
+
receipts: z.array(CompanyBrainContextReceipt).max(COMPANY_BRAIN_INSPECTOR_MAX_LIMIT),
|
|
61
|
+
nextCursor: z.string().min(1).max(COMPANY_BRAIN_INSPECTOR_CURSOR_MAX_CHARS).nullable(),
|
|
62
|
+
hasMore: z.boolean(),
|
|
63
|
+
})
|
|
64
|
+
.strict();
|
|
65
|
+
export type CompanyBrainContextReceiptPage = z.infer<typeof CompanyBrainContextReceiptPage>;
|
|
66
|
+
|
|
67
|
+
export const CompanyBrainKnowledgeProposal = z
|
|
68
|
+
.object({
|
|
69
|
+
id: z.string().uuid(),
|
|
70
|
+
authority: z.object({ kind: z.enum(["organization", "workspace", "personal"]) }).strict(),
|
|
71
|
+
targetKind: z.enum(["instruction_policy", "preference"]),
|
|
72
|
+
targetScope: z.string().min(1).max(96),
|
|
73
|
+
targetKey: z.string().min(1).max(96).nullable(),
|
|
74
|
+
content: boundedUtf8(COMPANY_BRAIN_PROPOSAL_CONTENT_MAX_BYTES),
|
|
75
|
+
contentHash: z.string().regex(/^[0-9a-f]{64}$/u),
|
|
76
|
+
source: z.object({ claimId: z.string().uuid(), evidenceId: z.string().uuid() }).strict(),
|
|
77
|
+
status: z.literal("proposed"),
|
|
78
|
+
createdAt: z.string().datetime(),
|
|
79
|
+
projection: z
|
|
80
|
+
.object({
|
|
81
|
+
truncated: z.boolean(),
|
|
82
|
+
originalContentUtf8Bytes: z.number().int().nonnegative().max(1_048_576),
|
|
83
|
+
})
|
|
84
|
+
.strict(),
|
|
85
|
+
})
|
|
86
|
+
.strict();
|
|
87
|
+
export type CompanyBrainKnowledgeProposal = z.infer<typeof CompanyBrainKnowledgeProposal>;
|
|
88
|
+
|
|
89
|
+
export const CompanyBrainKnowledgeProposalPage = z
|
|
90
|
+
.object({
|
|
91
|
+
proposals: z.array(CompanyBrainKnowledgeProposal).max(COMPANY_BRAIN_INSPECTOR_MAX_LIMIT),
|
|
92
|
+
truncatedForCount: z.boolean(),
|
|
93
|
+
truncatedForResponseBytes: z.boolean(),
|
|
94
|
+
responseBytes: z.number().int().nonnegative().max(COMPANY_BRAIN_PROPOSAL_RESPONSE_MAX_BYTES),
|
|
95
|
+
})
|
|
96
|
+
.strict();
|
|
97
|
+
export type CompanyBrainKnowledgeProposalPage = z.infer<typeof CompanyBrainKnowledgeProposalPage>;
|
|
98
|
+
|
|
99
|
+
export const CompanyBrainGuidanceClassification = z.enum([
|
|
100
|
+
"company_profile",
|
|
101
|
+
"mandatory_rule",
|
|
102
|
+
"guide",
|
|
103
|
+
]);
|
|
104
|
+
export type CompanyBrainGuidanceClassification = z.infer<typeof CompanyBrainGuidanceClassification>;
|
|
105
|
+
|
|
106
|
+
export const CompanyBrainGuidanceScope = z.enum(["organization", "workspace", "personal"]);
|
|
107
|
+
export type CompanyBrainGuidanceScope = z.infer<typeof CompanyBrainGuidanceScope>;
|
|
108
|
+
|
|
109
|
+
export const CompanyBrainGuidanceLifecycle = z.enum([
|
|
110
|
+
"active",
|
|
111
|
+
"proposal",
|
|
112
|
+
"inactive",
|
|
113
|
+
"rejected",
|
|
114
|
+
"superseded",
|
|
115
|
+
"expired",
|
|
116
|
+
"historical",
|
|
117
|
+
]);
|
|
118
|
+
export type CompanyBrainGuidanceLifecycle = z.infer<typeof CompanyBrainGuidanceLifecycle>;
|
|
119
|
+
|
|
120
|
+
export const CompanyBrainGuidanceRelationship = z
|
|
121
|
+
.object({
|
|
122
|
+
type: z.enum(["corrects", "supersedes", "superseded_by"]),
|
|
123
|
+
targetId: z.string().min(1).max(512),
|
|
124
|
+
})
|
|
125
|
+
.strict();
|
|
126
|
+
export type CompanyBrainGuidanceRelationship = z.infer<typeof CompanyBrainGuidanceRelationship>;
|
|
127
|
+
|
|
128
|
+
export const CompanyBrainGuidanceEntry = z
|
|
129
|
+
.object({
|
|
130
|
+
id: z.string().min(1).max(512),
|
|
131
|
+
revisionId: z.string().uuid(),
|
|
132
|
+
path: z.string().min(1).max(512),
|
|
133
|
+
scope: CompanyBrainGuidanceScope,
|
|
134
|
+
classification: CompanyBrainGuidanceClassification,
|
|
135
|
+
title: z.string().min(1).max(160),
|
|
136
|
+
description: z.string().max(512).nullable(),
|
|
137
|
+
content: z.string().min(1).max(COMPANY_BRAIN_GUIDANCE_CONTENT_MAX_CHARS),
|
|
138
|
+
contentHash: z.string().regex(/^[0-9a-f]{64}$/),
|
|
139
|
+
revision: z.number().int().positive(),
|
|
140
|
+
active: z.boolean(),
|
|
141
|
+
lifecycle: CompanyBrainGuidanceLifecycle,
|
|
142
|
+
provenance: z
|
|
143
|
+
.object({
|
|
144
|
+
source: z.string().min(1).max(96),
|
|
145
|
+
sourceId: z.string().min(1).max(512).nullable(),
|
|
146
|
+
trust: z.string().min(1).max(96).nullable(),
|
|
147
|
+
})
|
|
148
|
+
.strict(),
|
|
149
|
+
relationships: z.array(CompanyBrainGuidanceRelationship).max(32),
|
|
150
|
+
createdAt: z.string().datetime(),
|
|
151
|
+
})
|
|
152
|
+
.strict();
|
|
153
|
+
export type CompanyBrainGuidanceEntry = z.infer<typeof CompanyBrainGuidanceEntry>;
|
|
154
|
+
|
|
155
|
+
export const CompanyBrainGuidanceTruncationReason = z.enum([
|
|
156
|
+
"company_profile_history",
|
|
157
|
+
"instruction_policy_history",
|
|
158
|
+
"preference_count",
|
|
159
|
+
"preference_history",
|
|
160
|
+
"aggregate_item_count",
|
|
161
|
+
"aggregate_content_bytes",
|
|
162
|
+
]);
|
|
163
|
+
export type CompanyBrainGuidanceTruncationReason = z.infer<
|
|
164
|
+
typeof CompanyBrainGuidanceTruncationReason
|
|
165
|
+
>;
|
|
166
|
+
|
|
167
|
+
export const CompanyBrainOkfPackage = z
|
|
168
|
+
.object({
|
|
169
|
+
kind: z.literal("opengeni.company_brain.okf"),
|
|
170
|
+
schemaVersion: z.literal(COMPANY_BRAIN_OKF_SCHEMA_VERSION),
|
|
171
|
+
workspaceId: z.string().uuid(),
|
|
172
|
+
generatedAt: z.string().datetime(),
|
|
173
|
+
permissions: z
|
|
174
|
+
.object({
|
|
175
|
+
guidance: z.literal("available"),
|
|
176
|
+
knowledge: z.enum(["available", "unavailable"]),
|
|
177
|
+
})
|
|
178
|
+
.strict(),
|
|
179
|
+
guidance: z
|
|
180
|
+
.object({
|
|
181
|
+
entries: z.array(CompanyBrainGuidanceEntry).max(COMPANY_BRAIN_GUIDANCE_MAX_ENTRIES),
|
|
182
|
+
truncated: z.boolean(),
|
|
183
|
+
truncationReasons: z.array(CompanyBrainGuidanceTruncationReason).max(6),
|
|
184
|
+
})
|
|
185
|
+
.strict(),
|
|
186
|
+
knowledge: WorkspaceStateKnowledge,
|
|
187
|
+
omissions: z
|
|
188
|
+
.array(
|
|
189
|
+
z.enum([
|
|
190
|
+
"inaccessible_knowledge",
|
|
191
|
+
"document_bodies_use_documents_export",
|
|
192
|
+
"memory_bodies_and_provenance",
|
|
193
|
+
"secret_values_and_credentials",
|
|
194
|
+
"session_messages_and_task_notes",
|
|
195
|
+
"policy_and_preference_actor_identifiers",
|
|
196
|
+
]),
|
|
197
|
+
)
|
|
198
|
+
.max(6),
|
|
199
|
+
})
|
|
200
|
+
.strict();
|
|
201
|
+
export type CompanyBrainOkfPackage = z.infer<typeof CompanyBrainOkfPackage>;
|
package/src/company-profile.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
AGENT_AUTHORED_COMPANY_PROFILE_CONTENT_MAX_UTF8_BYTES,
|
|
4
|
+
AGENT_AUTHORED_COMPANY_PROFILE_ENTRY_MAX_CHARS,
|
|
5
|
+
AGENT_AUTHORED_COMPANY_PROFILE_SCALAR_MAX_CHARS,
|
|
6
|
+
AGENT_AUTHORED_COMPANY_PROFILE_TOO_LONG_MESSAGE,
|
|
7
|
+
} from "./agent-authored-durable-text";
|
|
8
|
+
import { HumanInputQuestion } from "./index";
|
|
2
9
|
|
|
3
10
|
export const COMPANY_PROFILE_SCALAR_MAX_CHARS = 2_048;
|
|
4
11
|
export const COMPANY_PROFILE_ENTRY_MAX_CHARS = 1_024;
|
|
@@ -100,10 +107,56 @@ export const CompanyProfileContent = z
|
|
|
100
107
|
});
|
|
101
108
|
export type CompanyProfileContent = z.infer<typeof CompanyProfileContent>;
|
|
102
109
|
|
|
110
|
+
/**
|
|
111
|
+
* The same profile, bounded for an **agent** author. The human `account:admin`
|
|
112
|
+
* route keeps `CompanyProfileContent` and its wider limits; this is the shape
|
|
113
|
+
* the first-party `company_profile_propose` tool accepts, because the profile is
|
|
114
|
+
* the largest always-on prompt surface in the product and a model left to its
|
|
115
|
+
* own judgement fills every field to the ceiling.
|
|
116
|
+
*/
|
|
117
|
+
export const AgentAuthoredCompanyProfileContent = CompanyProfileContent.superRefine(
|
|
118
|
+
(value, context) => {
|
|
119
|
+
for (const field of ["identity", "mission"] as const) {
|
|
120
|
+
const scalar = value[field];
|
|
121
|
+
if (scalar !== null && scalar.length > AGENT_AUTHORED_COMPANY_PROFILE_SCALAR_MAX_CHARS) {
|
|
122
|
+
context.addIssue({
|
|
123
|
+
code: "custom",
|
|
124
|
+
path: [field],
|
|
125
|
+
message: `${field} is ${scalar.length} characters. ${AGENT_AUTHORED_COMPANY_PROFILE_TOO_LONG_MESSAGE}`,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
for (const field of ["products", "customers", "goals", "constraints"] as const) {
|
|
130
|
+
for (const [index, entry] of value[field].entries()) {
|
|
131
|
+
if (entry.content.length > AGENT_AUTHORED_COMPANY_PROFILE_ENTRY_MAX_CHARS) {
|
|
132
|
+
context.addIssue({
|
|
133
|
+
code: "custom",
|
|
134
|
+
path: [field, index, "content"],
|
|
135
|
+
message: `this entry is ${entry.content.length} characters. ${AGENT_AUTHORED_COMPANY_PROFILE_TOO_LONG_MESSAGE}`,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const contentBytes = new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
141
|
+
if (contentBytes > AGENT_AUTHORED_COMPANY_PROFILE_CONTENT_MAX_UTF8_BYTES) {
|
|
142
|
+
context.addIssue({
|
|
143
|
+
code: "custom",
|
|
144
|
+
message: `this profile is ${contentBytes} UTF-8 bytes. ${AGENT_AUTHORED_COMPANY_PROFILE_TOO_LONG_MESSAGE}`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
);
|
|
149
|
+
export type AgentAuthoredCompanyProfileContent = z.infer<typeof AgentAuthoredCompanyProfileContent>;
|
|
150
|
+
|
|
103
151
|
export const CompanyProfileRevisionIntent = z.enum(["active", "proposal"]);
|
|
104
152
|
export type CompanyProfileRevisionIntent = z.infer<typeof CompanyProfileRevisionIntent>;
|
|
105
153
|
|
|
106
|
-
export const CompanyProfileProvenanceSource = z.enum([
|
|
154
|
+
export const CompanyProfileProvenanceSource = z.enum([
|
|
155
|
+
"human",
|
|
156
|
+
"agent_admin",
|
|
157
|
+
"durable_learning",
|
|
158
|
+
"migration",
|
|
159
|
+
]);
|
|
107
160
|
export type CompanyProfileProvenanceSource = z.infer<typeof CompanyProfileProvenanceSource>;
|
|
108
161
|
|
|
109
162
|
export const CompanyProfilePrincipalKind = z.enum(["human_session", "agent_attempt", "service"]);
|
|
@@ -240,6 +293,74 @@ export const CompanyProfileMutationResponse = z.object({
|
|
|
240
293
|
});
|
|
241
294
|
export type CompanyProfileMutationResponse = z.infer<typeof CompanyProfileMutationResponse>;
|
|
242
295
|
|
|
296
|
+
export const COMPANY_PROFILE_AGENT_APPROVE_OPTION = "activate" as const;
|
|
297
|
+
export const COMPANY_PROFILE_AGENT_REJECT_OPTION = "skip" as const;
|
|
298
|
+
|
|
299
|
+
export const CompanyProfileAgentAttempt = z
|
|
300
|
+
.object({
|
|
301
|
+
accountId: z.string().uuid(),
|
|
302
|
+
workspaceId: z.string().uuid(),
|
|
303
|
+
sessionId: z.string().uuid(),
|
|
304
|
+
turnId: z.string().uuid(),
|
|
305
|
+
attemptId: z.string().uuid(),
|
|
306
|
+
executionGeneration: z.number().int().positive(),
|
|
307
|
+
agentSubjectId: z.string().trim().min(1).max(1_024),
|
|
308
|
+
})
|
|
309
|
+
.strict();
|
|
310
|
+
export type CompanyProfileAgentAttempt = z.infer<typeof CompanyProfileAgentAttempt>;
|
|
311
|
+
|
|
312
|
+
export const CompanyProfileAgentProposalRequest = z
|
|
313
|
+
.object({
|
|
314
|
+
operationId: z.string().uuid(),
|
|
315
|
+
profile: CompanyProfileContent,
|
|
316
|
+
reason: z.string().trim().min(1).max(COMPANY_PROFILE_REASON_MAX_CHARS),
|
|
317
|
+
})
|
|
318
|
+
.strict();
|
|
319
|
+
export type CompanyProfileAgentProposalRequest = z.infer<typeof CompanyProfileAgentProposalRequest>;
|
|
320
|
+
|
|
321
|
+
// z.lazy avoids an import cycle because HumanInputQuestion is declared in the
|
|
322
|
+
// root contracts module that re-exports this file.
|
|
323
|
+
export const CompanyProfileAgentHumanInputPrompt = z.object({
|
|
324
|
+
questions: z.array(z.lazy(() => HumanInputQuestion)).length(1),
|
|
325
|
+
allowSkip: z.literal(false),
|
|
326
|
+
});
|
|
327
|
+
export type CompanyProfileAgentHumanInputPrompt = z.infer<
|
|
328
|
+
typeof CompanyProfileAgentHumanInputPrompt
|
|
329
|
+
>;
|
|
330
|
+
|
|
331
|
+
export const CompanyProfileAgentProposalReceipt = z.object({
|
|
332
|
+
status: z.literal("confirmation_required"),
|
|
333
|
+
operationId: z.string().uuid(),
|
|
334
|
+
proposalReceiptId: z.string().uuid(),
|
|
335
|
+
revision: CompanyProfileRevision,
|
|
336
|
+
humanInput: CompanyProfileAgentHumanInputPrompt,
|
|
337
|
+
confirmWith: z.literal("company_profile_confirm"),
|
|
338
|
+
replayed: z.boolean(),
|
|
339
|
+
});
|
|
340
|
+
export type CompanyProfileAgentProposalReceipt = z.infer<typeof CompanyProfileAgentProposalReceipt>;
|
|
341
|
+
|
|
342
|
+
export const CompanyProfileAgentConfirmRequest = z
|
|
343
|
+
.object({
|
|
344
|
+
operationId: z.string().uuid(),
|
|
345
|
+
proposalReceiptId: z.string().uuid(),
|
|
346
|
+
humanInputRequestId: z.string().uuid(),
|
|
347
|
+
})
|
|
348
|
+
.strict();
|
|
349
|
+
export type CompanyProfileAgentConfirmRequest = z.infer<typeof CompanyProfileAgentConfirmRequest>;
|
|
350
|
+
|
|
351
|
+
export const CompanyProfileAgentConfirmationReceipt = z.object({
|
|
352
|
+
status: z.literal("activated"),
|
|
353
|
+
operationId: z.string().uuid(),
|
|
354
|
+
confirmationReceiptId: z.string().uuid(),
|
|
355
|
+
proposalReceiptId: z.string().uuid(),
|
|
356
|
+
humanInputRequestId: z.string().uuid(),
|
|
357
|
+
mutation: CompanyProfileMutationResponse,
|
|
358
|
+
replayed: z.boolean(),
|
|
359
|
+
});
|
|
360
|
+
export type CompanyProfileAgentConfirmationReceipt = z.infer<
|
|
361
|
+
typeof CompanyProfileAgentConfirmationReceipt
|
|
362
|
+
>;
|
|
363
|
+
|
|
243
364
|
export const CompanyProfileDiffRequest = z
|
|
244
365
|
.object({ fromRevisionId: z.string().uuid(), toRevisionId: z.string().uuid() })
|
|
245
366
|
.refine((value) => value.fromRevisionId !== value.toRevisionId, {
|