Sign In

@sapiom/agent-core

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sapiom/agent-core - npm Package Compare versions

Comparing version
0.10.7
to
0.11.0
+14
-0
CHANGELOG.md
# @sapiom/orchestration-core
## 0.11.0
### Minor Changes
- b1d791b: Add an artifact-first Studio run workspace for local and cloud agents. Studio now
collects schema-driven input, streams chronological attempt evidence, renders
bounded outputs with Rendered and Raw views, and provides an isolated Focus mode
for inspecting input, output, state, directives, logs, and recorded capability
calls.
Local agent execution now emits start and settled trace events with timing,
directive, shared-state, log, and capability-call evidence. Desktop development
launches rebuild Harness first so Electron always opens the current Studio UI.
## 0.10.7

@@ -4,0 +18,0 @@

+1
-1

@@ -45,2 +45,2 @@ export { AgentOperationError } from "./errors.js";

export { LocalStubDispatcher } from "./local/dispatcher.js";
export type { LocalStepTrace, LogEntry } from "./local/dispatcher.js";
export type { LocalStepTrace, LocalStepTracePhase, LocalStepTraceSink, LogEntry, } from "./local/dispatcher.js";

@@ -14,5 +14,8 @@ import { type NextStepDirective, type AgentDefinition } from "@sapiom/agent";

input: unknown;
status: "succeeded" | "threw";
status: "running" | "succeeded" | "threw";
startedAt?: string;
finishedAt?: string;
output?: unknown;
directive?: NextStepDirective;
sharedStateAfter?: Record<string, unknown>;
error?: {

@@ -26,5 +29,8 @@ name: string;

}
export type LocalStepTracePhase = "started" | "settled";
export type LocalStepTraceSink = (phase: LocalStepTracePhase, trace: LocalStepTrace) => void;
export declare class LocalStubDispatcher implements StepDispatcher {
private readonly definition;
private readonly stubs;
private readonly traceSink?;
private core;

@@ -36,3 +42,4 @@ private maxAttemptsPerStep;

readonly stubWarnings: Set<string>;
constructor(definition: AgentDefinition, stubs: StubFile);
constructor(definition: AgentDefinition, stubs: StubFile, traceSink?: LocalStepTraceSink | undefined);
private emit;
setCore(core: AgentRunnerCore): void;

@@ -39,0 +46,0 @@ setMaxAttempts(max: number): void;

@@ -8,5 +8,6 @@ "use strict";

class LocalStubDispatcher {
constructor(definition, stubs) {
constructor(definition, stubs, traceSink) {
this.definition = definition;
this.stubs = stubs;
this.traceSink = traceSink;
this.core = null;

@@ -18,2 +19,9 @@ this.signals = new Map();

}
emit(phase, trace) {
try {
this.traceSink?.(phase, trace);
}
catch {
}
}
setCore(core) {

@@ -38,2 +46,11 @@ this.core = core;

const logs = [];
const startedAt = new Date().toISOString();
this.emit("started", {
step: request.stepName,
attempt: request.attempt,
input: request.input,
status: "running",
startedAt,
logs: [],
});
const sharedStore = new agent_1.InMemoryContextStore(request.shared);

@@ -85,2 +102,5 @@ const overrides = (this.stubs.steps[request.stepName] ?? {});

status: "threw",
startedAt,
finishedAt: new Date().toISOString(),
sharedStateAfter: sharedStore.snapshot(),
error: { name: e.name, message: e.message, stack: e.stack },

@@ -92,2 +112,3 @@ logs,

this.trace.push(traceEntry);
this.emit("settled", traceEntry);
await this.core.completeDispatchedStep({

@@ -108,4 +129,7 @@ protocol: 1,

status: "succeeded",
startedAt,
finishedAt: new Date().toISOString(),
output,
directive,
sharedStateAfter: sharedStore.snapshot(),
logs,

@@ -116,2 +140,3 @@ };

this.trace.push(traceEntry);
this.emit("settled", traceEntry);
const payload = {

@@ -118,0 +143,0 @@ protocol: 1,

import type { AgentDefinition, AgentManifest } from "@sapiom/agent";
import { type LocalStepTrace } from "./dispatcher.js";
import { type LocalStepTrace, type LocalStepTraceSink } from "./dispatcher.js";
import { type StubFile } from "./stubs.js";

@@ -11,2 +11,3 @@ export declare const STUBS_FILE: string;

maxAttemptsPerStep?: number;
onStepTrace?: LocalStepTraceSink;
}

@@ -33,2 +34,3 @@ export type LocalRunOutcome = "completed" | "failed" | "paused" | "running";

maxAttemptsPerStep?: number;
onStepTrace?: LocalStepTraceSink;
}): Promise<LocalRunResult>;

@@ -40,3 +40,3 @@ "use strict";

const store = new agent_runtime_1.InMemoryExecutionStore();
const dispatcher = new dispatcher_js_1.LocalStubDispatcher(opts.definition, stubs);
const dispatcher = new dispatcher_js_1.LocalStubDispatcher(opts.definition, stubs, opts.onStepTrace);
const signals = new Map();

@@ -102,3 +102,4 @@ dispatcher.setSignals(signals);

maxAttemptsPerStep: opts.maxAttemptsPerStep,
onStepTrace: opts.onStepTrace,
});
}

@@ -45,2 +45,2 @@ export { AgentOperationError } from "./errors.js";

