@melite/estate-call 0.1.4-alpha → 0.1.5-pre-alpha

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 ADDED
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: The one lane-call contract and card-tool builder — transport, flow-envelope output schema, and the executor test battery shared by every card tool.
3
+ kind: package-library
4
+ ---
5
+
6
+ # @melite/estate-call
7
+
8
+ `@melite/estate-call` is the SSOT for card-tool mechanics: the lane-call
9
+ contract (JSON in/out, cancellation, named refusals), the flow-envelope
10
+ output schema, and the executor test battery. It calls no engine — the
11
+ tools plane hands each card a transport built from the ctx seats,
12
+ in-process, no HTTP and no gateway. Card packages and
13
+ `@melite/harness-tools` compose it; its six-per-card predecessor copies are
14
+ the degeneration this package absorbed.
15
+
16
+ ## Contract
17
+
18
+ - `.` — `EstateCall` (the structural transport), `GatewayError` (status +
19
+ body + named `error` field), `jsonLane` (adapts the raw call to the
20
+ JSON-record contract; a pre-aborted call never dials).
21
+ - `./cardTool` — `defineCardTool(call, spec)`: owns the `CARD_TOOL_OUTPUT`
22
+ envelope (flow, model, run_id, draft_id, status, error), declared
23
+ JSON-array param normalization, the two-door execute (drafts, then start
24
+ with the `{model:}` lift), refusal mapping, and the presentation
25
+ projections. The card still owns its tool-plane name, flow id, identity
26
+ prose, emitted params spec, and default model.
27
+ - `./executorHarness` — `executorHarness` + `registerExecutorBattery`: the
28
+ recording seam, envelope arms, tile truth table, and presenter cores the
29
+ per-card specs restate.
30
+ - `./package.json`.
31
+
32
+ ## Model Experience
33
+
34
+ ### Request context and condition
35
+
36
+ #### What the model sees
37
+
38
+ The card tool's face — identity prose and emitted params spec — rides the
39
+ host toolset schemas, and the returned flow envelope is the tool result;
40
+ both are model-visible and logged by the session.
41
+
42
+ #### Token effect
43
+
44
+ Conditional — scales with the params spec and the envelope the run returns.
45
+
46
+ #### KV Cache effect
47
+
48
+ Append-only — each card-tool call and its result append to the session
49
+ transcript.
50
+
51
+ ## Known Limitations and Deferred Work
52
+
53
+ - **One flow per call** — the builder starts exactly one run and returns
54
+ its envelope; polling the run is the caller's job (run_status).
55
+ - **Refusals are field-named, not typed** — `GatewayError` carries the
56
+ door's refusal word in a named field; there is no closed refusal union at
57
+ this seam.
package/lib/cardTool.d.ts CHANGED
@@ -59,9 +59,9 @@ export interface CardToolSpec {
59
59
  /** Resolve a served model value to the estate's admission
60
60
  * spelling before it crosses the wire. Cards serving the
61
61
  * semantic style enum close over their own entries (the fold
62
- * at comfyui-cordis/semanticModelKnob.ts — one spelling); cards
63
- * serving bare family ids leave it unstated and the value
64
- * crosses verbatim. */
62
+ * at comfyui-card-kit/src/semanticModelKnob.ts — one
63
+ * spelling); cards serving bare family ids leave it unstated
64
+ * and the value crosses verbatim. */
65
65
  resolveModel?: (value: string) => string;
66
66
  previewField?: string;
67
67
  previewValue?: (a: Record<string, unknown>) => string;
package/lib/cardTool.js CHANGED
@@ -67,6 +67,15 @@ export function defineCardTool(call, spec) {
67
67
  const gw = jsonLane(call);
68
68
  const { name: TOOL_NAME, flow: FLOW, label, description, defaultModel: DEFAULT_MODEL, previewField, previewValue, timeoutMs } = spec;
69
69
  const previewPart = previewValue ?? ((a) => `${previewField}=${String(a[previewField] ?? '').slice(0, 60)}`);
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ const resolveModelArg = (a) => typeof a.model === 'string' && a.model !== '' ? a.model : DEFAULT_MODEL;
70
79
  return defineTool({
71
80
  name: TOOL_NAME,
72
81
  description,
@@ -80,7 +89,7 @@ export function defineCardTool(call, spec) {
80
89
  card: 'generic',
81
90
  title: label,
82
91
  kind: 'execute',
83
- rawInput: `model=${String(a.model ?? DEFAULT_MODEL)} ${previewPart(a)}`,
92
+ rawInput: `model=${resolveModelArg(a)} ${previewPart(a)}`,
84
93
  };
85
94
  },
86
95
  output: {
@@ -138,7 +147,7 @@ export function defineCardTool(call, spec) {
138
147
  // spec.resolveModel first: the estate's admission spelling
139
148
  // (a route atom) crosses the wire, while the envelope and
140
149
  // preview keep the picked style value.
141
- const rawModel = typeof a.model === 'string' && a.model !== '' ? a.model : DEFAULT_MODEL;
150
+ const rawModel = resolveModelArg(a);
142
151
  const model = spec.resolveModel !== undefined ? spec.resolveModel(rawModel) : rawModel;
143
152
  const params = {};
144
153
  for (const [k, v] of Object.entries(a))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melite/estate-call",
3
- "version": "0.1.4-alpha",
3
+ "version": "0.1.5-pre-alpha",
4
4
  "license": "SSPL-1.0",
5
5
  "type": "module",
6
6
  "exports": {