@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.
Files changed (207) hide show
  1. package/dist/adapters/in-memory-fs-adapter.d.ts +1 -1
  2. package/dist/adapters/in-memory-fs-adapter.js +1 -1
  3. package/dist/adapters/in-memory-shell-adapter.d.ts +1 -1
  4. package/dist/adapters/in-memory-subprocess/manifest-persistence.d.ts +2 -2
  5. package/dist/adapters/in-memory-subprocess/metadata.d.ts +1 -1
  6. package/dist/adapters/in-memory-subprocess/types.d.ts +2 -2
  7. package/dist/adapters/in-memory-subprocess-adapter.d.ts +1 -1
  8. package/dist/adapters/openrouter.d.ts +2 -6
  9. package/dist/adapters/openrouter.js +1 -4
  10. package/dist/builders/channel-builder.d.ts +1 -1
  11. package/dist/builders/control-flow-builders.d.ts +2 -3
  12. package/dist/builders/control-flow-builders.js +1 -2
  13. package/dist/builders/every.d.ts +2 -3
  14. package/dist/builders/every.js +1 -1
  15. package/dist/builders/layer-provides-builders.d.ts +1 -1
  16. package/dist/builders/layer-provides-builders.js +1 -1
  17. package/dist/builders/loop-builder.d.ts +2 -2
  18. package/dist/builders/loop-builder.js +1 -1
  19. package/dist/builders/memory-builder.d.ts +1 -1
  20. package/dist/builders/memory-builder.js +1 -1
  21. package/dist/builders/provide-builder.d.ts +2 -2
  22. package/dist/builders/provide-builder.js +1 -1
  23. package/dist/builders/spawn-builder.d.ts +2 -3
  24. package/dist/builders/spawn-builder.js +1 -1
  25. package/dist/builders/step-builders.d.ts +2 -6
  26. package/dist/builders/step-builders.js +1 -1
  27. package/dist/builders/tool-builder.d.ts +1 -3
  28. package/dist/builders/tool-builder.js +1 -1
  29. package/dist/builders/workflow-hydrator.d.ts +2 -3
  30. package/dist/builders/workflow-hydrator.js +1 -2
  31. package/dist/conditions/conditions.d.ts +2 -3
  32. package/dist/conditions/conditions.js +1 -1
  33. package/dist/harness/agent-harness.d.ts +15 -5
  34. package/dist/harness/agent-harness.js +65 -10
  35. package/dist/harness/deps/memory.d.ts +2 -5
  36. package/dist/harness/deps/memory.js +1 -4
  37. package/dist/harness/deps/types.d.ts +3 -16
  38. package/dist/harness/deps/types.js +1 -1
  39. package/dist/harness/model-call.d.ts +1 -3
  40. package/dist/harness/model-call.js +10 -10
  41. package/dist/harness/model-schema.d.ts +10 -4
  42. package/dist/harness/model-schema.js +9 -1
  43. package/dist/index.d.ts +28 -49
  44. package/dist/index.js +9 -27
  45. package/dist/interpreter/action-deps.d.ts +4 -8
  46. package/dist/interpreter/action-deps.js +2 -6
  47. package/dist/interpreter/action-types.d.ts +3 -8
  48. package/dist/interpreter/action-types.js +1 -1
  49. package/dist/interpreter/collect-tools.d.ts +1 -2
  50. package/dist/interpreter/collect-tools.js +1 -1
  51. package/dist/interpreter/execute-action.js +122 -27
  52. package/dist/interpreter/execute-control.d.ts +1 -2
  53. package/dist/interpreter/execute-control.js +60 -7
  54. package/dist/interpreter/execute.d.ts +2 -3
  55. package/dist/interpreter/execute.js +1 -2
  56. package/dist/interpreter/message-helpers.d.ts +1 -1
  57. package/dist/interpreter/message-helpers.js +1 -1
  58. package/dist/interpreter/step-dispatcher.d.ts +2 -5
  59. package/dist/interpreter/typeguards.d.ts +3 -4
  60. package/dist/interpreter/typeguards.js +1 -1
  61. package/dist/observability/span-impl.d.ts +1 -1
  62. package/dist/observability/trace-exporter.d.ts +1 -1
  63. package/dist/patterns/dynamic-workflow.d.ts +2 -5
  64. package/dist/patterns/dynamic-workflow.js +1 -2
  65. package/dist/patterns/flow.d.ts +2 -2
  66. package/dist/patterns/flow.js +1 -1
  67. package/dist/patterns/interview.d.ts +2 -2
  68. package/dist/patterns/interview.js +1 -1
  69. package/dist/patterns/plans.d.ts +2 -3
  70. package/dist/patterns/plans.js +1 -1
  71. package/dist/patterns/ralph-wiggum.d.ts +2 -3
  72. package/dist/patterns/react.d.ts +2 -3
  73. package/dist/portable/memory-layers.d.ts +1 -7
  74. package/dist/portable/memory-layers.js +1 -7
  75. package/dist/portable.d.ts +2 -2
  76. package/dist/portable.js +2 -2
  77. package/dist/runtime/broadcaster-utils.d.ts +1 -1
  78. package/dist/runtime/channel-store.d.ts +43 -3
  79. package/dist/runtime/channel-store.js +233 -37
  80. package/dist/runtime/context-deps.d.ts +3 -3
  81. package/dist/runtime/context-deps.js +2 -2
  82. package/dist/runtime/context-impl.d.ts +17 -1
  83. package/dist/runtime/context-impl.js +30 -3
  84. package/dist/runtime/context-type-deps.d.ts +2 -11
  85. package/dist/runtime/cwd-helpers.d.ts +1 -1
  86. package/dist/runtime/detached-handle.d.ts +2 -3
  87. package/dist/runtime/detached-handle.js +1 -3
  88. package/dist/runtime/durable/checkpoint-store.d.ts +1 -1
  89. package/dist/runtime/durable/checkpoint-store.js +1 -1
  90. package/dist/runtime/durable/harness-checkpoints.d.ts +2 -5
  91. package/dist/runtime/durable/runnable-loop.d.ts +1 -3
  92. package/dist/runtime/durable/session-seed.d.ts +1 -1
  93. package/dist/runtime/durable/stall-nudge.d.ts +17 -10
  94. package/dist/runtime/durable/stall-nudge.js +29 -10
  95. package/dist/runtime/event-broadcaster.d.ts +10 -2
  96. package/dist/runtime/event-broadcaster.js +43 -19
  97. package/dist/runtime/in-memory-storage.d.ts +1 -1
  98. package/dist/runtime/in-memory-storage.js +1 -1
  99. package/dist/runtime/item-log-impl.d.ts +1 -3
  100. package/dist/runtime/item-log-impl.js +1 -1
  101. package/dist/runtime/message-queue.d.ts +1 -2
  102. package/dist/runtime/session-runner.d.ts +1 -4
  103. package/dist/runtime/session-streams.d.ts +1 -2
  104. package/dist/runtime/session-streams.js +1 -1
  105. package/dist/runtime/step-registry.d.ts +2 -2
  106. package/dist/runtime/step-registry.js +1 -2
  107. package/dist/runtime/tool-memory.d.ts +1 -3
  108. package/dist/types/mutable-context.d.ts +2 -3
  109. package/dist/types/step-registrar.d.ts +1 -1
  110. package/dist/unstable.d.ts +5 -9
  111. package/dist/unstable.js +3 -6
  112. package/dist/until/combinators.d.ts +1 -1
  113. package/dist/until/never.d.ts +1 -1
  114. package/dist/until/predicates.d.ts +2 -2
  115. package/package.json +4 -2
  116. package/dist/errors/noetic-config-error.d.ts +0 -41
  117. package/dist/errors/noetic-config-error.js +0 -44
  118. package/dist/errors/noetic-error.d.ts +0 -18
  119. package/dist/errors/noetic-error.js +0 -54
  120. package/dist/memory/budget.d.ts +0 -23
  121. package/dist/memory/budget.js +0 -117
  122. package/dist/memory/exec-context-factory.d.ts +0 -25
  123. package/dist/memory/exec-context-factory.js +0 -30
  124. package/dist/memory/flow-schema.d.ts +0 -52
  125. package/dist/memory/flow-schema.js +0 -102
  126. package/dist/memory/function-call-utils.d.ts +0 -6
  127. package/dist/memory/function-call-utils.js +0 -27
  128. package/dist/memory/layer-api.d.ts +0 -14
  129. package/dist/memory/layer-api.js +0 -91
  130. package/dist/memory/layer-lifecycle.d.ts +0 -160
  131. package/dist/memory/layer-lifecycle.js +0 -552
  132. package/dist/memory/layer-provides.d.ts +0 -32
  133. package/dist/memory/layer-provides.js +0 -33
  134. package/dist/memory/layer-usage.d.ts +0 -16
  135. package/dist/memory/layer-usage.js +0 -54
  136. package/dist/memory/layers/durable-task-state.d.ts +0 -79
  137. package/dist/memory/layers/durable-task-state.js +0 -118
  138. package/dist/memory/layers/file-reference.d.ts +0 -55
  139. package/dist/memory/layers/file-reference.js +0 -594
  140. package/dist/memory/layers/history-window.d.ts +0 -29
  141. package/dist/memory/layers/history-window.js +0 -114
  142. package/dist/memory/layers/observational-memory.d.ts +0 -53
  143. package/dist/memory/layers/observational-memory.js +0 -109
  144. package/dist/memory/layers/plan.d.ts +0 -55
  145. package/dist/memory/layers/plan.js +0 -374
  146. package/dist/memory/layers/static-content.d.ts +0 -27
  147. package/dist/memory/layers/static-content.js +0 -35
  148. package/dist/memory/layers/steering.d.ts +0 -51
  149. package/dist/memory/layers/steering.js +0 -258
  150. package/dist/memory/layers/temporal.d.ts +0 -91
  151. package/dist/memory/layers/temporal.js +0 -245
  152. package/dist/memory/layers/tool-memory-layer.d.ts +0 -16
  153. package/dist/memory/layers/tool-memory-layer.js +0 -43
  154. package/dist/memory/layers/working-memory.d.ts +0 -44
  155. package/dist/memory/layers/working-memory.js +0 -92
  156. package/dist/memory/projector.d.ts +0 -10
  157. package/dist/memory/projector.js +0 -19
  158. package/dist/memory/scope.d.ts +0 -3
  159. package/dist/memory/scope.js +0 -31
  160. package/dist/memory/strip-unresolved.d.ts +0 -13
  161. package/dist/memory/strip-unresolved.js +0 -35
  162. package/dist/schemas/item.d.ts +0 -35
  163. package/dist/schemas/item.js +0 -155
  164. package/dist/types/channel.d.ts +0 -29
  165. package/dist/types/channel.js +0 -1
  166. package/dist/types/common.d.ts +0 -68
  167. package/dist/types/common.js +0 -1
  168. package/dist/types/context-parts/item-log.d.ts +0 -6
  169. package/dist/types/context-parts/item-log.js +0 -1
  170. package/dist/types/context-parts/layer-usage.d.ts +0 -18
  171. package/dist/types/context-parts/layer-usage.js +0 -1
  172. package/dist/types/context.d.ts +0 -202
  173. package/dist/types/context.js +0 -1
  174. package/dist/types/detached.d.ts +0 -17
  175. package/dist/types/detached.js +0 -7
  176. package/dist/types/error.d.ts +0 -66
  177. package/dist/types/error.js +0 -1
  178. package/dist/types/fs-adapter.d.ts +0 -51
  179. package/dist/types/fs-adapter.js +0 -3
  180. package/dist/types/harness-result.d.ts +0 -43
  181. package/dist/types/harness-result.js +0 -2
  182. package/dist/types/items.d.ts +0 -131
  183. package/dist/types/items.js +0 -2
  184. package/dist/types/memory-context.d.ts +0 -39
  185. package/dist/types/memory-context.js +0 -1
  186. package/dist/types/memory.d.ts +0 -306
  187. package/dist/types/memory.js +0 -13
  188. package/dist/types/observability.d.ts +0 -30
  189. package/dist/types/observability.js +0 -1
  190. package/dist/types/runtime.d.ts +0 -256
  191. package/dist/types/runtime.js +0 -1
  192. package/dist/types/shell-adapter.d.ts +0 -34
  193. package/dist/types/shell-adapter.js +0 -10
  194. package/dist/types/steering.d.ts +0 -89
  195. package/dist/types/steering.js +0 -14
  196. package/dist/types/step.d.ts +0 -231
  197. package/dist/types/step.js +0 -1
  198. package/dist/types/subprocess-adapter.d.ts +0 -157
  199. package/dist/types/subprocess-adapter.js +0 -3
  200. package/dist/types/tool-context.d.ts +0 -34
  201. package/dist/types/tool-context.js +0 -1
  202. package/dist/types/tool.d.ts +0 -64
  203. package/dist/types/tool.js +0 -1
  204. package/dist/util/framework-cast.d.ts +0 -10
  205. package/dist/util/framework-cast.js +0 -16
  206. package/dist/util/message-helpers.d.ts +0 -17
  207. package/dist/util/message-helpers.js +0 -64
