@toolproof-core/lib 1.0.37 → 1.0.38

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.
@@ -37,10 +37,10 @@ export declare const CONSTANTS: {
37
37
  readonly Goal: "Goal";
38
38
  readonly GoalHandle: "GoalHandle";
39
39
  readonly InputPotential: "InputPotential";
40
- readonly InputResource: "InputResource";
41
40
  readonly InternalInputPotential: "InternalInputPotential";
42
41
  readonly JsonScalarLink: "JsonScalarLink";
43
42
  readonly JsonSchemaObject: "JsonSchemaObject";
43
+ readonly MaterializedResource: "MaterializedResource";
44
44
  readonly Name: "Name";
45
45
  readonly NameFacet: "NameFacet";
46
46
  readonly Natural: "Natural";
@@ -75,10 +75,10 @@ export declare const CONSTANTS: {
75
75
  readonly StrategyProvenance: "StrategyProvenance";
76
76
  readonly StrategyStartTracePoint: "StrategyStartTracePoint";
77
77
  readonly StrategyState: "StrategyState";
78
+ readonly StrategyStateEntry: "StrategyStateEntry";
79
+ readonly StrategyStateEntryByRoleName: "StrategyStateEntryByRoleName";
80
+ readonly StrategyStateEntryKind: "StrategyStateEntryKind";
78
81
  readonly StrategyStateFacet: "StrategyStateFacet";
79
- readonly StrategyStateInputEntry: "StrategyStateInputEntry";
80
- readonly StrategyStateInputEntryByRoleName: "StrategyStateInputEntryByRoleName";
81
- readonly StrategyStateInputKind: "StrategyStateInputKind";
82
82
  readonly StrategyTrace: "StrategyTrace";
83
83
  readonly StrategyTraceHandle: "StrategyTraceHandle";
84
84
  readonly Suite: "Suite";
@@ -185,8 +185,8 @@ export declare const CONSTANTS: {
185
185
  readonly while: "while";
186
186
  readonly for: "for";
187
187
  };
188
- readonly StrategyStateInputKind: {
189
- readonly inputResource: "inputResource";
188
+ readonly StrategyStateEntryKind: {
189
+ readonly materializedResource: "materializedResource";
190
190
  readonly externalInputPotential: "externalInputPotential";
191
191
  readonly internalInputPotential: "internalInputPotential";
192
192
  };
@@ -1,11 +1,11 @@
1
- import type { BranchStep, Case, ExternalInputPotential, ForStep, InputResource, InternalInputPotential, Resource, RoleName, Strategy, Tool, ToolHandle, ToolStep, ToolStepRoleAddress, WhileStep } from '@toolproof-core/genesis';
1
+ import type { BranchStep, Case, ExternalInputPotential, ForStep, MaterializedResource, InternalInputPotential, Resource, RoleName, Strategy, Tool, ToolHandle, ToolStep, ToolStepRoleAddress, WhileStep } from '@toolproof-core/genesis';
2
2
  export type MutableToolStepKey = string;
3
3
  export type MutableBranchStepKey = string;
4
4
  export type MutableWhileStepKey = string;
5
5
  export type MutableForStepKey = string;
6
6
  export type MutableLoopStepKey = MutableWhileStepKey | MutableForStepKey;
7
7
  export type MutableMacroStepKey = MutableBranchStepKey | MutableLoopStepKey;
8
- export type MutableInputResource = InputResource;
8
+ export type MutableMaterializedResource = MaterializedResource;
9
9
  export type MutableToolStepRoleAddress<TKey extends string = MutableToolStepKey> = Omit<ToolStepRoleAddress, 'toolStepPath'> & {
10
10
  toolStepKey: TKey;
11
11
  };
@@ -13,9 +13,9 @@ export type MutableInternalInputPotential<TKey extends string = MutableToolStepK
13
13
  toolStepRoleAddress: MutableToolStepRoleAddress<TKey>;
14
14
  };
15
15
  export type MutableExternalInputPotential = ExternalInputPotential;
16
- export type MutableStrategyStateInputEntry<TKey extends string = MutableToolStepKey> = MutableInputResource | MutableInternalInputPotential<TKey> | MutableExternalInputPotential;
17
- export type MutableStrategyStateInputEntryByRoleName<TKey extends string = MutableToolStepKey> = Partial<Record<RoleName, MutableStrategyStateInputEntry<TKey>>>;
18
- export type MutableStrategyState<TKey extends string = MutableToolStepKey> = Partial<Record<TKey, MutableStrategyStateInputEntryByRoleName<TKey>>>;
16
+ export type MutableStrategyStateEntry<TKey extends string = MutableToolStepKey> = MutableMaterializedResource | MutableInternalInputPotential<TKey> | MutableExternalInputPotential;
17
+ export type MutableStrategyStateEntryByRoleName<TKey extends string = MutableToolStepKey> = Partial<Record<RoleName, MutableStrategyStateEntry<TKey>>>;
18
+ export type MutableStrategyState<TKey extends string = MutableToolStepKey> = Partial<Record<TKey, MutableStrategyStateEntryByRoleName<TKey>>>;
19
19
  export type MutableToolStep<TKey extends string = MutableToolStepKey> = ToolStep & {
20
20
  toolStepKey: TKey;
21
21
  };
@@ -43,11 +43,11 @@ export type MutableStrategy<TKey extends string = MutableToolStepKey, TStep exte
43
43
  export declare function getAuthoringSteps<TKey extends string = MutableToolStepKey, TStep extends MutableStep<TKey> = MutableStep<TKey>, TState extends MutableStrategyState<TKey> = MutableStrategyState<TKey>>(strategy: MutableStrategy<TKey, TStep, TState>): TStep[];
44
44
  export declare function setAuthoringSteps<// ATTENTION
45
45
  TKey extends string = MutableToolStepKey, TStep extends MutableStep<TKey> = MutableStep<TKey>, TState extends MutableStrategyState<TKey> = MutableStrategyState<TKey>>(strategy: MutableStrategy<TKey, TStep, TState>, steps: TStep[]): MutableStrategy<TKey, TStep, TState>;
46
- export declare function getStrategyStateInputEntryByRoleName<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, toolStepKey: TKey): MutableStrategyStateInputEntryByRoleName<TKey> | undefined;
47
- export declare function getStrategyStateInputEntry<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, toolStepRoleAddress: MutableToolStepRoleAddress<TKey>): MutableStrategyStateInputEntry<TKey> | undefined;
48
- export declare function setStrategyStateInputEntry<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, toolStepRoleAddress: MutableToolStepRoleAddress<TKey>, entry: MutableStrategyStateInputEntry<TKey>): TStrategyState;
46
+ export declare function getStrategyStateEntryByRoleName<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, toolStepKey: TKey): MutableStrategyStateEntryByRoleName<TKey> | undefined;
47
+ export declare function getStrategyStateEntry<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, toolStepRoleAddress: MutableToolStepRoleAddress<TKey>): MutableStrategyStateEntry<TKey> | undefined;
48
+ export declare function setStrategyStateEntry<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, toolStepRoleAddress: MutableToolStepRoleAddress<TKey>, entry: MutableStrategyStateEntry<TKey>): TStrategyState;
49
49
  export declare function clearInputBinding<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, toolStepRoleAddress: MutableToolStepRoleAddress<TKey>): TStrategyState;
