@elaraai/e3-ui-components 1.0.26 → 1.0.27
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/decision/facets.d.ts.map +1 -1
- package/dist/decision/handle-runtime.d.ts +3 -2
- package/dist/decision/handle-runtime.d.ts.map +1 -1
- package/dist/decision/queue.d.ts.map +1 -1
- package/dist/index.cjs +606 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +585 -207
- package/dist/index.js.map +1 -1
- package/dist/platform/bind-runtime.d.ts +32 -8
- package/dist/platform/bind-runtime.d.ts.map +1 -1
- package/dist/platform/func-runtime.d.ts +24 -3
- package/dist/platform/func-runtime.d.ts.map +1 -1
- package/dist/platform/record-runtime.d.ts +26 -3
- package/dist/platform/record-runtime.d.ts.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -18,16 +18,17 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
var _focused, _cleanup, _setup, _a, _provider, _providerCalled, _b, _online, _cleanup2, _setup2, _c, _gcTimeout, _d, _initialState, _revertState, _cache, _client, _retryer, _defaultOptions, _abortSignalConsumed, _Query_instances, isInitialPausedFetch_fn, dispatch_fn, _e, _client2, _observers, _mutationCache, _retryer2, _Mutation_instances, dispatch_fn2, _f, _mutations, _scopes, _mutationId, _g, _queries, _h, _queryCache, _mutationCache2, _defaultOptions2, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _i, _j;
|
|
21
|
-
import { variant, EastError, ConflictError, equalFor,
|
|
21
|
+
import { variant, SortedMap, compareFor, EastError, fromEastTypeValue, East, none as none$1, some, OptionType, BooleanType, NullType, ConflictError, equalFor, toEastTypeValue, PatchType, diffFor, applyFor, encodeBeast2For, decodeBeast2For, BlobType, StructType, StringType, walkPatch, pathToString, pathDisplay, printFor, isVariant, prunePatchFor, detectConflictsFor, mergeWithResolutionsFor, validatePatchFor, ArrayType } from "@elaraai/east";
|
|
22
22
|
import { EastTypeType } from "@elaraai/east/internal";
|
|
23
|
-
import { bindPlatformFn, funcBindPlatformFn, recordBindPlatformFn, Diff, Ontology, FuncBindHandleType, Experiment, decisionBindPlatformFn, DecisionQueue, DecisionJournal, decodeManifest } from "@elaraai/e3-ui/internal";
|
|
24
|
-
import { registerReactiveTracker, registerPlatformImplementation } from "@elaraai/east-ui-components/platform";
|
|
23
|
+
import { DataBindModeType, DataBindPrimitives, bindPlatformFn, FuncBindPrimitives, FuncErrorType, FuncStatusType, funcBindPlatformFn, RecordBindPrimitives, recordBindPlatformFn, Diff, Ontology, FuncBindHandleType, Experiment, decisionBindPlatformFn, DecisionBindPrimitives, DecisionConstraintType, DiffBindingType, CommitStateType, VerdictType, AnswerType, judgementInputType, DecisionType, DecisionQueue, DecisionJournal, decodeManifest } from "@elaraai/e3-ui/internal";
|
|
24
|
+
import { registerReactiveTracker, registerPlatformImplementation, getSomeorUndefined as getSomeorUndefined$1, StateRuntime, buildSliceHandle, DEFAULT_SLICE_STATE, getRegisteredPlatformImplementations } from "@elaraai/east-ui-components/platform";
|
|
25
|
+
import { TreePathType, DatasetStatusType } from "@elaraai/e3-types";
|
|
25
26
|
import { workspaceStatus, datasetListAt, datasetList, dataflowExecuteLaunch, datasetSet, datasetGet, ApiError, workspaceFunctionCall, workspaceFunctionList, workspaceRecordHistory, workspaceRecordMutate, workspaceRecordDescribe, 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";
|
|
26
27
|
import { jsx as jsx$1, Fragment, jsxs } from "react/jsx-runtime";
|
|
27
28
|
import * as React from "react";
|
|
28
29
|
import React__default, { useId, useMemo, useContext, createContext, useRef, useEffect, useState, useCallback, useSyncExternalStore, memo, forwardRef, useLayoutEffect, Fragment as Fragment$1, Component } from "react";
|
|
29
30
|
import { Box, Flex, Text, HStack, Input, useSlotRecipe, useRecipe, VStack, useToken, Drawer, Portal, Field, NativeSelect, Textarea, chakra, Tooltip, SegmentGroup, Menu, HoverCard, useChakraContext, Spinner, Code, Clipboard, IconButton, Badge, Button, Tabs, useTabs } from "@chakra-ui/react";
|
|
30
|
-
import { implementUIComponent, getSomeorUndefined, formatPredicate, SliceEditPopover, SlicePredicateBuilder,
|
|
31
|
+
import { implementUIComponent, getSomeorUndefined, formatPredicate, SliceEditPopover, SlicePredicateBuilder, EastChakraSelect, EastChakraStringInput, EastChakraDateTimeInput, EastChakraFloatInput, EastChakraIntegerInput, formatTick, useSliceReactivity, SliceRailCluster, EastChakraComponent, ClauseChip, StateImpl, NavImpl, SliceImpl, SliceApplyImpl, OverlayImpl, ClipboardImpl, DownloadImpl, ShareImpl, createUIStore, UIStoreProvider } from "@elaraai/east-ui-components";
|
|
31
32
|
import { createPortal } from "react-dom";
|
|
32
33
|
import { sliceMatches } from "@elaraai/east-ui/internal";
|
|
33
34
|
import { QueryClient as QueryClient$1, QueryClientProvider, useMutation, useQuery } from "@tanstack/react-query";
|
|
@@ -2916,6 +2917,17 @@ class BindRuntime {
|
|
|
2916
2917
|
__publicField(this, "fallbackWarningEmitted", /* @__PURE__ */ new Set());
|
|
2917
2918
|
// List cache helpers.
|
|
2918
2919
|
__publicField(this, "listCache", /* @__PURE__ */ new Map());
|
|
2920
|
+
// Compiled-handle cache (issue #106 perf). The bind impl compiles N
|
|
2921
|
+
// East.function methods per bind, and binds re-run on every reactive frame.
|
|
2922
|
+
// The compiled IR is a pure function of (sourceType, sourcePath, patch, mode)
|
|
2923
|
+
// — same key ⇒ same methods — and the methods resolve cache/workspace LIVE,
|
|
2924
|
+
// so a cached handle still re-binds correctly across renders / cache swaps.
|
|
2925
|
+
// Keyed *structurally* (each bind builds a fresh EastTypeValue from IR, so a
|
|
2926
|
+
// by-identity cache would miss every render — same reason as helpersCache).
|
|
2927
|
+
__publicField(this, "handleCache", new SortedMap(
|
|
2928
|
+
void 0,
|
|
2929
|
+
compareFor(EastTypeType)
|
|
2930
|
+
));
|
|
2919
2931
|
this.staged = staged;
|
|
2920
2932
|
this.staged.onPersistError((_key, err) => this.emitWriteError(err));
|
|
2921
2933
|
}
|
|
@@ -2946,6 +2958,7 @@ class BindRuntime {
|
|
|
2946
2958
|
clearCache() {
|
|
2947
2959
|
this.cache = null;
|
|
2948
2960
|
this.clearPendingWrites();
|
|
2961
|
+
this.handleCache.clear();
|
|
2949
2962
|
}
|
|
2950
2963
|
// ----- pending writes queue -------------------------------------------
|
|
2951
2964
|
/** Subscribe to write-queue errors. Returns an unsubscribe fn. */
|
|
@@ -3072,13 +3085,14 @@ class BindRuntime {
|
|
|
3072
3085
|
}
|
|
3073
3086
|
// ----- bind-handle construction --------------------------------------
|
|
3074
3087
|
/**
|
|
3075
|
-
* Build a bind handle
|
|
3076
|
-
*
|
|
3077
|
-
*
|
|
3088
|
+
* Build a `Data.bind` handle. Its methods are thin IR-bearing
|
|
3089
|
+
* `East.function`s over the `data_*` primitives, capturing only the
|
|
3090
|
+
* plain-data `{source, patch, mode}` descriptor — so the handle is ordinary
|
|
3091
|
+
* serializable East data (issue #106) and re-binds to the decoder's cache.
|
|
3092
|
+
* Public so tests can call it directly without East's compile/dispatch.
|
|
3078
3093
|
*
|
|
3079
|
-
* @throws `EastError` if the cache is uninitialized, the
|
|
3080
|
-
*
|
|
3081
|
-
* referenced path is not in it.
|
|
3094
|
+
* @throws `EastError` if the cache is uninitialized, the workspace is not
|
|
3095
|
+
* configured, or `allowed` is non-null and any referenced path is not in it.
|
|
3082
3096
|
*/
|
|
3083
3097
|
buildBindHandle(sourceType, sourcePath, patchPath, mode, allowed) {
|
|
3084
3098
|
const cache3 = this.requireCache();
|
|
@@ -3102,6 +3116,106 @@ class BindRuntime {
|
|
|
3102
3116
|
}
|
|
3103
3117
|
}
|
|
3104
3118
|
}
|
|
3119
|
+
const { patchType } = getBindingHelpers(sourceType);
|
|
3120
|
+
this.registerBindingTypes(ws, sourcePath, {
|
|
3121
|
+
workspace: ws,
|
|
3122
|
+
sourceType,
|
|
3123
|
+
patchType,
|
|
3124
|
+
mode,
|
|
3125
|
+
hasPatchDataset: patchPath !== void 0
|
|
3126
|
+
});
|
|
3127
|
+
const descKey = `${datasetPathToString(sourcePath)}\0${patchPath !== void 0 ? datasetPathToString(patchPath) : ""}\0${mode}`;
|
|
3128
|
+
let byDesc = this.handleCache.get(sourceType);
|
|
3129
|
+
if (byDesc) {
|
|
3130
|
+
const hit = byDesc.get(descKey);
|
|
3131
|
+
if (hit) return hit;
|
|
3132
|
+
} else {
|
|
3133
|
+
byDesc = /* @__PURE__ */ new Map();
|
|
3134
|
+
this.handleCache.set(sourceType, byDesc);
|
|
3135
|
+
}
|
|
3136
|
+
const T2 = fromEastTypeValue(sourceType);
|
|
3137
|
+
const srcExpr = East.value(sourcePath, TreePathType);
|
|
3138
|
+
const patchExpr = East.value(patchPath !== void 0 ? some(patchPath) : none$1, OptionType(TreePathType));
|
|
3139
|
+
const modeExpr = East.value(variant(mode, null), DataBindModeType);
|
|
3140
|
+
const platform = this.buildPrimitives();
|
|
3141
|
+
const P2 = DataBindPrimitives;
|
|
3142
|
+
const handle = {
|
|
3143
|
+
read: East.compile(East.function([], T2, ($3) => {
|
|
3144
|
+
$3.return(P2.read([T2], srcExpr, patchExpr, modeExpr));
|
|
3145
|
+
}), platform),
|
|
3146
|
+
write: East.compile(East.function([T2], NullType, ($3, v3) => {
|
|
3147
|
+
$3.return(P2.write([T2], srcExpr, patchExpr, modeExpr, v3));
|
|
3148
|
+
}), platform),
|
|
3149
|
+
writeAndStart: East.compile(East.function([T2], NullType, ($3, v3) => {
|
|
3150
|
+
$3.return(P2.writeAndStart([T2], srcExpr, patchExpr, modeExpr, v3));
|
|
3151
|
+
}), platform),
|
|
3152
|
+
start: East.compile(East.function([], NullType, ($3) => {
|
|
3153
|
+
$3.return(P2.start([T2], srcExpr, patchExpr, modeExpr));
|
|
3154
|
+
}), platform),
|
|
3155
|
+
source: East.compile(East.function([], T2, ($3) => {
|
|
3156
|
+
$3.return(P2.source([T2], srcExpr, patchExpr, modeExpr));
|
|
3157
|
+
}), platform),
|
|
3158
|
+
pending: East.compile(East.function([], BooleanType, ($3) => {
|
|
3159
|
+
$3.return(P2.pending([T2], srcExpr, patchExpr, modeExpr));
|
|
3160
|
+
}), platform),
|
|
3161
|
+
commit: East.compile(East.function([], NullType, ($3) => {
|
|
3162
|
+
$3.return(P2.commit([T2], srcExpr, patchExpr, modeExpr));
|
|
3163
|
+
}), platform),
|
|
3164
|
+
discard: East.compile(East.function([], NullType, ($3) => {
|
|
3165
|
+
$3.return(P2.discard([T2], srcExpr, patchExpr, modeExpr));
|
|
3166
|
+
}), platform),
|
|
3167
|
+
has: East.compile(East.function([], BooleanType, ($3) => {
|
|
3168
|
+
$3.return(P2.has([T2], srcExpr, patchExpr, modeExpr));
|
|
3169
|
+
}), platform),
|
|
3170
|
+
status: East.compile(East.function([], DatasetStatusType, ($3) => {
|
|
3171
|
+
$3.return(P2.status([T2], srcExpr, patchExpr, modeExpr));
|
|
3172
|
+
}), platform),
|
|
3173
|
+
binding: {
|
|
3174
|
+
source: sourcePath,
|
|
3175
|
+
patch: patchPath !== void 0 ? some(patchPath) : none$1,
|
|
3176
|
+
mode: variant(mode, null)
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
byDesc.set(descKey, handle);
|
|
3180
|
+
return handle;
|
|
3181
|
+
}
|
|
3182
|
+
/**
|
|
3183
|
+
* The low-level primitives backing handle methods, bound to THIS runtime.
|
|
3184
|
+
* Registered globally (extension registry) and included by the scoped
|
|
3185
|
+
* platform (e3 `ui()` tasks) so a decoded handle re-binds here. Each impl
|
|
3186
|
+
* recovers the `{source, patch, mode}` descriptor from its args and delegates
|
|
3187
|
+
* to {@link buildRawHandle}, reusing the full mode×patch logic verbatim.
|
|
3188
|
+
*/
|
|
3189
|
+
buildPrimitives() {
|
|
3190
|
+
const raw = (sourceType, sourceArg, patchOpt, modeVariant) => {
|
|
3191
|
+
const { patchPath, mode } = resolveOptions(patchOpt, modeVariant);
|
|
3192
|
+
return this.buildRawHandle(sourceType, sourceArg, patchPath, mode);
|
|
3193
|
+
};
|
|
3194
|
+
const P2 = DataBindPrimitives;
|
|
3195
|
+
return [
|
|
3196
|
+
P2.read.implement((t4) => (s2, p2, m2) => raw(t4, s2, p2, m2).read()),
|
|
3197
|
+
P2.source.implement((t4) => (s2, p2, m2) => raw(t4, s2, p2, m2).source()),
|
|
3198
|
+
P2.write.implement((t4) => (s2, p2, m2, v3) => raw(t4, s2, p2, m2).write(v3)),
|
|
3199
|
+
P2.writeAndStart.implement((t4) => (s2, p2, m2, v3) => raw(t4, s2, p2, m2).writeAndStart(v3)),
|
|
3200
|
+
P2.start.implement((t4) => (s2, p2, m2) => raw(t4, s2, p2, m2).start()),
|
|
3201
|
+
P2.pending.implement((t4) => (s2, p2, m2) => raw(t4, s2, p2, m2).pending()),
|
|
3202
|
+
P2.commit.implement((t4) => (s2, p2, m2) => raw(t4, s2, p2, m2).commit()),
|
|
3203
|
+
P2.discard.implement((t4) => (s2, p2, m2) => raw(t4, s2, p2, m2).discard()),
|
|
3204
|
+
P2.has.implement((t4) => (s2, p2, m2) => raw(t4, s2, p2, m2).has()),
|
|
3205
|
+
P2.status.implement((t4) => (s2, p2, m2) => raw(t4, s2, p2, m2).status())
|
|
3206
|
+
];
|
|
3207
|
+
}
|
|
3208
|
+
/**
|
|
3209
|
+
* Build the raw (host-closure) bind handle for a single
|
|
3210
|
+
* `(sourcePath, mode, patch?)` triple. The mode×patch matrix lives here; the
|
|
3211
|
+
* serializable {@link buildBindHandle} wraps each method as an `East.function`
|
|
3212
|
+
* over a primitive that delegates back here. Re-registers binding types on
|
|
3213
|
+
* every call (decode self-heal). Public so tests can drive the raw closures.
|
|
3214
|
+
*/
|
|
3215
|
+
buildRawHandle(sourceType, sourcePath, patchPath, mode) {
|
|
3216
|
+
const cache3 = this.requireCache();
|
|
3217
|
+
const ws = cache3.getConfig().workspace;
|
|
3218
|
+
if (!ws) throw new Error("ReactiveDatasetCache workspace not configured");
|
|
3105
3219
|
const { patchType, decodeT, encodeT, decodePatch, encodePatch, apply: apply2, diff: diff2 } = getBindingHelpers(sourceType);
|
|
3106
3220
|
this.registerBindingTypes(ws, sourcePath, {
|
|
3107
3221
|
workspace: ws,
|
|
@@ -3416,10 +3530,16 @@ function awaitPendingWrites() {
|
|
|
3416
3530
|
function clearPendingWrites() {
|
|
3417
3531
|
defaultBindRuntime.clearPendingWrites();
|
|
3418
3532
|
}
|
|
3419
|
-
const BindPlatform = [
|
|
3533
|
+
const BindPlatform = [
|
|
3534
|
+
defaultBindRuntime.buildPlatform(null),
|
|
3535
|
+
...defaultBindRuntime.buildPrimitives()
|
|
3536
|
+
];
|
|
3420
3537
|
function createScopedBindPlatform(manifest) {
|
|
3421
3538
|
const allowed = new Set(manifest.paths.map((p2) => datasetPathToString(p2)));
|
|
3422
|
-
return [
|
|
3539
|
+
return [
|
|
3540
|
+
defaultBindRuntime.buildPlatform(allowed),
|
|
3541
|
+
...defaultBindRuntime.buildPrimitives()
|
|
3542
|
+
];
|
|
3423
3543
|
}
|
|
3424
3544
|
async function preloadReactiveDatasetList(workspace, path2) {
|
|
3425
3545
|
return defaultBindRuntime.preloadList(workspace, path2);
|
|
@@ -3649,6 +3769,11 @@ class FuncRuntime extends TrackedChannelStore {
|
|
|
3649
3769
|
__publicField(this, "workspace", null);
|
|
3650
3770
|
// Signature lists are fetched once per workspace and cached.
|
|
3651
3771
|
__publicField(this, "signatureLists", /* @__PURE__ */ new Map());
|
|
3772
|
+
// Compiled-handle cache (issue #106 perf): buildHandle compiles 6 East.functions
|
|
3773
|
+
// per bind, and binds re-run every reactive frame. The method IR is a pure
|
|
3774
|
+
// function of the function name (which fixes the handle type), and the methods
|
|
3775
|
+
// resolve workspace/api LIVE, so a cached handle still re-binds. Cleared on clear().
|
|
3776
|
+
__publicField(this, "handleCache", /* @__PURE__ */ new Map());
|
|
3652
3777
|
}
|
|
3653
3778
|
createEntry() {
|
|
3654
3779
|
return { status: "idle", launchSeq: 0 };
|
|
@@ -3666,6 +3791,7 @@ class FuncRuntime extends TrackedChannelStore {
|
|
|
3666
3791
|
this.workspace = null;
|
|
3667
3792
|
this.clearChannels();
|
|
3668
3793
|
this.signatureLists.clear();
|
|
3794
|
+
this.handleCache.clear();
|
|
3669
3795
|
}
|
|
3670
3796
|
/** The deployed signature list for a workspace (fetched once). */
|
|
3671
3797
|
signatures(workspace) {
|
|
@@ -3769,9 +3895,15 @@ class FuncRuntime extends TrackedChannelStore {
|
|
|
3769
3895
|
}
|
|
3770
3896
|
})();
|
|
3771
3897
|
}
|
|
3772
|
-
/**
|
|
3773
|
-
|
|
3774
|
-
|
|
3898
|
+
/**
|
|
3899
|
+
* The 6 low-level primitives backing handle methods, bound to THIS runtime.
|
|
3900
|
+
* Registered globally (extension registry) and included by the scoped
|
|
3901
|
+
* platform (e3 `ui()` tasks) so a decoded handle re-binds to whatever runtime
|
|
3902
|
+
* resolves the primitives on the decode side. The host effects (launch /
|
|
3903
|
+
* channel reads + reactive tracking) live here, keyed only on the plain-data
|
|
3904
|
+
* function name; the output type rides as a type-arg.
|
|
3905
|
+
*/
|
|
3906
|
+
buildPrimitives() {
|
|
3775
3907
|
const runtime = this;
|
|
3776
3908
|
const resolveWorkspace = () => {
|
|
3777
3909
|
if (!runtime.workspace) {
|
|
@@ -3779,42 +3911,91 @@ class FuncRuntime extends TrackedChannelStore {
|
|
|
3779
3911
|
}
|
|
3780
3912
|
return runtime.workspace;
|
|
3781
3913
|
};
|
|
3782
|
-
const channel = () => {
|
|
3914
|
+
const channel = (name) => {
|
|
3783
3915
|
const key = funcChannelKey(resolveWorkspace(), name);
|
|
3784
3916
|
return { key, entry: runtime.entry(key) };
|
|
3785
3917
|
};
|
|
3786
|
-
return
|
|
3787
|
-
call:
|
|
3788
|
-
|
|
3918
|
+
return [
|
|
3919
|
+
// call: recover per-arg input types from the ArgsStruct type-arg + the
|
|
3920
|
+
// values from the passed struct (field order), and the output type from O.
|
|
3921
|
+
FuncBindPrimitives.call.implement((argsStructType, outputType) => (nameArg, argsStruct) => {
|
|
3922
|
+
const fields = argsStructType.value;
|
|
3923
|
+
const obj = argsStruct;
|
|
3924
|
+
const inputs = fields.map((f2) => f2.type);
|
|
3925
|
+
const args = fields.map((f2) => obj[f2.name]);
|
|
3926
|
+
runtime.launch(resolveWorkspace(), nameArg, { inputs, output: outputType }, args);
|
|
3789
3927
|
return null;
|
|
3790
|
-
},
|
|
3791
|
-
read
|
|
3792
|
-
const { key, entry } = channel();
|
|
3928
|
+
}),
|
|
3929
|
+
FuncBindPrimitives.read.implement((_outputType) => (nameArg) => {
|
|
3930
|
+
const { key, entry } = channel(nameArg);
|
|
3793
3931
|
runtime.track(key);
|
|
3794
3932
|
return entry.result !== void 0 ? variant("some", entry.result) : variant("none", null);
|
|
3795
|
-
},
|
|
3796
|
-
status
|
|
3797
|
-
const { key, entry } = channel();
|
|
3933
|
+
}),
|
|
3934
|
+
FuncBindPrimitives.status.implement((nameArg) => {
|
|
3935
|
+
const { key, entry } = channel(nameArg);
|
|
3798
3936
|
runtime.track(key);
|
|
3799
3937
|
return variant(entry.status, null);
|
|
3800
|
-
},
|
|
3801
|
-
error
|
|
3802
|
-
const { key, entry } = channel();
|
|
3938
|
+
}),
|
|
3939
|
+
FuncBindPrimitives.error.implement((nameArg) => {
|
|
3940
|
+
const { key, entry } = channel(nameArg);
|
|
3803
3941
|
runtime.track(key);
|
|
3804
3942
|
return entry.status === "failed" && entry.error !== void 0 ? variant("some", entry.error) : variant("none", null);
|
|
3805
|
-
},
|
|
3806
|
-
pending
|
|
3807
|
-
const { key, entry } = channel();
|
|
3943
|
+
}),
|
|
3944
|
+
FuncBindPrimitives.pending.implement((nameArg) => {
|
|
3945
|
+
const { key, entry } = channel(nameArg);
|
|
3808
3946
|
runtime.track(key);
|
|
3809
3947
|
return entry.status === "running";
|
|
3810
|
-
},
|
|
3811
|
-
cancel
|
|
3812
|
-
const { key } = channel();
|
|
3948
|
+
}),
|
|
3949
|
+
FuncBindPrimitives.cancel.implement((nameArg) => {
|
|
3950
|
+
const { key } = channel(nameArg);
|
|
3813
3951
|
runtime.cancelChannel(key);
|
|
3814
3952
|
return null;
|
|
3815
|
-
}
|
|
3953
|
+
})
|
|
3954
|
+
];
|
|
3955
|
+
}
|
|
3956
|
+
/**
|
|
3957
|
+
* Build the handle value for one `Func.bind` evaluation. The methods are
|
|
3958
|
+
* thin IR-bearing `East.function`s over {@link buildPrimitives}, capturing
|
|
3959
|
+
* only the function name (and the signature types via type-args) — so the
|
|
3960
|
+
* handle is ordinary serializable East data (issue #106).
|
|
3961
|
+
*/
|
|
3962
|
+
buildHandle(handleType, name) {
|
|
3963
|
+
const cached = this.handleCache.get(name);
|
|
3964
|
+
if (cached) return cached;
|
|
3965
|
+
const sig = signatureOfFuncHandleType(handleType);
|
|
3966
|
+
const inputsEast = sig.inputs.map((t4) => fromEastTypeValue(t4));
|
|
3967
|
+
const outputEast = fromEastTypeValue(sig.output);
|
|
3968
|
+
const ArgsStruct = StructType(Object.fromEntries(inputsEast.map((t4, i) => [`arg${i}`, t4])));
|
|
3969
|
+
const nameExpr = East.value(name, StringType);
|
|
3970
|
+
const platform = this.buildPrimitives();
|
|
3971
|
+
const { call, read, status, error: error3, pending, cancel } = FuncBindPrimitives;
|
|
3972
|
+
const handle = {
|
|
3973
|
+
call: East.compile(East.function(inputsEast, NullType, ($3, ...args) => {
|
|
3974
|
+
const obj = {};
|
|
3975
|
+
args.forEach((a2, i) => {
|
|
3976
|
+
obj[`arg${i}`] = a2;
|
|
3977
|
+
});
|
|
3978
|
+
$3.return(call([ArgsStruct, outputEast], nameExpr, East.value(obj, ArgsStruct)));
|
|
3979
|
+
}), platform),
|
|
3980
|
+
read: East.compile(East.function([], OptionType(outputEast), ($3) => {
|
|
3981
|
+
$3.return(read([outputEast], nameExpr));
|
|
3982
|
+
}), platform),
|
|
3983
|
+
status: East.compile(East.function([], FuncStatusType, ($3) => {
|
|
3984
|
+
$3.return(status(nameExpr));
|
|
3985
|
+
}), platform),
|
|
3986
|
+
error: East.compile(East.function([], OptionType(FuncErrorType), ($3) => {
|
|
3987
|
+
$3.return(error3(nameExpr));
|
|
3988
|
+
}), platform),
|
|
3989
|
+
pending: East.compile(East.function([], BooleanType, ($3) => {
|
|
3990
|
+
$3.return(pending(nameExpr));
|
|
3991
|
+
}), platform),
|
|
3992
|
+
cancel: East.compile(East.function([], NullType, ($3) => {
|
|
3993
|
+
$3.return(cancel(nameExpr));
|
|
3994
|
+
}), platform),
|
|
3816
3995
|
binding: { name }
|
|
3817
3996
|
};
|
|
3997
|
+
this.handleCache.set(name, handle);
|
|
3998
|
+
return handle;
|
|
3818
3999
|
}
|
|
3819
4000
|
// ----- platform building -------------------------------------------------
|
|
3820
4001
|
/** Build a `Func.bind` PlatformFunction bound to this runtime. Pass
|
|
@@ -3841,9 +4022,15 @@ function initializeFunctionApi(api3, workspace) {
|
|
|
3841
4022
|
function clearFunctionApi() {
|
|
3842
4023
|
defaultFuncRuntime.clear();
|
|
3843
4024
|
}
|
|
3844
|
-
const FuncPlatform = [
|
|
4025
|
+
const FuncPlatform = [
|
|
4026
|
+
defaultFuncRuntime.buildPlatform(null),
|
|
4027
|
+
...defaultFuncRuntime.buildPrimitives()
|
|
4028
|
+
];
|
|
3845
4029
|
function createScopedFuncPlatform(functions2) {
|
|
3846
|
-
return [
|
|
4030
|
+
return [
|
|
4031
|
+
defaultFuncRuntime.buildPlatform(new Set(functions2)),
|
|
4032
|
+
...defaultFuncRuntime.buildPrimitives()
|
|
4033
|
+
];
|
|
3847
4034
|
}
|
|
3848
4035
|
function createInMemoryFunctionApi(functions2) {
|
|
3849
4036
|
const defs2 = functions2.map((def) => ({
|
|
@@ -7653,6 +7840,12 @@ class RecordRuntime extends TrackedChannelStore {
|
|
|
7653
7840
|
// otherwise spin); cleared on the next commit / on clear() so a later
|
|
7654
7841
|
// mutation retries.
|
|
7655
7842
|
__publicField(this, "historyFailed", /* @__PURE__ */ new Set());
|
|
7843
|
+
// Compiled-handle cache (issue #106 perf): buildHandle compiles 8 + (one per
|
|
7844
|
+
// mutation) East.functions per bind, and binds re-run every reactive frame.
|
|
7845
|
+
// The method IR is a pure function of the record name (which fixes the handle
|
|
7846
|
+
// type), and the methods resolve cache/api/ws LIVE, so a cached handle still
|
|
7847
|
+
// re-binds. Cleared on clear().
|
|
7848
|
+
__publicField(this, "handleCache", /* @__PURE__ */ new Map());
|
|
7656
7849
|
}
|
|
7657
7850
|
createEntry() {
|
|
7658
7851
|
return { status: "idle", launchSeq: 0 };
|
|
@@ -7675,6 +7868,7 @@ class RecordRuntime extends TrackedChannelStore {
|
|
|
7675
7868
|
this.histories.clear();
|
|
7676
7869
|
this.historyInFlight.clear();
|
|
7677
7870
|
this.historyFailed.clear();
|
|
7871
|
+
this.handleCache.clear();
|
|
7678
7872
|
}
|
|
7679
7873
|
resolveWorkspace() {
|
|
7680
7874
|
if (!this.workspace) {
|
|
@@ -7793,89 +7987,163 @@ class RecordRuntime extends TrackedChannelStore {
|
|
|
7793
7987
|
if (current && current.inflight === run) delete current.inflight;
|
|
7794
7988
|
});
|
|
7795
7989
|
}
|
|
7796
|
-
/**
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7990
|
+
/**
|
|
7991
|
+
* The low-level primitives backing handle methods, bound to THIS runtime.
|
|
7992
|
+
* Registered globally (extension registry) and included by the scoped
|
|
7993
|
+
* platform (e3 `ui()` tasks) so a decoded handle re-binds here. The host
|
|
7994
|
+
* effects (dataset-cache reads + reactive tracking + mutation launch) live
|
|
7995
|
+
* here, keyed only on the plain-data record name; the state type rides as a
|
|
7996
|
+
* type-arg on `record_read`, and per-mutation arg types come from the
|
|
7997
|
+
* `record_mutate` ArgsStruct type-arg.
|
|
7998
|
+
*/
|
|
7999
|
+
buildPrimitives() {
|
|
7800
8000
|
const runtime = this;
|
|
7801
|
-
const path2 = recordPath(name);
|
|
7802
8001
|
const requireCache = () => {
|
|
7803
8002
|
if (!runtime.cache) {
|
|
7804
8003
|
throw new Error("Record.bind: no dataset cache configured — mount a provider first");
|
|
7805
8004
|
}
|
|
7806
8005
|
return runtime.cache;
|
|
7807
8006
|
};
|
|
7808
|
-
|
|
7809
|
-
|
|
8007
|
+
return [
|
|
8008
|
+
RecordBindPrimitives.read.implement((stateType) => {
|
|
8009
|
+
const decode = decodeBeast2For(stateType);
|
|
8010
|
+
return (nameArg) => {
|
|
8011
|
+
const ws = runtime.resolveWorkspace();
|
|
8012
|
+
const path2 = recordPath(nameArg);
|
|
8013
|
+
trackDatasetPath(ws, path2);
|
|
8014
|
+
const bytes = requireCache().read(ws, path2);
|
|
8015
|
+
if (bytes === void 0) {
|
|
8016
|
+
throw new Error(`Record.bind: record state not loaded: ${datasetCacheKey(ws, path2)} (it should be preloaded via the UI task manifest)`);
|
|
8017
|
+
}
|
|
8018
|
+
return decode(bytes);
|
|
8019
|
+
};
|
|
8020
|
+
}),
|
|
8021
|
+
RecordBindPrimitives.status.implement((nameArg) => {
|
|
8022
|
+
const ws = runtime.resolveWorkspace();
|
|
8023
|
+
const path2 = recordPath(nameArg);
|
|
8024
|
+
trackDatasetPath(ws, path2);
|
|
8025
|
+
return requireCache().getStatus(ws, path2);
|
|
8026
|
+
}),
|
|
8027
|
+
RecordBindPrimitives.history.implement((nameArg) => {
|
|
8028
|
+
const name = nameArg;
|
|
7810
8029
|
const ws = runtime.resolveWorkspace();
|
|
7811
8030
|
const key = recordChannelKey(ws, name);
|
|
7812
8031
|
runtime.track(key);
|
|
8032
|
+
const cached = runtime.histories.get(key);
|
|
8033
|
+
if (cached === void 0) {
|
|
8034
|
+
if (!runtime.historyFailed.has(key)) runtime.fetchHistory(ws, name, key);
|
|
8035
|
+
return none$1;
|
|
8036
|
+
}
|
|
8037
|
+
return some(cached);
|
|
8038
|
+
}),
|
|
8039
|
+
RecordBindPrimitives.start.implement((nameArg) => {
|
|
8040
|
+
const ws = runtime.resolveWorkspace();
|
|
8041
|
+
const cache3 = requireCache();
|
|
8042
|
+
const inflight = runtime.entry(recordChannelKey(ws, nameArg)).inflight;
|
|
8043
|
+
void Promise.resolve(inflight).catch(() => void 0).then(() => cache3.launchDataflow(ws)).catch(() => void 0);
|
|
8044
|
+
return null;
|
|
8045
|
+
}),
|
|
8046
|
+
RecordBindPrimitives.mutatePending.implement((nameArg) => {
|
|
8047
|
+
const ws = runtime.resolveWorkspace();
|
|
8048
|
+
const key = recordChannelKey(ws, nameArg);
|
|
8049
|
+
runtime.track(key);
|
|
7813
8050
|
return runtime.entry(key).status === "running";
|
|
7814
|
-
},
|
|
7815
|
-
|
|
8051
|
+
}),
|
|
8052
|
+
RecordBindPrimitives.mutateStatus.implement((nameArg) => {
|
|
7816
8053
|
const ws = runtime.resolveWorkspace();
|
|
7817
|
-
const key = recordChannelKey(ws,
|
|
8054
|
+
const key = recordChannelKey(ws, nameArg);
|
|
7818
8055
|
runtime.track(key);
|
|
7819
8056
|
return variant(runtime.entry(key).status, null);
|
|
7820
|
-
},
|
|
7821
|
-
|
|
8057
|
+
}),
|
|
8058
|
+
RecordBindPrimitives.mutateError.implement((nameArg) => {
|
|
7822
8059
|
const ws = runtime.resolveWorkspace();
|
|
7823
|
-
const key = recordChannelKey(ws,
|
|
8060
|
+
const key = recordChannelKey(ws, nameArg);
|
|
7824
8061
|
runtime.track(key);
|
|
7825
8062
|
const entry = runtime.entry(key);
|
|
7826
8063
|
return entry.status === "failed" && entry.error !== void 0 ? some(entry.error) : none$1;
|
|
7827
|
-
},
|
|
7828
|
-
|
|
8064
|
+
}),
|
|
8065
|
+
RecordBindPrimitives.mutateCancel.implement((nameArg) => {
|
|
7829
8066
|
const ws = runtime.resolveWorkspace();
|
|
7830
|
-
runtime.cancelChannel(recordChannelKey(ws,
|
|
8067
|
+
runtime.cancelChannel(recordChannelKey(ws, nameArg), (e3) => {
|
|
7831
8068
|
delete e3.error;
|
|
7832
8069
|
delete e3.inflight;
|
|
7833
8070
|
});
|
|
7834
8071
|
return null;
|
|
7835
|
-
}
|
|
8072
|
+
}),
|
|
8073
|
+
RecordBindPrimitives.mutate.implement((argsStructType) => (recordNameArg, mutationNameArg, argsStruct) => {
|
|
8074
|
+
const fields = argsStructType.value;
|
|
8075
|
+
const obj = argsStruct;
|
|
8076
|
+
const argTypes = fields.map((f2) => f2.type);
|
|
8077
|
+
const args = fields.map((f2) => obj[f2.name]);
|
|
8078
|
+
runtime.launchMutation(runtime.resolveWorkspace(), recordNameArg, mutationNameArg, argTypes, args);
|
|
8079
|
+
return null;
|
|
8080
|
+
})
|
|
8081
|
+
];
|
|
8082
|
+
}
|
|
8083
|
+
/**
|
|
8084
|
+
* Build the handle value for one `Record.bind` evaluation. Every method —
|
|
8085
|
+
* top-level AND nested `mutate.*` (incl. the dynamic per-mutation closures) —
|
|
8086
|
+
* is a thin IR-bearing `East.function` over {@link buildPrimitives}, capturing
|
|
8087
|
+
* only the record name (+ per-mutation name), so the handle is ordinary
|
|
8088
|
+
* serializable East data (issue #106).
|
|
8089
|
+
*/
|
|
8090
|
+
buildHandle(handleType, name) {
|
|
8091
|
+
const cached = this.handleCache.get(name);
|
|
8092
|
+
if (cached) return cached;
|
|
8093
|
+
const sig = signatureOfRecordHandleType(handleType);
|
|
8094
|
+
const stateTypeEast = fromEastTypeValue(sig.stateType);
|
|
8095
|
+
const fields = handleType.value;
|
|
8096
|
+
const fnOut = (list, n2) => fromEastTypeValue(list.find((f2) => f2.name === n2).type.value.output);
|
|
8097
|
+
const statusRet = fnOut(fields, "status");
|
|
8098
|
+
const historyRet = fnOut(fields, "history");
|
|
8099
|
+
const mfields = fields.find((f2) => f2.name === "mutate").type.value;
|
|
8100
|
+
const nameExpr = East.value(name, StringType);
|
|
8101
|
+
const platform = this.buildPrimitives();
|
|
8102
|
+
const P2 = RecordBindPrimitives;
|
|
8103
|
+
const mutate = {
|
|
8104
|
+
pending: East.compile(East.function([], fnOut(mfields, "pending"), ($3) => {
|
|
8105
|
+
$3.return(P2.mutatePending(nameExpr));
|
|
8106
|
+
}), platform),
|
|
8107
|
+
status: East.compile(East.function([], fnOut(mfields, "status"), ($3) => {
|
|
8108
|
+
$3.return(P2.mutateStatus(nameExpr));
|
|
8109
|
+
}), platform),
|
|
8110
|
+
error: East.compile(East.function([], fnOut(mfields, "error"), ($3) => {
|
|
8111
|
+
$3.return(P2.mutateError(nameExpr));
|
|
8112
|
+
}), platform),
|
|
8113
|
+
cancel: East.compile(East.function([], NullType, ($3) => {
|
|
8114
|
+
$3.return(P2.mutateCancel(nameExpr));
|
|
8115
|
+
}), platform)
|
|
7836
8116
|
};
|
|
7837
8117
|
for (const [mutationName, argTypes] of sig.mutations) {
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
return
|
|
7852
|
-
},
|
|
7853
|
-
status: () => {
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
const ws = runtime.resolveWorkspace();
|
|
7860
|
-
const key = recordChannelKey(ws, name);
|
|
7861
|
-
runtime.track(key);
|
|
7862
|
-
const cached = runtime.histories.get(key);
|
|
7863
|
-
if (cached === void 0) {
|
|
7864
|
-
if (!runtime.historyFailed.has(key)) runtime.fetchHistory(ws, name, key);
|
|
7865
|
-
return none$1;
|
|
7866
|
-
}
|
|
7867
|
-
return some(cached);
|
|
7868
|
-
},
|
|
8118
|
+
const argTypesEast = argTypes.map((t4) => fromEastTypeValue(t4));
|
|
8119
|
+
const ArgsStruct = StructType(Object.fromEntries(argTypesEast.map((t4, i) => [`arg${i}`, t4])));
|
|
8120
|
+
const mutationNameExpr = East.value(mutationName, StringType);
|
|
8121
|
+
mutate[mutationName] = East.compile(East.function(argTypesEast, NullType, ($3, ...args) => {
|
|
8122
|
+
const obj = {};
|
|
8123
|
+
args.forEach((a2, i) => {
|
|
8124
|
+
obj[`arg${i}`] = a2;
|
|
8125
|
+
});
|
|
8126
|
+
$3.return(P2.mutate([ArgsStruct], nameExpr, mutationNameExpr, East.value(obj, ArgsStruct)));
|
|
8127
|
+
}), platform);
|
|
8128
|
+
}
|
|
8129
|
+
const handle = {
|
|
8130
|
+
read: East.compile(East.function([], stateTypeEast, ($3) => {
|
|
8131
|
+
$3.return(P2.read([stateTypeEast], nameExpr));
|
|
8132
|
+
}), platform),
|
|
8133
|
+
status: East.compile(East.function([], statusRet, ($3) => {
|
|
8134
|
+
$3.return(P2.status(nameExpr));
|
|
8135
|
+
}), platform),
|
|
8136
|
+
history: East.compile(East.function([], historyRet, ($3) => {
|
|
8137
|
+
$3.return(P2.history(nameExpr));
|
|
8138
|
+
}), platform),
|
|
7869
8139
|
mutate,
|
|
7870
|
-
start: () => {
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
const inflight = runtime.entry(recordChannelKey(ws, name)).inflight;
|
|
7874
|
-
void Promise.resolve(inflight).catch(() => void 0).then(() => cache3.launchDataflow(ws)).catch(() => void 0);
|
|
7875
|
-
return null;
|
|
7876
|
-
},
|
|
8140
|
+
start: East.compile(East.function([], NullType, ($3) => {
|
|
8141
|
+
$3.return(P2.start(nameExpr));
|
|
8142
|
+
}), platform),
|
|
7877
8143
|
binding: { name, mutations: [...sig.mutations.keys()] }
|
|
7878
8144
|
};
|
|
8145
|
+
this.handleCache.set(name, handle);
|
|
8146
|
+
return handle;
|
|
7879
8147
|
}
|
|
7880
8148
|
// ----- platform building -------------------------------------------------
|
|
7881
8149
|
/** Build a `Record.bind` PlatformFunction bound to this runtime. Pass
|
|
@@ -7902,9 +8170,15 @@ function initializeRecordApi(api3, cache3, workspace) {
|
|
|
7902
8170
|
function clearRecordApi() {
|
|
7903
8171
|
defaultRecordRuntime.clear();
|
|
7904
8172
|
}
|
|
7905
|
-
const RecordPlatform = [
|
|
8173
|
+
const RecordPlatform = [
|
|
8174
|
+
defaultRecordRuntime.buildPlatform(null),
|
|
8175
|
+
...defaultRecordRuntime.buildPrimitives()
|
|
8176
|
+
];
|
|
7906
8177
|
function createScopedRecordPlatform(records) {
|
|
7907
|
-
return [
|
|
8178
|
+
return [
|
|
8179
|
+
defaultRecordRuntime.buildPlatform(new Set(records)),
|
|
8180
|
+
...defaultRecordRuntime.buildPrimitives()
|
|
8181
|
+
];
|
|
7908
8182
|
}
|
|
7909
8183
|
function createInMemoryRecordApi(cache3, workspace, defs2) {
|
|
7910
8184
|
const compiled = /* @__PURE__ */ new Map();
|
|
@@ -61612,23 +61886,23 @@ function hashString2(s2) {
|
|
|
61612
61886
|
for (let i = 0; i < s2.length; i++) h2 = (h2 << 5) + h2 + s2.charCodeAt(i) | 0;
|
|
61613
61887
|
return (h2 >>> 0).toString(36);
|
|
61614
61888
|
}
|
|
61615
|
-
function
|
|
61616
|
-
|
|
61617
|
-
const
|
|
61618
|
-
|
|
61619
|
-
|
|
61620
|
-
|
|
61621
|
-
|
|
61622
|
-
|
|
61623
|
-
|
|
61624
|
-
|
|
61625
|
-
|
|
61626
|
-
|
|
61627
|
-
|
|
61628
|
-
|
|
61629
|
-
|
|
61630
|
-
|
|
61631
|
-
|
|
61889
|
+
function readSelectionAt(selectionKey) {
|
|
61890
|
+
StateRuntime.trackKey(selectionKey);
|
|
61891
|
+
const bytes = StateRuntime.getStore().read(selectionKey);
|
|
61892
|
+
return bytes === void 0 ? none$1 : decodeSelection(bytes);
|
|
61893
|
+
}
|
|
61894
|
+
function writeSelectionAt(selectionKey, value) {
|
|
61895
|
+
StateRuntime.getStore().write(selectionKey, encodeSelection(value));
|
|
61896
|
+
return null;
|
|
61897
|
+
}
|
|
61898
|
+
function hostQueue(decisions) {
|
|
61899
|
+
return decisions.flatMap((b2) => viewFor(b2).read());
|
|
61900
|
+
}
|
|
61901
|
+
function readJudgementsAt(judgements) {
|
|
61902
|
+
return viewFor(judgements).read();
|
|
61903
|
+
}
|
|
61904
|
+
function judgementForAt(judgements, caseId) {
|
|
61905
|
+
return readJudgementsAt(judgements).get(caseId) ?? {
|
|
61632
61906
|
caseId,
|
|
61633
61907
|
answers: /* @__PURE__ */ new Map(),
|
|
61634
61908
|
knowledge: none$1,
|
|
@@ -61636,101 +61910,190 @@ function buildDecisionHandle(decisions, judgements, sliceInit) {
|
|
|
61636
61910
|
verdict: none$1,
|
|
61637
61911
|
resolvedAt: none$1
|
|
61638
61912
|
};
|
|
61639
|
-
|
|
61640
|
-
|
|
61641
|
-
|
|
61642
|
-
|
|
61643
|
-
|
|
61644
|
-
|
|
61645
|
-
|
|
61646
|
-
|
|
61647
|
-
|
|
61648
|
-
|
|
61649
|
-
|
|
61650
|
-
|
|
61651
|
-
|
|
61913
|
+
}
|
|
61914
|
+
function stageJudgementAt(judgements, caseId, change) {
|
|
61915
|
+
const dict = new Map(readJudgementsAt(judgements));
|
|
61916
|
+
dict.set(caseId, { ...judgementForAt(judgements, caseId), ...change });
|
|
61917
|
+
viewFor(judgements).write(dict);
|
|
61918
|
+
return null;
|
|
61919
|
+
}
|
|
61920
|
+
function removeFromOwningView(decisions, caseId) {
|
|
61921
|
+
for (const binding of decisions) {
|
|
61922
|
+
const view = viewFor(binding);
|
|
61923
|
+
const rows = view.read();
|
|
61924
|
+
if (rows.some((d2) => d2.id === caseId)) {
|
|
61925
|
+
view.write(rows.filter((d2) => d2.id !== caseId));
|
|
61652
61926
|
}
|
|
61653
|
-
}
|
|
61927
|
+
}
|
|
61928
|
+
}
|
|
61929
|
+
const decisionHandleCache = /* @__PURE__ */ new Map();
|
|
61930
|
+
function typeToken(tv) {
|
|
61931
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
61932
|
+
return JSON.stringify(tv, (_k, v3) => {
|
|
61933
|
+
if (typeof v3 === "object" && v3 !== null) {
|
|
61934
|
+
if (seen.has(v3)) return "<cyc>";
|
|
61935
|
+
seen.add(v3);
|
|
61936
|
+
}
|
|
61937
|
+
return typeof v3 === "bigint" ? `${v3}n` : v3;
|
|
61938
|
+
});
|
|
61939
|
+
}
|
|
61940
|
+
function compileDecisionMethods(constraintType, decisions, judgements, selectionKey) {
|
|
61941
|
+
const platform = getRegisteredPlatformImplementations();
|
|
61942
|
+
const c2 = fromEastTypeValue(constraintType);
|
|
61943
|
+
const decisionsExpr = East.value(decisions, ArrayType(DiffBindingType));
|
|
61944
|
+
const judgementsExpr = East.value(judgements, DiffBindingType);
|
|
61945
|
+
const selKeyExpr = East.value(selectionKey, StringType);
|
|
61946
|
+
const {
|
|
61947
|
+
queue,
|
|
61948
|
+
selected: selected2,
|
|
61949
|
+
select: select2,
|
|
61950
|
+
clearSelection,
|
|
61951
|
+
decision,
|
|
61952
|
+
update: update2,
|
|
61953
|
+
judgement,
|
|
61954
|
+
answer,
|
|
61955
|
+
addKnowledge,
|
|
61956
|
+
inject,
|
|
61957
|
+
resolve: resolve2,
|
|
61958
|
+
commitState
|
|
61959
|
+
} = DecisionBindPrimitives;
|
|
61960
|
+
return {
|
|
61961
|
+
queue: East.compile(East.function([], ArrayType(DecisionType), ($3) => {
|
|
61962
|
+
$3.return(queue(decisionsExpr));
|
|
61963
|
+
}), platform),
|
|
61964
|
+
selected: East.compile(East.function([], OptionType(StringType), ($3) => {
|
|
61965
|
+
$3.return(selected2(selKeyExpr));
|
|
61966
|
+
}), platform),
|
|
61967
|
+
select: East.compile(East.function([StringType], NullType, ($3, id3) => {
|
|
61968
|
+
$3.return(select2(selKeyExpr, id3));
|
|
61969
|
+
}), platform),
|
|
61970
|
+
clearSelection: East.compile(East.function([], NullType, ($3) => {
|
|
61971
|
+
$3.return(clearSelection(selKeyExpr));
|
|
61972
|
+
}), platform),
|
|
61973
|
+
decision: East.compile(East.function([], OptionType(DecisionType), ($3) => {
|
|
61974
|
+
$3.return(decision(decisionsExpr, selKeyExpr));
|
|
61975
|
+
}), platform),
|
|
61976
|
+
update: East.compile(East.function([DecisionType], NullType, ($3, edited) => {
|
|
61977
|
+
$3.return(update2(decisionsExpr, edited));
|
|
61978
|
+
}), platform),
|
|
61979
|
+
judgement: East.compile(East.function([StringType], judgementInputType(c2), ($3, id3) => {
|
|
61980
|
+
$3.return(judgement([c2], judgementsExpr, id3));
|
|
61981
|
+
}), platform),
|
|
61982
|
+
answer: East.compile(East.function([StringType, StringType, AnswerType], NullType, ($3, id3, prompt, ans) => {
|
|
61983
|
+
$3.return(answer(judgementsExpr, id3, prompt, ans));
|
|
61984
|
+
}), platform),
|
|
61985
|
+
addKnowledge: East.compile(East.function([StringType, StringType], NullType, ($3, id3, text) => {
|
|
61986
|
+
$3.return(addKnowledge(judgementsExpr, id3, text));
|
|
61987
|
+
}), platform),
|
|
61988
|
+
inject: East.compile(East.function([StringType, c2], NullType, ($3, id3, con) => {
|
|
61989
|
+
$3.return(inject([c2], judgementsExpr, id3, con));
|
|
61990
|
+
}), platform),
|
|
61991
|
+
resolve: East.compile(East.function([StringType, VerdictType], NullType, ($3, id3, verdict) => {
|
|
61992
|
+
$3.return(resolve2(decisionsExpr, judgementsExpr, selKeyExpr, id3, verdict));
|
|
61993
|
+
}), platform),
|
|
61994
|
+
commitState: East.compile(East.function([StringType], CommitStateType, ($3, id3) => {
|
|
61995
|
+
$3.return(commitState(decisionsExpr, judgementsExpr, id3));
|
|
61996
|
+
}), platform)
|
|
61997
|
+
};
|
|
61998
|
+
}
|
|
61999
|
+
function buildDecisionHandle(decisions, judgements, sliceInit, constraintType) {
|
|
62000
|
+
const cType = constraintType ?? toEastTypeValue(DecisionConstraintType);
|
|
62001
|
+
const selectionKey = deriveSelectionKey(decisions);
|
|
61654
62002
|
const slice3 = buildSliceHandle(
|
|
61655
62003
|
deriveSliceKey(decisions, sliceInit),
|
|
61656
62004
|
DECISION_SLICE_CONFIG,
|
|
61657
62005
|
sliceInit ?? DEFAULT_SLICE_STATE,
|
|
61658
|
-
() =>
|
|
62006
|
+
() => hostQueue(decisions),
|
|
61659
62007
|
none$1
|
|
61660
62008
|
);
|
|
62009
|
+
const journal = () => {
|
|
62010
|
+
const entries = [...readJudgementsAt(judgements).values()].filter((j2) => j2.verdict.type === "some");
|
|
62011
|
+
const at = (j2) => j2.resolvedAt.type === "some" ? j2.resolvedAt.value.getTime() : 0;
|
|
62012
|
+
return entries.sort((a2, b2) => at(b2) - at(a2));
|
|
62013
|
+
};
|
|
62014
|
+
const cacheKey = `${hashString2(stableStringify({ decisions, judgements }))}|${typeToken(cType)}`;
|
|
62015
|
+
let methods = decisionHandleCache.get(cacheKey);
|
|
62016
|
+
if (methods === void 0) {
|
|
62017
|
+
methods = compileDecisionMethods(cType, decisions, judgements, selectionKey);
|
|
62018
|
+
decisionHandleCache.set(cacheKey, methods);
|
|
62019
|
+
}
|
|
61661
62020
|
return {
|
|
61662
62021
|
decisions,
|
|
61663
62022
|
judgements,
|
|
61664
62023
|
sliceInit: sliceInit !== void 0 ? some(sliceInit) : none$1,
|
|
61665
62024
|
slice: slice3,
|
|
61666
|
-
|
|
61667
|
-
|
|
61668
|
-
select: (caseId) => writeSelection(some(caseId)),
|
|
61669
|
-
clearSelection: () => writeSelection(none$1),
|
|
61670
|
-
decision: () => {
|
|
61671
|
-
const selection2 = readSelection();
|
|
61672
|
-
if (selection2.type === "none") return none$1;
|
|
61673
|
-
const found = queue().find((d2) => d2.id === selection2.value);
|
|
61674
|
-
return found === void 0 ? none$1 : some(found);
|
|
61675
|
-
},
|
|
61676
|
-
update: (edited) => {
|
|
61677
|
-
for (const binding of decisions) {
|
|
61678
|
-
const view = viewFor(binding);
|
|
61679
|
-
const rows = view.read();
|
|
61680
|
-
if (rows.some((d2) => d2.id === edited.id)) {
|
|
61681
|
-
view.write(rows.map((d2) => d2.id === edited.id ? edited : d2));
|
|
61682
|
-
}
|
|
61683
|
-
}
|
|
61684
|
-
return null;
|
|
61685
|
-
},
|
|
61686
|
-
judgement: judgementFor,
|
|
61687
|
-
answer: (caseId, prompt, response) => {
|
|
61688
|
-
const answers = new Map(judgementFor(caseId).answers);
|
|
61689
|
-
answers.set(prompt, response);
|
|
61690
|
-
return stageJudgement(caseId, { answers });
|
|
61691
|
-
},
|
|
61692
|
-
addKnowledge: (caseId, text) => stageJudgement(caseId, { knowledge: some(text) }),
|
|
61693
|
-
inject: (caseId, constraint) => {
|
|
61694
|
-
const constraints = judgementFor(caseId).constraints.filter((c2) => c2.type !== constraint.type).concat([constraint]);
|
|
61695
|
-
return stageJudgement(caseId, { constraints });
|
|
61696
|
-
},
|
|
61697
|
-
resolve: (caseId, verdict) => {
|
|
61698
|
-
stageJudgement(caseId, { verdict: some(verdict), resolvedAt: some(/* @__PURE__ */ new Date()) });
|
|
61699
|
-
removeFromOwningView(caseId);
|
|
61700
|
-
writeSelection(none$1);
|
|
61701
|
-
return null;
|
|
61702
|
-
},
|
|
61703
|
-
journal: () => {
|
|
61704
|
-
const entries = [...readJudgements().values()].filter((j2) => j2.verdict.type === "some");
|
|
61705
|
-
const at = (j2) => j2.resolvedAt.type === "some" ? j2.resolvedAt.value.getTime() : 0;
|
|
61706
|
-
return entries.sort((a2, b2) => at(b2) - at(a2));
|
|
61707
|
-
},
|
|
61708
|
-
commitState: (caseId) => {
|
|
61709
|
-
const decision = queue().find((d2) => d2.id === caseId);
|
|
61710
|
-
const prompts = (decision == null ? void 0 : decision.prompts) ?? [];
|
|
61711
|
-
const answers = judgementFor(caseId).answers;
|
|
61712
|
-
const responses = prompts.map((p2) => {
|
|
61713
|
-
var _a2;
|
|
61714
|
-
return (_a2 = answers.get(p2.id)) == null ? void 0 : _a2.type;
|
|
61715
|
-
});
|
|
61716
|
-
if (responses.some((r2) => r2 === "no")) return variant("blocked", null);
|
|
61717
|
-
if (responses.some((r2) => r2 === "unknown")) return variant("handoff", null);
|
|
61718
|
-
const unanswered = responses.filter((r2) => r2 === void 0).length;
|
|
61719
|
-
if (unanswered > 0) return variant("gated", BigInt(unanswered));
|
|
61720
|
-
return variant("ready", null);
|
|
61721
|
-
}
|
|
62025
|
+
journal,
|
|
62026
|
+
...methods
|
|
61722
62027
|
};
|
|
61723
62028
|
}
|
|
61724
62029
|
const DecisionBindPlatform = [
|
|
61725
|
-
// Generic over the constraint contract — the
|
|
61726
|
-
//
|
|
61727
|
-
decisionBindPlatformFn.implement((
|
|
62030
|
+
// Generic over the constraint contract — the resolver receives the contract
|
|
62031
|
+
// type value and threads it into the IR-bearing judgement / inject methods.
|
|
62032
|
+
decisionBindPlatformFn.implement((constraintType) => (decisionsArg, judgementsArg, sliceInitArg) => buildDecisionHandle(
|
|
61728
62033
|
decisionsArg,
|
|
61729
62034
|
judgementsArg,
|
|
61730
|
-
getSomeorUndefined(sliceInitArg)
|
|
61731
|
-
|
|
62035
|
+
getSomeorUndefined$1(sliceInitArg),
|
|
62036
|
+
constraintType
|
|
62037
|
+
)),
|
|
62038
|
+
// ── issue #106 primitives — host I/O backing the IR-bearing handle methods.
|
|
62039
|
+
// Each is a faithful lift of the original closure body, taking the plain-data
|
|
62040
|
+
// descriptor(s) + the selection key as arguments. ──
|
|
62041
|
+
DecisionBindPrimitives.queue.implement((decisions) => hostQueue(decisions)),
|
|
62042
|
+
DecisionBindPrimitives.selected.implement((selectionKey) => readSelectionAt(selectionKey)),
|
|
62043
|
+
DecisionBindPrimitives.select.implement((selectionKey, caseId) => writeSelectionAt(selectionKey, some(caseId))),
|
|
62044
|
+
DecisionBindPrimitives.clearSelection.implement((selectionKey) => writeSelectionAt(selectionKey, none$1)),
|
|
62045
|
+
DecisionBindPrimitives.decision.implement((decisions, selectionKey) => {
|
|
62046
|
+
const sel = readSelectionAt(selectionKey);
|
|
62047
|
+
if (sel.type === "none") return none$1;
|
|
62048
|
+
const found = hostQueue(decisions).find((d2) => d2.id === sel.value);
|
|
62049
|
+
return found === void 0 ? none$1 : some(found);
|
|
62050
|
+
}),
|
|
62051
|
+
DecisionBindPrimitives.update.implement((decisions, edited) => {
|
|
62052
|
+
const e3 = edited;
|
|
62053
|
+
for (const binding of decisions) {
|
|
62054
|
+
const view = viewFor(binding);
|
|
62055
|
+
const rows = view.read();
|
|
62056
|
+
if (rows.some((d2) => d2.id === e3.id)) {
|
|
62057
|
+
view.write(rows.map((d2) => d2.id === e3.id ? e3 : d2));
|
|
62058
|
+
}
|
|
62059
|
+
}
|
|
62060
|
+
return null;
|
|
62061
|
+
}),
|
|
62062
|
+
DecisionBindPrimitives.judgement.implement((_c2) => (judgements, caseId) => judgementForAt(judgements, caseId)),
|
|
62063
|
+
DecisionBindPrimitives.answer.implement((judgements, caseId, prompt, response) => {
|
|
62064
|
+
const answers = new Map(judgementForAt(judgements, caseId).answers);
|
|
62065
|
+
answers.set(prompt, response);
|
|
62066
|
+
return stageJudgementAt(judgements, caseId, { answers });
|
|
62067
|
+
}),
|
|
62068
|
+
DecisionBindPrimitives.addKnowledge.implement((judgements, caseId, text) => stageJudgementAt(judgements, caseId, { knowledge: some(text) })),
|
|
62069
|
+
DecisionBindPrimitives.inject.implement((_c2) => (judgements, caseId, constraint) => {
|
|
62070
|
+
const con = constraint;
|
|
62071
|
+
const constraints = judgementForAt(judgements, caseId).constraints.filter((x2) => x2.type !== con.type).concat([con]);
|
|
62072
|
+
return stageJudgementAt(judgements, caseId, { constraints });
|
|
62073
|
+
}),
|
|
62074
|
+
DecisionBindPrimitives.resolve.implement((decisions, judgements, selectionKey, caseId, verdict) => {
|
|
62075
|
+
stageJudgementAt(judgements, caseId, { verdict: some(verdict), resolvedAt: some(/* @__PURE__ */ new Date()) });
|
|
62076
|
+
removeFromOwningView(decisions, caseId);
|
|
62077
|
+
writeSelectionAt(selectionKey, none$1);
|
|
62078
|
+
return null;
|
|
62079
|
+
}),
|
|
62080
|
+
DecisionBindPrimitives.commitState.implement((decisions, judgements, caseId) => {
|
|
62081
|
+
const cid = caseId;
|
|
62082
|
+
const decision = hostQueue(decisions).find((d2) => d2.id === cid);
|
|
62083
|
+
const prompts = (decision == null ? void 0 : decision.prompts) ?? [];
|
|
62084
|
+
const answers = judgementForAt(judgements, cid).answers;
|
|
62085
|
+
const responses = prompts.map((p2) => {
|
|
62086
|
+
var _a2;
|
|
62087
|
+
return (_a2 = answers.get(p2.id)) == null ? void 0 : _a2.type;
|
|
62088
|
+
});
|
|
62089
|
+
if (responses.some((r2) => r2 === "no")) return variant("blocked", null);
|
|
62090
|
+
if (responses.some((r2) => r2 === "unknown")) return variant("handoff", null);
|
|
62091
|
+
const unanswered = responses.filter((r2) => r2 === void 0).length;
|
|
62092
|
+
if (unanswered > 0) return variant("gated", BigInt(unanswered));
|
|
62093
|
+
return variant("ready", null);
|
|
62094
|
+
})
|
|
61732
62095
|
];
|
|
61733
|
-
registerPlatformImplementation
|
|
62096
|
+
registerPlatformImplementation(DecisionBindPlatform);
|
|
61734
62097
|
function useHandleVersion(handle) {
|
|
61735
62098
|
const staged = getStagedStore();
|
|
61736
62099
|
const cache3 = getReactiveDatasetCache();
|
|
@@ -61766,7 +62129,7 @@ function useDecisionHandle(ref) {
|
|
|
61766
62129
|
() => ref ? buildDecisionHandle(
|
|
61767
62130
|
[...ref.decisions],
|
|
61768
62131
|
ref.judgements,
|
|
61769
|
-
getSomeorUndefined(ref.slice)
|
|
62132
|
+
getSomeorUndefined$1(ref.slice)
|
|
61770
62133
|
) : null,
|
|
61771
62134
|
[ref]
|
|
61772
62135
|
);
|
|
@@ -62116,6 +62479,9 @@ const OptionsFacet = memo(function OptionsFacet2({ decision, narrow }) {
|
|
|
62116
62479
|
const options2 = rankOptions(decision);
|
|
62117
62480
|
const maxUp = Math.max(...options2.map((o2) => Math.max(o2.value, 0)), 1e-9);
|
|
62118
62481
|
const maxDown = Math.max(...options2.map((o2) => Math.abs(o2.downside ?? 0)), 1e-9);
|
|
62482
|
+
const valueAxis = getSomeorUndefined(decision.valueAxis);
|
|
62483
|
+
const upLabel = (valueAxis == null ? void 0 : valueAxis.label) ?? "Uplift";
|
|
62484
|
+
const signed2 = (valueAxis == null ? void 0 : valueAxis.signed) ?? true;
|
|
62119
62485
|
if (narrow) {
|
|
62120
62486
|
const meter = (label, frac, display, tone) => /* @__PURE__ */ jsxs(Box, { display: "grid", gridTemplateColumns: "80px 1fr 64px", alignItems: "center", gap: "8px", children: [
|
|
62121
62487
|
/* @__PURE__ */ jsx$1(Text, { ...caption, whiteSpace: "nowrap", children: label }),
|
|
@@ -62134,7 +62500,7 @@ const OptionsFacet = memo(function OptionsFacet2({ decision, narrow }) {
|
|
|
62134
62500
|
" ",
|
|
62135
62501
|
/* @__PURE__ */ jsx$1(Text, { as: "span", fontWeight: o2.recommended ? "semibold" : "normal", children: o2.label })
|
|
62136
62502
|
] }),
|
|
62137
|
-
meter(
|
|
62503
|
+
meter(upLabel, o2.value / maxUp, fmt(decision, o2.value, signed2), signed2 ? "success" : "neutral"),
|
|
62138
62504
|
meter("If wrong", (o2.downside ?? 0) / maxDown, o2.downside !== void 0 ? fmt(decision, o2.downside, true) : "—", "danger")
|
|
62139
62505
|
] }, o2.rank))
|
|
62140
62506
|
] });
|
|
@@ -62147,7 +62513,7 @@ const OptionsFacet = memo(function OptionsFacet2({ decision, narrow }) {
|
|
|
62147
62513
|
" evaluated"
|
|
62148
62514
|
] }),
|
|
62149
62515
|
/* @__PURE__ */ jsx$1(Text, { ...caption, textAlign: "center", children: "If wrong" }),
|
|
62150
|
-
/* @__PURE__ */ jsx$1(Text, { ...caption, textAlign: "right", children:
|
|
62516
|
+
/* @__PURE__ */ jsx$1(Text, { ...caption, textAlign: "right", children: upLabel })
|
|
62151
62517
|
] }),
|
|
62152
62518
|
options2.map((o2) => {
|
|
62153
62519
|
const downFrac = Math.min(Math.abs(o2.downside ?? 0) / maxDown, 1);
|
|
@@ -62172,8 +62538,8 @@ const OptionsFacet = memo(function OptionsFacet2({ decision, narrow }) {
|
|
|
62172
62538
|
/* @__PURE__ */ jsx$1(Box, { height: "12px", width: `${Math.round(downFrac * 100)}%`, bg: "fg.danger", opacity: 0.55 })
|
|
62173
62539
|
] }) }),
|
|
62174
62540
|
/* @__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: [
|
|
62175
|
-
/* @__PURE__ */ jsx$1(Box, { height: "12px", width: `${Math.round(upFrac * 100)}%`, bg: "fg.success", opacity: 0.6 }),
|
|
62176
|
-
/* @__PURE__ */ jsx$1(Text, { fontSize: "10.5px", fontFamily: "mono", color: "fg.success", flexShrink: 0, children: fmt(decision, o2.value,
|
|
62541
|
+
/* @__PURE__ */ jsx$1(Box, { height: "12px", width: `${Math.round(upFrac * 100)}%`, bg: signed2 ? "fg.success" : "fg.subtle", opacity: 0.6 }),
|
|
62542
|
+
/* @__PURE__ */ jsx$1(Text, { fontSize: "10.5px", fontFamily: "mono", color: signed2 ? "fg.success" : "fg.muted", flexShrink: 0, children: fmt(decision, o2.value, signed2) })
|
|
62177
62543
|
] }) })
|
|
62178
62544
|
]
|
|
62179
62545
|
},
|
|
@@ -62358,7 +62724,8 @@ function useLeverPayloads(ref) {
|
|
|
62358
62724
|
return (constraint == null ? void 0 : constraint.type) === "Variant" ? constraint.cases ?? {} : {};
|
|
62359
62725
|
}, [ref, workspace]);
|
|
62360
62726
|
}
|
|
62361
|
-
const Row = memo(function Row2({ decision, handle, selected: selected2, narrow, leverPayloads, modify,
|
|
62727
|
+
const Row = memo(function Row2({ decision, handle, selected: selected2, narrow, leverPayloads, modify, evidence, defaultFacet, facetInclude, apply: apply2, reject: reject2, leaving, storageKey }) {
|
|
62728
|
+
var _a2, _b2;
|
|
62362
62729
|
const dq = useSlotRecipe({ key: "decisionQueue" });
|
|
62363
62730
|
const status = useSlotRecipe({ key: "status" });
|
|
62364
62731
|
const tabs = useSlotRecipe({ key: "facetTabs" });
|
|
@@ -62366,10 +62733,15 @@ const Row = memo(function Row2({ decision, handle, selected: selected2, narrow,
|
|
|
62366
62733
|
const rs = dq({});
|
|
62367
62734
|
const ts = tabs({});
|
|
62368
62735
|
const st = status({ status: URGENCY_TONE[decision.urgency.type], size: "md" });
|
|
62369
|
-
const
|
|
62736
|
+
const visibleFacets = useMemo(
|
|
62737
|
+
() => FACETS.filter((f2) => f2.key === "modify" ? modify !== void 0 : facetInclude === null || facetInclude.has(f2.key)),
|
|
62738
|
+
[modify, facetInclude]
|
|
62739
|
+
);
|
|
62740
|
+
const effectiveDefault = visibleFacets.some((f2) => f2.key === defaultFacet) ? defaultFacet : ((_a2 = visibleFacets[0]) == null ? void 0 : _a2.key) ?? defaultFacet;
|
|
62741
|
+
const [facet, setFacet] = useState(effectiveDefault);
|
|
62370
62742
|
useEffect(() => {
|
|
62371
|
-
if (!selected2) setFacet(
|
|
62372
|
-
}, [selected2,
|
|
62743
|
+
if (!selected2) setFacet(effectiveDefault);
|
|
62744
|
+
}, [selected2, effectiveDefault]);
|
|
62373
62745
|
const gate = handle.commitStateFor(decision.id);
|
|
62374
62746
|
const applyEnabled = gate === null || gate.type === "ready";
|
|
62375
62747
|
const gatePulse = !applyEnabled && decision.prompts.length > 0;
|
|
@@ -62388,10 +62760,10 @@ const Row = memo(function Row2({ decision, handle, selected: selected2, narrow,
|
|
|
62388
62760
|
return modify(decision, handle.update);
|
|
62389
62761
|
}, [selected2, facet, modify, decision, handle.update]);
|
|
62390
62762
|
const canvas = useMemo(() => {
|
|
62391
|
-
if (!selected2 || facet !== "evidence" || !
|
|
62392
|
-
return
|
|
62393
|
-
}, [selected2, facet,
|
|
62394
|
-
const facetTabs = /* @__PURE__ */ jsx$1(Box, { css: ts.root, ...narrow ? { display: "flex", width: "100%" } : {}, children:
|
|
62763
|
+
if (!selected2 || facet !== "evidence" || !evidence) return null;
|
|
62764
|
+
return evidence(decision);
|
|
62765
|
+
}, [selected2, facet, evidence, decision]);
|
|
62766
|
+
const facetTabs = /* @__PURE__ */ jsx$1(Box, { css: ts.root, ...narrow ? { display: "flex", width: "100%" } : {}, children: visibleFacets.map((f2) => /* @__PURE__ */ jsx$1(
|
|
62395
62767
|
Box,
|
|
62396
62768
|
{
|
|
62397
62769
|
as: "button",
|
|
@@ -62437,7 +62809,8 @@ const Row = memo(function Row2({ decision, handle, selected: selected2, narrow,
|
|
|
62437
62809
|
deadlineSuffix(decision)
|
|
62438
62810
|
] })
|
|
62439
62811
|
] });
|
|
62440
|
-
const
|
|
62812
|
+
const valueSigned = ((_b2 = getSomeorUndefined(decision.valueAxis)) == null ? void 0 : _b2.signed) ?? true;
|
|
62813
|
+
const valueText = /* @__PURE__ */ jsx$1(Text, { fontFamily: "mono", fontWeight: "semibold", textAlign: "right", ...valueSigned && decision.value >= 0 && selected2 ? { color: "fg.success" } : {}, children: decisionValue(decision, decision.value, valueSigned && selected2) });
|
|
62441
62814
|
return /* @__PURE__ */ jsxs(Box, { css: rs.rowShell, ...leaving ? { "data-leaving": leaving } : {}, children: [
|
|
62442
62815
|
narrow ? /* @__PURE__ */ jsxs(Box, { px: "14px", py: "10px", children: [
|
|
62443
62816
|
/* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "baseline", children: [
|
|
@@ -62459,7 +62832,7 @@ const Row = memo(function Row2({ decision, handle, selected: selected2, narrow,
|
|
|
62459
62832
|
] })
|
|
62460
62833
|
] }),
|
|
62461
62834
|
selected2 && /* @__PURE__ */ jsxs(Box, { px: narrow ? "14px" : "18px", py: "12px", borderTopWidth: "1px", borderColor: "border.subtle", bg: "bg.canvas", children: [
|
|
62462
|
-
facet === "evidence" && /* @__PURE__ */ jsx$1(EvidenceFacet, { decision, children: canvas != null && /* @__PURE__ */ jsx$1(EastChakraComponent, { value: canvas, storageKey: `${storageKey}-
|
|
62835
|
+
facet === "evidence" && /* @__PURE__ */ jsx$1(EvidenceFacet, { decision, children: canvas != null && /* @__PURE__ */ jsx$1(EastChakraComponent, { value: canvas, storageKey: `${storageKey}-evidence-${decision.id}` }) }),
|
|
62463
62836
|
facet === "options" && /* @__PURE__ */ jsx$1(OptionsFacet, { decision, narrow }),
|
|
62464
62837
|
facet === "judgement" && /* @__PURE__ */ jsx$1(JudgementFacet, { decision, handle, leverPayloads }),
|
|
62465
62838
|
facet === "modify" && probe != null && /* @__PURE__ */ jsx$1(EastChakraComponent, { value: probe, storageKey: `${storageKey}-modify-${decision.id}` })
|
|
@@ -62567,11 +62940,15 @@ const EastChakraDecisionQueue = memo(function EastChakraDecisionQueue2({ value,
|
|
|
62567
62940
|
() => getSomeorUndefined(value.modify),
|
|
62568
62941
|
[value.modify]
|
|
62569
62942
|
);
|
|
62570
|
-
const
|
|
62571
|
-
() => getSomeorUndefined(value.
|
|
62572
|
-
[value.
|
|
62943
|
+
const evidence = useMemo(
|
|
62944
|
+
() => getSomeorUndefined(value.evidence),
|
|
62945
|
+
[value.evidence]
|
|
62573
62946
|
);
|
|
62574
62947
|
const defaultFacet = ((_a2 = getSomeorUndefined(value.defaultFacet)) == null ? void 0 : _a2.type) ?? "evidence";
|
|
62948
|
+
const facetInclude = useMemo(() => {
|
|
62949
|
+
const facets = getSomeorUndefined(value.facets);
|
|
62950
|
+
return facets === void 0 ? null : new Set(facets.map((f2) => f2.type));
|
|
62951
|
+
}, [value.facets]);
|
|
62575
62952
|
const defaultExpanded = getSomeorUndefined(value.defaultExpanded);
|
|
62576
62953
|
const selectedId = handle.selected ?? (defaultExpanded == null ? void 0 : defaultExpanded.id) ?? null;
|
|
62577
62954
|
const resolve2 = useCallback((ds, hook2, reason) => {
|
|
@@ -62658,8 +63035,9 @@ const EastChakraDecisionQueue = memo(function EastChakraDecisionQueue2({ value,
|
|
|
62658
63035
|
narrow,
|
|
62659
63036
|
leverPayloads,
|
|
62660
63037
|
modify,
|
|
62661
|
-
|
|
63038
|
+
evidence,
|
|
62662
63039
|
defaultFacet,
|
|
63040
|
+
facetInclude,
|
|
62663
63041
|
apply: apply2,
|
|
62664
63042
|
reject: reject2,
|
|
62665
63043
|
leaving: exitingReasons.get(d2.id),
|