@oscharko-dev/keiko-contracts 0.2.8 → 0.2.9
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/.tsbuildinfo +1 -1
- package/dist/bff-wire.d.ts +33 -0
- package/dist/bff-wire.d.ts.map +1 -1
- package/dist/command-runner.d.ts +81 -0
- package/dist/command-runner.d.ts.map +1 -0
- package/dist/command-runner.js +209 -0
- package/dist/container-runtime.d.ts +125 -0
- package/dist/container-runtime.d.ts.map +1 -0
- package/dist/container-runtime.js +287 -0
- package/dist/context-engineering.js +2 -2
- package/dist/discussion-intelligence.d.ts +70 -0
- package/dist/discussion-intelligence.d.ts.map +1 -0
- package/dist/discussion-intelligence.js +440 -0
- package/dist/editor-agent-governance.d.ts +65 -0
- package/dist/editor-agent-governance.d.ts.map +1 -0
- package/dist/editor-agent-governance.js +180 -0
- package/dist/editor-agent.d.ts +29 -1
- package/dist/editor-agent.d.ts.map +1 -1
- package/dist/editor-agent.js +183 -6
- package/dist/editor-builtin-capabilities.d.ts +13 -0
- package/dist/editor-builtin-capabilities.d.ts.map +1 -0
- package/dist/editor-builtin-capabilities.js +135 -0
- package/dist/editor-language-mode-map.d.ts +11 -0
- package/dist/editor-language-mode-map.d.ts.map +1 -0
- package/dist/editor-language-mode-map.js +89 -0
- package/dist/editor-layout.d.ts +37 -0
- package/dist/editor-layout.d.ts.map +1 -1
- package/dist/editor-layout.js +125 -8
- package/dist/editor-workspace-path.d.ts +20 -0
- package/dist/editor-workspace-path.d.ts.map +1 -0
- package/dist/editor-workspace-path.js +133 -0
- package/dist/evidence.d.ts +3 -1
- package/dist/evidence.d.ts.map +1 -1
- package/dist/gateway.d.ts +72 -3
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +73 -3
- package/dist/git-commit-intent.d.ts +28 -0
- package/dist/git-commit-intent.d.ts.map +1 -0
- package/dist/git-commit-intent.js +155 -0
- package/dist/git-commit-policy.d.ts +29 -0
- package/dist/git-commit-policy.d.ts.map +1 -0
- package/dist/git-commit-policy.js +173 -0
- package/dist/git-delivery-action-sheet.d.ts +157 -0
- package/dist/git-delivery-action-sheet.d.ts.map +1 -0
- package/dist/git-delivery-action-sheet.js +430 -0
- package/dist/git-delivery-evidence.d.ts +92 -0
- package/dist/git-delivery-evidence.d.ts.map +1 -0
- package/dist/git-delivery-evidence.js +272 -0
- package/dist/git-delivery-policy.d.ts +40 -0
- package/dist/git-delivery-policy.d.ts.map +1 -0
- package/dist/git-delivery-policy.js +183 -0
- package/dist/git-delivery-provider.d.ts +53 -0
- package/dist/git-delivery-provider.d.ts.map +1 -0
- package/dist/git-delivery-provider.js +96 -0
- package/dist/git-delivery.d.ts +202 -0
- package/dist/git-delivery.d.ts.map +1 -0
- package/dist/git-delivery.js +410 -0
- package/dist/git-history.d.ts +27 -0
- package/dist/git-history.d.ts.map +1 -0
- package/dist/git-history.js +73 -0
- package/dist/git-merge.d.ts +67 -0
- package/dist/git-merge.d.ts.map +1 -0
- package/dist/git-merge.js +323 -0
- package/dist/git-pull-request.d.ts +112 -0
- package/dist/git-pull-request.d.ts.map +1 -0
- package/dist/git-pull-request.js +351 -0
- package/dist/git-repository-agent.d.ts +46 -0
- package/dist/git-repository-agent.d.ts.map +1 -0
- package/dist/git-repository-agent.js +198 -0
- package/dist/git-repository-summary.d.ts +54 -0
- package/dist/git-repository-summary.d.ts.map +1 -0
- package/dist/git-repository-summary.js +105 -0
- package/dist/git-repository.d.ts +60 -0
- package/dist/git-repository.d.ts.map +1 -0
- package/dist/git-repository.js +106 -0
- package/dist/git-sync.d.ts +49 -0
- package/dist/git-sync.d.ts.map +1 -0
- package/dist/git-sync.js +110 -0
- package/dist/index.d.ts +63 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -6
- package/dist/lsp-process.d.ts +38 -0
- package/dist/lsp-process.d.ts.map +1 -0
- package/dist/lsp-process.js +103 -0
- package/dist/runtime-capabilities.d.ts +44 -0
- package/dist/runtime-capabilities.d.ts.map +1 -0
- package/dist/runtime-capabilities.js +141 -0
- package/dist/task-workspace.d.ts +302 -0
- package/dist/task-workspace.d.ts.map +1 -0
- package/dist/task-workspace.js +1236 -0
- package/dist/voice-action-intent.d.ts +86 -0
- package/dist/voice-action-intent.d.ts.map +1 -0
- package/dist/voice-action-intent.js +387 -0
- package/dist/voice-playback.d.ts +50 -0
- package/dist/voice-playback.d.ts.map +1 -0
- package/dist/voice-playback.js +240 -0
- package/dist/voice-protocol.d.ts +165 -0
- package/dist/voice-protocol.d.ts.map +1 -0
- package/dist/voice-protocol.js +312 -0
- package/dist/voice-transcript.d.ts +57 -0
- package/dist/voice-transcript.d.ts.map +1 -0
- package/dist/voice-transcript.js +221 -0
- package/package.json +5 -1
- package/dist/conversation-budget.d.ts +0 -37
- package/dist/conversation-budget.d.ts.map +0 -1
- package/dist/conversation-budget.js +0 -97
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// Governed container engine detection + execution wire contract (Issue #1388, Epic #1491,
|
|
2
|
+
// ADR-0070). This leaf module owns the wire-stable vocabulary for the container runtime pilot only.
|
|
3
|
+
// It is intentionally pure: no IO, no process execution, no clock, no randomness. The ONLY in-package
|
|
4
|
+
// imports are the `CommandRule` shape reused for the defense-in-depth allowlist and the two runtime
|
|
5
|
+
// capability vocabularies reused (aliased, never redefined) for the engine state.
|
|
6
|
+
//
|
|
7
|
+
// The runner never accepts free-form argv, image refs, or flags. A request names a `taskId` from a
|
|
8
|
+
// server-frozen catalog; the server resolves that id to a vetted `ContainerTask` whose `image` is in
|
|
9
|
+
// a closed allowlist and whose docker/podman argv is hardened by the server. Detection and execution
|
|
10
|
+
// live in keiko-server (composing keiko-tools `runCommand`), so the browser never gains container,
|
|
11
|
+
// process, shell, or filesystem authority.
|
|
12
|
+
// ─── Schema version ───────────────────────────────────────────────────────────────
|
|
13
|
+
export const CONTAINER_RUNTIME_SCHEMA_VERSION = "1";
|
|
14
|
+
export const CONTAINER_ENGINE_IDS = Object.freeze([
|
|
15
|
+
"docker",
|
|
16
|
+
"podman",
|
|
17
|
+
]);
|
|
18
|
+
export const CONTAINER_MOUNT_MODES = Object.freeze([
|
|
19
|
+
"read-only",
|
|
20
|
+
]);
|
|
21
|
+
export const CONTAINER_NETWORK_MODES = Object.freeze([
|
|
22
|
+
"none",
|
|
23
|
+
]);
|
|
24
|
+
export const CONTAINER_TASK_KINDS = Object.freeze([
|
|
25
|
+
"diagnostic",
|
|
26
|
+
"verify",
|
|
27
|
+
]);
|
|
28
|
+
export const CONTAINER_FAILURE_REASONS = Object.freeze([
|
|
29
|
+
"none",
|
|
30
|
+
"non-zero-exit",
|
|
31
|
+
"engine-unavailable",
|
|
32
|
+
"image-missing",
|
|
33
|
+
"pull-denied",
|
|
34
|
+
"mount-failure",
|
|
35
|
+
"timed-out",
|
|
36
|
+
"cancelled",
|
|
37
|
+
"denied",
|
|
38
|
+
"spawn-error",
|
|
39
|
+
"output-capped",
|
|
40
|
+
]);
|
|
41
|
+
export const CONTAINER_RUNNER_EVENT_KINDS = Object.freeze([
|
|
42
|
+
"run-started",
|
|
43
|
+
"run-completed",
|
|
44
|
+
"run-failed",
|
|
45
|
+
"run-cancelled",
|
|
46
|
+
]);
|
|
47
|
+
// ─── Allowlist (defense-in-depth, D4) ──────────────────────────────────────────────
|
|
48
|
+
// `runCommand` denies the WHOLE invocation if ANY `denyFlags` member appears ANYWHERE in argv (in
|
|
49
|
+
// `--flag x` or `--flag=x` form — see keiko-tools/src/sandbox.ts). The runner passes the server-
|
|
50
|
+
// FROZEN hardened argv to `runCommand`, so `denyFlags` MUST NOT contain any flag the server's own
|
|
51
|
+
// frozen argv emits, or the runner would self-deny its own hardened run. The frozen `docker run`
|
|
52
|
+
// argv emits `--rm`, `--network`, `--read-only`, `--cap-drop`, `--security-opt`, `--pids-limit`,
|
|
53
|
+
// `--memory`, `--cpus`, `--pull`, `-v`; those are therefore EXCLUDED from `denyFlags`. The decisive
|
|
54
|
+
// safety control is the server-frozen argv + closed catalog (D2/D3) — this list is pure defense-in-
|
|
55
|
+
// depth against escalation flags the server NEVER emits, catching a hypothetical future regression
|
|
56
|
+
// where a client-influenced token reaches the argv.
|
|
57
|
+
const CONTAINER_DENY_FLAGS = Object.freeze([
|
|
58
|
+
"--privileged",
|
|
59
|
+
"--volume", // long form of -v; the server uses only the short `-v`, so reject any extra mount
|
|
60
|
+
"--mount",
|
|
61
|
+
"--device",
|
|
62
|
+
"--cap-add",
|
|
63
|
+
"--net", // alias of --network; server uses the canonical --network, reject the alias
|
|
64
|
+
"--pid",
|
|
65
|
+
"--ipc",
|
|
66
|
+
"--user",
|
|
67
|
+
"-c",
|
|
68
|
+
]);
|
|
69
|
+
export const CONTAINER_TASK_RULES = Object.freeze([
|
|
70
|
+
{
|
|
71
|
+
executable: "docker",
|
|
72
|
+
allowedSubcommands: Object.freeze(["version", "info", "run"]),
|
|
73
|
+
denyFlags: CONTAINER_DENY_FLAGS,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
executable: "podman",
|
|
77
|
+
allowedSubcommands: Object.freeze(["version", "info", "run"]),
|
|
78
|
+
denyFlags: CONTAINER_DENY_FLAGS,
|
|
79
|
+
},
|
|
80
|
+
]);
|
|
81
|
+
function isRecord(value) {
|
|
82
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
83
|
+
}
|
|
84
|
+
function isOneOf(value, allowed) {
|
|
85
|
+
return typeof value === "string" && allowed.includes(value);
|
|
86
|
+
}
|
|
87
|
+
function isNonEmptyString(value) {
|
|
88
|
+
return typeof value === "string" && value.length > 0;
|
|
89
|
+
}
|
|
90
|
+
function isPositiveFinite(value) {
|
|
91
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
92
|
+
}
|
|
93
|
+
function collectOptionalRequestErrors(input, errors) {
|
|
94
|
+
if (input.timeoutMs !== undefined && !isPositiveFinite(input.timeoutMs)) {
|
|
95
|
+
errors.push("timeoutMs must be a positive finite number");
|
|
96
|
+
}
|
|
97
|
+
if (input.requestId !== undefined && typeof input.requestId !== "string") {
|
|
98
|
+
errors.push("requestId must be a string");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Parses an incoming run request at the BFF trust boundary. Collects ALL field errors in a fixed
|
|
102
|
+
// order (deterministic strings for test assertions); never throws.
|
|
103
|
+
export function parseContainerRunRequest(input) {
|
|
104
|
+
const errors = [];
|
|
105
|
+
if (!isRecord(input)) {
|
|
106
|
+
return { ok: false, errors: ["request must be an object"] };
|
|
107
|
+
}
|
|
108
|
+
if (!isNonEmptyString(input.projectId)) {
|
|
109
|
+
errors.push("projectId must be a non-empty string");
|
|
110
|
+
}
|
|
111
|
+
if (!isNonEmptyString(input.taskId)) {
|
|
112
|
+
errors.push("taskId must be a non-empty string");
|
|
113
|
+
}
|
|
114
|
+
collectOptionalRequestErrors(input, errors);
|
|
115
|
+
if (errors.length > 0) {
|
|
116
|
+
return { ok: false, errors };
|
|
117
|
+
}
|
|
118
|
+
return { ok: true, value: input };
|
|
119
|
+
}
|
|
120
|
+
function validateOptionalStringField(value, key, path, errors) {
|
|
121
|
+
if (value[key] !== undefined && typeof value[key] !== "string") {
|
|
122
|
+
errors.push(`${path}.${key} must be a string`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function validateEngineStatus(value, index, errors) {
|
|
126
|
+
const path = `engines[${String(index)}]`;
|
|
127
|
+
if (!isRecord(value)) {
|
|
128
|
+
errors.push(`${path} must be an object`);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (!isOneOf(value.engine, CONTAINER_ENGINE_IDS)) {
|
|
132
|
+
errors.push(`${path}.engine is invalid`);
|
|
133
|
+
}
|
|
134
|
+
if (typeof value.state !== "string" || value.state.length === 0) {
|
|
135
|
+
errors.push(`${path}.state must be a non-empty string`);
|
|
136
|
+
}
|
|
137
|
+
validateOptionalStringField(value, "version", path, errors);
|
|
138
|
+
validateOptionalStringField(value, "unavailableReason", path, errors);
|
|
139
|
+
validateOptionalStringField(value, "remediationHint", path, errors);
|
|
140
|
+
}
|
|
141
|
+
function validateCapabilityScalars(value, errors) {
|
|
142
|
+
if (value.schemaVersion !== CONTAINER_RUNTIME_SCHEMA_VERSION) {
|
|
143
|
+
errors.push("schemaVersion is invalid");
|
|
144
|
+
}
|
|
145
|
+
const generatedAtMs = value.generatedAtMs;
|
|
146
|
+
if (typeof generatedAtMs !== "number" ||
|
|
147
|
+
!Number.isSafeInteger(generatedAtMs) ||
|
|
148
|
+
generatedAtMs < 0) {
|
|
149
|
+
errors.push("generatedAtMs must be a non-negative safe integer");
|
|
150
|
+
}
|
|
151
|
+
const deadlineMs = value.deadlineMs;
|
|
152
|
+
if (typeof deadlineMs !== "number" || !Number.isSafeInteger(deadlineMs) || deadlineMs < 1) {
|
|
153
|
+
errors.push("deadlineMs must be a positive safe integer");
|
|
154
|
+
}
|
|
155
|
+
if (typeof value.anyAvailable !== "boolean") {
|
|
156
|
+
errors.push("anyAvailable must be a boolean");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function validateEnginesArray(value, errors) {
|
|
160
|
+
if (!Array.isArray(value.engines)) {
|
|
161
|
+
errors.push("engines must be an array");
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
value.engines.forEach((entry, index) => {
|
|
165
|
+
validateEngineStatus(entry, index, errors);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
export function validateContainerCapabilityResponse(value) {
|
|
170
|
+
const errors = [];
|
|
171
|
+
if (!isRecord(value)) {
|
|
172
|
+
return { ok: false, errors: ["response must be an object"] };
|
|
173
|
+
}
|
|
174
|
+
validateCapabilityScalars(value, errors);
|
|
175
|
+
validateEnginesArray(value, errors);
|
|
176
|
+
if (errors.length > 0) {
|
|
177
|
+
return { ok: false, errors };
|
|
178
|
+
}
|
|
179
|
+
return { ok: true, value: value };
|
|
180
|
+
}
|
|
181
|
+
function validateContainerTaskArgs(value, path, errors) {
|
|
182
|
+
const args = value.args;
|
|
183
|
+
if (!Array.isArray(args)) {
|
|
184
|
+
errors.push(`${path}.args must be an array`);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (!args.every((arg) => typeof arg === "string")) {
|
|
188
|
+
errors.push(`${path}.args must be an array of strings`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function validateContainerTask(value, index, errors) {
|
|
192
|
+
const path = `tasks[${String(index)}]`;
|
|
193
|
+
if (!isRecord(value)) {
|
|
194
|
+
errors.push(`${path} must be an object`);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (!isNonEmptyString(value.id))
|
|
198
|
+
errors.push(`${path}.id must be a non-empty string`);
|
|
199
|
+
if (!isNonEmptyString(value.label))
|
|
200
|
+
errors.push(`${path}.label must be a non-empty string`);
|
|
201
|
+
if (!isNonEmptyString(value.image))
|
|
202
|
+
errors.push(`${path}.image must be a non-empty string`);
|
|
203
|
+
if (!isOneOf(value.kind, CONTAINER_TASK_KINDS))
|
|
204
|
+
errors.push(`${path}.kind is invalid`);
|
|
205
|
+
if (!isOneOf(value.engine, CONTAINER_ENGINE_IDS))
|
|
206
|
+
errors.push(`${path}.engine is invalid`);
|
|
207
|
+
validateContainerTaskArgs(value, path, errors);
|
|
208
|
+
}
|
|
209
|
+
function validateCatalogScalars(value, errors) {
|
|
210
|
+
if (value.schemaVersion !== CONTAINER_RUNTIME_SCHEMA_VERSION) {
|
|
211
|
+
errors.push("schemaVersion is invalid");
|
|
212
|
+
}
|
|
213
|
+
if (!isNonEmptyString(value.projectId)) {
|
|
214
|
+
errors.push("projectId must be a non-empty string");
|
|
215
|
+
}
|
|
216
|
+
if (typeof value.engineAvailable !== "boolean") {
|
|
217
|
+
errors.push("engineAvailable must be a boolean");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export function validateContainerTaskCatalog(value) {
|
|
221
|
+
const errors = [];
|
|
222
|
+
if (!isRecord(value)) {
|
|
223
|
+
return { ok: false, errors: ["catalog must be an object"] };
|
|
224
|
+
}
|
|
225
|
+
validateCatalogScalars(value, errors);
|
|
226
|
+
if (!Array.isArray(value.tasks)) {
|
|
227
|
+
errors.push("tasks must be an array");
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
value.tasks.forEach((task, index) => {
|
|
231
|
+
validateContainerTask(task, index, errors);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
if (errors.length > 0) {
|
|
235
|
+
return { ok: false, errors };
|
|
236
|
+
}
|
|
237
|
+
return { ok: true, value: value };
|
|
238
|
+
}
|
|
239
|
+
function validateResultScalars(value, errors) {
|
|
240
|
+
if (value.schemaVersion !== CONTAINER_RUNTIME_SCHEMA_VERSION) {
|
|
241
|
+
errors.push("schemaVersion is invalid");
|
|
242
|
+
}
|
|
243
|
+
if (!isNonEmptyString(value.runId))
|
|
244
|
+
errors.push("runId must be a non-empty string");
|
|
245
|
+
if (!isNonEmptyString(value.taskId))
|
|
246
|
+
errors.push("taskId must be a non-empty string");
|
|
247
|
+
if (!isOneOf(value.kind, CONTAINER_TASK_KINDS))
|
|
248
|
+
errors.push("kind is invalid");
|
|
249
|
+
if (!isOneOf(value.engine, CONTAINER_ENGINE_IDS))
|
|
250
|
+
errors.push("engine is invalid");
|
|
251
|
+
if (!isOneOf(value.failureReason, CONTAINER_FAILURE_REASONS)) {
|
|
252
|
+
errors.push("failureReason is invalid");
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function validateResultNumbers(value, errors) {
|
|
256
|
+
const exitCode = value.exitCode;
|
|
257
|
+
if (exitCode !== null && (typeof exitCode !== "number" || !Number.isInteger(exitCode))) {
|
|
258
|
+
errors.push("exitCode must be an integer or null");
|
|
259
|
+
}
|
|
260
|
+
const durationMs = value.durationMs;
|
|
261
|
+
if (typeof durationMs !== "number" || !Number.isFinite(durationMs) || durationMs < 0) {
|
|
262
|
+
errors.push("durationMs must be a non-negative finite number");
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function validateResultFlagsAndText(value, errors) {
|
|
266
|
+
if (typeof value.truncated !== "boolean")
|
|
267
|
+
errors.push("truncated must be a boolean");
|
|
268
|
+
if (typeof value.timedOut !== "boolean")
|
|
269
|
+
errors.push("timedOut must be a boolean");
|
|
270
|
+
if (typeof value.stdout !== "string")
|
|
271
|
+
errors.push("stdout must be a string");
|
|
272
|
+
if (typeof value.stderr !== "string")
|
|
273
|
+
errors.push("stderr must be a string");
|
|
274
|
+
}
|
|
275
|
+
export function validateContainerRunResult(value) {
|
|
276
|
+
const errors = [];
|
|
277
|
+
if (!isRecord(value)) {
|
|
278
|
+
return { ok: false, errors: ["result must be an object"] };
|
|
279
|
+
}
|
|
280
|
+
validateResultScalars(value, errors);
|
|
281
|
+
validateResultNumbers(value, errors);
|
|
282
|
+
validateResultFlagsAndText(value, errors);
|
|
283
|
+
if (errors.length > 0) {
|
|
284
|
+
return { ok: false, errors };
|
|
285
|
+
}
|
|
286
|
+
return { ok: true, value: value };
|
|
287
|
+
}
|
|
@@ -44,8 +44,8 @@ const TOKEN_BYTES_PER_TOKEN_DIVISOR = 3.5;
|
|
|
44
44
|
// Small fixed structural overhead per segment, modelling per-message framing. Empty input
|
|
45
45
|
// returns exactly this (never 0 / NaN).
|
|
46
46
|
const TOKEN_STRUCTURAL_OVERHEAD = 2;
|
|
47
|
-
//
|
|
48
|
-
//
|
|
47
|
+
// Uses TextEncoder when available, with a char-length fallback for any legacy
|
|
48
|
+
// harness without it. Never throws.
|
|
49
49
|
function utf8ByteLength(text) {
|
|
50
50
|
if (typeof TextEncoder !== "undefined") {
|
|
51
51
|
return new TextEncoder().encode(text).length;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { VoiceProfile } from "./gateway.js";
|
|
2
|
+
import type { CitationDiscipline, ContradictionPolicy, GroundingDirective } from "./prompt-enhancer.js";
|
|
3
|
+
export declare const DISCUSSION_INTELLIGENCE_SCHEMA_VERSION: "1";
|
|
4
|
+
export declare function isDiscussionIntelligenceSchemaVersionSupported(version: unknown): boolean;
|
|
5
|
+
export type DiscussionMode = "challenge" | "review" | "decide" | "brainstorm" | "evidence-check";
|
|
6
|
+
export declare const DISCUSSION_MODES: readonly DiscussionMode[];
|
|
7
|
+
export declare function isDiscussionMode(value: unknown): value is DiscussionMode;
|
|
8
|
+
export declare function assertNeverDiscussionMode(value: never): never;
|
|
9
|
+
export type ConfidenceLevel = "high" | "medium" | "low";
|
|
10
|
+
export declare const DISCUSSION_CONFIDENCE_LEVELS: readonly ConfidenceLevel[];
|
|
11
|
+
export declare function confidenceLevelFromScore(score: number): ConfidenceLevel;
|
|
12
|
+
export type DisagreementFacet = "evidence" | "assumptions" | "uncertainty";
|
|
13
|
+
export declare const DISAGREEMENT_FACETS: readonly DisagreementFacet[];
|
|
14
|
+
export type DiscussionDirective = "state-position-then-evidence" | "challenge-stated-assumptions" | "surface-counter-evidence" | "list-explicit-assumptions" | "disclose-uncertainty-and-confidence" | "cite-evidence-or-state-none" | "offer-decision-with-tradeoffs" | "expand-option-space-before-converging" | "verify-claims-against-evidence" | "defer-to-user-on-unresolved-contradiction";
|
|
15
|
+
export declare const DISCUSSION_DIRECTIVES: readonly DiscussionDirective[];
|
|
16
|
+
export declare function assertNeverDiscussionDirective(value: never): never;
|
|
17
|
+
export declare const DISCUSSION_DIRECTIVE_TEMPLATES: Readonly<Record<DiscussionDirective, string>>;
|
|
18
|
+
export declare const DISCUSSION_DIRECTIVE_FACETS: Readonly<Record<DiscussionDirective, readonly DisagreementFacet[]>>;
|
|
19
|
+
export interface DiscussionModePlan {
|
|
20
|
+
readonly mode: DiscussionMode;
|
|
21
|
+
readonly challengesAssumptions: boolean;
|
|
22
|
+
readonly requiresExplicitAssumptions: boolean;
|
|
23
|
+
readonly requiresUncertaintyDisclosure: boolean;
|
|
24
|
+
readonly citationDiscipline: CitationDiscipline;
|
|
25
|
+
readonly contradictionPolicy: ContradictionPolicy;
|
|
26
|
+
readonly groundingDirectives: readonly GroundingDirective[];
|
|
27
|
+
readonly producesDecisionRecommendation: boolean;
|
|
28
|
+
readonly mandatedFacets: readonly DisagreementFacet[];
|
|
29
|
+
readonly directives: readonly DiscussionDirective[];
|
|
30
|
+
}
|
|
31
|
+
export declare const DISCUSSION_MODE_PLANS: Readonly<Record<DiscussionMode, DiscussionModePlan>>;
|
|
32
|
+
export declare function discussionModePlan(mode: DiscussionMode): DiscussionModePlan;
|
|
33
|
+
export declare function discussionDirectivesCoverFacets(plan: DiscussionModePlan): boolean;
|
|
34
|
+
export declare function voiceCanDriveDiscussion(profile: VoiceProfile): boolean;
|
|
35
|
+
export type DiscussionTurnStatus = "active" | "interrupted" | "recovered" | "resolved";
|
|
36
|
+
export declare const DISCUSSION_TURN_STATUSES: readonly DiscussionTurnStatus[];
|
|
37
|
+
export declare const DISCUSSION_TURN_STATUS_TRANSITIONS: Readonly<Record<DiscussionTurnStatus, readonly DiscussionTurnStatus[]>>;
|
|
38
|
+
export declare function isDiscussionTurnStatus(value: unknown): value is DiscussionTurnStatus;
|
|
39
|
+
export declare function canTransitionDiscussionTurnStatus(from: DiscussionTurnStatus, to: DiscussionTurnStatus): boolean;
|
|
40
|
+
export declare function assertNeverDiscussionTurnStatus(value: never): never;
|
|
41
|
+
export declare function discussionTopicIdReasons(value: unknown): readonly string[];
|
|
42
|
+
export declare function isValidDiscussionTopicId(value: unknown): value is string;
|
|
43
|
+
export interface DiscussionTurnContext {
|
|
44
|
+
readonly schemaVersion: typeof DISCUSSION_INTELLIGENCE_SCHEMA_VERSION;
|
|
45
|
+
readonly mode: DiscussionMode;
|
|
46
|
+
readonly topicId: string;
|
|
47
|
+
readonly turnIndex: number;
|
|
48
|
+
readonly status: DiscussionTurnStatus;
|
|
49
|
+
}
|
|
50
|
+
export declare function beginDiscussionTurn(mode: DiscussionMode, topicId: string, turnIndex: number): DiscussionTurnContext;
|
|
51
|
+
export declare function applyDiscussionInterruption(ctx: DiscussionTurnContext): DiscussionTurnContext;
|
|
52
|
+
export declare function applyDiscussionRecovery(ctx: DiscussionTurnContext): DiscussionTurnContext;
|
|
53
|
+
export declare function resolveDiscussionTurn(ctx: DiscussionTurnContext): DiscussionTurnContext;
|
|
54
|
+
export interface DiscussionTurnSummary {
|
|
55
|
+
readonly mode: DiscussionMode;
|
|
56
|
+
readonly status: DiscussionTurnStatus;
|
|
57
|
+
readonly turnIndex: number;
|
|
58
|
+
readonly mandatedFacetCount: number;
|
|
59
|
+
readonly confidence?: ConfidenceLevel;
|
|
60
|
+
}
|
|
61
|
+
export declare function summarizeDiscussionTurn(ctx: DiscussionTurnContext, confidenceScore?: number): DiscussionTurnSummary;
|
|
62
|
+
export type DiscussionValidationResult = {
|
|
63
|
+
readonly ok: true;
|
|
64
|
+
} | {
|
|
65
|
+
readonly ok: false;
|
|
66
|
+
readonly reasons: readonly string[];
|
|
67
|
+
};
|
|
68
|
+
export declare function validateDiscussionTurnContext(value: unknown): DiscussionValidationResult;
|
|
69
|
+
export declare function validateDiscussionModePlan(value: unknown): DiscussionValidationResult;
|
|
70
|
+
//# sourceMappingURL=discussion-intelligence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discussion-intelligence.d.ts","sourceRoot":"","sources":["../src/discussion-intelligence.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAI9B,eAAO,MAAM,sCAAsC,EAAG,GAAY,CAAC;AAEnE,wBAAgB,8CAA8C,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAExF;AAMD,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEjG,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAM5C,CAAC;AAEX,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,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