@elaraai/e3-ui-components 1.0.4 → 1.0.6
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/README.md +3 -2
- package/dist/decision/constraint-format.d.ts +20 -0
- package/dist/decision/constraint-format.d.ts.map +1 -0
- package/dist/decision/facets.d.ts +23 -0
- package/dist/decision/facets.d.ts.map +1 -0
- package/dist/decision/handle-runtime.d.ts +78 -0
- package/dist/decision/handle-runtime.d.ts.map +1 -0
- package/dist/decision/journal.d.ts +10 -0
- package/dist/decision/journal.d.ts.map +1 -0
- package/dist/decision/lever-editor.d.ts +28 -0
- package/dist/decision/lever-editor.d.ts.map +1 -0
- package/dist/decision/queue.d.ts +10 -0
- package/dist/decision/queue.d.ts.map +1 -0
- package/dist/decision/types.d.ts +11 -0
- package/dist/decision/types.d.ts.map +1 -0
- package/dist/diff/index.d.ts +1 -1
- package/dist/diff/index.d.ts.map +1 -1
- package/dist/index.cjs +1234 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1229 -12
- package/dist/index.js.map +1 -1
- package/dist/ontology/bind-runtime.d.ts +1 -1
- package/dist/ontology/bind-runtime.d.ts.map +1 -1
- package/dist/ontology/index.d.ts +1 -1
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/types.d.ts +1 -1
- package/dist/ontology/types.d.ts.map +1 -1
- package/dist/platform/bind-runtime.d.ts +1 -1
- package/dist/platform/bind-runtime.d.ts.map +1 -1
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -2,17 +2,18 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
var _a;
|
|
5
|
-
import { variant, EastError, ConflictError, equalFor, SortedMap, toEastTypeValue, PatchType, diffFor, applyFor, encodeBeast2For, decodeBeast2For, BlobType, compareFor, walkPatch, pathToString, pathDisplay, printFor, isVariant, prunePatchFor, detectConflictsFor, mergeWithResolutionsFor, validatePatchFor, none as none$1, some } from "@elaraai/east";
|
|
5
|
+
import { variant, EastError, ConflictError, equalFor, SortedMap, toEastTypeValue, PatchType, diffFor, applyFor, encodeBeast2For, decodeBeast2For, BlobType, compareFor, walkPatch, pathToString, pathDisplay, printFor, isVariant, prunePatchFor, detectConflictsFor, mergeWithResolutionsFor, validatePatchFor, none as none$1, some, OptionType, StringType } from "@elaraai/east";
|
|
6
6
|
import { EastTypeType } from "@elaraai/east/internal";
|
|
7
|
-
import { bindPlatformFn, Diff, Ontology, decodeManifest } from "@elaraai/e3-ui";
|
|
7
|
+
import { bindPlatformFn, Diff, Ontology, decisionBindPlatformFn, DecisionQueue, DecisionJournal, decodeManifest } from "@elaraai/e3-ui/internal";
|
|
8
8
|
import { registerReactiveTracker, registerPlatformImplementation } from "@elaraai/east-ui-components/platform";
|
|
9
9
|
import { workspaceStatus, datasetListAt, datasetList, dataflowExecuteLaunch, datasetSet, datasetGet, ApiError, repoCreate, repoGc, repoGcStart, repoGcStatus, repoList, repoRemove, repoStatus, packageExport, packageGet, packageImport, packageList, packageRemove, workspaceCreate, workspaceDeploy, workspaceExport, workspaceGet, workspaceList, workspaceRemove, datasetGetStatus, datasetListRecursive, datasetListRecursivePaths, datasetListWithStatus, taskExecutionList, taskGet, taskList, dataflowCancel, dataflowExecute, dataflowExecutePoll, dataflowGraph, taskLogs } from "@elaraai/e3-api-client";
|
|
10
10
|
import { jsx as jsx$1, Fragment, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import * as React from "react";
|
|
12
12
|
import React__default, { useId, useMemo, useContext, createContext, useRef, useEffect, useState, useCallback, useSyncExternalStore, memo, forwardRef, useLayoutEffect, Component } from "react";
|
|
13
|
-
import { Box, Flex, Text, HStack, Input, useSlotRecipe, useRecipe, VStack, useToken, Drawer, Portal, Field, NativeSelect, Textarea, Menu, Spinner, Code, Clipboard, IconButton, Badge, Button, Tabs, useTabs, SegmentGroup } from "@chakra-ui/react";
|
|
14
|
-
import { implementUIComponent, StateImpl, OverlayImpl, createUIStore, UIStoreProvider
|
|
13
|
+
import { Box, Flex, Text, HStack, Input, useSlotRecipe, useRecipe, VStack, useToken, Drawer, Portal, Field, NativeSelect, Textarea, Menu, chakra, Spinner, Code, Clipboard, IconButton, Badge, Button, Tabs, useTabs, SegmentGroup } from "@chakra-ui/react";
|
|
14
|
+
import { implementUIComponent, getSomeorUndefined, StateRuntime, buildSliceHandle, DEFAULT_SLICE_STATE, registerPlatformImplementation as registerPlatformImplementation$1, EastChakraSelect, EastChakraStringInput, EastChakraDateTimeInput, EastChakraFloatInput, EastChakraIntegerInput, formatTick, useSliceReactivity, SliceRailCluster, EastChakraComponent, ClauseChip, StateImpl, OverlayImpl, createUIStore, UIStoreProvider } from "@elaraai/east-ui-components";
|
|
15
15
|
import { createPortal } from "react-dom";
|
|
16
|
+
import { sliceMatches } from "@elaraai/east-ui/internal";
|
|
16
17
|
import { QueryClient, QueryClientProvider, useMutation, useQuery } from "@tanstack/react-query";
|
|
17
18
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
18
19
|
const realClock = {
|
|
@@ -18300,7 +18301,7 @@ var hashIntsArray = function hashIntsArray2(ints, seed) {
|
|
|
18300
18301
|
};
|
|
18301
18302
|
return hashIterableInts(iterator, seed);
|
|
18302
18303
|
};
|
|
18303
|
-
var hashString = function
|
|
18304
|
+
var hashString$1 = function hashString(str, seed) {
|
|
18304
18305
|
var entry = {
|
|
18305
18306
|
value: 0,
|
|
18306
18307
|
done: false
|
|
@@ -18327,9 +18328,9 @@ var hashStringsArray = function hashStringsArray2(strs) {
|
|
|
18327
18328
|
for (var i = 0; i < strs.length; i++) {
|
|
18328
18329
|
var str = strs[i];
|
|
18329
18330
|
if (i === 0) {
|
|
18330
|
-
hash2 = hashString(str);
|
|
18331
|
+
hash2 = hashString$1(str);
|
|
18331
18332
|
} else {
|
|
18332
|
-
hash2 = hashString(str, hash2);
|
|
18333
|
+
hash2 = hashString$1(str, hash2);
|
|
18333
18334
|
}
|
|
18334
18335
|
}
|
|
18335
18336
|
return hash2;
|
|
@@ -25467,7 +25468,7 @@ var cache = function cache2(fn3, name) {
|
|
|
25467
25468
|
var _p = eles[0]._private;
|
|
25468
25469
|
var tch = _p.traversalCache = _p.traversalCache || {};
|
|
25469
25470
|
var ch = tch[name] = tch[name] || [];
|
|
25470
|
-
var hash2 = hashString(key);
|
|
25471
|
+
var hash2 = hashString$1(key);
|
|
25471
25472
|
var cacheHit = ch[hash2];
|
|
25472
25473
|
if (cacheHit) {
|
|
25473
25474
|
return cacheHit;
|
|
@@ -28073,13 +28074,13 @@ function styleCache(key, fn3, ele) {
|
|
|
28073
28074
|
}
|
|
28074
28075
|
}
|
|
28075
28076
|
function cacheStyleFunction(key, fn3) {
|
|
28076
|
-
key = hashString(key);
|
|
28077
|
+
key = hashString$1(key);
|
|
28077
28078
|
return function cachedStyleFunction(ele) {
|
|
28078
28079
|
return styleCache(key, fn3, ele);
|
|
28079
28080
|
};
|
|
28080
28081
|
}
|
|
28081
28082
|
function cachePrototypeStyleFunction(key, fn3) {
|
|
28082
|
-
key = hashString(key);
|
|
28083
|
+
key = hashString$1(key);
|
|
28083
28084
|
var selfFn = function selfFn2(ele) {
|
|
28084
28085
|
return fn3.call(ele);
|
|
28085
28086
|
};
|
|
@@ -38350,7 +38351,7 @@ BRp$9.applyLabelDimensions = function(ele) {
|
|
|
38350
38351
|
BRp$9.applyPrefixedLabelDimensions = function(ele, prefix2) {
|
|
38351
38352
|
var _p = ele._private;
|
|
38352
38353
|
var text = this.getLabelText(ele, prefix2);
|
|
38353
|
-
var cacheKey = hashString(text, ele._private.labelDimsKey);
|
|
38354
|
+
var cacheKey = hashString$1(text, ele._private.labelDimsKey);
|
|
38354
38355
|
if (getPrefixedProperty(_p.rscratch, "prefixedLabelDimsKey", prefix2) === cacheKey) {
|
|
38355
38356
|
return;
|
|
38356
38357
|
}
|
|
@@ -42746,7 +42747,7 @@ CRp$9.drawArrowShape = function(edge, context, fill, edgeWidth, shape, shapeWidt
|
|
|
42746
42747
|
var shapeImpl = r2.arrowShapes[shape];
|
|
42747
42748
|
if (usePaths) {
|
|
42748
42749
|
var cache3 = r2.arrowPathCache = r2.arrowPathCache || [];
|
|
42749
|
-
var key = hashString(shape);
|
|
42750
|
+
var key = hashString$1(shape);
|
|
42750
42751
|
var cachedPath = cache3[key];
|
|
42751
42752
|
if (cachedPath != null) {
|
|
42752
42753
|
path = context = cachedPath;
|
|
@@ -53038,6 +53039,1219 @@ const EastChakraOntology = memo(function EastChakraOntology2({ value }) {
|
|
|
53038
53039
|
);
|
|
53039
53040
|
});
|
|
53040
53041
|
implementUIComponent(Ontology.Component, EastChakraOntology);
|
|
53042
|
+
const SELECTION_TYPE = OptionType(StringType);
|
|
53043
|
+
const encodeSelection = encodeBeast2For(SELECTION_TYPE);
|
|
53044
|
+
const decodeSelection = decodeBeast2For(SELECTION_TYPE);
|
|
53045
|
+
function deriveSelectionKey(decisions) {
|
|
53046
|
+
return ["decision.selection", ...decisions.map((d2) => datasetPathToString(d2.source))].join("|");
|
|
53047
|
+
}
|
|
53048
|
+
function viewFor(binding) {
|
|
53049
|
+
const workspace = getReactiveDatasetCache().getConfig().workspace ?? "";
|
|
53050
|
+
const source = binding.source;
|
|
53051
|
+
const types = getBindingTypes(workspace, source);
|
|
53052
|
+
if (!types) {
|
|
53053
|
+
throw new Error(
|
|
53054
|
+
`Decision.bind: no binding registered for ${datasetPathToString(source)} — bind it with Data.bind on the same surface first`
|
|
53055
|
+
);
|
|
53056
|
+
}
|
|
53057
|
+
const patch = binding.patch.type === "some" ? binding.patch.value : void 0;
|
|
53058
|
+
return defaultBindRuntime.buildBindHandle(types.sourceType, source, patch, binding.mode.type);
|
|
53059
|
+
}
|
|
53060
|
+
const DECISION_SLICE_CONFIG = {
|
|
53061
|
+
fields: /* @__PURE__ */ new Map([
|
|
53062
|
+
["kind", variant("string", { label: "Kind", accessor: (d2) => d2.kind })],
|
|
53063
|
+
["title", variant("string", { label: "Title", accessor: (d2) => d2.title })],
|
|
53064
|
+
["value", variant("float", { label: "Value", accessor: (d2) => d2.value })]
|
|
53065
|
+
]),
|
|
53066
|
+
rangeFieldId: none$1,
|
|
53067
|
+
searchFieldIds: ["kind", "title"],
|
|
53068
|
+
breakdownFieldIds: []
|
|
53069
|
+
};
|
|
53070
|
+
function deriveSliceKey(decisions, sliceInit) {
|
|
53071
|
+
const sources = decisions.map((d2) => datasetPathToString(d2.source));
|
|
53072
|
+
const seed = sliceInit === void 0 ? "none" : hashString2(stableStringify(sliceInit));
|
|
53073
|
+
return ["decision.slice", ...sources, seed].join("|");
|
|
53074
|
+
}
|
|
53075
|
+
function stableStringify(v3) {
|
|
53076
|
+
return JSON.stringify(v3, (_k, x2) => {
|
|
53077
|
+
if (typeof x2 === "bigint") return `${x2}n`;
|
|
53078
|
+
if (x2 instanceof Date) return x2.toISOString();
|
|
53079
|
+
if (x2 instanceof Set) return [...x2].sort();
|
|
53080
|
+
if (x2 instanceof Map) return [...x2.entries()].sort((a2, b2) => String(a2[0]).localeCompare(String(b2[0])));
|
|
53081
|
+
return x2;
|
|
53082
|
+
});
|
|
53083
|
+
}
|
|
53084
|
+
function hashString2(s2) {
|
|
53085
|
+
let h2 = 5381;
|
|
53086
|
+
for (let i = 0; i < s2.length; i++) h2 = (h2 << 5) + h2 + s2.charCodeAt(i) | 0;
|
|
53087
|
+
return (h2 >>> 0).toString(36);
|
|
53088
|
+
}
|
|
53089
|
+
function buildDecisionHandle(decisions, judgements, sliceInit) {
|
|
53090
|
+
const selectionKey = deriveSelectionKey(decisions);
|
|
53091
|
+
const readSelection = () => {
|
|
53092
|
+
StateRuntime.trackKey(selectionKey);
|
|
53093
|
+
const bytes = StateRuntime.getStore().read(selectionKey);
|
|
53094
|
+
return bytes === void 0 ? none$1 : decodeSelection(bytes);
|
|
53095
|
+
};
|
|
53096
|
+
const writeSelection = (value) => {
|
|
53097
|
+
StateRuntime.getStore().write(selectionKey, encodeSelection(value));
|
|
53098
|
+
return null;
|
|
53099
|
+
};
|
|
53100
|
+
const queue = () => decisions.flatMap((b2) => viewFor(b2).read());
|
|
53101
|
+
const readJudgements = () => viewFor(judgements).read();
|
|
53102
|
+
const writeJudgements = (next2) => {
|
|
53103
|
+
viewFor(judgements).write(next2);
|
|
53104
|
+
};
|
|
53105
|
+
const judgementFor = (caseId) => readJudgements().get(caseId) ?? {
|
|
53106
|
+
caseId,
|
|
53107
|
+
answers: /* @__PURE__ */ new Map(),
|
|
53108
|
+
knowledge: none$1,
|
|
53109
|
+
constraints: [],
|
|
53110
|
+
verdict: none$1,
|
|
53111
|
+
resolvedAt: none$1
|
|
53112
|
+
};
|
|
53113
|
+
const stageJudgement = (caseId, change) => {
|
|
53114
|
+
const dict = new Map(readJudgements());
|
|
53115
|
+
dict.set(caseId, { ...judgementFor(caseId), ...change });
|
|
53116
|
+
writeJudgements(dict);
|
|
53117
|
+
return null;
|
|
53118
|
+
};
|
|
53119
|
+
const removeFromOwningView = (caseId) => {
|
|
53120
|
+
for (const binding of decisions) {
|
|
53121
|
+
const view = viewFor(binding);
|
|
53122
|
+
const rows = view.read();
|
|
53123
|
+
if (rows.some((d2) => d2.id === caseId)) {
|
|
53124
|
+
view.write(rows.filter((d2) => d2.id !== caseId));
|
|
53125
|
+
}
|
|
53126
|
+
}
|
|
53127
|
+
};
|
|
53128
|
+
const slice3 = buildSliceHandle(
|
|
53129
|
+
deriveSliceKey(decisions, sliceInit),
|
|
53130
|
+
DECISION_SLICE_CONFIG,
|
|
53131
|
+
sliceInit ?? DEFAULT_SLICE_STATE,
|
|
53132
|
+
() => queue(),
|
|
53133
|
+
none$1
|
|
53134
|
+
);
|
|
53135
|
+
return {
|
|
53136
|
+
decisions,
|
|
53137
|
+
judgements,
|
|
53138
|
+
sliceInit: sliceInit !== void 0 ? some(sliceInit) : none$1,
|
|
53139
|
+
slice: slice3,
|
|
53140
|
+
queue,
|
|
53141
|
+
selected: readSelection,
|
|
53142
|
+
select: (caseId) => writeSelection(some(caseId)),
|
|
53143
|
+
clearSelection: () => writeSelection(none$1),
|
|
53144
|
+
decision: () => {
|
|
53145
|
+
const selection2 = readSelection();
|
|
53146
|
+
if (selection2.type === "none") return none$1;
|
|
53147
|
+
const found = queue().find((d2) => d2.id === selection2.value);
|
|
53148
|
+
return found === void 0 ? none$1 : some(found);
|
|
53149
|
+
},
|
|
53150
|
+
update: (edited) => {
|
|
53151
|
+
for (const binding of decisions) {
|
|
53152
|
+
const view = viewFor(binding);
|
|
53153
|
+
const rows = view.read();
|
|
53154
|
+
if (rows.some((d2) => d2.id === edited.id)) {
|
|
53155
|
+
view.write(rows.map((d2) => d2.id === edited.id ? edited : d2));
|
|
53156
|
+
}
|
|
53157
|
+
}
|
|
53158
|
+
return null;
|
|
53159
|
+
},
|
|
53160
|
+
judgement: judgementFor,
|
|
53161
|
+
answer: (caseId, prompt, response) => {
|
|
53162
|
+
const answers = new Map(judgementFor(caseId).answers);
|
|
53163
|
+
answers.set(prompt, response);
|
|
53164
|
+
return stageJudgement(caseId, { answers });
|
|
53165
|
+
},
|
|
53166
|
+
addKnowledge: (caseId, text) => stageJudgement(caseId, { knowledge: some(text) }),
|
|
53167
|
+
inject: (caseId, constraint) => {
|
|
53168
|
+
const constraints = judgementFor(caseId).constraints.filter((c2) => c2.type !== constraint.type).concat([constraint]);
|
|
53169
|
+
return stageJudgement(caseId, { constraints });
|
|
53170
|
+
},
|
|
53171
|
+
resolve: (caseId, verdict) => {
|
|
53172
|
+
stageJudgement(caseId, { verdict: some(verdict), resolvedAt: some(/* @__PURE__ */ new Date()) });
|
|
53173
|
+
removeFromOwningView(caseId);
|
|
53174
|
+
writeSelection(none$1);
|
|
53175
|
+
return null;
|
|
53176
|
+
},
|
|
53177
|
+
journal: () => {
|
|
53178
|
+
const entries = [...readJudgements().values()].filter((j2) => j2.verdict.type === "some");
|
|
53179
|
+
const at = (j2) => j2.resolvedAt.type === "some" ? j2.resolvedAt.value.getTime() : 0;
|
|
53180
|
+
return entries.sort((a2, b2) => at(b2) - at(a2));
|
|
53181
|
+
},
|
|
53182
|
+
commitState: (caseId) => {
|
|
53183
|
+
const decision = queue().find((d2) => d2.id === caseId);
|
|
53184
|
+
const prompts = (decision == null ? void 0 : decision.prompts) ?? [];
|
|
53185
|
+
const answers = judgementFor(caseId).answers;
|
|
53186
|
+
const responses = prompts.map((p2) => {
|
|
53187
|
+
var _a2;
|
|
53188
|
+
return (_a2 = answers.get(p2.id)) == null ? void 0 : _a2.type;
|
|
53189
|
+
});
|
|
53190
|
+
if (responses.some((r2) => r2 === "no")) return variant("blocked", null);
|
|
53191
|
+
if (responses.some((r2) => r2 === "unknown")) return variant("handoff", null);
|
|
53192
|
+
const unanswered = responses.filter((r2) => r2 === void 0).length;
|
|
53193
|
+
if (unanswered > 0) return variant("gated", BigInt(unanswered));
|
|
53194
|
+
return variant("ready", null);
|
|
53195
|
+
}
|
|
53196
|
+
};
|
|
53197
|
+
}
|
|
53198
|
+
const DecisionBindPlatform = [
|
|
53199
|
+
// Generic over the constraint contract — the type argument resolver
|
|
53200
|
+
// receives the contract type value; the JS impl is type-agnostic.
|
|
53201
|
+
decisionBindPlatformFn.implement((_constraintType) => (decisionsArg, judgementsArg, sliceInitArg) => buildDecisionHandle(
|
|
53202
|
+
decisionsArg,
|
|
53203
|
+
judgementsArg,
|
|
53204
|
+
getSomeorUndefined(sliceInitArg)
|
|
53205
|
+
))
|
|
53206
|
+
];
|
|
53207
|
+
registerPlatformImplementation$1(DecisionBindPlatform);
|
|
53208
|
+
function useHandleVersion(handle) {
|
|
53209
|
+
const staged = getStagedStore();
|
|
53210
|
+
const cache3 = getReactiveDatasetCache();
|
|
53211
|
+
const state = StateRuntime.getStore();
|
|
53212
|
+
const workspace = cache3.getConfig().workspace ?? "";
|
|
53213
|
+
const keys = useMemo(() => {
|
|
53214
|
+
if (!handle) return [];
|
|
53215
|
+
const bindings = [...handle.decisions, handle.judgements];
|
|
53216
|
+
const ks = [];
|
|
53217
|
+
for (const b2 of bindings) {
|
|
53218
|
+
ks.push(datasetCacheKey(workspace, b2.source));
|
|
53219
|
+
if (b2.patch.type === "some") ks.push(datasetCacheKey(workspace, b2.patch.value));
|
|
53220
|
+
}
|
|
53221
|
+
return ks;
|
|
53222
|
+
}, [workspace, handle]);
|
|
53223
|
+
const selectionKey = handle ? deriveSelectionKey(handle.decisions) : void 0;
|
|
53224
|
+
const subscribe = useCallback((cb) => {
|
|
53225
|
+
const unsubs = keys.flatMap((k2) => [staged.subscribe(k2, cb), cache3.subscribe(k2, cb)]);
|
|
53226
|
+
if (selectionKey !== void 0) unsubs.push(state.subscribe(selectionKey, cb));
|
|
53227
|
+
return () => {
|
|
53228
|
+
for (const u2 of unsubs) u2();
|
|
53229
|
+
};
|
|
53230
|
+
}, [staged, cache3, state, keys, selectionKey]);
|
|
53231
|
+
const getSnapshot = useCallback(
|
|
53232
|
+
() => keys.reduce((sum, k2) => sum + staged.getKeyVersion(k2) + cache3.getKeyVersion(k2), 0) + (selectionKey !== void 0 ? state.getKeyVersion(selectionKey) : 0),
|
|
53233
|
+
[staged, cache3, state, keys, selectionKey]
|
|
53234
|
+
);
|
|
53235
|
+
return useSyncExternalStore(subscribe, getSnapshot);
|
|
53236
|
+
}
|
|
53237
|
+
function useDecisionHandle(ref) {
|
|
53238
|
+
const version2 = useHandleVersion(ref);
|
|
53239
|
+
const fns = useMemo(
|
|
53240
|
+
() => ref ? buildDecisionHandle(
|
|
53241
|
+
[...ref.decisions],
|
|
53242
|
+
ref.judgements,
|
|
53243
|
+
getSomeorUndefined(ref.slice)
|
|
53244
|
+
) : null,
|
|
53245
|
+
[ref]
|
|
53246
|
+
);
|
|
53247
|
+
const { decisions, selected: selected2, journal } = useMemo(() => {
|
|
53248
|
+
try {
|
|
53249
|
+
if (!fns) return { decisions: null, selected: null, journal: null };
|
|
53250
|
+
const sel = fns.selected();
|
|
53251
|
+
return {
|
|
53252
|
+
decisions: fns.queue(),
|
|
53253
|
+
selected: sel.type === "some" ? sel.value : null,
|
|
53254
|
+
journal: fns.journal()
|
|
53255
|
+
};
|
|
53256
|
+
} catch {
|
|
53257
|
+
return { decisions: null, selected: null, journal: null };
|
|
53258
|
+
}
|
|
53259
|
+
}, [fns, version2]);
|
|
53260
|
+
const judgementFor = useCallback((caseId) => {
|
|
53261
|
+
try {
|
|
53262
|
+
return fns ? fns.judgement(caseId) : null;
|
|
53263
|
+
} catch {
|
|
53264
|
+
return null;
|
|
53265
|
+
}
|
|
53266
|
+
}, [fns, version2]);
|
|
53267
|
+
const commitStateFor = useCallback((caseId) => {
|
|
53268
|
+
try {
|
|
53269
|
+
return fns ? fns.commitState(caseId) : null;
|
|
53270
|
+
} catch {
|
|
53271
|
+
return null;
|
|
53272
|
+
}
|
|
53273
|
+
}, [fns, version2]);
|
|
53274
|
+
const select2 = useCallback((caseId) => {
|
|
53275
|
+
fns == null ? void 0 : fns.select(caseId);
|
|
53276
|
+
}, [fns]);
|
|
53277
|
+
const clearSelection = useCallback(() => {
|
|
53278
|
+
fns == null ? void 0 : fns.clearSelection();
|
|
53279
|
+
}, [fns]);
|
|
53280
|
+
const update2 = useCallback((next2) => {
|
|
53281
|
+
fns == null ? void 0 : fns.update(next2);
|
|
53282
|
+
}, [fns]);
|
|
53283
|
+
const answer = useCallback((caseId, promptId, response) => {
|
|
53284
|
+
fns == null ? void 0 : fns.answer(caseId, promptId, variant(response, null));
|
|
53285
|
+
}, [fns]);
|
|
53286
|
+
const addKnowledge = useCallback((caseId, text) => {
|
|
53287
|
+
fns == null ? void 0 : fns.addKnowledge(caseId, text);
|
|
53288
|
+
}, [fns]);
|
|
53289
|
+
const inject = useCallback((caseId, constraint) => {
|
|
53290
|
+
fns == null ? void 0 : fns.inject(caseId, constraint);
|
|
53291
|
+
}, [fns]);
|
|
53292
|
+
const resolve2 = useCallback((caseId, verdict) => {
|
|
53293
|
+
fns == null ? void 0 : fns.resolve(caseId, verdict);
|
|
53294
|
+
}, [fns]);
|
|
53295
|
+
return {
|
|
53296
|
+
decisions,
|
|
53297
|
+
selected: selected2,
|
|
53298
|
+
journal,
|
|
53299
|
+
judgementFor,
|
|
53300
|
+
commitStateFor,
|
|
53301
|
+
select: select2,
|
|
53302
|
+
clearSelection,
|
|
53303
|
+
update: update2,
|
|
53304
|
+
answer,
|
|
53305
|
+
addKnowledge,
|
|
53306
|
+
inject,
|
|
53307
|
+
resolve: resolve2,
|
|
53308
|
+
slice: fns ? fns.slice : null
|
|
53309
|
+
};
|
|
53310
|
+
}
|
|
53311
|
+
const OP_WORDS = {
|
|
53312
|
+
eq: "=",
|
|
53313
|
+
neq: "≠",
|
|
53314
|
+
atMost: "at most",
|
|
53315
|
+
atLeast: "at least",
|
|
53316
|
+
between: "between",
|
|
53317
|
+
before: "before",
|
|
53318
|
+
after: "after",
|
|
53319
|
+
in: "in",
|
|
53320
|
+
notIn: "not in",
|
|
53321
|
+
is: "is"
|
|
53322
|
+
};
|
|
53323
|
+
function formatScalar(v3) {
|
|
53324
|
+
if (v3 instanceof Date) {
|
|
53325
|
+
return `${v3.toLocaleString("en", { month: "short" })} ${v3.getDate()}`;
|
|
53326
|
+
}
|
|
53327
|
+
if (v3 instanceof Set) {
|
|
53328
|
+
return `{${[...v3].map(formatScalar).join(", ")}}`;
|
|
53329
|
+
}
|
|
53330
|
+
if (v3 !== null && typeof v3 === "object" && !v3.type) {
|
|
53331
|
+
return Object.entries(v3).map(([k2, x2]) => `${k2} ${formatScalar(x2)}`).join(" · ");
|
|
53332
|
+
}
|
|
53333
|
+
return String(v3);
|
|
53334
|
+
}
|
|
53335
|
+
function formatConstraint(constraint, payloadType, levers) {
|
|
53336
|
+
var _a2, _b;
|
|
53337
|
+
const c2 = constraint;
|
|
53338
|
+
const lever = ((_a2 = levers == null ? void 0 : levers.find((l2) => l2.case === c2.type)) == null ? void 0 : _a2.label) ?? c2.type;
|
|
53339
|
+
if ((payloadType == null ? void 0 : payloadType.type) === "Variant") {
|
|
53340
|
+
const op = c2.value;
|
|
53341
|
+
const word = OP_WORDS[op.type] ?? op.type;
|
|
53342
|
+
const opType = (_b = payloadType.cases) == null ? void 0 : _b[op.type];
|
|
53343
|
+
if ((opType == null ? void 0 : opType.type) === "Struct" && op.value !== null && typeof op.value === "object") {
|
|
53344
|
+
const r2 = op.value;
|
|
53345
|
+
if ("min" in r2 && "max" in r2) {
|
|
53346
|
+
return { lever, op: word, value: `${formatScalar(r2.min)} – ${formatScalar(r2.max)}` };
|
|
53347
|
+
}
|
|
53348
|
+
}
|
|
53349
|
+
return { lever, op: word, value: formatScalar(op.value) };
|
|
53350
|
+
}
|
|
53351
|
+
return { lever, op: "·", value: formatScalar(c2.value) };
|
|
53352
|
+
}
|
|
53353
|
+
const PRIMITIVES = /* @__PURE__ */ new Set(["String", "Integer", "Float", "DateTime", "Boolean"]);
|
|
53354
|
+
function normalizeTypeValue(tv) {
|
|
53355
|
+
var _a2;
|
|
53356
|
+
const n2 = tv;
|
|
53357
|
+
if (n2.cases !== void 0 || n2.fields !== void 0) {
|
|
53358
|
+
const out = { type: n2.type };
|
|
53359
|
+
if (n2.cases) out.cases = Object.fromEntries(Object.entries(n2.cases).map(([k2, v3]) => [k2, normalizeTypeValue(v3)]));
|
|
53360
|
+
if (n2.fields) out.fields = Object.fromEntries(Object.entries(n2.fields).map(([k2, v3]) => [k2, normalizeTypeValue(v3)]));
|
|
53361
|
+
if (n2.key) out.key = normalizeTypeValue(n2.key);
|
|
53362
|
+
if (n2.value !== void 0 && (n2.type === "Array" || n2.type === "Dict")) out.value = normalizeTypeValue(n2.value);
|
|
53363
|
+
return out;
|
|
53364
|
+
}
|
|
53365
|
+
switch (n2.type) {
|
|
53366
|
+
case "Struct":
|
|
53367
|
+
return { type: "Struct", fields: Object.fromEntries(n2.value.map((f2) => [f2.name, normalizeTypeValue(f2.type)])) };
|
|
53368
|
+
case "Variant":
|
|
53369
|
+
return { type: "Variant", cases: Object.fromEntries(n2.value.map((f2) => [f2.name, normalizeTypeValue(f2.type)])) };
|
|
53370
|
+
case "Array":
|
|
53371
|
+
return { type: "Array", value: normalizeTypeValue(n2.value) };
|
|
53372
|
+
case "Dict": {
|
|
53373
|
+
const d2 = n2.value;
|
|
53374
|
+
return { type: "Dict", key: normalizeTypeValue(d2.key), value: normalizeTypeValue(d2.value) };
|
|
53375
|
+
}
|
|
53376
|
+
case "Recursive": {
|
|
53377
|
+
const w2 = n2.value;
|
|
53378
|
+
if ((w2 == null ? void 0 : w2.type) === "wrapper" && ((_a2 = w2.value) == null ? void 0 : _a2.inner)) return normalizeTypeValue(w2.value.inner);
|
|
53379
|
+
return { type: n2.type };
|
|
53380
|
+
}
|
|
53381
|
+
default:
|
|
53382
|
+
return { type: n2.type };
|
|
53383
|
+
}
|
|
53384
|
+
}
|
|
53385
|
+
function emptyFor(node2) {
|
|
53386
|
+
switch (node2.type) {
|
|
53387
|
+
case "Integer":
|
|
53388
|
+
return 0n;
|
|
53389
|
+
case "Float":
|
|
53390
|
+
return 0;
|
|
53391
|
+
case "DateTime":
|
|
53392
|
+
return /* @__PURE__ */ new Date();
|
|
53393
|
+
case "Boolean":
|
|
53394
|
+
return false;
|
|
53395
|
+
case "String":
|
|
53396
|
+
return "";
|
|
53397
|
+
case "Struct":
|
|
53398
|
+
return Object.fromEntries(Object.entries(node2.fields ?? {}).map(([k2, f2]) => [k2, emptyFor(f2)]));
|
|
53399
|
+
default:
|
|
53400
|
+
return null;
|
|
53401
|
+
}
|
|
53402
|
+
}
|
|
53403
|
+
function leverPayloadEditable(node2) {
|
|
53404
|
+
if (!node2) return false;
|
|
53405
|
+
if (PRIMITIVES.has(node2.type)) return true;
|
|
53406
|
+
if (node2.type === "Struct") return Object.values(node2.fields ?? {}).every((f2) => PRIMITIVES.has(f2.type));
|
|
53407
|
+
if (node2.type === "Variant") return Object.values(node2.cases ?? {}).every((c2) => PRIMITIVES.has(c2.type) || c2.type === "Struct" && Object.values(c2.fields ?? {}).every((f2) => PRIMITIVES.has(f2.type)));
|
|
53408
|
+
return false;
|
|
53409
|
+
}
|
|
53410
|
+
const inputStyle = some({ size: some(variant("sm", null)) });
|
|
53411
|
+
function LeverEditor({ leverCase, payload, onInject }) {
|
|
53412
|
+
var _a2;
|
|
53413
|
+
const button = useRecipe({ key: "button" });
|
|
53414
|
+
const isOpVariant = payload.type === "Variant";
|
|
53415
|
+
const ops = useMemo(() => isOpVariant ? Object.keys(payload.cases ?? {}) : [], [isOpVariant, payload]);
|
|
53416
|
+
const [opTag, setOpTag] = useState(ops[0] ?? "");
|
|
53417
|
+
const active = isOpVariant ? ((_a2 = payload.cases) == null ? void 0 : _a2[opTag]) ?? { type: "Null" } : payload;
|
|
53418
|
+
const valRef = useRef(emptyFor(active));
|
|
53419
|
+
const keyRef = useRef(`${leverCase}:${opTag}`);
|
|
53420
|
+
if (keyRef.current !== `${leverCase}:${opTag}`) {
|
|
53421
|
+
keyRef.current = `${leverCase}:${opTag}`;
|
|
53422
|
+
valRef.current = emptyFor(active);
|
|
53423
|
+
}
|
|
53424
|
+
const primitiveInput = (node2, key, get3, set3) => {
|
|
53425
|
+
switch (node2.type) {
|
|
53426
|
+
case "Integer":
|
|
53427
|
+
return /* @__PURE__ */ jsx$1(EastChakraIntegerInput, { value: { value: get3(), onChange: some(set3), style: inputStyle } }, key);
|
|
53428
|
+
case "Float":
|
|
53429
|
+
return /* @__PURE__ */ jsx$1(EastChakraFloatInput, { value: { value: get3(), onChange: some(set3), style: inputStyle } }, key);
|
|
53430
|
+
case "DateTime":
|
|
53431
|
+
return /* @__PURE__ */ jsx$1(EastChakraDateTimeInput, { value: { value: get3(), onChange: some(set3), style: inputStyle } }, key);
|
|
53432
|
+
case "Boolean":
|
|
53433
|
+
return /* @__PURE__ */ jsx$1(
|
|
53434
|
+
EastChakraSelect,
|
|
53435
|
+
{
|
|
53436
|
+
ariaLabel: key,
|
|
53437
|
+
value: {
|
|
53438
|
+
value: some(String(get3())),
|
|
53439
|
+
items: [{ value: "true", label: "true", disabled: none$1 }, { value: "false", label: "false", disabled: none$1 }],
|
|
53440
|
+
placeholder: none$1,
|
|
53441
|
+
multiple: none$1,
|
|
53442
|
+
disabled: none$1,
|
|
53443
|
+
onChange: some((v3) => set3(v3 === "true")),
|
|
53444
|
+
onChangeMultiple: none$1,
|
|
53445
|
+
onOpenChange: none$1,
|
|
53446
|
+
style: inputStyle
|
|
53447
|
+
}
|
|
53448
|
+
},
|
|
53449
|
+
key
|
|
53450
|
+
);
|
|
53451
|
+
default:
|
|
53452
|
+
return /* @__PURE__ */ jsx$1(EastChakraStringInput, { value: { value: String(get3() ?? ""), onChange: some(set3), style: inputStyle } }, key);
|
|
53453
|
+
}
|
|
53454
|
+
};
|
|
53455
|
+
const valueControls = useMemo(() => {
|
|
53456
|
+
const k2 = keyRef.current;
|
|
53457
|
+
if (active.type === "Struct") {
|
|
53458
|
+
return Object.entries(active.fields ?? {}).map(([field, node2]) => /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: "6px", minW: 0, children: [
|
|
53459
|
+
/* @__PURE__ */ jsx$1(Box, { as: "span", textStyle: "caption.eyebrow", color: "fg.subtle", flexShrink: 0, children: field }),
|
|
53460
|
+
primitiveInput(
|
|
53461
|
+
node2,
|
|
53462
|
+
`${k2}.${field}.in`,
|
|
53463
|
+
() => valRef.current[field],
|
|
53464
|
+
(v3) => {
|
|
53465
|
+
valRef.current[field] = v3;
|
|
53466
|
+
}
|
|
53467
|
+
)
|
|
53468
|
+
] }, `${k2}.${field}`));
|
|
53469
|
+
}
|
|
53470
|
+
return /* @__PURE__ */ jsx$1(Box, { width: "180px", flexShrink: 0, children: primitiveInput(active, `${k2}.value`, () => valRef.current, (v3) => {
|
|
53471
|
+
valRef.current = v3;
|
|
53472
|
+
}) }, `${k2}.wrap`);
|
|
53473
|
+
}, [active, opTag, leverCase]);
|
|
53474
|
+
const submit = () => {
|
|
53475
|
+
const value = valRef.current;
|
|
53476
|
+
const payloadValue = active.type === "Struct" ? { ...value } : value;
|
|
53477
|
+
const constraint = isOpVariant ? variant(leverCase, variant(opTag, payloadValue)) : variant(leverCase, payloadValue);
|
|
53478
|
+
onInject(constraint);
|
|
53479
|
+
valRef.current = emptyFor(active);
|
|
53480
|
+
};
|
|
53481
|
+
return /* @__PURE__ */ jsxs(
|
|
53482
|
+
Box,
|
|
53483
|
+
{
|
|
53484
|
+
display: "flex",
|
|
53485
|
+
alignItems: "center",
|
|
53486
|
+
gap: "8px",
|
|
53487
|
+
flexWrap: "wrap",
|
|
53488
|
+
minW: 0,
|
|
53489
|
+
css: {
|
|
53490
|
+
"& [data-scope=select][data-part=root]": { width: "auto", minWidth: "110px", flexShrink: 0 },
|
|
53491
|
+
"& [data-scope=number-input][data-part=root]": { width: "150px", flexShrink: 0 }
|
|
53492
|
+
},
|
|
53493
|
+
children: [
|
|
53494
|
+
isOpVariant && /* @__PURE__ */ jsx$1(
|
|
53495
|
+
EastChakraSelect,
|
|
53496
|
+
{
|
|
53497
|
+
ariaLabel: "Operator",
|
|
53498
|
+
value: {
|
|
53499
|
+
value: some(opTag),
|
|
53500
|
+
items: ops.map((o2) => ({ value: o2, label: OP_WORDS[o2] ?? o2, disabled: none$1 })),
|
|
53501
|
+
placeholder: none$1,
|
|
53502
|
+
multiple: none$1,
|
|
53503
|
+
disabled: none$1,
|
|
53504
|
+
onChange: some((v3) => setOpTag(v3)),
|
|
53505
|
+
onChangeMultiple: none$1,
|
|
53506
|
+
onOpenChange: none$1,
|
|
53507
|
+
style: inputStyle
|
|
53508
|
+
}
|
|
53509
|
+
}
|
|
53510
|
+
),
|
|
53511
|
+
valueControls,
|
|
53512
|
+
/* @__PURE__ */ jsx$1(chakra.button, { type: "button", css: button({ variant: "solid", size: "xs" }), onClick: submit, children: "Add" })
|
|
53513
|
+
]
|
|
53514
|
+
}
|
|
53515
|
+
);
|
|
53516
|
+
}
|
|
53517
|
+
function fmt(d2, n2, showSign = false) {
|
|
53518
|
+
return formatTick(n2, getSomeorUndefined(d2.format), showSign);
|
|
53519
|
+
}
|
|
53520
|
+
const caption = { textStyle: "caption.eyebrow", color: "fg.muted" };
|
|
53521
|
+
const EvidenceFacet = memo(function EvidenceFacet2({ decision, children: children2 }) {
|
|
53522
|
+
const stakes = getSomeorUndefined(decision.stakes);
|
|
53523
|
+
const downside = getSomeorUndefined(decision.downside);
|
|
53524
|
+
const confidence = getSomeorUndefined(decision.confidence);
|
|
53525
|
+
const detail = getSomeorUndefined(decision.detail);
|
|
53526
|
+
return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: "10px", children: [
|
|
53527
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "baseline", gap: "12px", flexWrap: "wrap", children: [
|
|
53528
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, color: "fg", children: "Why this is recommended" }),
|
|
53529
|
+
/* @__PURE__ */ jsxs(Text, { ...caption, children: [
|
|
53530
|
+
stakes !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53531
|
+
"stakes ",
|
|
53532
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", fontWeight: "semibold", children: stakes.type }),
|
|
53533
|
+
" · "
|
|
53534
|
+
] }),
|
|
53535
|
+
downside !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53536
|
+
"if wrong ",
|
|
53537
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", fontWeight: "semibold", color: "fg.danger", children: fmt(decision, downside, true) }),
|
|
53538
|
+
" · "
|
|
53539
|
+
] }),
|
|
53540
|
+
confidence !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53541
|
+
"confidence ",
|
|
53542
|
+
/* @__PURE__ */ jsxs(Text, { as: "span", fontFamily: "mono", fontWeight: "semibold", children: [
|
|
53543
|
+
Math.round(confidence * 100),
|
|
53544
|
+
"%"
|
|
53545
|
+
] })
|
|
53546
|
+
] })
|
|
53547
|
+
] })
|
|
53548
|
+
] }),
|
|
53549
|
+
detail !== void 0 && /* @__PURE__ */ jsx$1(Text, { fontSize: "12.5px", color: "fg.muted", children: detail }),
|
|
53550
|
+
decision.evidence.length > 0 && /* @__PURE__ */ jsx$1(Box, { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))", gap: "8px", children: decision.evidence.map((e2, i) => {
|
|
53551
|
+
const note = getSomeorUndefined(e2.note);
|
|
53552
|
+
return /* @__PURE__ */ jsxs(Box, { borderWidth: "1px", borderColor: "border.subtle", borderRadius: "4px", px: "10px", py: "8px", bg: "bg.canvas", children: [
|
|
53553
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, children: e2.label }),
|
|
53554
|
+
/* @__PURE__ */ jsx$1(Text, { fontSize: "13px", fontWeight: "medium", children: e2.text }),
|
|
53555
|
+
note !== void 0 && /* @__PURE__ */ jsx$1(Text, { fontSize: "11px", fontFamily: "mono", color: "fg.subtle", children: note })
|
|
53556
|
+
] }, i);
|
|
53557
|
+
}) }),
|
|
53558
|
+
children2
|
|
53559
|
+
] });
|
|
53560
|
+
});
|
|
53561
|
+
function rankOptions(d2) {
|
|
53562
|
+
const alternatives = [...d2.alternatives].sort((a2, b2) => b2.value - a2.value).map((a2) => ({
|
|
53563
|
+
label: a2.label,
|
|
53564
|
+
value: a2.value,
|
|
53565
|
+
downside: getSomeorUndefined(a2.downside),
|
|
53566
|
+
confidence: getSomeorUndefined(a2.confidence),
|
|
53567
|
+
note: getSomeorUndefined(a2.note),
|
|
53568
|
+
recommended: false
|
|
53569
|
+
}));
|
|
53570
|
+
return [
|
|
53571
|
+
{
|
|
53572
|
+
label: d2.title,
|
|
53573
|
+
value: d2.value,
|
|
53574
|
+
downside: getSomeorUndefined(d2.downside),
|
|
53575
|
+
confidence: getSomeorUndefined(d2.confidence),
|
|
53576
|
+
note: getSomeorUndefined(d2.summary),
|
|
53577
|
+
recommended: true
|
|
53578
|
+
},
|
|
53579
|
+
...alternatives
|
|
53580
|
+
].map((o2, i) => ({ ...o2, rank: i + 1 }));
|
|
53581
|
+
}
|
|
53582
|
+
function metaLine(o2) {
|
|
53583
|
+
const parts = [];
|
|
53584
|
+
if (o2.recommended) parts.push("recommended");
|
|
53585
|
+
if (o2.confidence !== void 0) parts.push(`${Math.round(o2.confidence * 100)}% conf`);
|
|
53586
|
+
if (!o2.recommended && o2.note !== void 0) parts.push(o2.note);
|
|
53587
|
+
return parts.join(" · ");
|
|
53588
|
+
}
|
|
53589
|
+
const OptionsFacet = memo(function OptionsFacet2({ decision, narrow }) {
|
|
53590
|
+
const options2 = rankOptions(decision);
|
|
53591
|
+
const maxUp = Math.max(...options2.map((o2) => Math.max(o2.value, 0)), 1e-9);
|
|
53592
|
+
const maxDown = Math.max(...options2.map((o2) => Math.abs(o2.downside ?? 0)), 1e-9);
|
|
53593
|
+
if (narrow) {
|
|
53594
|
+
const meter = (label, frac, display, tone) => /* @__PURE__ */ jsxs(Box, { display: "grid", gridTemplateColumns: "80px 1fr 64px", alignItems: "center", gap: "8px", children: [
|
|
53595
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, whiteSpace: "nowrap", children: label }),
|
|
53596
|
+
/* @__PURE__ */ jsx$1(Box, { height: "6px", bg: "border.subtle", borderRadius: "3px", overflow: "hidden", children: /* @__PURE__ */ jsx$1(Box, { height: "100%", width: `${Math.round(Math.min(Math.abs(frac), 1) * 100)}%`, bg: tone === "success" ? "fg.success" : tone === "danger" ? "fg.danger" : "fg.subtle", opacity: 0.7 }) }),
|
|
53597
|
+
/* @__PURE__ */ jsx$1(Text, { fontSize: "11px", fontFamily: "mono", fontWeight: "semibold", textAlign: "right", children: display })
|
|
53598
|
+
] });
|
|
53599
|
+
return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: "10px", children: [
|
|
53600
|
+
/* @__PURE__ */ jsxs(Text, { ...caption, color: "fg", children: [
|
|
53601
|
+
"Options · ",
|
|
53602
|
+
options2.length,
|
|
53603
|
+
" evaluated"
|
|
53604
|
+
] }),
|
|
53605
|
+
options2.map((o2) => /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: "4px", pl: "8px", ...o2.recommended ? { boxShadow: "inset 2px 0 0 var(--chakra-colors-accent-brand)" } : {}, children: [
|
|
53606
|
+
/* @__PURE__ */ jsxs(Text, { fontSize: "12.5px", children: [
|
|
53607
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", color: "fg.subtle", children: o2.rank }),
|
|
53608
|
+
" ",
|
|
53609
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontWeight: o2.recommended ? "semibold" : "normal", children: o2.label })
|
|
53610
|
+
] }),
|
|
53611
|
+
meter("Uplift", o2.value / maxUp, fmt(decision, o2.value, true), "success"),
|
|
53612
|
+
meter("If wrong", (o2.downside ?? 0) / maxDown, o2.downside !== void 0 ? fmt(decision, o2.downside, true) : "—", "danger")
|
|
53613
|
+
] }, o2.rank))
|
|
53614
|
+
] });
|
|
53615
|
+
}
|
|
53616
|
+
return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: "6px", children: [
|
|
53617
|
+
/* @__PURE__ */ jsxs(Box, { display: "grid", gridTemplateColumns: "minmax(180px, 1.1fr) 1fr 1fr", alignItems: "baseline", gap: "8px", children: [
|
|
53618
|
+
/* @__PURE__ */ jsxs(Text, { ...caption, color: "fg", children: [
|
|
53619
|
+
"Options · ",
|
|
53620
|
+
options2.length,
|
|
53621
|
+
" evaluated"
|
|
53622
|
+
] }),
|
|
53623
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, textAlign: "center", children: "If wrong" }),
|
|
53624
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, textAlign: "right", children: "Uplift" })
|
|
53625
|
+
] }),
|
|
53626
|
+
options2.map((o2) => {
|
|
53627
|
+
const downFrac = Math.min(Math.abs(o2.downside ?? 0) / maxDown, 1);
|
|
53628
|
+
const upFrac = Math.min(Math.max(o2.value, 0) / maxUp, 1);
|
|
53629
|
+
return /* @__PURE__ */ jsxs(
|
|
53630
|
+
Box,
|
|
53631
|
+
{
|
|
53632
|
+
display: "grid",
|
|
53633
|
+
gridTemplateColumns: "minmax(180px, 1.1fr) 1fr 1fr",
|
|
53634
|
+
alignItems: "center",
|
|
53635
|
+
gap: "8px",
|
|
53636
|
+
py: "4px",
|
|
53637
|
+
...o2.recommended ? { bg: "bg.brand.subtle", boxShadow: "inset 2px 0 0 var(--chakra-colors-accent-brand)" } : {},
|
|
53638
|
+
children: [
|
|
53639
|
+
/* @__PURE__ */ jsxs(Box, { minW: 0, pl: o2.recommended ? "6px" : "0", display: "flex", alignItems: "baseline", gap: "6px", children: [
|
|
53640
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", fontSize: "11px", color: "fg.subtle", flexShrink: 0, children: o2.rank }),
|
|
53641
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontSize: "12.5px", fontWeight: o2.recommended ? "semibold" : "normal", flexShrink: 0, children: o2.label }),
|
|
53642
|
+
metaLine(o2) !== "" && /* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", fontSize: "10.5px", color: "fg.muted", minW: 0, truncate: true, children: metaLine(o2) })
|
|
53643
|
+
] }),
|
|
53644
|
+
/* @__PURE__ */ jsx$1(Box, { display: "flex", justifyContent: "flex-end", alignItems: "center", gap: "6px", height: "16px", children: o2.downside !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53645
|
+
/* @__PURE__ */ jsx$1(Text, { fontSize: "10.5px", fontFamily: "mono", color: "fg.danger", flexShrink: 0, children: fmt(decision, o2.downside, true) }),
|
|
53646
|
+
/* @__PURE__ */ jsx$1(Box, { height: "12px", width: `${Math.round(downFrac * 100)}%`, bg: "fg.danger", opacity: 0.55 })
|
|
53647
|
+
] }) }),
|
|
53648
|
+
/* @__PURE__ */ jsx$1(Box, { display: "flex", alignItems: "center", gap: "6px", height: "16px", borderLeftWidth: "1px", borderColor: "border.strong", children: o2.value > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53649
|
+
/* @__PURE__ */ jsx$1(Box, { height: "12px", width: `${Math.round(upFrac * 100)}%`, bg: "fg.success", opacity: 0.6 }),
|
|
53650
|
+
/* @__PURE__ */ jsx$1(Text, { fontSize: "10.5px", fontFamily: "mono", color: "fg.success", flexShrink: 0, children: fmt(decision, o2.value, true) })
|
|
53651
|
+
] }) })
|
|
53652
|
+
]
|
|
53653
|
+
},
|
|
53654
|
+
o2.rank
|
|
53655
|
+
);
|
|
53656
|
+
})
|
|
53657
|
+
] });
|
|
53658
|
+
});
|
|
53659
|
+
const ANSWERS = [
|
|
53660
|
+
{ literal: "yes", label: "Yes" },
|
|
53661
|
+
{ literal: "no", label: "No" },
|
|
53662
|
+
{ literal: "unknown", label: "Don't know" }
|
|
53663
|
+
];
|
|
53664
|
+
const JudgementFacet = memo(function JudgementFacet2({ decision, handle, leverPayloads }) {
|
|
53665
|
+
var _a2;
|
|
53666
|
+
const button = useRecipe({ key: "button" });
|
|
53667
|
+
const input = useRecipe({ key: "input" });
|
|
53668
|
+
const judgement = handle.judgementFor(decision.id);
|
|
53669
|
+
const stagedKnowledge = (judgement == null ? void 0 : judgement.knowledge.type) === "some" ? judgement.knowledge.value : "";
|
|
53670
|
+
const [knowledge, setKnowledge] = useState(stagedKnowledge);
|
|
53671
|
+
useEffect(() => {
|
|
53672
|
+
setKnowledge(stagedKnowledge);
|
|
53673
|
+
}, [stagedKnowledge]);
|
|
53674
|
+
const commitKnowledge = useCallback(() => {
|
|
53675
|
+
if (knowledge !== stagedKnowledge) handle.addKnowledge(decision.id, knowledge);
|
|
53676
|
+
}, [knowledge, stagedKnowledge, handle, decision.id]);
|
|
53677
|
+
const levers = useMemo(
|
|
53678
|
+
() => decision.levers.filter((l2) => leverPayloadEditable(leverPayloads[l2.case])),
|
|
53679
|
+
[decision.levers, leverPayloads]
|
|
53680
|
+
);
|
|
53681
|
+
const [leverCase, setLeverCase] = useState(((_a2 = levers[0]) == null ? void 0 : _a2.case) ?? "");
|
|
53682
|
+
const activeLever = levers.find((l2) => l2.case === leverCase) ?? levers[0];
|
|
53683
|
+
const gate = handle.commitStateFor(decision.id);
|
|
53684
|
+
const gateHint = (gate == null ? void 0 : gate.type) === "gated" ? gate.value === 1n ? "Answer the judgement question to enable apply" : `Answer the ${gate.value} judgement questions to enable apply` : (gate == null ? void 0 : gate.type) === "blocked" ? "Commit blocked — an answer contradicts the recommendation" : (gate == null ? void 0 : gate.type) === "handoff" ? "Awaiting handoff — an answer was don't know" : null;
|
|
53685
|
+
const onInject = useCallback((constraint) => {
|
|
53686
|
+
handle.inject(decision.id, constraint);
|
|
53687
|
+
}, [handle, decision.id]);
|
|
53688
|
+
if (!judgement) return null;
|
|
53689
|
+
return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: "10px", children: [
|
|
53690
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "baseline", gap: "12px", children: [
|
|
53691
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, color: "fg.warning", children: "Required before commit" }),
|
|
53692
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, marginLeft: "auto", children: "human-only signal · model can’t see this" })
|
|
53693
|
+
] }),
|
|
53694
|
+
decision.prompts.map((prompt) => {
|
|
53695
|
+
var _a3;
|
|
53696
|
+
const current = (_a3 = judgement.answers.get(prompt.id)) == null ? void 0 : _a3.type;
|
|
53697
|
+
return /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: "12px", flexWrap: "wrap", children: [
|
|
53698
|
+
/* @__PURE__ */ jsx$1(Text, { fontSize: "13px", fontWeight: "medium", flex: "1", minW: "180px", children: prompt.text }),
|
|
53699
|
+
/* @__PURE__ */ jsx$1(Box, { display: "flex", gap: "6px", flexShrink: 0, children: ANSWERS.map((a2) => /* @__PURE__ */ jsx$1(
|
|
53700
|
+
chakra.button,
|
|
53701
|
+
{
|
|
53702
|
+
type: "button",
|
|
53703
|
+
css: button({ variant: current === a2.literal ? "solid" : "outline", size: "xs" }),
|
|
53704
|
+
onClick: () => handle.answer(decision.id, prompt.id, a2.literal),
|
|
53705
|
+
children: a2.label
|
|
53706
|
+
},
|
|
53707
|
+
a2.literal
|
|
53708
|
+
)) })
|
|
53709
|
+
] }, prompt.id);
|
|
53710
|
+
}),
|
|
53711
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: "4px", children: [
|
|
53712
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, children: "Knowledge · what the model can’t see" }),
|
|
53713
|
+
/* @__PURE__ */ jsx$1(
|
|
53714
|
+
chakra.textarea,
|
|
53715
|
+
{
|
|
53716
|
+
css: input({ size: "sm" }),
|
|
53717
|
+
rows: 2,
|
|
53718
|
+
value: knowledge,
|
|
53719
|
+
placeholder: "Private context — persists with the case",
|
|
53720
|
+
onChange: (e2) => setKnowledge(e2.target.value),
|
|
53721
|
+
onBlur: commitKnowledge
|
|
53722
|
+
}
|
|
53723
|
+
)
|
|
53724
|
+
] }),
|
|
53725
|
+
(levers.length > 0 || judgement.constraints.length > 0) && /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", gap: "6px", children: [
|
|
53726
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, children: "Inject constraint · next run folds it in" }),
|
|
53727
|
+
judgement.constraints.length > 0 && /* @__PURE__ */ jsx$1(Box, { display: "flex", gap: "12px", flexWrap: "wrap", children: judgement.constraints.map((c2, i) => {
|
|
53728
|
+
const tag = c2.type;
|
|
53729
|
+
const f2 = formatConstraint(c2, leverPayloads[tag], decision.levers);
|
|
53730
|
+
return /* @__PURE__ */ jsxs(Text, { as: "span", fontFamily: "mono", fontSize: "11px", children: [
|
|
53731
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "accent.brand", fontWeight: "semibold", children: f2.lever }),
|
|
53732
|
+
" ",
|
|
53733
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "fg.subtle", children: f2.op }),
|
|
53734
|
+
" ",
|
|
53735
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontWeight: "semibold", children: f2.value })
|
|
53736
|
+
] }, i);
|
|
53737
|
+
}) }),
|
|
53738
|
+
activeLever !== void 0 && /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: "8px", flexWrap: "wrap", children: [
|
|
53739
|
+
levers.length > 1 ? /* @__PURE__ */ jsx$1(Box, { flexShrink: 0, css: { "& [data-scope=select][data-part=root]": { width: "auto", minWidth: "160px" } }, children: /* @__PURE__ */ jsx$1(
|
|
53740
|
+
EastChakraSelect,
|
|
53741
|
+
{
|
|
53742
|
+
ariaLabel: "Lever",
|
|
53743
|
+
value: {
|
|
53744
|
+
value: some(activeLever.case),
|
|
53745
|
+
items: levers.map((l2) => ({ value: l2.case, label: l2.label, disabled: none$1 })),
|
|
53746
|
+
placeholder: none$1,
|
|
53747
|
+
multiple: none$1,
|
|
53748
|
+
disabled: none$1,
|
|
53749
|
+
onChange: some((v3) => setLeverCase(v3)),
|
|
53750
|
+
onChangeMultiple: none$1,
|
|
53751
|
+
onOpenChange: none$1,
|
|
53752
|
+
style: some({ size: some(variant("sm", null)) })
|
|
53753
|
+
}
|
|
53754
|
+
}
|
|
53755
|
+
) }) : /* @__PURE__ */ jsx$1(Text, { ...caption, color: "fg", flexShrink: 0, children: activeLever.label }),
|
|
53756
|
+
/* @__PURE__ */ jsx$1(Box, { flex: "1", minW: "260px", children: /* @__PURE__ */ jsx$1(
|
|
53757
|
+
LeverEditor,
|
|
53758
|
+
{
|
|
53759
|
+
leverCase: activeLever.case,
|
|
53760
|
+
payload: leverPayloads[activeLever.case],
|
|
53761
|
+
onInject
|
|
53762
|
+
},
|
|
53763
|
+
activeLever.case
|
|
53764
|
+
) })
|
|
53765
|
+
] })
|
|
53766
|
+
] }),
|
|
53767
|
+
gateHint !== null && /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: "8px", pt: "4px", children: [
|
|
53768
|
+
/* @__PURE__ */ jsx$1(Box, { width: "7px", height: "7px", borderRadius: "full", bg: "fg.warning", flexShrink: 0 }),
|
|
53769
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, children: gateHint }),
|
|
53770
|
+
/* @__PURE__ */ jsx$1(
|
|
53771
|
+
chakra.button,
|
|
53772
|
+
{
|
|
53773
|
+
type: "button",
|
|
53774
|
+
css: button({ variant: "outline", size: "xs" }),
|
|
53775
|
+
marginLeft: "auto",
|
|
53776
|
+
onClick: () => handle.resolve(decision.id, variant("deferred", none$1)),
|
|
53777
|
+
children: "Defer"
|
|
53778
|
+
}
|
|
53779
|
+
)
|
|
53780
|
+
] })
|
|
53781
|
+
] });
|
|
53782
|
+
});
|
|
53783
|
+
const URGENCY_RANK = {
|
|
53784
|
+
overdue: 0,
|
|
53785
|
+
due: 1,
|
|
53786
|
+
routine: 2
|
|
53787
|
+
};
|
|
53788
|
+
const FACETS = [
|
|
53789
|
+
{ key: "evidence", label: "Evidence" },
|
|
53790
|
+
{ key: "options", label: "Options" },
|
|
53791
|
+
{ key: "judgement", label: "Judgement" },
|
|
53792
|
+
{ key: "modify", label: "Modify" }
|
|
53793
|
+
];
|
|
53794
|
+
const URGENCY_TONE = {
|
|
53795
|
+
overdue: "danger",
|
|
53796
|
+
due: "warning",
|
|
53797
|
+
routine: "neutral"
|
|
53798
|
+
};
|
|
53799
|
+
const EXIT_MS = 560;
|
|
53800
|
+
const NARROW_PX = 560;
|
|
53801
|
+
function decisionValue(d2, n2, showSign = false) {
|
|
53802
|
+
return formatTick(n2, getSomeorUndefined(d2.format), showSign);
|
|
53803
|
+
}
|
|
53804
|
+
function deadlineSuffix(d2) {
|
|
53805
|
+
const deadline = getSomeorUndefined(d2.deadline);
|
|
53806
|
+
if (deadline === void 0) return "";
|
|
53807
|
+
if (d2.urgency.type === "overdue") {
|
|
53808
|
+
const hours = Math.round((Date.now() - deadline.getTime()) / 36e5);
|
|
53809
|
+
if (hours < 1) return " <1h";
|
|
53810
|
+
if (hours < 48) return ` ${hours}h`;
|
|
53811
|
+
return ` ${Math.round(hours / 24)}d`;
|
|
53812
|
+
}
|
|
53813
|
+
if (d2.urgency.type === "due") {
|
|
53814
|
+
const h2 = deadline.getHours();
|
|
53815
|
+
const m2 = deadline.getMinutes();
|
|
53816
|
+
const meridiem = h2 >= 12 ? "pm" : "am";
|
|
53817
|
+
const clock2 = h2 % 12 === 0 ? 12 : h2 % 12;
|
|
53818
|
+
return m2 === 0 ? ` ${clock2}${meridiem}` : ` ${clock2}:${String(m2).padStart(2, "0")}${meridiem}`;
|
|
53819
|
+
}
|
|
53820
|
+
return "";
|
|
53821
|
+
}
|
|
53822
|
+
function useLeverPayloads(ref) {
|
|
53823
|
+
const cache3 = getReactiveDatasetCache();
|
|
53824
|
+
const workspace = cache3.getConfig().workspace ?? "";
|
|
53825
|
+
return useMemo(() => {
|
|
53826
|
+
var _a2, _b, _c;
|
|
53827
|
+
if (!ref) return {};
|
|
53828
|
+
const judgements = getBindingTypes(workspace, ref.judgements.source);
|
|
53829
|
+
if (!(judgements == null ? void 0 : judgements.sourceType)) return {};
|
|
53830
|
+
const root2 = normalizeTypeValue(judgements.sourceType);
|
|
53831
|
+
const constraint = (_c = (_b = (_a2 = root2.value) == null ? void 0 : _a2.fields) == null ? void 0 : _b["constraints"]) == null ? void 0 : _c.value;
|
|
53832
|
+
return (constraint == null ? void 0 : constraint.type) === "Variant" ? constraint.cases ?? {} : {};
|
|
53833
|
+
}, [ref, workspace]);
|
|
53834
|
+
}
|
|
53835
|
+
const Row = memo(function Row2({ decision, handle, selected: selected2, narrow, leverPayloads, modify, detail, defaultFacet, apply: apply2, reject: reject2, leaving, storageKey }) {
|
|
53836
|
+
const dq = useSlotRecipe({ key: "decisionQueue" });
|
|
53837
|
+
const status = useSlotRecipe({ key: "status" });
|
|
53838
|
+
const tabs = useSlotRecipe({ key: "facetTabs" });
|
|
53839
|
+
const button = useRecipe({ key: "button" });
|
|
53840
|
+
const rs = dq({});
|
|
53841
|
+
const ts = tabs({});
|
|
53842
|
+
const st = status({ status: URGENCY_TONE[decision.urgency.type], size: "md" });
|
|
53843
|
+
const [facet, setFacet] = useState(defaultFacet);
|
|
53844
|
+
useEffect(() => {
|
|
53845
|
+
if (!selected2) setFacet(defaultFacet);
|
|
53846
|
+
}, [selected2, defaultFacet]);
|
|
53847
|
+
const gate = handle.commitStateFor(decision.id);
|
|
53848
|
+
const applyEnabled = gate === null || gate.type === "ready";
|
|
53849
|
+
const gatePulse = !applyEnabled && decision.prompts.length > 0;
|
|
53850
|
+
const summary = getSomeorUndefined(decision.summary);
|
|
53851
|
+
const handleSelect = useCallback(() => {
|
|
53852
|
+
if (!selected2) handle.select(decision.id);
|
|
53853
|
+
}, [selected2, handle, decision.id]);
|
|
53854
|
+
const handleApply = useCallback(() => {
|
|
53855
|
+
if (applyEnabled) apply2(decision);
|
|
53856
|
+
}, [applyEnabled, apply2, decision]);
|
|
53857
|
+
const handleReject = useCallback(() => {
|
|
53858
|
+
reject2(decision);
|
|
53859
|
+
}, [reject2, decision]);
|
|
53860
|
+
const probe = useMemo(() => {
|
|
53861
|
+
if (!selected2 || facet !== "modify" || !modify) return null;
|
|
53862
|
+
return modify(decision, handle.update);
|
|
53863
|
+
}, [selected2, facet, modify, decision, handle.update]);
|
|
53864
|
+
const canvas = useMemo(() => {
|
|
53865
|
+
if (!selected2 || facet !== "evidence" || !detail) return null;
|
|
53866
|
+
return detail(decision);
|
|
53867
|
+
}, [selected2, facet, detail, decision]);
|
|
53868
|
+
const facetTabs = /* @__PURE__ */ jsx$1(Box, { css: ts.root, ...narrow ? { display: "flex", width: "100%" } : {}, children: FACETS.filter((f2) => f2.key !== "modify" || modify !== void 0).map((f2) => /* @__PURE__ */ jsx$1(
|
|
53869
|
+
Box,
|
|
53870
|
+
{
|
|
53871
|
+
as: "button",
|
|
53872
|
+
css: ts.tab,
|
|
53873
|
+
...narrow ? { flex: 1 } : {},
|
|
53874
|
+
...facet === f2.key ? { "data-on": "" } : {},
|
|
53875
|
+
...f2.key === "judgement" && gatePulse ? { "data-pulse": "" } : {},
|
|
53876
|
+
"aria-pressed": facet === f2.key,
|
|
53877
|
+
onClick: () => setFacet(f2.key),
|
|
53878
|
+
children: f2.label
|
|
53879
|
+
},
|
|
53880
|
+
f2.key
|
|
53881
|
+
)) });
|
|
53882
|
+
const commands = /* @__PURE__ */ jsxs(Box, { display: "flex", gap: "6px", ...narrow ? { justifyContent: "flex-end" } : {}, children: [
|
|
53883
|
+
/* @__PURE__ */ jsx$1(
|
|
53884
|
+
Box,
|
|
53885
|
+
{
|
|
53886
|
+
as: "button",
|
|
53887
|
+
css: button({ variant: "solid", size: "xs" }),
|
|
53888
|
+
"aria-disabled": !applyEnabled,
|
|
53889
|
+
opacity: applyEnabled ? void 0 : 0.5,
|
|
53890
|
+
cursor: applyEnabled ? void 0 : "not-allowed",
|
|
53891
|
+
title: applyEnabled ? void 0 : "Answer the judgement to enable apply",
|
|
53892
|
+
onClick: handleApply,
|
|
53893
|
+
children: "Apply"
|
|
53894
|
+
}
|
|
53895
|
+
),
|
|
53896
|
+
/* @__PURE__ */ jsx$1(Box, { as: "button", css: button({ variant: "ghost", size: "xs" }), onClick: handleReject, children: "Reject" })
|
|
53897
|
+
] });
|
|
53898
|
+
const title = /* @__PURE__ */ jsxs(Box, { minW: 0, cursor: selected2 ? void 0 : "pointer", onClick: handleSelect, children: [
|
|
53899
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontWeight: "semibold", children: decision.kind }),
|
|
53900
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "fg.subtle", children: " · " }),
|
|
53901
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", children: decision.title }),
|
|
53902
|
+
summary !== void 0 && !narrow && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53903
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "fg.subtle", children: " · " }),
|
|
53904
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "fg.muted", children: summary })
|
|
53905
|
+
] })
|
|
53906
|
+
] });
|
|
53907
|
+
const urgency = /* @__PURE__ */ jsxs(Box, { as: "span", css: st.root, flexShrink: 0, children: [
|
|
53908
|
+
/* @__PURE__ */ jsx$1(Box, { as: "span", css: st.indicator }),
|
|
53909
|
+
/* @__PURE__ */ jsxs(Box, { as: "span", css: st.label, children: [
|
|
53910
|
+
decision.urgency.type,
|
|
53911
|
+
deadlineSuffix(decision)
|
|
53912
|
+
] })
|
|
53913
|
+
] });
|
|
53914
|
+
const valueText = /* @__PURE__ */ jsx$1(Text, { fontFamily: "mono", fontWeight: "semibold", textAlign: "right", ...decision.value >= 0 && selected2 ? { color: "fg.success" } : {}, children: decisionValue(decision, decision.value, selected2) });
|
|
53915
|
+
return /* @__PURE__ */ jsxs(Box, { css: rs.rowShell, ...leaving ? { "data-leaving": leaving } : {}, children: [
|
|
53916
|
+
narrow ? /* @__PURE__ */ jsxs(Box, { px: "14px", py: "10px", children: [
|
|
53917
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "baseline", children: [
|
|
53918
|
+
urgency,
|
|
53919
|
+
valueText
|
|
53920
|
+
] }),
|
|
53921
|
+
/* @__PURE__ */ jsx$1(Box, { mt: "2px", fontSize: "13px", children: title }),
|
|
53922
|
+
selected2 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
53923
|
+
/* @__PURE__ */ jsx$1(Box, { mt: "8px", children: facetTabs }),
|
|
53924
|
+
/* @__PURE__ */ jsx$1(Box, { mt: "8px", children: commands })
|
|
53925
|
+
] })
|
|
53926
|
+
] }) : /* @__PURE__ */ jsxs(Box, { css: rs.row, children: [
|
|
53927
|
+
urgency,
|
|
53928
|
+
/* @__PURE__ */ jsx$1(Box, { css: rs.title, p: 0, children: title }),
|
|
53929
|
+
valueText,
|
|
53930
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: "12px", children: [
|
|
53931
|
+
selected2 && facetTabs,
|
|
53932
|
+
commands
|
|
53933
|
+
] })
|
|
53934
|
+
] }),
|
|
53935
|
+
selected2 && /* @__PURE__ */ jsxs(Box, { px: narrow ? "14px" : "18px", py: "12px", borderTopWidth: "1px", borderColor: "border.subtle", bg: "bg.canvas", children: [
|
|
53936
|
+
facet === "evidence" && /* @__PURE__ */ jsx$1(EvidenceFacet, { decision, children: canvas != null && /* @__PURE__ */ jsx$1(EastChakraComponent, { value: canvas, storageKey: `${storageKey}-detail-${decision.id}` }) }),
|
|
53937
|
+
facet === "options" && /* @__PURE__ */ jsx$1(OptionsFacet, { decision, narrow }),
|
|
53938
|
+
facet === "judgement" && /* @__PURE__ */ jsx$1(JudgementFacet, { decision, handle, leverPayloads }),
|
|
53939
|
+
facet === "modify" && probe != null && /* @__PURE__ */ jsx$1(EastChakraComponent, { value: probe, storageKey: `${storageKey}-modify-${decision.id}` })
|
|
53940
|
+
] })
|
|
53941
|
+
] });
|
|
53942
|
+
});
|
|
53943
|
+
const RoutineGroup = memo(function RoutineGroup2({ routine, acceptAll, leaving, narrow }) {
|
|
53944
|
+
const dq = useSlotRecipe({ key: "decisionQueue" });
|
|
53945
|
+
const status = useSlotRecipe({ key: "status" });
|
|
53946
|
+
const button = useRecipe({ key: "button" });
|
|
53947
|
+
const rs = dq({});
|
|
53948
|
+
const st = status({ status: "neutral", size: "md" });
|
|
53949
|
+
const total = useMemo(() => routine.reduce((acc, d2) => acc + d2.value, 0), [routine]);
|
|
53950
|
+
const format = routine[0] ? getSomeorUndefined(routine[0].format) : void 0;
|
|
53951
|
+
const handleAcceptAll = useCallback(() => {
|
|
53952
|
+
if (acceptAll) acceptAll(routine);
|
|
53953
|
+
}, [acceptAll, routine]);
|
|
53954
|
+
if (routine.length === 0) return null;
|
|
53955
|
+
return /* @__PURE__ */ jsxs(Box, { css: rs.routineGroup, children: [
|
|
53956
|
+
routine.map((d2) => /* @__PURE__ */ jsx$1(Box, { css: rs.rowShell, ...leaving.has(d2.id) ? { "data-leaving": leaving.get(d2.id) } : {}, children: /* @__PURE__ */ jsxs(Box, { css: rs.routineRow, children: [
|
|
53957
|
+
/* @__PURE__ */ jsxs(Box, { as: "span", css: st.root, children: [
|
|
53958
|
+
/* @__PURE__ */ jsx$1(Box, { as: "span", css: st.indicator }),
|
|
53959
|
+
/* @__PURE__ */ jsx$1(Box, { as: "span", css: st.label, children: "routine" })
|
|
53960
|
+
] }),
|
|
53961
|
+
/* @__PURE__ */ jsxs(Box, { minW: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", children: [
|
|
53962
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", children: d2.id }),
|
|
53963
|
+
/* @__PURE__ */ jsxs(Text, { as: "span", color: "fg.muted", children: [
|
|
53964
|
+
" · ",
|
|
53965
|
+
d2.kind
|
|
53966
|
+
] })
|
|
53967
|
+
] }),
|
|
53968
|
+
/* @__PURE__ */ jsx$1(Box, { css: rs.routineValue, children: decisionValue(d2, d2.value) })
|
|
53969
|
+
] }) }, d2.id)),
|
|
53970
|
+
/* @__PURE__ */ jsxs(Box, { css: rs.summary, ...narrow ? { marginLeft: "0", flexWrap: "wrap" } : {}, children: [
|
|
53971
|
+
/* @__PURE__ */ jsxs(Box, { as: "span", css: rs.summaryCap, children: [
|
|
53972
|
+
routine.length,
|
|
53973
|
+
" routine"
|
|
53974
|
+
] }),
|
|
53975
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "fg.subtle", children: "·" }),
|
|
53976
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", fontWeight: "semibold", children: formatTick(total, format) }),
|
|
53977
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "fg.muted", children: "total" }),
|
|
53978
|
+
acceptAll && /* @__PURE__ */ jsx$1(Box, { as: "button", css: button({ variant: "solid", size: "xs" }), ml: "auto", onClick: handleAcceptAll, children: "Accept all" })
|
|
53979
|
+
] })
|
|
53980
|
+
] });
|
|
53981
|
+
});
|
|
53982
|
+
const EastChakraDecisionQueue = memo(function EastChakraDecisionQueue2({ value, storageKey }) {
|
|
53983
|
+
var _a2;
|
|
53984
|
+
const eyebrow = useSlotRecipe({ key: "eyebrowRow" });
|
|
53985
|
+
const es = eyebrow({});
|
|
53986
|
+
const handleRef = value.handle;
|
|
53987
|
+
const handle = useDecisionHandle(handleRef);
|
|
53988
|
+
const decisions = handle.decisions;
|
|
53989
|
+
const leverPayloads = useLeverPayloads(handleRef);
|
|
53990
|
+
const railAffordances = getSomeorUndefined(value.slice);
|
|
53991
|
+
const sliceHandle = handle.slice;
|
|
53992
|
+
useSliceReactivity(sliceHandle == null ? void 0 : sliceHandle.key);
|
|
53993
|
+
const sliceState = sliceHandle !== null ? sliceHandle.read() : null;
|
|
53994
|
+
const rootRef = useRef(null);
|
|
53995
|
+
const [narrow, setNarrow] = useState(false);
|
|
53996
|
+
useLayoutEffect(() => {
|
|
53997
|
+
const el = rootRef.current;
|
|
53998
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
53999
|
+
const ro = new ResizeObserver((entries) => {
|
|
54000
|
+
var _a3;
|
|
54001
|
+
const width2 = ((_a3 = entries[0]) == null ? void 0 : _a3.contentRect.width) ?? 0;
|
|
54002
|
+
setNarrow(width2 > 0 && width2 < NARROW_PX);
|
|
54003
|
+
});
|
|
54004
|
+
ro.observe(el);
|
|
54005
|
+
return () => ro.disconnect();
|
|
54006
|
+
}, []);
|
|
54007
|
+
const [exiting, setExiting] = useState(/* @__PURE__ */ new Map());
|
|
54008
|
+
const prevRef = useRef(null);
|
|
54009
|
+
const reasonsRef = useRef(/* @__PURE__ */ new Map());
|
|
54010
|
+
const timersRef = useRef([]);
|
|
54011
|
+
useLayoutEffect(() => {
|
|
54012
|
+
const prev2 = prevRef.current;
|
|
54013
|
+
prevRef.current = decisions;
|
|
54014
|
+
if (!prev2 || !decisions) return;
|
|
54015
|
+
const ids = new Set(decisions.map((d2) => d2.id));
|
|
54016
|
+
const removed = prev2.filter((d2) => !ids.has(d2.id));
|
|
54017
|
+
if (removed.length === 0) return;
|
|
54018
|
+
setExiting((old) => {
|
|
54019
|
+
const next2 = new Map(old);
|
|
54020
|
+
for (const d2 of removed) {
|
|
54021
|
+
next2.set(d2.id, { decision: d2, reason: reasonsRef.current.get(d2.id) ?? "removed" });
|
|
54022
|
+
reasonsRef.current.delete(d2.id);
|
|
54023
|
+
}
|
|
54024
|
+
return next2;
|
|
54025
|
+
});
|
|
54026
|
+
timersRef.current.push(setTimeout(() => {
|
|
54027
|
+
setExiting((old) => {
|
|
54028
|
+
const next2 = new Map(old);
|
|
54029
|
+
for (const d2 of removed) next2.delete(d2.id);
|
|
54030
|
+
return next2;
|
|
54031
|
+
});
|
|
54032
|
+
}, EXIT_MS));
|
|
54033
|
+
}, [decisions]);
|
|
54034
|
+
useEffect(() => () => {
|
|
54035
|
+
for (const t2 of timersRef.current) clearTimeout(t2);
|
|
54036
|
+
}, []);
|
|
54037
|
+
const heading = getSomeorUndefined(value.heading) ?? "Decisions waiting";
|
|
54038
|
+
const onApply = useMemo(() => getSomeorUndefined(value.onApply), [value.onApply]);
|
|
54039
|
+
const onReject = useMemo(() => getSomeorUndefined(value.onReject), [value.onReject]);
|
|
54040
|
+
const modify = useMemo(
|
|
54041
|
+
() => getSomeorUndefined(value.modify),
|
|
54042
|
+
[value.modify]
|
|
54043
|
+
);
|
|
54044
|
+
const detail = useMemo(
|
|
54045
|
+
() => getSomeorUndefined(value.detail),
|
|
54046
|
+
[value.detail]
|
|
54047
|
+
);
|
|
54048
|
+
const defaultFacet = ((_a2 = getSomeorUndefined(value.defaultFacet)) == null ? void 0 : _a2.type) ?? "evidence";
|
|
54049
|
+
const defaultExpanded = getSomeorUndefined(value.defaultExpanded);
|
|
54050
|
+
const selectedId = handle.selected ?? (defaultExpanded == null ? void 0 : defaultExpanded.id) ?? null;
|
|
54051
|
+
const resolve2 = useCallback((ds, hook2, reason) => {
|
|
54052
|
+
if (hook2) for (const d2 of ds) {
|
|
54053
|
+
const decision = d2;
|
|
54054
|
+
queueMicrotask(() => hook2(decision));
|
|
54055
|
+
}
|
|
54056
|
+
for (const d2 of ds) {
|
|
54057
|
+
reasonsRef.current.set(d2.id, reason);
|
|
54058
|
+
handle.resolve(d2.id, reason === "reject" ? variant("rejected", null) : variant("accepted", ""));
|
|
54059
|
+
}
|
|
54060
|
+
}, [handle]);
|
|
54061
|
+
const apply2 = useCallback((d2) => resolve2([d2], onApply, "apply"), [resolve2, onApply]);
|
|
54062
|
+
const reject2 = useCallback((d2) => resolve2([d2], onReject, "reject"), [resolve2, onReject]);
|
|
54063
|
+
const acceptAll = useCallback((ds) => resolve2(ds, onApply, "apply"), [resolve2, onApply]);
|
|
54064
|
+
const { active, routine, pastSla, visible } = useMemo(() => {
|
|
54065
|
+
const scoped = decisions ?? [];
|
|
54066
|
+
const now2 = /* @__PURE__ */ new Date();
|
|
54067
|
+
const live = sliceState !== null ? scoped.filter((d2) => sliceMatches(sliceState, DECISION_SLICE_CONFIG, d2, now2)) : scoped;
|
|
54068
|
+
const merged = [...live];
|
|
54069
|
+
for (const { decision } of exiting.values()) {
|
|
54070
|
+
if (!merged.some((d2) => d2.id === decision.id)) merged.push(decision);
|
|
54071
|
+
}
|
|
54072
|
+
merged.sort((a2, b2) => {
|
|
54073
|
+
var _a3, _b;
|
|
54074
|
+
const r2 = URGENCY_RANK[a2.urgency.type] - URGENCY_RANK[b2.urgency.type];
|
|
54075
|
+
if (r2 !== 0) return r2;
|
|
54076
|
+
const da = ((_a3 = getSomeorUndefined(a2.deadline)) == null ? void 0 : _a3.getTime()) ?? Infinity;
|
|
54077
|
+
const db = ((_b = getSomeorUndefined(b2.deadline)) == null ? void 0 : _b.getTime()) ?? Infinity;
|
|
54078
|
+
if (da !== db) return da - db;
|
|
54079
|
+
return b2.value - a2.value;
|
|
54080
|
+
});
|
|
54081
|
+
return {
|
|
54082
|
+
active: merged.filter((d2) => d2.urgency.type !== "routine"),
|
|
54083
|
+
routine: merged.filter((d2) => d2.urgency.type === "routine"),
|
|
54084
|
+
pastSla: merged.filter((d2) => d2.urgency.type === "overdue").length,
|
|
54085
|
+
visible: live.length
|
|
54086
|
+
};
|
|
54087
|
+
}, [decisions, exiting, sliceState]);
|
|
54088
|
+
const exitingReasons = useMemo(() => {
|
|
54089
|
+
const m2 = /* @__PURE__ */ new Map();
|
|
54090
|
+
for (const [id3, e2] of exiting) m2.set(id3, e2.reason);
|
|
54091
|
+
return m2;
|
|
54092
|
+
}, [exiting]);
|
|
54093
|
+
if (decisions === null) {
|
|
54094
|
+
return /* @__PURE__ */ jsx$1(Box, { layerStyle: "frame", p: "16px", children: /* @__PURE__ */ jsx$1(Text, { color: "fg.muted", fontSize: "13px", children: "Loading decisions…" }) });
|
|
54095
|
+
}
|
|
54096
|
+
return /* @__PURE__ */ jsxs(Box, { ref: rootRef, layerStyle: "frame", overflow: "hidden", children: [
|
|
54097
|
+
/* @__PURE__ */ jsxs(Box, { css: es.root, children: [
|
|
54098
|
+
/* @__PURE__ */ jsx$1(Box, { css: es.lbl, children: heading }),
|
|
54099
|
+
sliceHandle !== null && railAffordances !== void 0 && /* @__PURE__ */ jsx$1(Box, { display: "flex", alignItems: "center", minWidth: "0", flex: "1", justifyContent: "flex-end", marginRight: "10px", children: /* @__PURE__ */ jsx$1(
|
|
54100
|
+
SliceRailCluster,
|
|
54101
|
+
{
|
|
54102
|
+
slice: sliceHandle,
|
|
54103
|
+
affordanceKinds: railAffordances.map((a2) => a2.type)
|
|
54104
|
+
}
|
|
54105
|
+
) }),
|
|
54106
|
+
/* @__PURE__ */ jsxs(Box, { css: es.meta, gap: "10px", children: [
|
|
54107
|
+
/* @__PURE__ */ jsxs(Box, { as: "span", children: [
|
|
54108
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "fg", fontWeight: "semibold", children: visible }),
|
|
54109
|
+
narrow ? "" : " decisions"
|
|
54110
|
+
] }),
|
|
54111
|
+
pastSla > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54112
|
+
/* @__PURE__ */ jsx$1(Box, { as: "span", css: es.sep, children: "·" }),
|
|
54113
|
+
/* @__PURE__ */ jsxs(Box, { as: "span", children: [
|
|
54114
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", color: "fg.danger", fontWeight: "semibold", children: pastSla }),
|
|
54115
|
+
narrow ? " SLA" : " past SLA"
|
|
54116
|
+
] })
|
|
54117
|
+
] })
|
|
54118
|
+
] })
|
|
54119
|
+
] }),
|
|
54120
|
+
/* @__PURE__ */ jsxs(
|
|
54121
|
+
Box,
|
|
54122
|
+
{
|
|
54123
|
+
maxHeight: getSomeorUndefined(value.maxHeight),
|
|
54124
|
+
overflowY: value.maxHeight.type === "some" ? "auto" : void 0,
|
|
54125
|
+
children: [
|
|
54126
|
+
active.map((d2) => /* @__PURE__ */ jsx$1(
|
|
54127
|
+
Row,
|
|
54128
|
+
{
|
|
54129
|
+
decision: d2,
|
|
54130
|
+
handle,
|
|
54131
|
+
selected: selectedId === d2.id,
|
|
54132
|
+
narrow,
|
|
54133
|
+
leverPayloads,
|
|
54134
|
+
modify,
|
|
54135
|
+
detail,
|
|
54136
|
+
defaultFacet,
|
|
54137
|
+
apply: apply2,
|
|
54138
|
+
reject: reject2,
|
|
54139
|
+
leaving: exitingReasons.get(d2.id),
|
|
54140
|
+
storageKey
|
|
54141
|
+
},
|
|
54142
|
+
d2.id
|
|
54143
|
+
)),
|
|
54144
|
+
/* @__PURE__ */ jsx$1(RoutineGroup, { routine, acceptAll, leaving: exitingReasons, narrow })
|
|
54145
|
+
]
|
|
54146
|
+
}
|
|
54147
|
+
)
|
|
54148
|
+
] });
|
|
54149
|
+
});
|
|
54150
|
+
implementUIComponent(DecisionQueue.Component, EastChakraDecisionQueue);
|
|
54151
|
+
function verdictPresentation(verdict) {
|
|
54152
|
+
switch (verdict.type) {
|
|
54153
|
+
case "accepted":
|
|
54154
|
+
return { tone: "success", verb: "accepted", detail: verdict.value !== "" ? verdict.value : null };
|
|
54155
|
+
case "rejected":
|
|
54156
|
+
return { tone: "danger", verb: "rejected", detail: null };
|
|
54157
|
+
case "deferred":
|
|
54158
|
+
return { tone: "neutral", verb: "deferred", detail: verdict.value.type === "some" ? verdict.value.value : null };
|
|
54159
|
+
case "handoff":
|
|
54160
|
+
return { tone: "warning", verb: "handed off", detail: verdict.value !== "" ? verdict.value : null };
|
|
54161
|
+
}
|
|
54162
|
+
}
|
|
54163
|
+
function formatResolvedAt(j2) {
|
|
54164
|
+
if (j2.resolvedAt.type !== "some") return null;
|
|
54165
|
+
const d2 = j2.resolvedAt.value;
|
|
54166
|
+
const month = d2.toLocaleString("en", { month: "short" });
|
|
54167
|
+
const time2 = `${String(d2.getHours()).padStart(2, "0")}:${String(d2.getMinutes()).padStart(2, "0")}`;
|
|
54168
|
+
return `${month} ${d2.getDate()} · ${time2}`;
|
|
54169
|
+
}
|
|
54170
|
+
const EastChakraDecisionJournal = memo(function EastChakraDecisionJournal2({ value }) {
|
|
54171
|
+
const eyebrow = useSlotRecipe({ key: "eyebrowRow" });
|
|
54172
|
+
const status = useSlotRecipe({ key: "status" });
|
|
54173
|
+
const es = eyebrow({});
|
|
54174
|
+
const handle = useDecisionHandle(value.handle);
|
|
54175
|
+
const heading = getSomeorUndefined(value.heading) ?? "Decision journal";
|
|
54176
|
+
const cache3 = getReactiveDatasetCache();
|
|
54177
|
+
const workspace = cache3.getConfig().workspace ?? "";
|
|
54178
|
+
const leverPayloads = useMemo(() => {
|
|
54179
|
+
var _a2, _b, _c;
|
|
54180
|
+
const judgements = getBindingTypes(workspace, value.handle.judgements.source);
|
|
54181
|
+
if (!(judgements == null ? void 0 : judgements.sourceType)) return {};
|
|
54182
|
+
const root2 = normalizeTypeValue(judgements.sourceType);
|
|
54183
|
+
const constraint = (_c = (_b = (_a2 = root2.value) == null ? void 0 : _a2.fields) == null ? void 0 : _b["constraints"]) == null ? void 0 : _c.value;
|
|
54184
|
+
return (constraint == null ? void 0 : constraint.type) === "Variant" ? constraint.cases ?? {} : {};
|
|
54185
|
+
}, [workspace, value.handle]);
|
|
54186
|
+
const entries = useMemo(() => handle.journal ?? [], [handle.journal]);
|
|
54187
|
+
return /* @__PURE__ */ jsxs(Box, { borderWidth: "1px", borderColor: "border.strong", borderRadius: "6px", background: "bg.canvas", overflow: "hidden", children: [
|
|
54188
|
+
/* @__PURE__ */ jsxs(Box, { css: es.root, children: [
|
|
54189
|
+
/* @__PURE__ */ jsx$1(Box, { css: es.lbl, children: heading }),
|
|
54190
|
+
/* @__PURE__ */ jsx$1(Box, { css: es.meta, children: entries.length === 1 ? "1 entry" : `${entries.length} entries` })
|
|
54191
|
+
] }),
|
|
54192
|
+
/* @__PURE__ */ jsx$1(
|
|
54193
|
+
Box,
|
|
54194
|
+
{
|
|
54195
|
+
maxHeight: getSomeorUndefined(value.maxHeight),
|
|
54196
|
+
overflowY: value.maxHeight.type === "some" ? "auto" : void 0,
|
|
54197
|
+
children: entries.length === 0 ? /* @__PURE__ */ jsx$1(Text, { px: "16px", py: "14px", fontSize: "13px", color: "fg.muted", children: "No resolved cases yet — verdicts land here as the queue clears." }) : entries.map((j2, i) => {
|
|
54198
|
+
const verdict = j2.verdict.type === "some" ? j2.verdict.value : null;
|
|
54199
|
+
if (!verdict) return null;
|
|
54200
|
+
const { tone, verb, detail } = verdictPresentation(verdict);
|
|
54201
|
+
const st = status({ status: tone, size: "md" });
|
|
54202
|
+
const when = formatResolvedAt(j2);
|
|
54203
|
+
const knowledge = j2.knowledge.type === "some" && j2.knowledge.value !== "" ? j2.knowledge.value : null;
|
|
54204
|
+
return /* @__PURE__ */ jsxs(
|
|
54205
|
+
Box,
|
|
54206
|
+
{
|
|
54207
|
+
px: "16px",
|
|
54208
|
+
py: "10px",
|
|
54209
|
+
borderTopWidth: i === 0 ? void 0 : "1px",
|
|
54210
|
+
borderColor: "border.subtle",
|
|
54211
|
+
display: "flex",
|
|
54212
|
+
flexDirection: "column",
|
|
54213
|
+
gap: "6px",
|
|
54214
|
+
children: [
|
|
54215
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "baseline", gap: "10px", children: [
|
|
54216
|
+
/* @__PURE__ */ jsxs(Box, { as: "span", css: st.root, flexShrink: 0, children: [
|
|
54217
|
+
/* @__PURE__ */ jsx$1(Box, { as: "span", css: st.indicator }),
|
|
54218
|
+
/* @__PURE__ */ jsx$1(Box, { as: "span", css: st.label, children: verb })
|
|
54219
|
+
] }),
|
|
54220
|
+
/* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", fontSize: "12px", color: "fg.muted", children: j2.caseId }),
|
|
54221
|
+
detail !== null && /* @__PURE__ */ jsx$1(Text, { as: "span", fontSize: "13px", minW: 0, flex: "1", truncate: true, children: detail }),
|
|
54222
|
+
when !== null && /* @__PURE__ */ jsx$1(Text, { as: "span", fontFamily: "mono", fontSize: "11.5px", color: "fg.muted", marginLeft: "auto", flexShrink: 0, children: when })
|
|
54223
|
+
] }),
|
|
54224
|
+
knowledge !== null && /* @__PURE__ */ jsxs(
|
|
54225
|
+
Text,
|
|
54226
|
+
{
|
|
54227
|
+
fontSize: "12.5px",
|
|
54228
|
+
fontStyle: "italic",
|
|
54229
|
+
color: "fg.muted",
|
|
54230
|
+
borderLeftWidth: "2px",
|
|
54231
|
+
borderColor: "border.strong",
|
|
54232
|
+
paddingLeft: "10px",
|
|
54233
|
+
children: [
|
|
54234
|
+
"“",
|
|
54235
|
+
knowledge,
|
|
54236
|
+
"”"
|
|
54237
|
+
]
|
|
54238
|
+
}
|
|
54239
|
+
),
|
|
54240
|
+
j2.constraints.length > 0 && /* @__PURE__ */ jsx$1(Box, { display: "flex", gap: "12px", flexWrap: "wrap", children: j2.constraints.map((c2, k2) => {
|
|
54241
|
+
const tag = c2.type;
|
|
54242
|
+
const f2 = formatConstraint(c2, leverPayloads[tag]);
|
|
54243
|
+
return /* @__PURE__ */ jsx$1(ClauseChip, { field: f2.lever, op: f2.op, value: f2.value }, k2);
|
|
54244
|
+
}) })
|
|
54245
|
+
]
|
|
54246
|
+
},
|
|
54247
|
+
j2.caseId
|
|
54248
|
+
);
|
|
54249
|
+
})
|
|
54250
|
+
}
|
|
54251
|
+
)
|
|
54252
|
+
] });
|
|
54253
|
+
});
|
|
54254
|
+
implementUIComponent(DecisionJournal.Component, EastChakraDecisionJournal);
|
|
53041
54255
|
function formatApiError(error3) {
|
|
53042
54256
|
if (error3 instanceof ApiError && error3.details != null) {
|
|
53043
54257
|
const details = error3.details;
|
|
@@ -54552,6 +55766,8 @@ export {
|
|
|
54552
55766
|
DataTaskPreview,
|
|
54553
55767
|
DatasetPreview,
|
|
54554
55768
|
E3Provider,
|
|
55769
|
+
EastChakraDecisionJournal,
|
|
55770
|
+
EastChakraDecisionQueue,
|
|
54555
55771
|
EastChakraDiff,
|
|
54556
55772
|
EastChakraOntology,
|
|
54557
55773
|
EastValueViewer,
|
|
@@ -54611,6 +55827,7 @@ export {
|
|
|
54611
55827
|
useDatasetSet,
|
|
54612
55828
|
useDatasetStatus,
|
|
54613
55829
|
useDatasetValue,
|
|
55830
|
+
useDecisionHandle,
|
|
54614
55831
|
useE3Config,
|
|
54615
55832
|
useE3ConfigOptional,
|
|
54616
55833
|
usePackageExport,
|