@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,176 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { WorkspaceLearningMode } from "./workspace-learning-policy";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Automatic is intentionally conservative in the first evaluator tranche.
|
|
6
|
+
* This constant is platform-owned rather than caller-selectable so an agent or
|
|
7
|
+
* connector cannot lower the admission floor inside one request.
|
|
8
|
+
*/
|
|
9
|
+
export const GOVERNED_LEARNING_AUTOMATIC_CONFIDENCE_FLOOR_BPS = 8_500;
|
|
10
|
+
export const GOVERNED_LEARNING_MAX_CONFLICT_COUNT = 1_000;
|
|
11
|
+
|
|
12
|
+
export const GovernedLearningDecisionOutcome = z.enum([
|
|
13
|
+
"off",
|
|
14
|
+
"suggest",
|
|
15
|
+
"automatic",
|
|
16
|
+
"confidence",
|
|
17
|
+
"conflict",
|
|
18
|
+
"stale",
|
|
19
|
+
"revoked",
|
|
20
|
+
]);
|
|
21
|
+
export type GovernedLearningDecisionOutcome = z.infer<typeof GovernedLearningDecisionOutcome>;
|
|
22
|
+
|
|
23
|
+
/** Stable order used by TypeScript, SQL constraints, and public receipts. */
|
|
24
|
+
export const GOVERNED_LEARNING_REASON_ORDER = [
|
|
25
|
+
"policy_off",
|
|
26
|
+
"evidence_revoked",
|
|
27
|
+
"proposal_stale",
|
|
28
|
+
"evidence_conflict",
|
|
29
|
+
"confidence_below_floor",
|
|
30
|
+
"policy_suggest",
|
|
31
|
+
"policy_automatic",
|
|
32
|
+
] as const;
|
|
33
|
+
|
|
34
|
+
export const GovernedLearningDecisionReason = z.enum(GOVERNED_LEARNING_REASON_ORDER);
|
|
35
|
+
export type GovernedLearningDecisionReason = z.infer<typeof GovernedLearningDecisionReason>;
|
|
36
|
+
|
|
37
|
+
export const GovernedLearningDecisionFacts = z
|
|
38
|
+
.object({
|
|
39
|
+
effectiveMode: WorkspaceLearningMode,
|
|
40
|
+
confidenceBps: z.number().int().min(0).max(10_000),
|
|
41
|
+
conflictCount: z.number().int().min(0).max(GOVERNED_LEARNING_MAX_CONFLICT_COUNT),
|
|
42
|
+
stale: z.boolean(),
|
|
43
|
+
revoked: z.boolean(),
|
|
44
|
+
})
|
|
45
|
+
.strict();
|
|
46
|
+
export type GovernedLearningDecisionFacts = z.infer<typeof GovernedLearningDecisionFacts>;
|
|
47
|
+
|
|
48
|
+
export const GovernedLearningDecision = z
|
|
49
|
+
.object({
|
|
50
|
+
outcome: GovernedLearningDecisionOutcome,
|
|
51
|
+
reasons: z
|
|
52
|
+
.array(GovernedLearningDecisionReason)
|
|
53
|
+
.min(1)
|
|
54
|
+
.max(GOVERNED_LEARNING_REASON_ORDER.length),
|
|
55
|
+
automaticEligible: z.boolean(),
|
|
56
|
+
confidenceFloorBps: z.literal(GOVERNED_LEARNING_AUTOMATIC_CONFIDENCE_FLOOR_BPS),
|
|
57
|
+
})
|
|
58
|
+
.strict()
|
|
59
|
+
.superRefine((decision, context) => {
|
|
60
|
+
if (decision.automaticEligible !== (decision.outcome === "automatic")) {
|
|
61
|
+
context.addIssue({
|
|
62
|
+
code: "custom",
|
|
63
|
+
path: ["automaticEligible"],
|
|
64
|
+
message: "automatic eligibility must exactly match the automatic outcome",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const indexes = decision.reasons.map((reason) =>
|
|
68
|
+
GOVERNED_LEARNING_REASON_ORDER.indexOf(reason),
|
|
69
|
+
);
|
|
70
|
+
if (indexes.some((value, index) => index > 0 && value <= indexes[index - 1]!)) {
|
|
71
|
+
context.addIssue({
|
|
72
|
+
code: "custom",
|
|
73
|
+
path: ["reasons"],
|
|
74
|
+
message: "governed-learning reasons must be unique and in canonical order",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
export type GovernedLearningDecision = z.infer<typeof GovernedLearningDecision>;
|
|
79
|
+
|
|
80
|
+
export const GovernedLearningEvaluationAttempt = z
|
|
81
|
+
.object({
|
|
82
|
+
workspaceId: z.string().uuid(),
|
|
83
|
+
subjectId: z.string().trim().min(1).max(1_024),
|
|
84
|
+
sessionId: z.string().uuid(),
|
|
85
|
+
turnId: z.string().uuid(),
|
|
86
|
+
attemptId: z.string().uuid(),
|
|
87
|
+
executionGeneration: z.number().int().positive(),
|
|
88
|
+
})
|
|
89
|
+
.strict();
|
|
90
|
+
export type GovernedLearningEvaluationAttempt = z.infer<typeof GovernedLearningEvaluationAttempt>;
|
|
91
|
+
|
|
92
|
+
export const EvaluateGovernedLearningProposalRequest = z
|
|
93
|
+
.object({
|
|
94
|
+
operationId: z.string().uuid(),
|
|
95
|
+
policySnapshotId: z.string().uuid(),
|
|
96
|
+
proposalId: z.string().uuid(),
|
|
97
|
+
claimId: z.string().uuid(),
|
|
98
|
+
evidenceId: z.string().uuid(),
|
|
99
|
+
})
|
|
100
|
+
.strict();
|
|
101
|
+
export type EvaluateGovernedLearningProposalRequest = z.infer<
|
|
102
|
+
typeof EvaluateGovernedLearningProposalRequest
|
|
103
|
+
>;
|
|
104
|
+
|
|
105
|
+
const sha256 = z.string().regex(/^[0-9a-f]{64}$/);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Content-free immutable evidence. Hashes and bounded enums identify exactly
|
|
109
|
+
* what was evaluated without copying proposal, fact, citation, or note text.
|
|
110
|
+
*/
|
|
111
|
+
export const GovernedLearningDecisionReceipt = z
|
|
112
|
+
.object({
|
|
113
|
+
id: z.string().uuid(),
|
|
114
|
+
operationId: z.string().uuid(),
|
|
115
|
+
inputHash: sha256,
|
|
116
|
+
accountId: z.string().uuid(),
|
|
117
|
+
workspaceId: z.string().uuid(),
|
|
118
|
+
sessionId: z.string().uuid(),
|
|
119
|
+
turnId: z.string().uuid(),
|
|
120
|
+
attemptId: z.string().uuid(),
|
|
121
|
+
executionGeneration: z.number().int().positive(),
|
|
122
|
+
initiatingHumanSubjectId: z.string().min(1).max(1_024),
|
|
123
|
+
policySnapshotId: z.string().uuid(),
|
|
124
|
+
policySnapshotHash: sha256,
|
|
125
|
+
policyRevisionId: z.string().uuid().nullable(),
|
|
126
|
+
policyActivationVersion: z.number().int().nonnegative(),
|
|
127
|
+
sourceKind: z.enum(["scoped-knowledge-evidence", "task-note"]),
|
|
128
|
+
sourceId: z.string().uuid(),
|
|
129
|
+
proposalId: z.string().uuid(),
|
|
130
|
+
proposalInputHash: sha256,
|
|
131
|
+
proposalContentHash: sha256,
|
|
132
|
+
claimId: z.string().uuid(),
|
|
133
|
+
claimInputHash: sha256,
|
|
134
|
+
evidenceId: z.string().uuid(),
|
|
135
|
+
evidenceInputHash: sha256,
|
|
136
|
+
evidenceContentHash: sha256,
|
|
137
|
+
evidenceAuthorityHash: sha256,
|
|
138
|
+
reviewRevision: z.number().int().positive(),
|
|
139
|
+
reviewState: z.enum(["proposed", "approved", "rejected", "revoked"]),
|
|
140
|
+
effectiveMode: WorkspaceLearningMode,
|
|
141
|
+
confidenceBps: z.number().int().min(0).max(10_000),
|
|
142
|
+
conflictCount: z.number().int().min(0).max(GOVERNED_LEARNING_MAX_CONFLICT_COUNT),
|
|
143
|
+
outcome: GovernedLearningDecisionOutcome,
|
|
144
|
+
reasons: z
|
|
145
|
+
.array(GovernedLearningDecisionReason)
|
|
146
|
+
.min(1)
|
|
147
|
+
.max(GOVERNED_LEARNING_REASON_ORDER.length),
|
|
148
|
+
automaticEligible: z.boolean(),
|
|
149
|
+
confidenceFloorBps: z.literal(GOVERNED_LEARNING_AUTOMATIC_CONFIDENCE_FLOOR_BPS),
|
|
150
|
+
createdAt: z.string().datetime(),
|
|
151
|
+
})
|
|
152
|
+
.strict()
|
|
153
|
+
.superRefine((receipt, context) => {
|
|
154
|
+
const decision = GovernedLearningDecision.safeParse({
|
|
155
|
+
outcome: receipt.outcome,
|
|
156
|
+
reasons: receipt.reasons,
|
|
157
|
+
automaticEligible: receipt.automaticEligible,
|
|
158
|
+
confidenceFloorBps: receipt.confidenceFloorBps,
|
|
159
|
+
});
|
|
160
|
+
if (!decision.success) {
|
|
161
|
+
for (const issue of decision.error.issues) {
|
|
162
|
+
context.addIssue({ ...issue, path: issue.path });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (
|
|
166
|
+
receipt.sourceKind === "scoped-knowledge-evidence" &&
|
|
167
|
+
receipt.sourceId !== receipt.evidenceId
|
|
168
|
+
) {
|
|
169
|
+
context.addIssue({
|
|
170
|
+
code: "custom",
|
|
171
|
+
path: ["sourceId"],
|
|
172
|
+
message: "scoped-Knowledge evaluation must use its exact evidence id as the source id",
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
export type GovernedLearningDecisionReceipt = z.infer<typeof GovernedLearningDecisionReceipt>;
|