@noetic-tools/core 0.2.1 → 1.0.0
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/in-memory-fs-adapter.d.ts +1 -1
- package/dist/adapters/in-memory-fs-adapter.js +1 -1
- package/dist/adapters/in-memory-shell-adapter.d.ts +1 -1
- package/dist/adapters/in-memory-subprocess/manifest-persistence.d.ts +2 -2
- package/dist/adapters/in-memory-subprocess/metadata.d.ts +1 -1
- package/dist/adapters/in-memory-subprocess/types.d.ts +2 -2
- package/dist/adapters/in-memory-subprocess-adapter.d.ts +1 -1
- package/dist/adapters/openrouter.d.ts +2 -6
- package/dist/adapters/openrouter.js +1 -4
- package/dist/builders/channel-builder.d.ts +1 -1
- package/dist/builders/control-flow-builders.d.ts +2 -3
- package/dist/builders/control-flow-builders.js +1 -2
- package/dist/builders/every.d.ts +2 -3
- package/dist/builders/every.js +1 -1
- package/dist/builders/layer-provides-builders.d.ts +1 -1
- package/dist/builders/layer-provides-builders.js +1 -1
- package/dist/builders/loop-builder.d.ts +2 -2
- package/dist/builders/loop-builder.js +1 -1
- package/dist/builders/memory-builder.d.ts +1 -1
- package/dist/builders/memory-builder.js +1 -1
- package/dist/builders/provide-builder.d.ts +2 -2
- package/dist/builders/provide-builder.js +1 -1
- package/dist/builders/spawn-builder.d.ts +2 -3
- package/dist/builders/spawn-builder.js +1 -1
- package/dist/builders/step-builders.d.ts +2 -6
- package/dist/builders/step-builders.js +1 -1
- package/dist/builders/tool-builder.d.ts +1 -3
- package/dist/builders/tool-builder.js +1 -1
- package/dist/builders/workflow-hydrator.d.ts +2 -3
- package/dist/builders/workflow-hydrator.js +1 -2
- package/dist/conditions/conditions.d.ts +2 -3
- package/dist/conditions/conditions.js +1 -1
- package/dist/harness/agent-harness.d.ts +15 -5
- package/dist/harness/agent-harness.js +65 -10
- package/dist/harness/deps/memory.d.ts +2 -5
- package/dist/harness/deps/memory.js +1 -4
- package/dist/harness/deps/types.d.ts +3 -16
- package/dist/harness/deps/types.js +1 -1
- package/dist/harness/model-call.d.ts +1 -3
- package/dist/harness/model-call.js +10 -10
- package/dist/harness/model-schema.d.ts +10 -4
- package/dist/harness/model-schema.js +9 -1
- package/dist/index.d.ts +28 -49
- package/dist/index.js +9 -27
- package/dist/interpreter/action-deps.d.ts +4 -8
- package/dist/interpreter/action-deps.js +2 -6
- package/dist/interpreter/action-types.d.ts +3 -8
- package/dist/interpreter/action-types.js +1 -1
- package/dist/interpreter/collect-tools.d.ts +1 -2
- package/dist/interpreter/collect-tools.js +1 -1
- package/dist/interpreter/execute-action.js +122 -27
- package/dist/interpreter/execute-control.d.ts +1 -2
- package/dist/interpreter/execute-control.js +60 -7
- package/dist/interpreter/execute.d.ts +2 -3
- package/dist/interpreter/execute.js +1 -2
- package/dist/interpreter/message-helpers.d.ts +1 -1
- package/dist/interpreter/message-helpers.js +1 -1
- package/dist/interpreter/step-dispatcher.d.ts +2 -5
- package/dist/interpreter/typeguards.d.ts +3 -4
- package/dist/interpreter/typeguards.js +1 -1
- package/dist/observability/span-impl.d.ts +1 -1
- package/dist/observability/trace-exporter.d.ts +1 -1
- package/dist/patterns/dynamic-workflow.d.ts +2 -5
- package/dist/patterns/dynamic-workflow.js +1 -2
- package/dist/patterns/flow.d.ts +2 -2
- package/dist/patterns/flow.js +1 -1
- package/dist/patterns/interview.d.ts +2 -2
- package/dist/patterns/interview.js +1 -1
- package/dist/patterns/plans.d.ts +2 -3
- package/dist/patterns/plans.js +1 -1
- package/dist/patterns/ralph-wiggum.d.ts +2 -3
- package/dist/patterns/react.d.ts +2 -3
- package/dist/portable/memory-layers.d.ts +1 -7
- package/dist/portable/memory-layers.js +1 -7
- package/dist/portable.d.ts +2 -2
- package/dist/portable.js +2 -2
- package/dist/runtime/broadcaster-utils.d.ts +1 -1
- package/dist/runtime/channel-store.d.ts +43 -3
- package/dist/runtime/channel-store.js +233 -37
- package/dist/runtime/context-deps.d.ts +3 -3
- package/dist/runtime/context-deps.js +2 -2
- package/dist/runtime/context-impl.d.ts +17 -1
- package/dist/runtime/context-impl.js +30 -3
- package/dist/runtime/context-type-deps.d.ts +2 -11
- package/dist/runtime/cwd-helpers.d.ts +1 -1
- package/dist/runtime/detached-handle.d.ts +2 -3
- package/dist/runtime/detached-handle.js +1 -3
- package/dist/runtime/durable/checkpoint-store.d.ts +1 -1
- package/dist/runtime/durable/checkpoint-store.js +1 -1
- package/dist/runtime/durable/harness-checkpoints.d.ts +2 -5
- package/dist/runtime/durable/runnable-loop.d.ts +1 -3
- package/dist/runtime/durable/session-seed.d.ts +1 -1
- package/dist/runtime/durable/stall-nudge.d.ts +17 -10
- package/dist/runtime/durable/stall-nudge.js +29 -10
- package/dist/runtime/event-broadcaster.d.ts +10 -2
- package/dist/runtime/event-broadcaster.js +43 -19
- package/dist/runtime/in-memory-storage.d.ts +1 -1
- package/dist/runtime/in-memory-storage.js +1 -1
- package/dist/runtime/item-log-impl.d.ts +1 -3
- package/dist/runtime/item-log-impl.js +1 -1
- package/dist/runtime/message-queue.d.ts +1 -2
- package/dist/runtime/session-runner.d.ts +1 -4
- package/dist/runtime/session-streams.d.ts +1 -2
- package/dist/runtime/session-streams.js +1 -1
- package/dist/runtime/step-registry.d.ts +2 -2
- package/dist/runtime/step-registry.js +1 -2
- package/dist/runtime/tool-memory.d.ts +1 -3
- package/dist/types/mutable-context.d.ts +2 -3
- package/dist/types/step-registrar.d.ts +1 -1
- package/dist/unstable.d.ts +5 -9
- package/dist/unstable.js +3 -6
- package/dist/until/combinators.d.ts +1 -1
- package/dist/until/never.d.ts +1 -1
- package/dist/until/predicates.d.ts +2 -2
- package/package.json +4 -2
- package/dist/errors/noetic-config-error.d.ts +0 -41
- package/dist/errors/noetic-config-error.js +0 -44
- package/dist/errors/noetic-error.d.ts +0 -18
- package/dist/errors/noetic-error.js +0 -54
- package/dist/memory/budget.d.ts +0 -23
- package/dist/memory/budget.js +0 -117
- package/dist/memory/exec-context-factory.d.ts +0 -25
- package/dist/memory/exec-context-factory.js +0 -30
- package/dist/memory/flow-schema.d.ts +0 -52
- package/dist/memory/flow-schema.js +0 -102
- package/dist/memory/function-call-utils.d.ts +0 -6
- package/dist/memory/function-call-utils.js +0 -27
- package/dist/memory/layer-api.d.ts +0 -14
- package/dist/memory/layer-api.js +0 -91
- package/dist/memory/layer-lifecycle.d.ts +0 -160
- package/dist/memory/layer-lifecycle.js +0 -552
- package/dist/memory/layer-provides.d.ts +0 -32
- package/dist/memory/layer-provides.js +0 -33
- package/dist/memory/layer-usage.d.ts +0 -16
- package/dist/memory/layer-usage.js +0 -54
- package/dist/memory/layers/durable-task-state.d.ts +0 -79
- package/dist/memory/layers/durable-task-state.js +0 -118
- package/dist/memory/layers/file-reference.d.ts +0 -55
- package/dist/memory/layers/file-reference.js +0 -594
- package/dist/memory/layers/history-window.d.ts +0 -29
- package/dist/memory/layers/history-window.js +0 -114
- package/dist/memory/layers/observational-memory.d.ts +0 -53
- package/dist/memory/layers/observational-memory.js +0 -109
- package/dist/memory/layers/plan.d.ts +0 -55
- package/dist/memory/layers/plan.js +0 -374
- package/dist/memory/layers/static-content.d.ts +0 -27
- package/dist/memory/layers/static-content.js +0 -35
- package/dist/memory/layers/steering.d.ts +0 -51
- package/dist/memory/layers/steering.js +0 -258
- package/dist/memory/layers/temporal.d.ts +0 -91
- package/dist/memory/layers/temporal.js +0 -245
- package/dist/memory/layers/tool-memory-layer.d.ts +0 -16
- package/dist/memory/layers/tool-memory-layer.js +0 -43
- package/dist/memory/layers/working-memory.d.ts +0 -44
- package/dist/memory/layers/working-memory.js +0 -92
- package/dist/memory/projector.d.ts +0 -10
- package/dist/memory/projector.js +0 -19
- package/dist/memory/scope.d.ts +0 -3
- package/dist/memory/scope.js +0 -31
- package/dist/memory/strip-unresolved.d.ts +0 -13
- package/dist/memory/strip-unresolved.js +0 -35
- package/dist/schemas/item.d.ts +0 -35
- package/dist/schemas/item.js +0 -155
- package/dist/types/channel.d.ts +0 -29
- package/dist/types/channel.js +0 -1
- package/dist/types/common.d.ts +0 -68
- package/dist/types/common.js +0 -1
- package/dist/types/context-parts/item-log.d.ts +0 -6
- package/dist/types/context-parts/item-log.js +0 -1
- package/dist/types/context-parts/layer-usage.d.ts +0 -18
- package/dist/types/context-parts/layer-usage.js +0 -1
- package/dist/types/context.d.ts +0 -202
- package/dist/types/context.js +0 -1
- package/dist/types/detached.d.ts +0 -17
- package/dist/types/detached.js +0 -7
- package/dist/types/error.d.ts +0 -66
- package/dist/types/error.js +0 -1
- package/dist/types/fs-adapter.d.ts +0 -51
- package/dist/types/fs-adapter.js +0 -3
- package/dist/types/harness-result.d.ts +0 -43
- package/dist/types/harness-result.js +0 -2
- package/dist/types/items.d.ts +0 -131
- package/dist/types/items.js +0 -2
- package/dist/types/memory-context.d.ts +0 -39
- package/dist/types/memory-context.js +0 -1
- package/dist/types/memory.d.ts +0 -306
- package/dist/types/memory.js +0 -13
- package/dist/types/observability.d.ts +0 -30
- package/dist/types/observability.js +0 -1
- package/dist/types/runtime.d.ts +0 -256
- package/dist/types/runtime.js +0 -1
- package/dist/types/shell-adapter.d.ts +0 -34
- package/dist/types/shell-adapter.js +0 -10
- package/dist/types/steering.d.ts +0 -89
- package/dist/types/steering.js +0 -14
- package/dist/types/step.d.ts +0 -231
- package/dist/types/step.js +0 -1
- package/dist/types/subprocess-adapter.d.ts +0 -157
- package/dist/types/subprocess-adapter.js +0 -3
- package/dist/types/tool-context.d.ts +0 -34
- package/dist/types/tool-context.js +0 -1
- package/dist/types/tool.d.ts +0 -64
- package/dist/types/tool.js +0 -1
- package/dist/util/framework-cast.d.ts +0 -10
- package/dist/util/framework-cast.js +0 -16
- package/dist/util/message-helpers.d.ts +0 -17
- package/dist/util/message-helpers.js +0 -64
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Control-flow step handlers: branch, fork, loop, every.
|
|
3
3
|
*/
|
|
4
|
-
import { isNoeticError, NoeticErrorImpl } from '
|
|
4
|
+
import { createMessage, frameworkCast, isNoeticError, NoeticErrorImpl } from '@noetic-tools/types';
|
|
5
5
|
import { ContextImpl } from '../runtime/context-impl.js';
|
|
6
6
|
import { snapshotCwdState } from '../runtime/cwd-helpers.js';
|
|
7
|
-
import { frameworkCast } from '../util/framework-cast.js';
|
|
8
|
-
import { createMessage } from '../util/message-helpers.js';
|
|
9
7
|
import { cloneWithGuard } from './clone-guard.js';
|
|
10
8
|
import { getContextChannelStore, isContextImpl, isMutableContext } from './typeguards.js';
|
|
11
9
|
//#region branch
|
|
@@ -137,9 +135,46 @@ function classifyResults(settled, paths) {
|
|
|
137
135
|
};
|
|
138
136
|
}
|
|
139
137
|
async function executeAll(step, paths, _input, ctx, childContexts, executeStep, concurrency) {
|
|
140
|
-
|
|
138
|
+
// Fail-fast (specs 03/09): the first genuine path failure aborts every
|
|
139
|
+
// sibling child context. Cancellation is cooperative — in-flight siblings
|
|
140
|
+
// are still awaited (they stop at their next step boundary / blocked
|
|
141
|
+
// channel op) so fork_partial's succeeded/failed stay accurate; paths
|
|
142
|
+
// still queued behind the concurrency limit are skipped outright. Skipped
|
|
143
|
+
// and aborted paths appear in `failed` with kind 'cancelled'.
|
|
144
|
+
let firstFailureSeen = false;
|
|
145
|
+
const tasks = paths.map((path, i) => async () => {
|
|
146
|
+
if (firstFailureSeen) {
|
|
147
|
+
throw new NoeticErrorImpl({
|
|
148
|
+
kind: 'cancelled',
|
|
149
|
+
reason: `fork '${step.id}' sibling failed`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
try {
|
|
153
|
+
return await executeStep(path, _input, frameworkCast(childContexts[i]));
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
const isCancellation = isNoeticError(e) && e.noeticError.kind === 'cancelled';
|
|
157
|
+
if (!isCancellation && !firstFailureSeen) {
|
|
158
|
+
firstFailureSeen = true;
|
|
159
|
+
for (let j = 0; j < childContexts.length; j++) {
|
|
160
|
+
if (j !== i) {
|
|
161
|
+
childContexts[j].abort(`fork '${step.id}' sibling failed`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
throw e;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
141
168
|
const settled = await runWithConcurrency(tasks, concurrency);
|
|
142
169
|
const { succeeded, failed } = classifyResults(settled, paths);
|
|
170
|
+
// If the PARENT context was aborted mid-fork, the whole fork is cancelled —
|
|
171
|
+
// surface 'cancelled', not a partial-failure shape (spec 09, item 3).
|
|
172
|
+
if (ctx.aborted) {
|
|
173
|
+
throw new NoeticErrorImpl({
|
|
174
|
+
kind: 'cancelled',
|
|
175
|
+
reason: ctx.abortReason ?? 'context aborted',
|
|
176
|
+
});
|
|
177
|
+
}
|
|
143
178
|
if (failed.length > 0) {
|
|
144
179
|
throw new NoeticErrorImpl({
|
|
145
180
|
kind: 'fork_partial',
|
|
@@ -210,9 +245,17 @@ async function executeRace(step, paths, input, ctx, childContexts, executeStep,
|
|
|
210
245
|
}
|
|
211
246
|
});
|
|
212
247
|
}
|
|
213
|
-
async function executeSettle(step, paths, input,
|
|
248
|
+
async function executeSettle(step, paths, input, ctx, childContexts, executeStep, concurrency) {
|
|
214
249
|
const tasks = paths.map((path, i) => () => executeStep(path, input, frameworkCast(childContexts[i])));
|
|
215
250
|
const settled = await runWithConcurrency(tasks, concurrency);
|
|
251
|
+
// Parent aborted mid-fork: the fork is cancelled, merge never runs
|
|
252
|
+
// (spec 09, Cancellation item 3 — same rule as mode 'all').
|
|
253
|
+
if (ctx.aborted) {
|
|
254
|
+
throw new NoeticErrorImpl({
|
|
255
|
+
kind: 'cancelled',
|
|
256
|
+
reason: ctx.abortReason ?? 'context aborted',
|
|
257
|
+
});
|
|
258
|
+
}
|
|
216
259
|
const results = settled.map((result, i) => {
|
|
217
260
|
if (result.status === 'fulfilled') {
|
|
218
261
|
return {
|
|
@@ -227,7 +270,7 @@ async function executeSettle(step, paths, input, _ctx, childContexts, executeSte
|
|
|
227
270
|
error: toNoeticError(result.reason, paths[i].id),
|
|
228
271
|
};
|
|
229
272
|
});
|
|
230
|
-
return step.merge(results,
|
|
273
|
+
return step.merge(results, ctx);
|
|
231
274
|
}
|
|
232
275
|
function hasTextField(value) {
|
|
233
276
|
return typeof value === 'object' && value !== null && 'text' in value;
|
|
@@ -244,7 +287,11 @@ async function recvInboxWithTimeout(ctx, step) {
|
|
|
244
287
|
timeout: step.parkTimeout,
|
|
245
288
|
});
|
|
246
289
|
}
|
|
247
|
-
catch {
|
|
290
|
+
catch (e) {
|
|
291
|
+
// Cancellation must terminate the loop, not read as "no message".
|
|
292
|
+
if (isNoeticError(e) && e.noeticError.kind === 'cancelled') {
|
|
293
|
+
throw e;
|
|
294
|
+
}
|
|
248
295
|
// Expected: channel_timeout error when parkTimeout expires with no message.
|
|
249
296
|
return null;
|
|
250
297
|
}
|
|
@@ -309,6 +356,12 @@ export async function executeLoop(step, input, ctx, executeStep) {
|
|
|
309
356
|
if (!step.onError || !isNoeticError(e)) {
|
|
310
357
|
throw e;
|
|
311
358
|
}
|
|
359
|
+
// Cancellation is not a retriable error (spec 09): it must terminate
|
|
360
|
+
// the loop promptly rather than be consumed by 'retry'/'skip'. Same
|
|
361
|
+
// guard as executeEvery's 'continue' policy below.
|
|
362
|
+
if (e.noeticError.kind === 'cancelled') {
|
|
363
|
+
throw e;
|
|
364
|
+
}
|
|
312
365
|
const action = step.onError(e.noeticError, ctx);
|
|
313
366
|
if (action === 'retry') {
|
|
314
367
|
continue;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type { Step } from '../types/step.js';
|
|
1
|
+
import type { ContextMemory } from '@noetic-tools/memory';
|
|
2
|
+
import type { Context, Step } from '@noetic-tools/types';
|
|
4
3
|
/**
|
|
5
4
|
* @internal
|
|
6
5
|
* Dispatch a step at the per-kind handler level without adapter routing.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { NoeticErrorImpl } from '
|
|
1
|
+
import { frameworkCast, NoeticErrorImpl } from '@noetic-tools/types';
|
|
2
2
|
import { emitFrameworkEvent, getBroadcaster, shouldEmit } from '../runtime/broadcaster-utils.js';
|
|
3
3
|
import { ContextImpl } from '../runtime/context-impl.js';
|
|
4
4
|
import { DetachedHandleImpl } from '../runtime/detached-handle.js';
|
|
5
|
-
import { frameworkCast } from '../util/framework-cast.js';
|
|
6
5
|
import { executeLLM, executeProvide, executeRun, executeSpawn, executeTool, } from './execute-action.js';
|
|
7
6
|
import { executeBranch, executeEvery, executeFork, executeLoop } from './execute-control.js';
|
|
8
7
|
import { isMutableContext } from './typeguards.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { trackUsage } from '
|
|
1
|
+
export { trackUsage } from '@noetic-tools/types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { trackUsage } from '
|
|
1
|
+
export { trackUsage } from '@noetic-tools/types';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DetachedHandle } from '
|
|
3
|
-
import type { ContextMemory } from '../types/memory.js';
|
|
4
|
-
import type { Step } from '../types/step.js';
|
|
5
|
-
import type { SubprocessAdapter } from '../types/subprocess-adapter.js';
|
|
1
|
+
import type { ContextMemory } from '@noetic-tools/memory';
|
|
2
|
+
import type { Context, DetachedHandle, Step, SubprocessAdapter } from '@noetic-tools/types';
|
|
6
3
|
/**
|
|
7
4
|
* Resolve the subprocess adapter used for a given step dispatch.
|
|
8
5
|
*
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import type { ContextMemory } from '@noetic-tools/memory';
|
|
2
|
+
import type { Context, FunctionCallItem, Item } from '@noetic-tools/types';
|
|
1
3
|
import type { ChannelStore } from '../runtime/channel-store.js';
|
|
2
4
|
import { ContextImpl } from '../runtime/context-impl.js';
|
|
3
|
-
import type { Context } from '../types/context.js';
|
|
4
|
-
import type { FunctionCallItem, Item } from '../types/items.js';
|
|
5
|
-
import type { ContextMemory } from '../types/memory.js';
|
|
6
5
|
import type { MutableContext } from '../types/mutable-context.js';
|
|
7
|
-
export { isAssistantMessage, isOutputText, isUserMessage } from '
|
|
6
|
+
export { isAssistantMessage, isOutputText, isUserMessage } from '@noetic-tools/types';
|
|
8
7
|
export declare function isMutableContext(ctx: Context<ContextMemory>): ctx is MutableContext;
|
|
9
8
|
export declare function isContextImpl(ctx: Context<ContextMemory>): ctx is ContextImpl;
|
|
10
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextImpl } from '../runtime/context-impl.js';
|
|
2
2
|
// Re-exports for backward compatibility; the pure variants live in util/.
|
|
3
|
-
export { isAssistantMessage, isOutputText, isUserMessage } from '
|
|
3
|
+
export { isAssistantMessage, isOutputText, isUserMessage } from '@noetic-tools/types';
|
|
4
4
|
export function isMutableContext(ctx) {
|
|
5
5
|
// Check if the context has writable mutable fields (ContextImpl or compatible mock)
|
|
6
6
|
if (ctx instanceof ContextImpl) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Span, TraceExporter } from '
|
|
1
|
+
import type { Span, TraceExporter } from '@noetic-tools/types';
|
|
2
2
|
import { SpanImpl } from './span-impl.js';
|
|
3
3
|
/** @public No-op trace exporter that silently discards all spans. */
|
|
4
4
|
export declare class NoopExporter implements TraceExporter {
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
* Pattern that lets an LLM generate a workflow as JSON during execution,
|
|
3
3
|
* then hydrates and runs it within the same harness session.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type { AgentHarnessContract } from '../types/runtime.js';
|
|
8
|
-
import type { Step } from '../types/step.js';
|
|
9
|
-
import type { Tool } from '../types/tool.js';
|
|
5
|
+
import type { ContextMemory } from '@noetic-tools/memory';
|
|
6
|
+
import type { AgentHarnessContract, Context, Step, Tool } from '@noetic-tools/types';
|
|
10
7
|
/** @public Options for creating a dynamic workflow step. */
|
|
11
8
|
export interface DynamicWorkflowOpts {
|
|
12
9
|
model?: string;
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* Pattern that lets an LLM generate a workflow as JSON during execution,
|
|
3
3
|
* then hydrates and runs it within the same harness session.
|
|
4
4
|
*/
|
|
5
|
+
import { frameworkCast, NoeticConfigError } from '@noetic-tools/types';
|
|
5
6
|
import { step } from '../builders/step-builders.js';
|
|
6
7
|
import { hydrateWorkflow } from '../builders/workflow-hydrator.js';
|
|
7
|
-
import { NoeticConfigError } from '../errors/noetic-config-error.js';
|
|
8
8
|
import { WorkflowDocumentSchema, workflowDepth } from '../schemas/workflow.js';
|
|
9
|
-
import { frameworkCast } from '../util/framework-cast.js';
|
|
10
9
|
//#endregion
|
|
11
10
|
//#region Constants
|
|
12
11
|
const DEFAULT_MAX_DEPTH = 5;
|
package/dist/patterns/flow.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { FlowNode, ForkFlowNode, LlmFlowNode, SequenceFlowNode, SpawnFlowNode, SubagentFlowNode, } from '
|
|
2
|
-
export { FlowSchema, flowDepth, validateFlow, walkFlow } from '
|
|
1
|
+
export type { FlowNode, ForkFlowNode, LlmFlowNode, SequenceFlowNode, SpawnFlowNode, SubagentFlowNode, } from '@noetic-tools/memory';
|
|
2
|
+
export { FlowSchema, flowDepth, validateFlow, walkFlow } from '@noetic-tools/memory';
|
package/dist/patterns/flow.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FlowSchema, flowDepth, validateFlow, walkFlow } from '
|
|
1
|
+
export { FlowSchema, flowDepth, validateFlow, walkFlow } from '@noetic-tools/memory';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ContextMemory } from '@noetic-tools/memory';
|
|
2
|
+
import type { Step } from '@noetic-tools/types';
|
|
1
3
|
import type { ZodType } from 'zod';
|
|
2
|
-
import type { ContextMemory } from '../types/memory.js';
|
|
3
|
-
import type { Step } from '../types/step.js';
|
|
4
4
|
/** @public Answer captured by the host for a single interview question. */
|
|
5
5
|
export interface InterviewQuestionAnswer {
|
|
6
6
|
questionId: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { frameworkCast } from '@noetic-tools/types';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { loop } from '../builders/loop-builder.js';
|
|
3
4
|
import { step } from '../builders/step-builders.js';
|
|
4
5
|
import { any } from '../until/combinators.js';
|
|
5
6
|
import { until } from '../until/predicates.js';
|
|
6
|
-
import { frameworkCast } from '../util/framework-cast.js';
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region Helpers
|
|
9
9
|
const DEFAULT_MAX_QUESTIONS = 8;
|
package/dist/patterns/plans.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import type { ContextMemory } from '@noetic-tools/memory';
|
|
2
|
+
import type { Context, ExecuteStepFn, Step } from '@noetic-tools/types';
|
|
1
3
|
import { z } from 'zod';
|
|
2
|
-
import type { Context } from '../types/context.js';
|
|
3
|
-
import type { ContextMemory } from '../types/memory.js';
|
|
4
|
-
import type { ExecuteStepFn, Step } from '../types/step.js';
|
|
5
4
|
export interface PlanNode {
|
|
6
5
|
id: string;
|
|
7
6
|
description: string;
|
package/dist/patterns/plans.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { frameworkCast } from '@noetic-tools/types';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { fork } from '../builders/control-flow-builders.js';
|
|
3
|
-
import { frameworkCast } from '../util/framework-cast.js';
|
|
4
4
|
// PlanNode schema — the variable annotation provides the recursive type;
|
|
5
5
|
// z.lazy() returns a compatible type that TypeScript checks against it.
|
|
6
6
|
/** @public Zod schema for recursive `PlanNode` validation. */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ContextMemory } from '
|
|
2
|
-
import type { StepLoop } from '
|
|
3
|
-
import type { Tool } from '../types/tool.js';
|
|
1
|
+
import type { ContextMemory } from '@noetic-tools/memory';
|
|
2
|
+
import type { StepLoop, Tool } from '@noetic-tools/types';
|
|
4
3
|
import type { VerifyFn } from '../until/predicates.js';
|
|
5
4
|
/**
|
|
6
5
|
* Creates a retry-with-feedback loop wrapping a ReAct agent. Each iteration spawns an inner agent
|
package/dist/patterns/react.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ContextMemory, MemoryConfig, MemoryLayer } from '
|
|
2
|
-
import type { StepLoop, StepSpawn } from '
|
|
3
|
-
import type { Tool } from '../types/tool.js';
|
|
1
|
+
import type { ContextMemory, MemoryConfig, MemoryLayer } from '@noetic-tools/memory';
|
|
2
|
+
import type { StepLoop, StepSpawn, Tool } from '@noetic-tools/types';
|
|
4
3
|
/**
|
|
5
4
|
* Creates a ReAct (Reason + Act) agent loop: an LLM step with tools iterated until no tool calls or limits are hit.
|
|
6
5
|
*
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
/** @public */
|
|
2
|
-
export { durableTaskState } from '../memory/layers/durable-task-state.js';
|
|
3
2
|
/** @public */
|
|
4
|
-
export { historyWindow } from '../memory/layers/history-window.js';
|
|
5
3
|
/** @public */
|
|
6
|
-
export { observationalMemory } from '../memory/layers/observational-memory.js';
|
|
7
4
|
/** @public */
|
|
8
|
-
export { planMemory } from '../memory/layers/plan.js';
|
|
9
5
|
/** @public */
|
|
10
|
-
export { temporalMemory } from '../memory/layers/temporal.js';
|
|
11
6
|
/** @public */
|
|
12
|
-
export { toolMemoryLayer } from '../memory/layers/tool-memory-layer.js';
|
|
13
7
|
/** @public */
|
|
14
|
-
export { workingMemory } from '
|
|
8
|
+
export { durableTaskState, historyWindow, observationalMemory, planMemory, temporalMemory, toolMemoryLayer, workingMemory, } from '@noetic-tools/memory';
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
/** @public */
|
|
2
|
-
export { durableTaskState } from '../memory/layers/durable-task-state.js';
|
|
3
2
|
/** @public */
|
|
4
|
-
export { historyWindow } from '../memory/layers/history-window.js';
|
|
5
3
|
/** @public */
|
|
6
|
-
export { observationalMemory } from '../memory/layers/observational-memory.js';
|
|
7
4
|
/** @public */
|
|
8
|
-
export { planMemory } from '../memory/layers/plan.js';
|
|
9
5
|
/** @public */
|
|
10
|
-
export { temporalMemory } from '../memory/layers/temporal.js';
|
|
11
6
|
/** @public */
|
|
12
|
-
export { toolMemoryLayer } from '../memory/layers/tool-memory-layer.js';
|
|
13
7
|
/** @public */
|
|
14
|
-
export { workingMemory } from '
|
|
8
|
+
export { durableTaskState, historyWindow, observationalMemory, planMemory, temporalMemory, toolMemoryLayer, workingMemory, } from '@noetic-tools/memory';
|
package/dist/portable.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export { Slot } from '@noetic-tools/memory';
|
|
1
3
|
export * from './portable/adapters.js';
|
|
2
4
|
export * from './portable/ask-user.js';
|
|
3
5
|
export * from './portable/builders.js';
|
|
4
6
|
export * from './portable/memory-layers.js';
|
|
5
7
|
export * from './portable/runtime.js';
|
|
6
8
|
export * from './portable/until.js';
|
|
7
|
-
/** @public */
|
|
8
|
-
export { Slot } from './types/memory.js';
|
package/dist/portable.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export { Slot } from '@noetic-tools/memory';
|
|
1
3
|
export * from './portable/adapters.js';
|
|
2
4
|
export * from './portable/ask-user.js';
|
|
3
5
|
export * from './portable/builders.js';
|
|
4
6
|
export * from './portable/memory-layers.js';
|
|
5
7
|
export * from './portable/runtime.js';
|
|
6
8
|
export * from './portable/until.js';
|
|
7
|
-
/** @public */
|
|
8
|
-
export { Slot } from './types/memory.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context } from '
|
|
1
|
+
import type { Context } from '@noetic-tools/types';
|
|
2
2
|
import type { EventBroadcaster } from './event-broadcaster.js';
|
|
3
3
|
/** @internal Option controlling framework event emission on a step or callModel request. */
|
|
4
4
|
export type EmitOption = boolean | ((eventType: string, data: Record<string, unknown>) => boolean);
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import type { Channel, ChannelHandle, ExternalChannel } from '
|
|
1
|
+
import type { Channel, ChannelHandle, ExternalChannel } from '@noetic-tools/types';
|
|
2
|
+
/** Options accepted by internal (back-pressured) `send`. */
|
|
3
|
+
export interface ChannelSendOpts {
|
|
4
|
+
/**
|
|
5
|
+
* How long a sender may stay parked on a full queue before rejecting with
|
|
6
|
+
* `channel_timeout`. Default 30s; `0` disables the timeout.
|
|
7
|
+
*/
|
|
8
|
+
timeout?: number;
|
|
9
|
+
/** Abort signal — rejects a parked sender with `cancelled`. */
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
2
12
|
export declare class ChannelStore {
|
|
3
13
|
private channels;
|
|
4
14
|
private closedExecutions;
|
|
@@ -9,10 +19,40 @@ export declare class ChannelStore {
|
|
|
9
19
|
* an `unsubscribe` so the caller can detach if it cancels first.
|
|
10
20
|
*/
|
|
11
21
|
subscribeWake<T>(channel: Channel<T>, callback: () => void): () => void;
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Internal-sender write with back-pressure (spec 06). Delivery is
|
|
24
|
+
* synchronous when possible; the returned promise only parks when a queue
|
|
25
|
+
* channel is at capacity:
|
|
26
|
+
*
|
|
27
|
+
* - **value**: store last-write-wins value, drain ALL parked recv waiters,
|
|
28
|
+
* resolve immediately.
|
|
29
|
+
* - **queue**: hand off to a parked recv waiter or push below capacity —
|
|
30
|
+
* resolve immediately. At capacity, park the sender FIFO until a consumer
|
|
31
|
+
* dequeues an item; reject `channel_timeout` after `opts.timeout`
|
|
32
|
+
* (default 30s) or `cancelled` when `opts.signal` aborts.
|
|
33
|
+
* - **topic**: deliver to current subscribers, resolve immediately.
|
|
34
|
+
*
|
|
35
|
+
* External callers use `ChannelHandle.send` (sync, drop-oldest) instead.
|
|
36
|
+
*/
|
|
37
|
+
send<T>(channel: Channel<T>, value: T, opts?: ChannelSendOpts): Promise<void>;
|
|
38
|
+
/** Park an internal sender on a full queue until a slot frees (FIFO). */
|
|
39
|
+
private parkSender;
|
|
40
|
+
/**
|
|
41
|
+
* A dequeue freed a queue slot — shift the oldest parked sender's value
|
|
42
|
+
* into it (FIFO) and resolve that sender's promise.
|
|
43
|
+
*/
|
|
44
|
+
private promotePendingSender;
|
|
45
|
+
/** Fire-and-reset the one-shot wake subscribers for a channel state. */
|
|
46
|
+
private fireWakes;
|
|
47
|
+
recv<T>(channel: Channel<T>, timeout?: number, signal?: AbortSignal): Promise<T>;
|
|
14
48
|
tryRecv<T>(channel: Channel<T>): T | null;
|
|
15
49
|
private waitWithTimeout;
|
|
50
|
+
/**
|
|
51
|
+
* External-sender write: synchronous, never back-pressured (spec 06,
|
|
52
|
+
* External Sender Back-Pressure). At capacity the OLDEST queued item is
|
|
53
|
+
* dropped (with a warning) so external callers never block.
|
|
54
|
+
*/
|
|
55
|
+
private sendExternal;
|
|
16
56
|
getHandle<T>(channel: ExternalChannel<T>, executionId: string): ChannelHandle<T>;
|
|
17
57
|
closeExecution(executionId: string): void;
|
|
18
58
|
}
|