@opengeni/contracts 2.6.0-canary.0 → 2.9.2-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 +3 -0
- package/dist/agent-topology.d.ts +292 -0
- package/dist/atlassian.js +2 -1
- package/dist/chunk-4IVHBXRI.js +221 -0
- package/dist/chunk-4IVHBXRI.js.map +1 -0
- package/dist/{chunk-MJ3K6ICH.js → chunk-AWNGBY5I.js} +7153 -6946
- package/dist/chunk-AWNGBY5I.js.map +1 -0
- package/dist/company-profile.d.ts +275 -1
- package/dist/connection-authority.js +2 -1
- package/dist/connection-authority.js.map +1 -1
- package/dist/google-drive.js +2 -1
- package/dist/google-drive.js.map +1 -1
- package/dist/index.d.ts +273 -140
- package/dist/index.js +107 -5
- package/dist/managed-auth-session-sets.d.ts +19 -0
- package/dist/managed-auth-session-sets.js +12 -1
- package/dist/managed-auth-session-sets.js.map +1 -1
- package/dist/organization-membership-lifecycle.d.ts +3 -0
- package/dist/permissions.d.ts +1 -0
- package/dist/personal-github.js +2 -1
- package/dist/personal-github.js.map +1 -1
- package/dist/session-titles.d.ts +9 -0
- package/dist/session-titles.js +17 -0
- package/dist/session-titles.js.map +1 -0
- package/dist/session-topology-primitives.d.ts +22 -0
- package/dist/work-claims.d.ts +411 -0
- package/package.json +5 -1
- package/src/agent-authored-durable-text.ts +13 -6
- package/src/agent-topology.ts +69 -0
- package/src/company-profile.ts +46 -1
- package/src/index.ts +385 -249
- package/src/managed-auth-session-sets.ts +18 -0
- package/src/permissions.ts +1 -0
- package/src/session-titles.ts +12 -5
- package/src/session-topology-primitives.ts +21 -0
- package/src/work-claims.ts +266 -0
- package/dist/chunk-MJ3K6ICH.js.map +0 -1
|
@@ -127,6 +127,24 @@ export const ManagedAuthLoginTransaction = z.object({
|
|
|
127
127
|
});
|
|
128
128
|
export type ManagedAuthLoginTransaction = z.infer<typeof ManagedAuthLoginTransaction>;
|
|
129
129
|
|
|
130
|
+
export const ManagedAuthSocialProvider = z.enum(["google", "github"]);
|
|
131
|
+
export type ManagedAuthSocialProvider = z.infer<typeof ManagedAuthSocialProvider>;
|
|
132
|
+
|
|
133
|
+
export const StartManagedAuthSocialTransactionRequest = ManagedAuthOperationIdentity.extend({
|
|
134
|
+
transactionId: z.string().uuid(),
|
|
135
|
+
provider: ManagedAuthSocialProvider,
|
|
136
|
+
});
|
|
137
|
+
export type StartManagedAuthSocialTransactionRequest = z.infer<
|
|
138
|
+
typeof StartManagedAuthSocialTransactionRequest
|
|
139
|
+
>;
|
|
140
|
+
|
|
141
|
+
export const StartManagedAuthSocialTransactionResponse = z.object({
|
|
142
|
+
url: z.string().url().max(4_096),
|
|
143
|
+
});
|
|
144
|
+
export type StartManagedAuthSocialTransactionResponse = z.infer<
|
|
145
|
+
typeof StartManagedAuthSocialTransactionResponse
|
|
146
|
+
>;
|
|
147
|
+
|
|
130
148
|
export const CompleteManagedAuthEmailPasswordTransactionRequest =
|
|
131
149
|
ManagedAuthOperationIdentity.extend({
|
|
132
150
|
transactionId: z.string().uuid(),
|
package/src/permissions.ts
CHANGED
package/src/session-titles.ts
CHANGED
|
@@ -212,7 +212,13 @@ function hasVisibleAutomaticTitleContent(value: string): boolean {
|
|
|
212
212
|
return automaticTitleDetectionValue(value).trim().length > 0;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Whether a bounded automatic-title candidate contains a credential, URL, or
|
|
217
|
+
* opaque identifier that must stay out of navigation and other display-title
|
|
218
|
+
* surfaces. Callers handling an unbounded source must bound it before invoking
|
|
219
|
+
* this helper.
|
|
220
|
+
*/
|
|
221
|
+
export function containsSensitiveAutomaticSessionTitleValue(value: string): boolean {
|
|
216
222
|
const detectionValue = automaticTitleDetectionValue(value);
|
|
217
223
|
|
|
218
224
|
if (KNOWN_SENSITIVE_VALUE_PATTERNS.some((pattern) => pattern.test(detectionValue))) return true;
|
|
@@ -271,7 +277,8 @@ function automaticTitleGraphemes(value: string): string[] {
|
|
|
271
277
|
return graphemes;
|
|
272
278
|
}
|
|
273
279
|
|
|
274
|
-
|
|
280
|
+
/** Bound an already-normalized automatic-title candidate without splitting graphemes. */
|
|
281
|
+
export function boundAutomaticSessionTitle(value: string): string {
|
|
275
282
|
const words = value.split(/\s+/u);
|
|
276
283
|
const wordBounded = words.length > 10 ? words.slice(0, 10).join(" ") : value;
|
|
277
284
|
const graphemes = automaticTitleGraphemes(wordBounded);
|
|
@@ -299,7 +306,7 @@ export function normalizeAutomaticSessionTitle(value: string): string | null {
|
|
|
299
306
|
if (
|
|
300
307
|
!firstLine ||
|
|
301
308
|
!hasVisibleAutomaticTitleContent(firstLine) ||
|
|
302
|
-
|
|
309
|
+
containsSensitiveAutomaticSessionTitleValue(firstLine)
|
|
303
310
|
) {
|
|
304
311
|
return null;
|
|
305
312
|
}
|
|
@@ -311,12 +318,12 @@ export function normalizeAutomaticSessionTitle(value: string): string | null {
|
|
|
311
318
|
if (
|
|
312
319
|
!title ||
|
|
313
320
|
!hasVisibleAutomaticTitleContent(title) ||
|
|
314
|
-
|
|
321
|
+
containsSensitiveAutomaticSessionTitleValue(title)
|
|
315
322
|
) {
|
|
316
323
|
return null;
|
|
317
324
|
}
|
|
318
325
|
|
|
319
|
-
title =
|
|
326
|
+
title = boundAutomaticSessionTitle(title)
|
|
320
327
|
.replace(/[\s.!?,;:\-–—]+$/u, "")
|
|
321
328
|
.trim();
|
|
322
329
|
if (!title || !hasVisibleAutomaticTitleContent(title)) return null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const SessionStatus = z.enum([
|
|
4
|
+
"queued",
|
|
5
|
+
"running",
|
|
6
|
+
"idle",
|
|
7
|
+
"requires_action",
|
|
8
|
+
"recovering",
|
|
9
|
+
"waiting_capacity",
|
|
10
|
+
"failed",
|
|
11
|
+
"cancelled",
|
|
12
|
+
]);
|
|
13
|
+
export type SessionStatus = z.infer<typeof SessionStatus>;
|
|
14
|
+
|
|
15
|
+
export const SessionGoalStatus = z.enum(["active", "paused", "completed"]);
|
|
16
|
+
export type SessionGoalStatus = z.infer<typeof SessionGoalStatus>;
|
|
17
|
+
|
|
18
|
+
/** Physical ceiling of the PostgreSQL integer columns that persist depth policy. */
|
|
19
|
+
export const MAX_NESTED_AGENT_DEPTH = 2_147_483_647;
|
|
20
|
+
export const NestedAgentDepthValue = z.number().int().nonnegative().max(MAX_NESTED_AGENT_DEPTH);
|
|
21
|
+
export type NestedAgentDepthValue = z.infer<typeof NestedAgentDepthValue>;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { normalizeAutomaticSessionTitle } from "./session-titles";
|
|
3
|
+
|
|
4
|
+
export const WORK_CLAIM_NAMESPACE_MAX_BYTES = 64;
|
|
5
|
+
export const WORK_CLAIM_CANONICAL_KEY_MAX_BYTES = 512;
|
|
6
|
+
export const WORK_CLAIM_DISPLAY_LABEL_MAX_BYTES = 256;
|
|
7
|
+
export const WORK_CLAIM_VERSION_VALUE_MAX_BYTES = 256;
|
|
8
|
+
export const WORK_CLAIM_ACTIVE_SESSION_CAP = 64;
|
|
9
|
+
export const WORK_CLAIM_DISCOVERY_LIMIT = 8;
|
|
10
|
+
export const WORK_CLAIM_DISCOVERY_DEFAULT_LIMIT = 4;
|
|
11
|
+
export const WORK_DISCOVERY_QUERY_MAX_CHARS = 200;
|
|
12
|
+
export const WORK_DISCOVERY_RECENT_HOURS_MAX = 24 * 365;
|
|
13
|
+
|
|
14
|
+
const utf8Bytes = (value: string): number => new TextEncoder().encode(value).byteLength;
|
|
15
|
+
const CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]/u;
|
|
16
|
+
const NAMESPACE_PATTERN = /^[a-z0-9](?:[a-z0-9._:-]{0,62}[a-z0-9])?$/u;
|
|
17
|
+
|
|
18
|
+
function boundedCanonicalText(maxBytes: number, label: string) {
|
|
19
|
+
return z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1)
|
|
22
|
+
.superRefine((value, context) => {
|
|
23
|
+
if (value !== value.trim()) {
|
|
24
|
+
context.addIssue({
|
|
25
|
+
code: z.ZodIssueCode.custom,
|
|
26
|
+
message: `${label} must not have leading or trailing whitespace`,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (value !== value.normalize("NFKC")) {
|
|
30
|
+
context.addIssue({
|
|
31
|
+
code: z.ZodIssueCode.custom,
|
|
32
|
+
message: `${label} must use canonical Unicode normalization`,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (CONTROL_CHARACTERS.test(value)) {
|
|
36
|
+
context.addIssue({
|
|
37
|
+
code: z.ZodIssueCode.custom,
|
|
38
|
+
message: `${label} must not contain control characters`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (utf8Bytes(value) > maxBytes) {
|
|
42
|
+
context.addIssue({
|
|
43
|
+
code: z.ZodIssueCode.custom,
|
|
44
|
+
message: `${label} must be at most ${maxBytes} UTF-8 bytes`,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function normalizeWorkClaimNamespace(value: string): string {
|
|
51
|
+
return value.normalize("NFKC").trim().toLowerCase();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function normalizeWorkClaimCanonicalKey(value: string): string {
|
|
55
|
+
return value.normalize("NFKC").trim();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function normalizeWorkClaimDisplayLabel(value: string): string | null {
|
|
59
|
+
const normalized = normalizeAutomaticSessionTitle(value);
|
|
60
|
+
if (!normalized || utf8Bytes(normalized) > WORK_CLAIM_DISPLAY_LABEL_MAX_BYTES) return null;
|
|
61
|
+
return normalized;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const WorkClaimNamespace = z
|
|
65
|
+
.string()
|
|
66
|
+
.min(1)
|
|
67
|
+
.max(WORK_CLAIM_NAMESPACE_MAX_BYTES)
|
|
68
|
+
.regex(NAMESPACE_PATTERN)
|
|
69
|
+
.refine((value) => value === normalizeWorkClaimNamespace(value), {
|
|
70
|
+
message: "work claim namespace must already be canonical lowercase text",
|
|
71
|
+
});
|
|
72
|
+
export type WorkClaimNamespace = z.infer<typeof WorkClaimNamespace>;
|
|
73
|
+
|
|
74
|
+
export const WorkClaimCanonicalKey = boundedCanonicalText(
|
|
75
|
+
WORK_CLAIM_CANONICAL_KEY_MAX_BYTES,
|
|
76
|
+
"work claim canonical key",
|
|
77
|
+
);
|
|
78
|
+
export type WorkClaimCanonicalKey = z.infer<typeof WorkClaimCanonicalKey>;
|
|
79
|
+
|
|
80
|
+
export const WorkClaimDisplayLabel = z
|
|
81
|
+
.string()
|
|
82
|
+
.min(1)
|
|
83
|
+
.superRefine((value, context) => {
|
|
84
|
+
if (utf8Bytes(value) > WORK_CLAIM_DISPLAY_LABEL_MAX_BYTES) {
|
|
85
|
+
context.addIssue({
|
|
86
|
+
code: z.ZodIssueCode.custom,
|
|
87
|
+
message: `work claim display label must be at most ${WORK_CLAIM_DISPLAY_LABEL_MAX_BYTES} UTF-8 bytes`,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (normalizeWorkClaimDisplayLabel(value) !== value) {
|
|
91
|
+
context.addIssue({
|
|
92
|
+
code: z.ZodIssueCode.custom,
|
|
93
|
+
message: "work claim display label must be a safe concise semantic label",
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
export type WorkClaimDisplayLabel = z.infer<typeof WorkClaimDisplayLabel>;
|
|
98
|
+
|
|
99
|
+
export const WorkClaimSubjectType = z.enum([
|
|
100
|
+
"repository",
|
|
101
|
+
"branch",
|
|
102
|
+
"pull_request",
|
|
103
|
+
"issue",
|
|
104
|
+
"artifact",
|
|
105
|
+
"release",
|
|
106
|
+
"ci_run",
|
|
107
|
+
"other",
|
|
108
|
+
]);
|
|
109
|
+
export type WorkClaimSubjectType = z.infer<typeof WorkClaimSubjectType>;
|
|
110
|
+
|
|
111
|
+
export const WorkClaimRole = z.enum(["working", "reviewing", "monitoring", "delivering"]);
|
|
112
|
+
export type WorkClaimRole = z.infer<typeof WorkClaimRole>;
|
|
113
|
+
|
|
114
|
+
export const WorkClaimState = z.enum(["active", "released", "superseded", "stale"]);
|
|
115
|
+
export type WorkClaimState = z.infer<typeof WorkClaimState>;
|
|
116
|
+
|
|
117
|
+
export const WorkClaimProvenance = z.enum([
|
|
118
|
+
"explicit_agent",
|
|
119
|
+
"user_api",
|
|
120
|
+
"trusted_integration",
|
|
121
|
+
"session_resource",
|
|
122
|
+
"system_lifecycle",
|
|
123
|
+
]);
|
|
124
|
+
export type WorkClaimProvenance = z.infer<typeof WorkClaimProvenance>;
|
|
125
|
+
|
|
126
|
+
export const WorkClaimVersionKind = z.enum([
|
|
127
|
+
"git_commit",
|
|
128
|
+
"branch_head",
|
|
129
|
+
"pull_request_head",
|
|
130
|
+
"artifact_version",
|
|
131
|
+
"release_version",
|
|
132
|
+
"ci_run",
|
|
133
|
+
"other",
|
|
134
|
+
]);
|
|
135
|
+
export type WorkClaimVersionKind = z.infer<typeof WorkClaimVersionKind>;
|
|
136
|
+
|
|
137
|
+
export const WorkClaimVersionValue = boundedCanonicalText(
|
|
138
|
+
WORK_CLAIM_VERSION_VALUE_MAX_BYTES,
|
|
139
|
+
"work claim version value",
|
|
140
|
+
);
|
|
141
|
+
export type WorkClaimVersionValue = z.infer<typeof WorkClaimVersionValue>;
|
|
142
|
+
|
|
143
|
+
export const WorkClaimReleaseReason = z.enum([
|
|
144
|
+
"completed",
|
|
145
|
+
"cancelled",
|
|
146
|
+
"failed",
|
|
147
|
+
"superseded",
|
|
148
|
+
"no_longer_active",
|
|
149
|
+
"corrected",
|
|
150
|
+
"external_state_changed",
|
|
151
|
+
"other",
|
|
152
|
+
]);
|
|
153
|
+
export type WorkClaimReleaseReason = z.infer<typeof WorkClaimReleaseReason>;
|
|
154
|
+
|
|
155
|
+
export const WorkClaimMutationKind = z.enum([
|
|
156
|
+
"created",
|
|
157
|
+
"updated",
|
|
158
|
+
"released",
|
|
159
|
+
"superseded",
|
|
160
|
+
"stale",
|
|
161
|
+
]);
|
|
162
|
+
export type WorkClaimMutationKind = z.infer<typeof WorkClaimMutationKind>;
|
|
163
|
+
|
|
164
|
+
export const WorkClaim = z.object({
|
|
165
|
+
id: z.string().uuid(),
|
|
166
|
+
sessionId: z.string().uuid(),
|
|
167
|
+
rootSessionId: z.string().uuid(),
|
|
168
|
+
subject: z.object({
|
|
169
|
+
namespace: WorkClaimNamespace,
|
|
170
|
+
type: WorkClaimSubjectType,
|
|
171
|
+
canonicalKey: WorkClaimCanonicalKey,
|
|
172
|
+
displayLabel: WorkClaimDisplayLabel.nullable(),
|
|
173
|
+
}),
|
|
174
|
+
role: WorkClaimRole,
|
|
175
|
+
state: WorkClaimState,
|
|
176
|
+
revision: z.number().int().positive(),
|
|
177
|
+
provenance: WorkClaimProvenance,
|
|
178
|
+
version: z
|
|
179
|
+
.object({
|
|
180
|
+
kind: WorkClaimVersionKind,
|
|
181
|
+
value: WorkClaimVersionValue,
|
|
182
|
+
})
|
|
183
|
+
.nullable(),
|
|
184
|
+
observedAt: z.string().datetime({ offset: true }),
|
|
185
|
+
createdAt: z.string().datetime({ offset: true }),
|
|
186
|
+
updatedAt: z.string().datetime({ offset: true }),
|
|
187
|
+
settledAt: z.string().datetime({ offset: true }).nullable(),
|
|
188
|
+
});
|
|
189
|
+
export type WorkClaim = z.infer<typeof WorkClaim>;
|
|
190
|
+
|
|
191
|
+
export const WorkClaimMutationResult = z.object({
|
|
192
|
+
claim: WorkClaim,
|
|
193
|
+
mutation: WorkClaimMutationKind,
|
|
194
|
+
replayed: z.boolean(),
|
|
195
|
+
});
|
|
196
|
+
export type WorkClaimMutationResult = z.infer<typeof WorkClaimMutationResult>;
|
|
197
|
+
|
|
198
|
+
export const WorkClaimDiscoverySummary = WorkClaim.pick({
|
|
199
|
+
id: true,
|
|
200
|
+
sessionId: true,
|
|
201
|
+
subject: true,
|
|
202
|
+
role: true,
|
|
203
|
+
state: true,
|
|
204
|
+
revision: true,
|
|
205
|
+
provenance: true,
|
|
206
|
+
version: true,
|
|
207
|
+
observedAt: true,
|
|
208
|
+
updatedAt: true,
|
|
209
|
+
settledAt: true,
|
|
210
|
+
});
|
|
211
|
+
export type WorkClaimDiscoverySummary = z.infer<typeof WorkClaimDiscoverySummary>;
|
|
212
|
+
|
|
213
|
+
export const WorkClaimSubjectFilter = z
|
|
214
|
+
.object({
|
|
215
|
+
namespace: WorkClaimNamespace,
|
|
216
|
+
type: WorkClaimSubjectType,
|
|
217
|
+
canonicalKey: WorkClaimCanonicalKey,
|
|
218
|
+
})
|
|
219
|
+
.strict();
|
|
220
|
+
export type WorkClaimSubjectFilter = z.infer<typeof WorkClaimSubjectFilter>;
|
|
221
|
+
|
|
222
|
+
export const WorkDiscoveryMatchClass = z.enum(["exact_subject", "title", "goal", "fuzzy"]);
|
|
223
|
+
export type WorkDiscoveryMatchClass = z.infer<typeof WorkDiscoveryMatchClass>;
|
|
224
|
+
|
|
225
|
+
export const WorkDiscoveryMatchedField = z.enum([
|
|
226
|
+
"subject",
|
|
227
|
+
"title",
|
|
228
|
+
"goal",
|
|
229
|
+
"claim_key",
|
|
230
|
+
"claim_label",
|
|
231
|
+
]);
|
|
232
|
+
export type WorkDiscoveryMatchedField = z.infer<typeof WorkDiscoveryMatchedField>;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Deliberately stable bands rather than a raw ranking score. Raw full-text or
|
|
236
|
+
* trigram values are query-relative and become a misleading cross-query API.
|
|
237
|
+
*/
|
|
238
|
+
export const WorkDiscoveryScoreBand = z.enum(["exact", "strong", "related"]);
|
|
239
|
+
export type WorkDiscoveryScoreBand = z.infer<typeof WorkDiscoveryScoreBand>;
|
|
240
|
+
|
|
241
|
+
export const WorkDiscoveryMatch = z
|
|
242
|
+
.object({
|
|
243
|
+
class: WorkDiscoveryMatchClass,
|
|
244
|
+
field: WorkDiscoveryMatchedField,
|
|
245
|
+
scoreBand: WorkDiscoveryScoreBand,
|
|
246
|
+
claimId: z.string().uuid().nullable(),
|
|
247
|
+
})
|
|
248
|
+
.strict();
|
|
249
|
+
export type WorkDiscoveryMatch = z.infer<typeof WorkDiscoveryMatch>;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Provider-neutral related-work evidence. The two literal booleans are part of
|
|
253
|
+
* the wire contract so a consumer cannot accidentally present a claim as a
|
|
254
|
+
* lock, authorization grant, ownership transfer, or mandatory instruction.
|
|
255
|
+
*/
|
|
256
|
+
export const WorkDiscoveryProjection = z
|
|
257
|
+
.object({
|
|
258
|
+
claims: z.array(WorkClaimDiscoverySummary).max(WORK_CLAIM_DISCOVERY_LIMIT),
|
|
259
|
+
claimsTruncated: z.boolean(),
|
|
260
|
+
match: WorkDiscoveryMatch.nullable(),
|
|
261
|
+
possibleOverlap: z.boolean(),
|
|
262
|
+
advisoryOnly: z.literal(true),
|
|
263
|
+
noAdditionalAccess: z.literal(true),
|
|
264
|
+
})
|
|
265
|
+
.strict();
|
|
266
|
+
export type WorkDiscoveryProjection = z.infer<typeof WorkDiscoveryProjection>;
|