@@ -1,79 +0,0 @@
1
- import type { ZodType } from 'zod';
2
- export interface DurableTaskState {
3
- checkpoints: Array<{
4
- timestamp: number;
5
- depth: number;
6
- }>;
7
- files: string[];
8
- data: Record<string, unknown>;
9
- }
10
- export interface DurableTaskStateSerializer {
11
- serialize(state: DurableTaskState): string;
12
- deserialize(data: string): DurableTaskState;
13
- }
14
- export interface DurableTaskStateConfig {
15
- baseDir?: string;
16
- gitCommit?: boolean;
17
- schema?: ZodType;
18
- serializer?: DurableTaskStateSerializer;
19
- }
20
- /**
21
- * Creates a memory layer that persists task checkpoints, files, and arbitrary data across iterations.
22
- *
23
- * @public
24
- * @param _config - Optional configuration for base directory, git commit behavior, schema, and serializer.
25
- * @returns A `MemoryLayer` scoped to the execution with durable task state.
26
- */
27
- export declare function durableTaskState(_config?: DurableTaskStateConfig): {
28
- id: "durable-task-state";
29
- name: string;
30
- slot: number;
31
- scope: "execution";
32
- budget: {
33
- min: number;
34
- max: number;
35
- };
36
- timeouts: {
37
- store: number;
38
- };
39
- hooks: {
40
- init({ storage }: import("../../index.js").InitParams): Promise<{
41
- state: DurableTaskState;
42
- }>;
43
- recall({ state }: import("../../index.js").RecallParams<DurableTaskState>): Promise<{
44
- items: import("../../index.js").InputMessageItem[];
45
- tokenCount: number;
46
- } | null>;
47
- store({ state, ctx }: import("../../index.js").StoreParams<DurableTaskState>): Promise<{
48
- state: DurableTaskState;
49
- }>;
50
- onSpawn({ parentState }: import("../../index.js").SpawnParams<DurableTaskState>): Promise<{
51
- childState: DurableTaskState;
52
- items: never[];
53
- }>;
54
- onReturn({ childState, parentState }: import("../../index.js").ReturnParams<DurableTaskState>): Promise<{
55
- parentState: {
56
- checkpoints: {
57
- timestamp: number;
58
- depth: number;
59
- }[];
60
- files: string[];
61
- data: {
62
- [x: string]: unknown;
63
- };
64
- };
65
- }>;
66
- onComplete({ state, outcome }: import("../../index.js").CompleteParams<DurableTaskState>): Promise<{
67
- state: {
68
- data: {
69
- __outcome: import("../../index.js").ExecutionOutcome;
70
- };
71
- checkpoints: {
72
- timestamp: number;
73
- depth: number;
74
- }[];
75
- files: string[];
76
- };
77
- } | undefined>;
78
- };
79
- };
@@ -1,118 +0,0 @@
1
- import { Slot } from '../../types/memory.js';
2
- import { createMessage, estimateTokens } from '../../util/message-helpers.js';
3
- /**
4
- * Creates a memory layer that persists task checkpoints, files, and arbitrary data across iterations.
5
- *
6
- * @public
7
- * @param _config - Optional configuration for base directory, git commit behavior, schema, and serializer.
8
- * @returns A `MemoryLayer` scoped to the execution with durable task state.
9
- */
10
- export function durableTaskState(_config) {
11
- return {
12
- id: 'durable-task-state',
13
- name: 'Durable Task State',
14
- slot: Slot.WORKING_MEMORY + 10, // 110
15
- scope: 'execution',
16
- budget: {
17
- min: 100,
18
- max: 800,
19
- },
20
- timeouts: {
21
- store: 30_000,
22
- },
23
- hooks: {
24
- async init({ storage }) {
25
- const saved = await storage.get('state');
26
- return {
27
- state: saved ?? {
28
- checkpoints: [],
29
- files: [],
30
- data: {},
31
- },
32
- };
33
- },
34
- async recall({ state }) {
35
- if (!state) {
36
- return null;
37
- }
38
- const text = `<task_state>\n${JSON.stringify(state, null, 2)}\n</task_state>`;
39
- return {
40
- items: [
41
- createMessage(text, 'developer'),
42
- ],
43
- tokenCount: estimateTokens(text),
44
- };
45
- },
46
- async store({ state, ctx }) {
47
- const currentState = state ?? {
48
- checkpoints: [],
49
- files: [],
50
- data: {},
51
- };
52
- // Add a checkpoint for each store call
53
- const newState = {
54
- ...currentState,
55
- checkpoints: [
56
- ...currentState.checkpoints,
57
- {
58
- timestamp: Date.now(),
59
- depth: ctx.depth,
60
- },
61
- ],
62
- };
63
- return {
64
- state: newState,
65
- };
66
- },
67
- async onSpawn({ parentState }) {
68
- // ALWAYS provides child state (unlike other layers)
69
- return {
70
- childState: structuredClone(parentState),
71
- items: [],
72
- };
73
- },
74
- async onReturn({ childState, parentState }) {
75
- // Merge child artifacts back to parent
76
- return {
77
- parentState: {
78
- checkpoints: [
79
- ...parentState.checkpoints,
80
- ...childState.checkpoints,
81
- ],
82
- files: [
83
- ...new Set([
84
- ...parentState.files,
85
- ...childState.files,
86
- ]),
87
- ],
88
- data: {
89
- ...parentState.data,
90
- ...childState.data,
91
- },
92
- },
93
- };
94
- },
95
- async onComplete({ state, outcome }) {
96
- if (!state) {
97
- return;
98
- }
99
- return {
100
- state: {
101
- ...state,
102
- data: {
103
- ...state.data,
104
- __outcome: outcome,
105
- },
106
- checkpoints: [
107
- ...state.checkpoints,
108
- {
109
- timestamp: Date.now(),
110
- depth: 0,
111
- },
112
- ],
113
- },
114
- };
115
- },
116
- },
117
- };
118
- }
@@ -1,55 +0,0 @@
1
- import type { MemoryLayer } from '../../types/memory.js';
2
- interface TrackedFile {
3
- /** Absolute path to the file */
4
- absolutePath: string;
5
- /** Original reference path (as written by user) */
6
- referencePath: string;
7
- /** File content (null if deleted or error) */
8
- content: string | null;
9
- /** LLM-assigned priority score (0-100, higher = more relevant) */
10
- priority: number;
11
- /** Content hash for change detection */
12
- contentHash: string;
13
- /** Whether the file has been deleted */
14
- deleted: boolean;
15
- /** Estimated token count */
16
- tokenCount: number;
17
- /** Error message if file couldn't be read (security, size, permission) */
18
- error?: string;
19
- }
20
- interface FileReferenceState {
21
- /** Map of reference path to tracked file info */
22
- files: Map<string, TrackedFile>;
23
- /** Base directory for resolving relative paths */
24
- baseDir: string;
25
- }
26
- interface FileReferenceOptions {
27
- /** Base directory for resolving relative paths (defaults to cwd) */
28
- baseDir?: string;
29
- /** Slot position (defaults to Slot.RAG) */
30
- slot?: number;
31
- /** Model to use for priority scoring */
32
- scoringModel?: string;
33
- /** Maximum file size in bytes (defaults to 1MB) */
34
- maxFileSize?: number;
35
- /** Whether to follow symlinks (defaults to false for security) */
36
- followSymlinks?: boolean;
37
- /** Allowed file extensions (defaults to common code/text extensions) */
38
- allowedExtensions?: string[];
39
- }
40
- /**
41
- * Creates a memory layer that tracks file references in user messages.
42
- *
43
- * Syntax: `#path/to/file` in user messages
44
- *
45
- * Behavior:
46
- * - Transforms references to markdown anchor links `[#path/to/file](#path-to-file)`
47
- * - Scores file relevance using LLM when first referenced
48
- * - Injects file contents into context via recall(), ordered by priority
49
- * - Detects file changes on each new message, triggers immediate re-render
50
- * - Shows warning for deleted files
51
- *
52
- * @public
53
- */
54
- export declare function fileReference(opts?: FileReferenceOptions): MemoryLayer<FileReferenceState>;
55
- export {};