@noetic-tools/core 5.19.1-next.1 → 5.20.0-next.1
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/adapters/openrouter.js +5 -0
- package/dist/builders/control-flow-builders.d.ts +15 -6
- package/dist/builders/control-flow-builders.js +8 -0
- package/dist/builders/decide-builders.d.ts +2 -5
- package/dist/builders/dynamic-workflow.d.ts +16 -1
- package/dist/builders/dynamic-workflow.js +222 -11
- package/dist/builders/every.d.ts +3 -3
- package/dist/builders/every.js +2 -1
- package/dist/builders/provide-builder.d.ts +3 -2
- package/dist/builders/provide-builder.js +2 -1
- package/dist/builders/sequence.d.ts +14 -0
- package/dist/builders/sequence.js +103 -0
- package/dist/builders/spawn-builder.d.ts +3 -2
- package/dist/builders/spawn-builder.js +3 -2
- package/dist/builders/step-builders.d.ts +80 -1
- package/dist/builders/step-builders.js +115 -1
- package/dist/builders/verify-builder.d.ts +79 -0
- package/dist/builders/verify-builder.js +69 -0
- package/dist/builders/workflow-child-nodes.d.ts +21 -0
- package/dist/builders/workflow-child-nodes.js +335 -0
- package/dist/builders/workflow-connection-nodes.d.ts +17 -0
- package/dist/builders/workflow-connection-nodes.js +160 -0
- package/dist/builders/workflow-connections.d.ts +90 -0
- package/dist/builders/workflow-connections.js +560 -0
- package/dist/builders/workflow-control-nodes.d.ts +13 -0
- package/dist/builders/workflow-control-nodes.js +213 -0
- package/dist/builders/workflow-hydrator.d.ts +44 -3
- package/dist/builders/workflow-hydrator.js +53 -495
- package/dist/builders/workflow-verify.d.ts +19 -0
- package/dist/builders/workflow-verify.js +194 -0
- package/dist/conditions/conditions.d.ts +7 -5
- package/dist/conditions/conditions.js +7 -4
- package/dist/connections/blobs.d.ts +33 -0
- package/dist/connections/blobs.js +77 -0
- package/dist/connections/cron-schedule.d.ts +32 -0
- package/dist/connections/cron-schedule.js +213 -0
- package/dist/connections/durability.d.ts +65 -0
- package/dist/connections/durability.js +54 -0
- package/dist/connections/errors.d.ts +30 -0
- package/dist/connections/errors.js +100 -0
- package/dist/connections/event-stream.d.ts +24 -0
- package/dist/connections/event-stream.js +176 -0
- package/dist/connections/gates.d.ts +94 -0
- package/dist/connections/gates.js +271 -0
- package/dist/connections/glob.d.ts +10 -0
- package/dist/connections/glob.js +46 -0
- package/dist/connections/handle.d.ts +22 -0
- package/dist/connections/handle.js +84 -0
- package/dist/connections/harness-wiring.d.ts +52 -0
- package/dist/connections/harness-wiring.js +143 -0
- package/dist/connections/in-memory-connection.d.ts +147 -0
- package/dist/connections/in-memory-connection.js +593 -0
- package/dist/connections/index.d.ts +34 -0
- package/dist/connections/index.js +23 -0
- package/dist/connections/json-schema.d.ts +28 -0
- package/dist/connections/json-schema.js +338 -0
- package/dist/connections/model-tools.d.ts +46 -0
- package/dist/connections/model-tools.js +466 -0
- package/dist/connections/negotiation.d.ts +30 -0
- package/dist/connections/negotiation.js +159 -0
- package/dist/connections/policy.d.ts +21 -0
- package/dist/connections/policy.js +34 -0
- package/dist/connections/pool.d.ts +111 -0
- package/dist/connections/pool.js +339 -0
- package/dist/connections/refs.d.ts +74 -0
- package/dist/connections/refs.js +316 -0
- package/dist/connections/registry-types.d.ts +141 -0
- package/dist/connections/registry-types.js +14 -0
- package/dist/connections/registry.d.ts +125 -0
- package/dist/connections/registry.js +775 -0
- package/dist/connections/secrets.d.ts +59 -0
- package/dist/connections/secrets.js +153 -0
- package/dist/connections/settle.d.ts +9 -0
- package/dist/connections/settle.js +26 -0
- package/dist/connections/sources.d.ts +27 -0
- package/dist/connections/sources.js +300 -0
- package/dist/connections/triggers.d.ts +78 -0
- package/dist/connections/triggers.js +310 -0
- package/dist/connections/values.d.ts +26 -0
- package/dist/connections/values.js +93 -0
- package/dist/connections/views.d.ts +31 -0
- package/dist/connections/views.js +176 -0
- package/dist/expression/check.js +80 -1
- package/dist/expression/jsonata.d.ts +14 -4
- package/dist/expression/jsonata.js +27 -9
- package/dist/expression/step-outputs.d.ts +25 -0
- package/dist/expression/step-outputs.js +78 -0
- package/dist/harness/agent-harness.d.ts +69 -166
- package/dist/harness/agent-harness.js +170 -262
- package/dist/harness/call-span-collector.d.ts +33 -0
- package/dist/harness/call-span-collector.js +83 -0
- package/dist/harness/call-spend.d.ts +2 -0
- package/dist/harness/call-spend.js +10 -14
- package/dist/harness/connection-gate.d.ts +78 -0
- package/dist/harness/connection-gate.js +169 -0
- package/dist/harness/deps/interpreter.d.ts +1 -0
- package/dist/harness/deps/interpreter.js +1 -0
- package/dist/harness/deps/runtime.d.ts +1 -1
- package/dist/harness/deps/types.d.ts +1 -1
- package/dist/harness/harness-options.d.ts +153 -0
- package/dist/harness/harness-options.js +36 -0
- package/dist/harness/harness-tracing.d.ts +16 -0
- package/dist/harness/harness-tracing.js +35 -0
- package/dist/harness/llm-client.d.ts +71 -0
- package/dist/harness/llm-client.js +218 -0
- package/dist/harness/model-call.d.ts +2 -7
- package/dist/harness/model-call.js +141 -558
- package/dist/harness/model-request.d.ts +42 -0
- package/dist/harness/model-request.js +159 -0
- package/dist/harness/model-rounds.d.ts +18 -2
- package/dist/harness/model-rounds.js +39 -8
- package/dist/harness/model-stream.d.ts +39 -0
- package/dist/harness/model-stream.js +131 -0
- package/dist/harness/model-tool-round.d.ts +37 -0
- package/dist/harness/model-tool-round.js +197 -0
- package/dist/harness/spend.d.ts +2 -0
- package/dist/harness/spend.js +5 -1
- package/dist/index.d.ts +31 -6
- package/dist/index.js +18 -1
- package/dist/interpreter/connection-steps.d.ts +194 -0
- package/dist/interpreter/connection-steps.js +537 -0
- package/dist/interpreter/execute-action.d.ts +2 -8
- package/dist/interpreter/execute-action.js +3 -178
- package/dist/interpreter/execute-call.d.ts +19 -0
- package/dist/interpreter/execute-call.js +99 -0
- package/dist/interpreter/execute-control.d.ts +6 -1
- package/dist/interpreter/execute-control.js +14 -0
- package/dist/interpreter/execute-invoke-tool.d.ts +11 -0
- package/dist/interpreter/execute-invoke-tool.js +183 -0
- package/dist/interpreter/execute-verify.d.ts +21 -0
- package/dist/interpreter/execute-verify.js +391 -0
- package/dist/interpreter/execute-wait.d.ts +21 -0
- package/dist/interpreter/execute-wait.js +233 -0
- package/dist/interpreter/execute.js +24 -133
- package/dist/interpreter/step-kind-dispatch.d.ts +24 -0
- package/dist/interpreter/step-kind-dispatch.js +157 -0
- package/dist/interpreter/step-walk.d.ts +2 -0
- package/dist/interpreter/step-walk.js +24 -0
- package/dist/interpreter/verify-host.d.ts +40 -0
- package/dist/interpreter/verify-host.js +245 -0
- package/dist/runtime/durable/step-ledger.d.ts +34 -2
- package/dist/runtime/durable/step-ledger.js +97 -3
- package/dist/runtime/in-memory-artifact-store.d.ts +24 -0
- package/dist/runtime/in-memory-artifact-store.js +240 -0
- package/dist/schemas/workflow.d.ts +2 -2
- package/dist/schemas/workflow.js +1 -1
- package/dist/util/harness-internals.d.ts +23 -0
- package/dist/util/harness-internals.js +35 -0
- package/package.json +2 -2
- package/schema/noetic-workflow.schema.json +1170 -92
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default artifact store (spec 08 § Artifact Store): content-addressed
|
|
3
|
+
* bytes in memory, linked to runs, with per-run retention. Used when
|
|
4
|
+
* `environment.artifacts` is unset.
|
|
5
|
+
*
|
|
6
|
+
* - Identical content is stored once (`artifact://sha256/<hex>`).
|
|
7
|
+
* - When a run exceeds a cap, its oldest unpinned blobs are dropped and the
|
|
8
|
+
* drop is recorded on the run's manifest (`state: 'dropped'`). When pinned
|
|
9
|
+
* blobs alone exceed a cap, new blobs are still stored and marked `overCap`.
|
|
10
|
+
* - `clearRun` removes one run's links; content no run links to is removed.
|
|
11
|
+
*/
|
|
12
|
+
import { artifactUri, DEFAULT_ARTIFACT_MAX_BYTES_PER_RUN, DEFAULT_ARTIFACT_MAX_COUNT_PER_RUN, } from '@noetic-tools/types';
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region Helpers
|
|
15
|
+
async function readAll(content) {
|
|
16
|
+
if (content instanceof Uint8Array) {
|
|
17
|
+
return content;
|
|
18
|
+
}
|
|
19
|
+
const chunks = [];
|
|
20
|
+
let total = 0;
|
|
21
|
+
const reader = content.getReader();
|
|
22
|
+
for (;;) {
|
|
23
|
+
const { done, value } = await reader.read();
|
|
24
|
+
if (done) {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
chunks.push(value);
|
|
28
|
+
total += value.byteLength;
|
|
29
|
+
}
|
|
30
|
+
const joined = new Uint8Array(total);
|
|
31
|
+
let offset = 0;
|
|
32
|
+
for (const chunk of chunks) {
|
|
33
|
+
joined.set(chunk, offset);
|
|
34
|
+
offset += chunk.byteLength;
|
|
35
|
+
}
|
|
36
|
+
return joined;
|
|
37
|
+
}
|
|
38
|
+
async function sha256Hex(bytes) {
|
|
39
|
+
const copy = new Uint8Array(bytes.byteLength);
|
|
40
|
+
copy.set(bytes);
|
|
41
|
+
const digest = new Uint8Array(await crypto.subtle.digest('SHA-256', copy));
|
|
42
|
+
return [
|
|
43
|
+
...digest,
|
|
44
|
+
]
|
|
45
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
46
|
+
.join('');
|
|
47
|
+
}
|
|
48
|
+
function streamOf(bytes) {
|
|
49
|
+
return new ReadableStream({
|
|
50
|
+
start(controller) {
|
|
51
|
+
controller.enqueue(bytes.slice());
|
|
52
|
+
controller.close();
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function resolveRetention(retention) {
|
|
57
|
+
return {
|
|
58
|
+
maxBytesPerRun: retention?.maxBytesPerRun ?? DEFAULT_ARTIFACT_MAX_BYTES_PER_RUN,
|
|
59
|
+
maxCountPerRun: retention?.maxCountPerRun ?? DEFAULT_ARTIFACT_MAX_COUNT_PER_RUN,
|
|
60
|
+
ttlMs: retention?.ttlMs,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function stored(records) {
|
|
64
|
+
return records.filter((r) => r.record.state === 'stored');
|
|
65
|
+
}
|
|
66
|
+
function overLimits(records, retention) {
|
|
67
|
+
const live = stored(records);
|
|
68
|
+
const bytes = live.reduce((sum, r) => sum + r.record.bytes, 0);
|
|
69
|
+
return live.length > retention.maxCountPerRun || bytes > retention.maxBytesPerRun;
|
|
70
|
+
}
|
|
71
|
+
function markDropped(entry) {
|
|
72
|
+
entry.record = {
|
|
73
|
+
...entry.record,
|
|
74
|
+
state: 'dropped',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function findStored(records, uri) {
|
|
78
|
+
return records.find((r) => r.record.uri === uri && r.record.state === 'stored');
|
|
79
|
+
}
|
|
80
|
+
function isLinked(state, uri) {
|
|
81
|
+
for (const records of state.runs.values()) {
|
|
82
|
+
if (findStored(records, uri)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
function dropIfOrphaned(state, uri) {
|
|
89
|
+
if (!isLinked(state, uri)) {
|
|
90
|
+
state.contents.delete(uri);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function expire(state, records) {
|
|
94
|
+
const ttl = state.retention.ttlMs;
|
|
95
|
+
if (ttl === undefined) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
for (const entry of stored(records)) {
|
|
99
|
+
if (!entry.record.pinned && state.now() - entry.record.attachedAt > ttl) {
|
|
100
|
+
markDropped(entry);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/** Applies retention; returns whether pinned blobs alone keep the run over a cap. */
|
|
105
|
+
function enforce(state, records) {
|
|
106
|
+
expire(state, records);
|
|
107
|
+
while (overLimits(records, state.retention)) {
|
|
108
|
+
const oldest = stored(records).find((r) => !r.record.pinned);
|
|
109
|
+
if (!oldest) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
markDropped(oldest);
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
async function putContent(state, content, meta) {
|
|
117
|
+
const bytes = await readAll(content);
|
|
118
|
+
const sha256 = await sha256Hex(bytes);
|
|
119
|
+
const uri = artifactUri(sha256);
|
|
120
|
+
const existing = state.contents.get(uri);
|
|
121
|
+
const body = existing?.body ?? {
|
|
122
|
+
uri,
|
|
123
|
+
mimeType: meta.mimeType,
|
|
124
|
+
bytes: bytes.byteLength,
|
|
125
|
+
sha256,
|
|
126
|
+
};
|
|
127
|
+
if (!existing) {
|
|
128
|
+
state.contents.set(uri, {
|
|
129
|
+
bytes,
|
|
130
|
+
body,
|
|
131
|
+
meta,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
$blob: body,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function headContent(content) {
|
|
139
|
+
if (!content) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
return content.meta.sensitive
|
|
143
|
+
? {
|
|
144
|
+
...content.body,
|
|
145
|
+
sensitive: true,
|
|
146
|
+
}
|
|
147
|
+
: content.body;
|
|
148
|
+
}
|
|
149
|
+
function newRecord(state, content, link) {
|
|
150
|
+
return {
|
|
151
|
+
record: {
|
|
152
|
+
...content.body,
|
|
153
|
+
executionId: link.executionId,
|
|
154
|
+
stepPath: link.stepPath,
|
|
155
|
+
source: link.source,
|
|
156
|
+
name: content.meta.name,
|
|
157
|
+
sensitive: content.meta.sensitive,
|
|
158
|
+
pinned: link.pinned ?? false,
|
|
159
|
+
attachedAt: state.now(),
|
|
160
|
+
state: 'stored',
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function pinIfAsked(entry, link) {
|
|
165
|
+
if (link.pinned && !entry.record.pinned) {
|
|
166
|
+
entry.record = {
|
|
167
|
+
...entry.record,
|
|
168
|
+
pinned: true,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function runRecords(state, executionId) {
|
|
173
|
+
const records = state.runs.get(executionId) ?? [];
|
|
174
|
+
state.runs.set(executionId, records);
|
|
175
|
+
return records;
|
|
176
|
+
}
|
|
177
|
+
function attachContent(state, uri, link) {
|
|
178
|
+
const content = state.contents.get(uri);
|
|
179
|
+
if (!content) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const records = runRecords(state, link.executionId);
|
|
183
|
+
const already = findStored(records, uri);
|
|
184
|
+
if (already) {
|
|
185
|
+
pinIfAsked(already, link);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const entry = newRecord(state, content, link);
|
|
189
|
+
records.push(entry);
|
|
190
|
+
const overCap = enforce(state, records);
|
|
191
|
+
if (overCap && entry.record.state === 'stored') {
|
|
192
|
+
entry.record = {
|
|
193
|
+
...entry.record,
|
|
194
|
+
overCap: true,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
for (const record of records) {
|
|
198
|
+
if (record.record.state === 'dropped') {
|
|
199
|
+
dropIfOrphaned(state, record.record.uri);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function clearRunRecords(state, executionId) {
|
|
204
|
+
const records = state.runs.get(executionId) ?? [];
|
|
205
|
+
state.runs.delete(executionId);
|
|
206
|
+
for (const entry of records) {
|
|
207
|
+
dropIfOrphaned(state, entry.record.uri);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region Public API
|
|
212
|
+
/**
|
|
213
|
+
* @public
|
|
214
|
+
* An `ArtifactStore` that keeps content in memory. The harness uses one when
|
|
215
|
+
* `environment.artifacts` is unset.
|
|
216
|
+
*/
|
|
217
|
+
export function createInMemoryArtifactStore(options = {}) {
|
|
218
|
+
const state = {
|
|
219
|
+
retention: resolveRetention(options.retention),
|
|
220
|
+
now: options.now ?? Date.now,
|
|
221
|
+
contents: new Map(),
|
|
222
|
+
runs: new Map(),
|
|
223
|
+
};
|
|
224
|
+
return {
|
|
225
|
+
put: (content, meta) => putContent(state, content, meta),
|
|
226
|
+
async get(uri) {
|
|
227
|
+
const content = state.contents.get(uri);
|
|
228
|
+
return content ? streamOf(content.bytes) : null;
|
|
229
|
+
},
|
|
230
|
+
head: async (uri) => headContent(state.contents.get(uri)),
|
|
231
|
+
attach: async (uri, link) => attachContent(state, uri, link),
|
|
232
|
+
async listRun(executionId) {
|
|
233
|
+
const records = state.runs.get(executionId) ?? [];
|
|
234
|
+
expire(state, records);
|
|
235
|
+
return records.map((r) => r.record);
|
|
236
|
+
},
|
|
237
|
+
clearRun: async (executionId) => clearRunRecords(state, executionId),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* consumers can validate workflow documents without importing core.
|
|
4
4
|
* This barrel keeps core's public and intra-core import paths unchanged.
|
|
5
5
|
*/
|
|
6
|
-
export type { AcpAgentWorkflowNode, CallModelWorkflowNode, ComputeWorkflowNode, ConditionalRoute, ConditionalWorkflowNode, DecideWorkflowNode, InParallelWorkflowNode, InvokeToolWorkflowNode, LoopWorkflowNode, OutputCodecRef, RouteSwitchWorkflowNode, RunCodeWorkflowNode, ScheduleWorkflowNode, SequenceWorkflowNode, SpawnWorkflowNode, SubflowWorkflowNode, UntilPredicate, WithContextWorkflowNode, WorkflowCustomItem, WorkflowDocument, WorkflowEmitItems, WorkflowGraph, WorkflowNode, WorkflowReplayKey, } from '@noetic-tools/types';
|
|
7
|
-
export { MergeStrategy, MergeStrategySchema, UntilPredicateSchema, validateWorkflow, WorkflowDocumentSchema, WorkflowNodeSchema, walkWorkflow, workflowDepth, workflowGraph, } from '@noetic-tools/types';
|
|
6
|
+
export type { AcpAgentWorkflowNode, CallModelWorkflowNode, CallWorkflowNode, ComputeWorkflowNode, ConditionalRoute, ConditionalWorkflowNode, DecideWorkflowNode, InParallelWorkflowNode, InvokeToolWorkflowNode, LoopWorkflowNode, OutputCodecRef, RouteSwitchWorkflowNode, RunCodeWorkflowNode, ScheduleWorkflowNode, SequenceWorkflowNode, SpawnWorkflowNode, SubflowWorkflowNode, UntilPredicate, VerifyWorkflowNode, WaitWorkflowNode, WithContextWorkflowNode, WorkflowArgs, WorkflowConnectionRef, WorkflowConnectionRequirement, WorkflowCustomItem, WorkflowDocument, WorkflowEmitItems, WorkflowExprValue, WorkflowGraph, WorkflowLiteralValue, WorkflowNode, WorkflowOpShorthand, WorkflowReplayKey, WorkflowSecretValue, WorkflowStepEntry, WorkflowStepList, WorkflowValue, WorkflowVerifyClose, WorkflowVerifyMatcher, } from '@noetic-tools/types';
|
|
7
|
+
export { isWorkflowOpShorthand, MergeStrategy, MergeStrategySchema, shorthandStepId, stepEntryToNode, stepListEntries, UntilPredicateSchema, validateWorkflow, verifyMatcherFromJson, WorkflowArgsSchema, WorkflowConnectionRequirementSchema, WorkflowDocumentSchema, WorkflowNodeSchema, WorkflowOpShorthandSchema, WorkflowValueSchema, WorkflowVerifyMatcherSchema, walkWorkflow, workflowDepth, workflowGraph, } from '@noetic-tools/types';
|
package/dist/schemas/workflow.js
CHANGED
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* consumers can validate workflow documents without importing core.
|
|
4
4
|
* This barrel keeps core's public and intra-core import paths unchanged.
|
|
5
5
|
*/
|
|
6
|
-
export { MergeStrategy, MergeStrategySchema, UntilPredicateSchema, validateWorkflow, WorkflowDocumentSchema, WorkflowNodeSchema, walkWorkflow, workflowDepth, workflowGraph, } from '@noetic-tools/types';
|
|
6
|
+
export { isWorkflowOpShorthand, MergeStrategy, MergeStrategySchema, shorthandStepId, stepEntryToNode, stepListEntries, UntilPredicateSchema, validateWorkflow, verifyMatcherFromJson, WorkflowArgsSchema, WorkflowConnectionRequirementSchema, WorkflowDocumentSchema, WorkflowNodeSchema, WorkflowOpShorthandSchema, WorkflowValueSchema, WorkflowVerifyMatcherSchema, walkWorkflow, workflowDepth, workflowGraph, } from '@noetic-tools/types';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness state that core modules share but that must never be reachable from
|
|
3
|
+
* the harness object itself: anything holding `ctx.harness` (a tool, a step, a
|
|
4
|
+
* context layer) could otherwise cast its way to the connection registry and
|
|
5
|
+
* drive a connection around the gates. The store is keyed by harness and is
|
|
6
|
+
* not exported from any package entry point.
|
|
7
|
+
*/
|
|
8
|
+
/** The internal slots a harness fills when it is constructed. */
|
|
9
|
+
export interface HarnessInternalSlots {
|
|
10
|
+
/** The connection registry steps and tools resolve connections through (spec 35). */
|
|
11
|
+
connectionRegistry: unknown;
|
|
12
|
+
/** The verifier `step.verify` uses (spec 37). */
|
|
13
|
+
verifier: unknown;
|
|
14
|
+
}
|
|
15
|
+
type HarnessInternalKey = keyof HarnessInternalSlots;
|
|
16
|
+
/** Records internal slots of a harness, merged over any it already has. */
|
|
17
|
+
export declare function setHarnessInternals(harness: object, slots: Partial<HarnessInternalSlots>): void;
|
|
18
|
+
/**
|
|
19
|
+
* Reads one internal slot of a harness, typed by the caller (the slot's owner
|
|
20
|
+
* sits in a higher layer than this module, so the type is supplied, not imported).
|
|
21
|
+
*/
|
|
22
|
+
export declare function harnessInternal<T>(harness: unknown, key: HarnessInternalKey): T | undefined;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness state that core modules share but that must never be reachable from
|
|
3
|
+
* the harness object itself: anything holding `ctx.harness` (a tool, a step, a
|
|
4
|
+
* context layer) could otherwise cast its way to the connection registry and
|
|
5
|
+
* drive a connection around the gates. The store is keyed by harness and is
|
|
6
|
+
* not exported from any package entry point.
|
|
7
|
+
*/
|
|
8
|
+
import { frameworkCast } from '@noetic-tools/types';
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region Store
|
|
11
|
+
const INTERNALS = new WeakMap();
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region Public API
|
|
14
|
+
/** Records internal slots of a harness, merged over any it already has. */
|
|
15
|
+
export function setHarnessInternals(harness, slots) {
|
|
16
|
+
INTERNALS.set(harness, {
|
|
17
|
+
...INTERNALS.get(harness),
|
|
18
|
+
...slots,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reads one internal slot of a harness, typed by the caller (the slot's owner
|
|
23
|
+
* sits in a higher layer than this module, so the type is supplied, not imported).
|
|
24
|
+
*/
|
|
25
|
+
export function harnessInternal(harness, key) {
|
|
26
|
+
if (typeof harness !== 'object' || harness === null) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const value = INTERNALS.get(harness)?.[key];
|
|
30
|
+
if (value === undefined) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return frameworkCast(value);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noetic-tools/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.20.0-next.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Step primitives, interpreter, runtime, and context layer contract for Noetic agents.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@noetic-tools/context": "^1.11.1-next.1",
|
|
72
|
-
"@noetic-tools/types": "^3.
|
|
72
|
+
"@noetic-tools/types": "^3.18.0-next.1",
|
|
73
73
|
"@openrouter/agent": "^0.11.0",
|
|
74
74
|
"@openrouter/sdk": "1.4.25",
|
|
75
75
|
"jsonata": "2.2.2",
|