@toolproof-core/lib 1.0.17 → 1.0.19

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.
@@ -77,13 +77,13 @@ export function extractRoleMapFromRawStrategy(rawStrategy: RawStrategyJson, jobM
77
77
  const job = jobMap.get(jobHandle);
78
78
  if (!job) continue;
79
79
 
80
- for (const [rid, role] of Object.entries(job.roles.inputRoleValueByIdentity)) {
80
+ for (const [rid, role] of Object.entries(job.roleSpec.inputRoleValueByIdentity)) {
81
81
  roleMap.set(rid as ResourceRoleIdentityJson, {
82
82
  identity: rid as ResourceRoleIdentityJson,
83
83
  ...role,
84
84
  });
85
85
  }
86
- for (const [rid, role] of Object.entries(job.roles.outputRoleValueByIdentity)) {
86
+ for (const [rid, role] of Object.entries(job.roleSpec.outputRoleValueByIdentity)) {
87
87
  roleMap.set(rid as ResourceRoleIdentityJson, {
88
88
  identity: rid as ResourceRoleIdentityJson,
89
89
  ...role,
@@ -96,7 +96,7 @@ export function extractRoleMapFromRawStrategy(rawStrategy: RawStrategyJson, jobM
96
96
 
97
97
  export function extractSingleNonErrorOutputTypeHandle(job: JobJson): ResourceTypeIdentityJson | null {
98
98
  const errorRoleId = CONSTANTS.Cosmos.ROLE_ErrorOutput;
99
- const outputEntries = Object.entries(job.roles.outputRoleValueByIdentity).filter(([roleId]) => roleId !== errorRoleId);
99
+ const outputEntries = Object.entries(job.roleSpec.outputRoleValueByIdentity).filter(([roleId]) => roleId !== errorRoleId);
100
100
  if (!outputEntries || !outputEntries[0] || outputEntries.length !== 1) {
101
101
  throw new Error(`Job ${job.identity} must have exactly one non-error output role to be branchable/loopable`);
102
102
  } // ATTENTION_PUREIFY
@@ -90,24 +90,24 @@ export function getIndependentThreads(steps: StepJson[], strategyState: Strategy
90
90
  ensureOwner(ownerIndex);
91
91
 
92
92
  const jobStep = jobStepById.get(jobStepId);
93
- const inputBindings = jobStep?.roleBindings?.inputBindings ?? [];
93
+ const inputBindings = jobStep?.roleBindingSpec?.inputBindings ?? [];
94
94
  const bucket = strategyState?.[jobStepId] ?? ({} as any);
95
95
 
96
96
  for (const inputRoleHandle of inputBindings) {
97
97
  const entry = bucket?.[inputRoleHandle as ResourceRoleIdentityJson] as any;
98
- if (!entry || entry.resourceShellKind !== 'inputPotential') continue;
98
+ if (!entry || entry.resourceShellKind !== 'internalInputPotential') continue;
99
99
 
100
100
  const creatorJobStepHandle = entry?.creationContext?.jobStepHandle as JobStepIdentityJson | undefined;
101
101
  if (!creatorJobStepHandle) {
102
102
  throw new Error(
103
- `Unresolvable inputPotential in jobStep '${jobStepId}' (${getOwnerLabel(ownerIndex)}): missing creationContext.jobStepHandle for role '${inputRoleHandle}'`
103
+ `Unresolvable internalInputPotential in jobStep '${jobStepId}' (${getOwnerLabel(ownerIndex)}): missing creationContext.jobStepHandle for role '${inputRoleHandle}'`
104
104
  );
105
105
  }
106
106
 
107
107
  const producerOwner = jobStepIdToOwner.get(creatorJobStepHandle);
108
108
  if (producerOwner === undefined) {
109
109
  throw new Error(
110
- `Unresolvable inputPotential in jobStep '${jobStepId}' (${getOwnerLabel(ownerIndex)}): creator jobStepHandle '${creatorJobStepHandle}' not found in strategy steps`
110
+ `Unresolvable internalInputPotential in jobStep '${jobStepId}' (${getOwnerLabel(ownerIndex)}): creator jobStepHandle '${creatorJobStepHandle}' not found in strategy steps`
111
111
  );
112
112
  }
113
113
 
@@ -1,9 +1,9 @@
1
1
  import type {
2
2
  CreationContextJson,
3
+ ExternalInputPotentialShellJson,
4
+ InternalInputPotentialShellJson,
5
+ OutputPotentialShellJson,
3
6
  ResourceJson,
4
- ResourceMissingJson,
5
- ResourceInputPotentialJson,
6
- ResourceOutputPotentialJson,
7
7
  ResourcePotentialJson,
8
8
  StrategyStateJson,
9
9
  } from '@toolproof-core/schema';
@@ -11,8 +11,8 @@ import { CONSTANTS } from '../artifacts/artifacts.js';
11
11
 
12
12
  export type ResolveResult =
13
13
  | { status: typeof CONSTANTS.Enums.ResourceShellKind.materialized; entry: ResourceJson; path: CreationContextJson[] }
14
- | { status: typeof CONSTANTS.Enums.ResourceShellKind.missing; entry: ResourceMissingJson; path: CreationContextJson[] }
15
- | { status: typeof CONSTANTS.Enums.ResourceShellKind.outputPotential; entry: ResourceOutputPotentialJson; path: CreationContextJson[] }
14
+ | { status: typeof CONSTANTS.Enums.ResourceShellKind.externalInputPotential; entry: ExternalInputPotentialShellJson; path: CreationContextJson[] }
15
+ | { status: typeof CONSTANTS.Enums.ResourceShellKind.outputPotential; entry: OutputPotentialShellJson; path: CreationContextJson[] }
16
16
  | { status: 'unresolved'; reason: 'not-found' | 'cycle' | 'depth-exceeded'; path: CreationContextJson[] };
17
17
 
18
18
  export function resolveResourceChain(
@@ -45,16 +45,16 @@ export function resolveResourceChain(
45
45
  if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.materialized) {
46
46
  return { status: CONSTANTS.Enums.ResourceShellKind.materialized, entry: entry as ResourceJson, path };
47
47
  }
48
- if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.missing) {
49
- return { status: CONSTANTS.Enums.ResourceShellKind.missing, entry: entry as ResourceMissingJson, path };
48
+ if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.externalInputPotential) {
49
+ return { status: CONSTANTS.Enums.ResourceShellKind.externalInputPotential, entry: entry as ExternalInputPotentialShellJson, path };
50
50
  }
51
51
  if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.outputPotential) {
52
- return { status: CONSTANTS.Enums.ResourceShellKind.outputPotential, entry: entry as ResourceOutputPotentialJson, path };
52
+ return { status: CONSTANTS.Enums.ResourceShellKind.outputPotential, entry: entry as OutputPotentialShellJson, path };
53
53
  }
54
54
 
55
- // inputPotential: follow ref backwards
56
- if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.inputPotential) {
57
- current = (entry as ResourceInputPotentialJson).creationContext;
55
+ // internalInputPotential: follow ref backwards
56
+ if (entry.resourceShellKind === CONSTANTS.Enums.ResourceShellKind.internalInputPotential) {
57
+ current = (entry as InternalInputPotentialShellJson).creationContext;
58
58
  continue;
59
59
  }
60
60