50
- export declare function bindInputResource<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, target: MutableToolStepRoleAddress<TKey>, resource: Resource): TStrategyState;
50
+ export declare function bindMaterializedResource<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, target: MutableToolStepRoleAddress<TKey>, resource: Resource): TStrategyState;
51
51
  export declare function bindInternalInputPotential<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(strategyState: TStrategyState, targetAddress: MutableToolStepRoleAddress<TKey>, sourceAddress: MutableToolStepRoleAddress<TKey>, context: {
52
52
  toolStepByKey: ReadonlyMap<TKey, MutableToolStep<TKey>>;
53
53
  toolMap: ReadonlyMap<ToolHandle, Tool>;
@@ -10,15 +10,15 @@ export function setAuthoringSteps(strategy, steps) {
10
10
  stepsByThreadIndex: nextStepsByThreadIndex,
11
11
  };
12
12
  }
13
- export function getStrategyStateInputEntryByRoleName(strategyState, toolStepKey) {
13
+ export function getStrategyStateEntryByRoleName(strategyState, toolStepKey) {
14
14
  return strategyState[toolStepKey];
15
15
  }
16
- export function getStrategyStateInputEntry(strategyState, toolStepRoleAddress) {
17
- const inputEntryByRoleName = getStrategyStateInputEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey);
16
+ export function getStrategyStateEntry(strategyState, toolStepRoleAddress) {
17
+ const inputEntryByRoleName = getStrategyStateEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey);
18
18
  return inputEntryByRoleName?.[toolStepRoleAddress.roleName];
19
19
  }
20
- export function setStrategyStateInputEntry(strategyState, toolStepRoleAddress, entry) {
21
- const inputEntryByRoleName = getStrategyStateInputEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey) ?? {};
20
+ export function setStrategyStateEntry(strategyState, toolStepRoleAddress, entry) {
21
+ const inputEntryByRoleName = getStrategyStateEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey) ?? {};
22
22
  return {
23
23
  ...strategyState,
24
24
  [toolStepRoleAddress.toolStepKey]: {
@@ -28,7 +28,7 @@ export function setStrategyStateInputEntry(strategyState, toolStepRoleAddress, e
28
28
  };
29
29
  }
30
30
  export function clearInputBinding(strategyState, toolStepRoleAddress) {
31
- const inputEntryByRoleName = getStrategyStateInputEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey);
31
+ const inputEntryByRoleName = getStrategyStateEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey);
32
32
  if (!inputEntryByRoleName || !(toolStepRoleAddress.roleName in inputEntryByRoleName)) {
33
33
  return strategyState;
34
34
  }
@@ -44,12 +44,12 @@ export function clearInputBinding(strategyState, toolStepRoleAddress) {
44
44
  [toolStepRoleAddress.toolStepKey]: nextInputEntryByRoleName,
45
45
  };
46
46
  }