export { LocalStubDispatcher } from "./local/dispatcher.js";
export type { LocalStepTrace, LogEntry } from "./local/dispatcher.js";
export type { LocalStepTrace, LocalStepTracePhase, LocalStepTraceSink, LogEntry, } from "./local/dispatcher.js";

@@ -14,5 +14,8 @@ import { type NextStepDirective, type AgentDefinition } from "@sapiom/agent";

input: unknown;
status: "succeeded" | "threw";
status: "running" | "succeeded" | "threw";
startedAt?: string;
finishedAt?: string;
output?: unknown;
directive?: NextStepDirective;
sharedStateAfter?: Record<string, unknown>;
error?: {

@@ -26,5 +29,8 @@ name: string;

}
export type LocalStepTracePhase = "started" | "settled";
export type LocalStepTraceSink = (phase: LocalStepTracePhase, trace: LocalStepTrace) => void;
export declare class LocalStubDispatcher implements StepDispatcher {
private readonly definition;
private readonly stubs;
private readonly traceSink?;
private core;

@@ -36,3 +42,4 @@ private maxAttemptsPerStep;

readonly stubWarnings: Set<string>;
constructor(definition: AgentDefinition, stubs: StubFile);
constructor(definition: AgentDefinition, stubs: StubFile, traceSink?: LocalStepTraceSink | undefined);
private emit;
setCore(core: AgentRunnerCore): void;

@@ -39,0 +46,0 @@ setMaxAttempts(max: number): void;

@@ -5,5 +5,6 @@ import { InMemoryContextStore, StepInputValidationError, } from "@sapiom/agent";

export class LocalStubDispatcher {
constructor(definition, stubs) {
constructor(definition, stubs, traceSink) {
this.definition = definition;
this.stubs = stubs;
this.traceSink = traceSink;
this.core = null;

@@ -15,2 +16,9 @@ this.signals = new Map();

}
emit(phase, trace) {
try {
this.traceSink?.(phase, trace);
}
catch {
}
}
setCore(core) {

@@ -35,2 +43,11 @@ this.core = core;

const logs = [];
const startedAt = new Date().toISOString();
this.emit("started", {
step: request.stepName,
attempt: request.attempt,
input: request.input,
status: "running",
startedAt,
logs: [],
});
const sharedStore = new InMemoryContextStore(request.shared);

@@ -82,2 +99,5 @@ const overrides = (this.stubs.steps[request.stepName] ?? {});

status: "threw",
startedAt,
finishedAt: new Date().toISOString(),
sharedStateAfter: sharedStore.snapshot(),
error: { name: e.name, message: e.message, stack: e.stack },

@@ -89,2 +109,3 @@ logs,

this.trace.push(traceEntry);
this.emit("settled", traceEntry);
await this.core.completeDispatchedStep({

@@ -105,4 +126,7 @@ protocol: 1,

status: "succeeded",
startedAt,
finishedAt: new Date().toISOString(),
output,
directive,
sharedStateAfter: sharedStore.snapshot(),
logs,

@@ -113,2 +137,3 @@ };

this.trace.push(traceEntry);
this.emit("settled", traceEntry);
const payload = {

@@ -115,0 +140,0 @@ protocol: 1,

import type { AgentDefinition, AgentManifest } from "@sapiom/agent";
import { type LocalStepTrace } from "./dispatcher.js";
import { type LocalStepTrace, type LocalStepTraceSink } from "./dispatcher.js";
import { type StubFile } from "./stubs.js";

@@ -11,2 +11,3 @@ export declare const STUBS_FILE: string;

maxAttemptsPerStep?: number;
onStepTrace?: LocalStepTraceSink;
}

@@ -33,2 +34,3 @@ export type LocalRunOutcome = "completed" | "failed" | "paused" | "running";

maxAttemptsPerStep?: number;
onStepTrace?: LocalStepTraceSink;
}): Promise<LocalRunResult>;

@@ -6,3 +6,3 @@ import { existsSync, readFileSync } from "node:fs";

import { AgentOperationError } from "../errors.js";
import { LocalStubDispatcher } from "./dispatcher.js";
import { LocalStubDispatcher, } from "./dispatcher.js";
import { loadDefinition } from "./load.js";

@@ -33,3 +33,3 @@ import { parseStubFile } from "./stubs.js";

const store = new InMemoryExecutionStore();
const dispatcher = new LocalStubDispatcher(opts.definition, stubs);
const dispatcher = new LocalStubDispatcher(opts.definition, stubs, opts.onStepTrace);
const signals = new Map();

@@ -95,3 +95,4 @@ dispatcher.setSignals(signals);

maxAttemptsPerStep: opts.maxAttemptsPerStep,
onStepTrace: opts.onStepTrace,
});
}
{
"name": "@sapiom/agent-core",
"version": "0.10.7",
"version": "0.11.0",
"description": "Pure, stateless core functions for scaffolding, validating, and operating Sapiom agents — shared by the CLI and MCP packages.",

@@ -41,5 +41,5 @@ "license": "MIT",

"@sapiom/agent": "^0.9.3",
"@sapiom/agent-runtime": "^0.4.3",
"@sapiom/analytics-core": "^0.2.1",
"@sapiom/tools": "^0.26.2"
"@sapiom/tools": "^0.26.2",
"@sapiom/agent-runtime": "^0.4.3"
},

@@ -46,0 +46,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet