@codemation/core 0.8.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/CHANGELOG.md +55 -0
- package/dist/bootstrap/index.cjs +2 -2
- package/dist/bootstrap/index.d.ts +1 -1
- package/dist/bootstrap/index.js +2 -2
- package/dist/{bootstrap-Bx1u4cbS.cjs → bootstrap-BfZE19lK.cjs} +2 -2
- package/dist/{bootstrap-Bx1u4cbS.cjs.map → bootstrap-BfZE19lK.cjs.map} +1 -1
- package/dist/{bootstrap-BoknFKnw.js → bootstrap-jqh1kCNI.js} +2 -2
- package/dist/{bootstrap-BoknFKnw.js.map → bootstrap-jqh1kCNI.js.map} +1 -1
- package/dist/{index-CVs9rVhl.d.ts → index-CGs3Hnoz.d.ts} +35 -13
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{runtime-Dvo2ru5A.cjs → runtime-DWKfb0BI.cjs} +2 -2
- package/dist/{runtime-Dvo2ru5A.cjs.map → runtime-DWKfb0BI.cjs.map} +1 -1
- package/dist/{runtime-DUW6tIJ1.js → runtime-u6O644ST.js} +2 -2
- package/dist/{runtime-DUW6tIJ1.js.map → runtime-u6O644ST.js.map} +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.js +2 -2
- package/package.json +1 -1
- package/src/ai/AiHost.ts +33 -14
- package/src/orchestration/RunStartService.ts +8 -1
package/dist/testing.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_runtime = require('./runtime-
|
|
1
|
+
const require_runtime = require('./runtime-DWKfb0BI.cjs');
|
|
2
2
|
const require_InMemoryRunEventBusRegistry = require('./InMemoryRunEventBusRegistry-B0_C4OnP.cjs');
|
|
3
|
-
const require_bootstrap = require('./bootstrap-
|
|
3
|
+
const require_bootstrap = require('./bootstrap-BfZE19lK.cjs');
|
|
4
4
|
let tsyringe = require("tsyringe");
|
|
5
5
|
tsyringe = require_runtime.__toESM(tsyringe);
|
|
6
6
|
|
package/dist/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as NodeExecutor, D as PersistedWorkflowTokenRegistry, E as WorkflowSnapshotCodec, F as InProcessRetryRunner, L as DefaultExecutionContextFactory, R as AllWorkflowsActiveWorkflowActivationPolicy, Rt as CoreTokens, T as NodeInstanceFactory, a as InMemoryLiveWorkflowRepository, b as DefaultDrivingScheduler, i as RunIntentService, it as emitPorts, l as Engine, st as DefaultAsyncSleeper, u as InMemoryRunDataFactory, v as InlineDrivingScheduler, y as HintOnlyOffloadPolicy } from "./runtime-
|
|
1
|
+
import { A as NodeExecutor, D as PersistedWorkflowTokenRegistry, E as WorkflowSnapshotCodec, F as InProcessRetryRunner, L as DefaultExecutionContextFactory, R as AllWorkflowsActiveWorkflowActivationPolicy, Rt as CoreTokens, T as NodeInstanceFactory, a as InMemoryLiveWorkflowRepository, b as DefaultDrivingScheduler, i as RunIntentService, it as emitPorts, l as Engine, st as DefaultAsyncSleeper, u as InMemoryRunDataFactory, v as InlineDrivingScheduler, y as HintOnlyOffloadPolicy } from "./runtime-u6O644ST.js";
|
|
2
2
|
import { n as WorkflowBuilder, t as InMemoryRunEventBus } from "./InMemoryRunEventBusRegistry-C2U83Hmv.js";
|
|
3
|
-
import { n as InMemoryWorkflowExecutionRepository, t as EngineRuntimeRegistrar } from "./bootstrap-
|
|
3
|
+
import { n as InMemoryWorkflowExecutionRepository, t as EngineRuntimeRegistrar } from "./bootstrap-jqh1kCNI.js";
|
|
4
4
|
import { container } from "tsyringe";
|
|
5
5
|
|
|
6
6
|
//#region src/testing/RejectingCredentialSessionService.ts
|
package/package.json
CHANGED
package/src/ai/AiHost.ts
CHANGED
|
@@ -142,30 +142,49 @@ export interface ChatModelConfig {
|
|
|
142
142
|
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Provider-neutral chat language model wrapper returned by a {@link ChatModelFactory}.
|
|
147
|
+
*
|
|
148
|
+
* Thin adapter around an AI SDK `LanguageModelV2` (from `@ai-sdk/provider`) plus the call-site
|
|
149
|
+
* defaults Codemation needs at every generate/stream: the provider label, the model name used for
|
|
150
|
+
* pricing / telemetry, and the default invocation options (max output tokens, temperature,
|
|
151
|
+
* provider-specific overrides).
|
|
152
|
+
*
|
|
153
|
+
* The consumer (AIAgentNode / AgentStructuredOutputRunner) passes `languageModel` directly into
|
|
154
|
+
* `generateText({ model, ... })` from the `ai` package.
|
|
155
|
+
*/
|
|
156
|
+
export interface ChatLanguageModel {
|
|
157
|
+
/** AI SDK `LanguageModelV2` instance (kept `unknown` to avoid leaking the SDK type into `@codemation/core`). */
|
|
158
|
+
readonly languageModel: unknown;
|
|
159
|
+
/** Stable pricing/telemetry key — e.g. `"gpt-4.1-nano"`. */
|
|
160
|
+
readonly modelName: string;
|
|
161
|
+
/** Provider label — e.g. `"openai"`. Used for cost tracking. */
|
|
162
|
+
readonly provider?: string;
|
|
163
|
+
/** Defaults merged into every call. Consumers may override per-invocation. */
|
|
164
|
+
readonly defaultCallOptions?: ChatLanguageModelCallOptions;
|
|
152
165
|
}
|
|
153
166
|
|
|
154
|
-
export interface
|
|
155
|
-
|
|
167
|
+
export interface ChatLanguageModelCallOptions {
|
|
168
|
+
readonly maxOutputTokens?: number;
|
|
169
|
+
readonly temperature?: number;
|
|
170
|
+
readonly providerOptions?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
|
|
156
171
|
}
|
|
157
172
|
|
|
158
|
-
|
|
159
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Options for a structured-output generate call. Mirrors
|
|
175
|
+
* `generateText({ output: Output.object(...) })` from the `ai` package.
|
|
176
|
+
*/
|
|
177
|
+
export interface StructuredOutputOptions {
|
|
178
|
+
/** Optional schema name — used by some providers as the JSON schema name attribute. */
|
|
179
|
+
readonly schemaName?: string;
|
|
180
|
+
/** When `true`, the consumer should pass a strict-mode-compatible JSON Schema record. */
|
|
160
181
|
readonly strict?: boolean;
|
|
161
|
-
readonly includeRaw?: boolean;
|
|
162
|
-
readonly tools?: ReadonlyArray<unknown>;
|
|
163
182
|
}
|
|
164
183
|
|
|
165
184
|
export interface ChatModelFactory<TConfig extends ChatModelConfig = ChatModelConfig> {
|
|
166
185
|
create(
|
|
167
186
|
args: Readonly<{ config: TConfig; ctx: NodeExecutionContext<any> }>,
|
|
168
|
-
): Promise<
|
|
187
|
+
): Promise<ChatLanguageModel> | ChatLanguageModel;
|
|
169
188
|
}
|
|
170
189
|
|
|
171
190
|
export type NodeBackedToolInputMapperArgs<
|
|
@@ -229,10 +229,17 @@ export class RunStartService {
|
|
|
229
229
|
currentState: RunCurrentState | undefined,
|
|
230
230
|
mutableState: NonNullable<Awaited<ReturnType<WorkflowExecutionRepository["load"]>>>["mutableState"],
|
|
231
231
|
): RunCurrentState {
|
|
232
|
+
// Each `ConnectionInvocationRecord` represents a single, auditable LLM/tool call
|
|
233
|
+
// that must belong to exactly one run. Reruns start from a fresh invocation
|
|
234
|
+
// ledger so the new run only records what it actually invokes. The prior run's
|
|
235
|
+
// invocations remain queryable on that run's persisted state (their true owner).
|
|
236
|
+
// Carrying them over here would write duplicate `ExecutionInstance` rows whose
|
|
237
|
+
// primary key (`invocationId`) already exists under the previous run, causing a
|
|
238
|
+
// `Unique constraint failed on the fields: (instance_id)` violation on first save.
|
|
232
239
|
return {
|
|
233
240
|
outputsByNode: { ...(currentState?.outputsByNode ?? {}) },
|
|
234
241
|
nodeSnapshotsByNodeId: { ...(currentState?.nodeSnapshotsByNodeId ?? {}) },
|
|
235
|
-
connectionInvocations:
|
|
242
|
+
connectionInvocations: [],
|
|
236
243
|
mutableState: mutableState ?? currentState?.mutableState,
|
|
237
244
|
};
|
|
238
245
|
}
|