47
- export function bindInputResource(strategyState, target, resource) {
48
- const mutableInputResource = {
47
+ export function bindMaterializedResource(strategyState, target, resource) {
48
+ const mutableMaterializedResource = {
49
49
  ...resource,
50
- strategyStateInputKind: 'inputResource',
50
+ strategyStateEntryKind: 'materializedResource',
51
51
  };
52
- return setStrategyStateInputEntry(strategyState, target, mutableInputResource);
52
+ return setStrategyStateEntry(strategyState, target, mutableMaterializedResource);
53
53
  }
54
54
  function getInputRoleValue(tool, roleName) {
55
55
  return tool.roleSpec.inputRoleValueByName[roleName];
@@ -99,8 +99,8 @@ export function bindInternalInputPotential(strategyState, targetAddress, sourceA
99
99
  if (!sourceRoleType || !targetRoleType || sourceRoleType !== targetRoleType) {
100
100
  throw new Error(`Reference type mismatch between source (${sourceAddress.toolStepKey}, ${sourceAddress.roleName}) and target (${targetAddress.toolStepKey}, ${targetAddress.roleName}).`);
101
101
  }
102
- return setStrategyStateInputEntry(strategyState, targetAddress, {
103
- strategyStateInputKind: 'internalInputPotential',
102
+ return setStrategyStateEntry(strategyState, targetAddress, {
103
+ strategyStateEntryKind: 'internalInputPotential',
104
104
  toolStepRoleAddress: {
105
105
  toolStepKey: sourceAddress.toolStepKey,
106
106
  roleName: sourceAddress.roleName,
@@ -109,7 +109,7 @@ export function bindInternalInputPotential(strategyState, targetAddress, sourceA
109
109
  }
110
110
  export function bindExternalInputPotential(strategyState, target) {
111
111
  const mutableExternalInputPotential = {
112
- strategyStateInputKind: 'externalInputPotential',
112
+ strategyStateEntryKind: 'externalInputPotential',
113
113
  };
114
- return setStrategyStateInputEntry(strategyState, target, mutableExternalInputPotential);
114
+ return setStrategyStateEntry(strategyState, target, mutableExternalInputPotential);
115
115
  }
@@ -59,7 +59,7 @@ export function getIndependentThreads(steps, strategyState) {
59
59
  const bucket = strategyState[toolStepKey];
60
60
  for (const inputRoleId of inputBindings) {
61
61
  const entry = bucket?.[inputRoleId];
62
- if (!entry || entry.strategyStateInputKind !== 'internalInputPotential')
62
+ if (!entry || entry.strategyStateEntryKind !== 'internalInputPotential')
63
63
  continue;
64
64
  const producerToolStepKey = entry.toolStepRoleAddress?.toolStepKey;
65
65
  if (typeof producerToolStepKey !== 'string') {
@@ -40,7 +40,7 @@ function buildExecutionPathMap(strategy) {
40
40
  return executionPathByKey;
41
41
  }
42
42
  function toCanonicalStrategyStateEntry(entry, executionPathByKey) {
43
- if (entry.strategyStateInputKind !== 'internalInputPotential') {
43
+ if (entry.strategyStateEntryKind !== 'internalInputPotential') {
44
44
  return entry;
45
45
  }
46
46
  const sourceToolStepPath = executionPathByKey.get(entry.toolStepRoleAddress.toolStepKey);
@@ -48,7 +48,7 @@ function toCanonicalStrategyStateEntry(entry, executionPathByKey) {
48
48
  throw new Error(`Cannot project strategy state: no execution path found for toolStepKey '${entry.toolStepRoleAddress.toolStepKey}'.`);
49
49
  }
50
50
  return {
51
- strategyStateInputKind: 'internalInputPotential',
51
+ strategyStateEntryKind: 'internalInputPotential',
52
52
  toolStepRoleAddress: {
53
53
  toolStepPath: sourceToolStepPath,
54
54
  roleName: entry.toolStepRoleAddress.roleName,
@@ -81,7 +81,7 @@ function toCanonicalStep(step) {
81
81
  }
82
82
  }
83
83
  function toMutableStrategyStateEntry(entry, executionKeyByPath) {
84
- if (entry.strategyStateInputKind !== 'internalInputPotential') {
84
+ if (entry.strategyStateEntryKind !== 'internalInputPotential') {
85
85
  return entry;
86
86
  }
87
87
  const sourceToolStepKey = executionKeyByPath.get(entry.toolStepRoleAddress.toolStepPath);
@@ -89,7 +89,7 @@ function toMutableStrategyStateEntry(entry, executionKeyByPath) {
89
89
  throw new Error(`Cannot deproject strategy state: no mutable key found for toolStepPath '${entry.toolStepRoleAddress.toolStepPath}'.`);
90
90
  }
91
91
  return {
92
- strategyStateInputKind: 'internalInputPotential',
92
+ strategyStateEntryKind: 'internalInputPotential',
93
93
  toolStepRoleAddress: {
94
94
  toolStepKey: sourceToolStepKey,
95
95
  roleName: entry.toolStepRoleAddress.roleName,
@@ -1,7 +1,7 @@
1
- import type { MutableInputResource, MutableExternalInputPotential, MutableStrategyState, MutableToolStepKey, MutableToolStepRoleAddress } from './mutableStrategyOverlay.js';
1
+ import type { MutableMaterializedResource, MutableExternalInputPotential, MutableStrategyState, MutableToolStepKey, MutableToolStepRoleAddress } from './mutableStrategyOverlay.js';
2
2
  export type ResolveResult<TKey extends string = MutableToolStepKey> = {
3
- status: 'inputResource';
4
- entry: MutableInputResource;
3
+ status: 'materializedResource';
4
+ entry: MutableMaterializedResource;
5
5
  path: MutableToolStepRoleAddress<TKey>[];
6
6
  } | {
7
7
  status: 'externalInputPotential';
@@ -1,4 +1,4 @@
1
- import { getStrategyStateInputEntry } from './mutableStrategyOverlay.js';
1
+ import { getStrategyStateEntry } from './mutableStrategyOverlay.js';
2
2
  export function resolveStrategyStateChain(strategyState, start, opts) {
3
3
  const maxDepth = opts?.maxDepth ?? 50;
4
4
  const visited = new Set();
@@ -11,14 +11,14 @@ export function resolveStrategyStateChain(strategyState, start, opts) {
11
11
  return { status: 'unresolved', reason: 'cycle', path };
12
12
  }
13
13
  visited.add(visitKey);
14
- const entry = getStrategyStateInputEntry(strategyState, current);
14
+ const entry = getStrategyStateEntry(strategyState, current);
15
15
  if (!entry) {
16
16
  return { status: 'unresolved', reason: 'not-found', path };
17
17
  }
18
- if (entry.strategyStateInputKind === 'inputResource') {
19
- return { status: 'inputResource', entry, path };
18
+ if (entry.strategyStateEntryKind === 'materializedResource') {
19
+ return { status: 'materializedResource', entry, path };
20
20
  }
21
- if (entry.strategyStateInputKind === 'externalInputPotential') {
21
+ if (entry.strategyStateEntryKind === 'externalInputPotential') {
22
22
  return { status: 'externalInputPotential', entry, path };
23
23
  }
24
24
  current = entry.toolStepRoleAddress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolproof-core/lib",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -72,7 +72,7 @@
72
72
  "@types/node": "^22.0.0"
73
73
  },
74
74
  "dependencies": {
75
- "@toolproof-core/genesis": "^1.0.58",
75
+ "@toolproof-core/genesis": "^1.0.59",
76
76
  "firebase-admin": "^13.7.0"
77
77
  },
78
78
  "scripts": {
@@ -3,7 +3,7 @@ import type {
3
3
  Case,
4
4
  ExternalInputPotential,
5
5
  ForStep,
6
- InputResource,
6
+ MaterializedResource,
7
7
  InternalInputPotential,
8
8
  Resource,
9
9
  RoleName,
@@ -23,7 +23,7 @@ export type MutableForStepKey = string;
23
23
  export type MutableLoopStepKey = MutableWhileStepKey | MutableForStepKey;
24
24
  export type MutableMacroStepKey = MutableBranchStepKey | MutableLoopStepKey;
25
25
 
26
- export type MutableInputResource = InputResource;
26
+ export type MutableMaterializedResource = MaterializedResource;
27
27
 
28
28
  export type MutableToolStepRoleAddress<TKey extends string = MutableToolStepKey> =
29
29
  Omit<ToolStepRoleAddress, 'toolStepPath'> & {
@@ -37,18 +37,18 @@ export type MutableInternalInputPotential<TKey extends string = MutableToolStepK
37
37
 
38
38
  export type MutableExternalInputPotential = ExternalInputPotential;
39
39
 
40
- export type MutableStrategyStateInputEntry<TKey extends string = MutableToolStepKey> =
41
- | MutableInputResource
40
+ export type MutableStrategyStateEntry<TKey extends string = MutableToolStepKey> =
41
+ | MutableMaterializedResource
42
42
  | MutableInternalInputPotential<TKey>
43
43
  | MutableExternalInputPotential;
44
44
 
45
- export type MutableStrategyStateInputEntryByRoleName<
45
+ export type MutableStrategyStateEntryByRoleName<
46
46
  TKey extends string = MutableToolStepKey,
47
- > = Partial<Record<RoleName, MutableStrategyStateInputEntry<TKey>>>;
47
+ > = Partial<Record<RoleName, MutableStrategyStateEntry<TKey>>>;
48
48
 
49
49
  export type MutableStrategyState<
50
50
  TKey extends string = MutableToolStepKey,
51
- > = Partial<Record<TKey, MutableStrategyStateInputEntryByRoleName<TKey>>>;
51
+ > = Partial<Record<TKey, MutableStrategyStateEntryByRoleName<TKey>>>;
52
52
 
53
53
  export type MutableToolStep<TKey extends string = MutableToolStepKey> = ToolStep & {
54
54
  toolStepKey: TKey;
@@ -116,27 +116,27 @@ export function setAuthoringSteps< // ATTENTION
116
116
  };
117
117
  }
118
118
 
119
- export function getStrategyStateInputEntryByRoleName<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(
119
+ export function getStrategyStateEntryByRoleName<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(
120
120
  strategyState: TStrategyState,
121
121
  toolStepKey: TKey,
122
- ): MutableStrategyStateInputEntryByRoleName<TKey> | undefined {
122
+ ): MutableStrategyStateEntryByRoleName<TKey> | undefined {
123
123
  return strategyState[toolStepKey];
124
124
  }
125
125
 
126
- export function getStrategyStateInputEntry<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(
126
+ export function getStrategyStateEntry<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(
127
127
  strategyState: TStrategyState,
128
128
  toolStepRoleAddress: MutableToolStepRoleAddress<TKey>,
129
- ): MutableStrategyStateInputEntry<TKey> | undefined {
130
- const inputEntryByRoleName = getStrategyStateInputEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey);
129
+ ): MutableStrategyStateEntry<TKey> | undefined {
130
+ const inputEntryByRoleName = getStrategyStateEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey);
131
131
  return inputEntryByRoleName?.[toolStepRoleAddress.roleName];
132
132
  }
133
133
 
134
- export function setStrategyStateInputEntry<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(
134
+ export function setStrategyStateEntry<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(
135
135
  strategyState: TStrategyState,
136
136
  toolStepRoleAddress: MutableToolStepRoleAddress<TKey>,
137
- entry: MutableStrategyStateInputEntry<TKey>,
137
+ entry: MutableStrategyStateEntry<TKey>,
138
138
  ): TStrategyState {
139
- const inputEntryByRoleName = getStrategyStateInputEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey) ?? {};
139
+ const inputEntryByRoleName = getStrategyStateEntryByRoleName(strategyState, toolStepRoleAddress.toolStepKey) ?? {};
140
140
 
141
141
  return {
142
142
  ...strategyState,
@@ -155,7 +155,7 @@ export function clearInputBinding<
155
155
  toolStepRoleAddress: MutableToolStepRoleAddress<TKey>,
156
156
  ): TStrategyState {
157
157
  const inputEntryByRoleName =
158
- getStrategyStateInputEntryByRoleName(
158
+ getStrategyStateEntryByRoleName(
159
159
  strategyState,
160
160
  toolStepRoleAddress.toolStepKey,
161
161
  );
@@ -179,17 +179,17 @@ export function clearInputBinding<
179
179
  };
180
180
  }
181
181
 
182
- export function bindInputResource<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(
182
+ export function bindMaterializedResource<TKey extends string, TStrategyState extends MutableStrategyState<TKey>>(
183
183
  strategyState: TStrategyState,
184
184
  target: MutableToolStepRoleAddress<TKey>,
185
185
  resource: Resource,
186
186
  ): TStrategyState {
187
- const mutableInputResource: MutableInputResource = {
187
+ const mutableMaterializedResource: MutableMaterializedResource = {
188
188
  ...resource,
189
- strategyStateInputKind: 'inputResource',
189
+ strategyStateEntryKind: 'materializedResource',
190
190
  };
191
191
 
192
- return setStrategyStateInputEntry(strategyState, target, mutableInputResource);
192
+ return setStrategyStateEntry(strategyState, target, mutableMaterializedResource);
193
193
  }
194
194
 
195
195
  function getInputRoleValue(tool: Tool, roleName: RoleName) {
@@ -265,8 +265,8 @@ export function bindInternalInputPotential<TKey extends string, TStrategyState e
265
265
  );
266
266
  }
267
267
 
268
- return setStrategyStateInputEntry(strategyState, targetAddress, {
269
- strategyStateInputKind: 'internalInputPotential',
268
+ return setStrategyStateEntry(strategyState, targetAddress, {
269
+ strategyStateEntryKind: 'internalInputPotential',
270
270
  toolStepRoleAddress: {
271
271
  toolStepKey: sourceAddress.toolStepKey,
272
272
  roleName: sourceAddress.roleName,
@@ -279,8 +279,8 @@ export function bindExternalInputPotential<TKey extends string, TStrategyState e
279
279
  target: MutableToolStepRoleAddress<TKey>,
280
280
  ): TStrategyState {
281
281
  const mutableExternalInputPotential: MutableExternalInputPotential = {
282
- strategyStateInputKind: 'externalInputPotential',
282
+ strategyStateEntryKind: 'externalInputPotential',
283
283
  };
284
284
 
285
- return setStrategyStateInputEntry(strategyState, target, mutableExternalInputPotential);
285
+ return setStrategyStateEntry(strategyState, target, mutableExternalInputPotential);
286
286
  }
@@ -93,7 +93,7 @@ export function getIndependentThreads<
93
93
 
94
94
  for (const inputRoleId of inputBindings) {
95
95
  const entry = bucket?.[inputRoleId];
96
- if (!entry || entry.strategyStateInputKind !== 'internalInputPotential') continue;
96
+ if (!entry || entry.strategyStateEntryKind !== 'internalInputPotential') continue;
97
97
 
98
98
  const producerToolStepKey = entry.toolStepRoleAddress?.toolStepKey;
99
99
  if (typeof producerToolStepKey !== 'string') {
@@ -3,12 +3,12 @@ import type {
3
3
  Case,
4
4
  ExternalInputPotential,
5
5
  ForStep,
6
- InputResource,
6
+ MaterializedResource,
7
7
  InternalInputPotential,
8
8
  RoleName,
9
9
  Step,
10
10
  Strategy,
11
- StrategyStateInputEntry,
11
+ StrategyStateEntry,
12
12
  ToolStep,
13
13
  ToolStepPath,
14
14
  WhileStep,
@@ -21,7 +21,7 @@ import type {
21
21
  MutableInternalInputPotential,
22
22
  MutableStrategy,
23
23
  MutableStep,
24
- MutableStrategyStateInputEntry,
24
+ MutableStrategyStateEntry,
25
25
  MutableToolStepKey,
26
26
  MutableWhileStep,
27
27
  } from './mutableStrategyOverlay.js';
@@ -73,11 +73,11 @@ function buildExecutionPathMap(strategy: MutableStrategy): Map<MutableToolStepKe
73
73
  }
74
74
 
75
75
  function toCanonicalStrategyStateEntry(
76
- entry: MutableStrategyStateInputEntry,
76
+ entry: MutableStrategyStateEntry,
77
77
  executionPathByKey: ReadonlyMap<MutableToolStepKey, ToolStepPath>,
78
- ): StrategyStateInputEntry {
79
- if (entry.strategyStateInputKind !== 'internalInputPotential') {
80
- return entry as InputResource | ExternalInputPotential;
78
+ ): StrategyStateEntry {
79
+ if (entry.strategyStateEntryKind !== 'internalInputPotential') {
80
+ return entry as MaterializedResource | ExternalInputPotential;
81
81
  }
82
82
 
83
83
  const sourceToolStepPath = executionPathByKey.get(entry.toolStepRoleAddress.toolStepKey);
@@ -86,7 +86,7 @@ function toCanonicalStrategyStateEntry(
86
86
  }
87
87
 
88
88
  return {
89
- strategyStateInputKind: 'internalInputPotential',
89
+ strategyStateEntryKind: 'internalInputPotential',
90
90
  toolStepRoleAddress: {
91
91
  toolStepPath: sourceToolStepPath,
92
92
  roleName: entry.toolStepRoleAddress.roleName,
@@ -121,11 +121,11 @@ function toCanonicalStep(step: MutableStep): Step {
121
121
  }
122
122
 
123
123
  function toMutableStrategyStateEntry(
124
- entry: StrategyStateInputEntry,
124
+ entry: StrategyStateEntry,
125
125
  executionKeyByPath: ReadonlyMap<ToolStepPath, MutableToolStepKey>,
126
- ): MutableStrategyStateInputEntry {
127
- if (entry.strategyStateInputKind !== 'internalInputPotential') {
128
- return entry as InputResource | ExternalInputPotential;
126
+ ): MutableStrategyStateEntry {
127
+ if (entry.strategyStateEntryKind !== 'internalInputPotential') {
128
+ return entry as MaterializedResource | ExternalInputPotential;
129
129
  }
130
130
 
131
131
  const sourceToolStepKey = executionKeyByPath.get(entry.toolStepRoleAddress.toolStepPath);
@@ -134,7 +134,7 @@ function toMutableStrategyStateEntry(
134
134
  }
135
135
 
136
136
  return {
137
- strategyStateInputKind: 'internalInputPotential',
137
+ strategyStateEntryKind: 'internalInputPotential',
138
138
  toolStepRoleAddress: {
139
139
  toolStepKey: sourceToolStepKey,
140
140
  roleName: entry.toolStepRoleAddress.roleName,
@@ -1,16 +1,16 @@
1
1
  import type {
2
- MutableInputResource,
2
+ MutableMaterializedResource,
3
3
  MutableExternalInputPotential,
4
4
  MutableInternalInputPotential,
5
5
  MutableStrategyState,
6
- MutableStrategyStateInputEntry,
6
+ MutableStrategyStateEntry,
7
7
  MutableToolStepKey,
8
8
  MutableToolStepRoleAddress,
9
9
  } from './mutableStrategyOverlay.js';
10
- import { getStrategyStateInputEntry } from './mutableStrategyOverlay.js';
10
+ import { getStrategyStateEntry } from './mutableStrategyOverlay.js';
11
11
 
12
12
  export type ResolveResult<TKey extends string = MutableToolStepKey> =
13
- | { status: 'inputResource'; entry: MutableInputResource; path: MutableToolStepRoleAddress<TKey>[] }
13
+ | { status: 'materializedResource'; entry: MutableMaterializedResource; path: MutableToolStepRoleAddress<TKey>[] }
14
14
  | { status: 'externalInputPotential'; entry: MutableExternalInputPotential; path: MutableToolStepRoleAddress<TKey>[] }
15
15
  | {
16
16
  status: 'unresolved';
@@ -37,16 +37,16 @@ export function resolveStrategyStateChain<TKey extends string, TStrategyState ex
37
37
  }
38
38
  visited.add(visitKey);
39
39
 
40
- const entry = getStrategyStateInputEntry(strategyState, current) as MutableStrategyStateInputEntry<TKey> | undefined;
40
+ const entry = getStrategyStateEntry(strategyState, current) as MutableStrategyStateEntry<TKey> | undefined;
41
41
  if (!entry) {
42
42
  return { status: 'unresolved', reason: 'not-found', path };
43
43
  }
44
44
 
45
- if (entry.strategyStateInputKind === 'inputResource') {
46
- return { status: 'inputResource', entry, path };
45
+ if (entry.strategyStateEntryKind === 'materializedResource') {
46
+ return { status: 'materializedResource', entry, path };
47
47
  }
48
48
 
49
- if (entry.strategyStateInputKind === 'externalInputPotential') {
49
+ if (entry.strategyStateEntryKind === 'externalInputPotential') {
50
50
  return { status: 'externalInputPotential', entry, path };
51
51
  }
52
52