@clearideas/agent-runtime-cli 0.6.2 → 0.7.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { AgentManifest, RunResult } from "@clearideas/agent-runtime-contracts";
2
- import { type ArtifactStore, type ApprovalAdapter, type ConnectionCredentialProvider, type EventSink, type ModelAdapter, type RunSandboxProvider, type RunStore, type SandboxAdapter, type StepExecutor, type SubRunAdapter, type ToolAdapter, type WorkspaceProvider } from "@clearideas/agent-runtime-core";
1
+ import type { AgentManifest, RunResult, ExecutionPolicies } from "@clearideas/agent-runtime-contracts";
2
+ import { type ArtifactStore, type ApprovalAdapter, type ConnectionCredentialProvider, type EventSink, type ModelAdapter, type RunSandboxProvider, type RunStore, type SandboxAdapter, type StepExecutor, type SubRunAdapter, type ContextSummarizerAdapter, type ToolAdapter, type WorkspaceProvider } from "@clearideas/agent-runtime-core";
3
3
  import type { SandboxProvider } from "@clearideas/agent-runtime-sandbox";
4
4
  import { type ExecutionRequest, type WorkerInvocation, type WorkerMessage } from "@clearideas/agent-runtime-execution";
5
5
  import { type AgentRuntimeConfig, type ConfiguredMcpToolAdapterOptions, type ModelAuthorizationPolicy, type WorkspaceCompositionOptions } from "@clearideas/agent-runtime-config";
@@ -28,6 +28,12 @@ export interface CliRuntime {
28
28
  sandboxProvider?: SandboxProvider;
29
29
  eventSinks?: EventSink[];
30
30
  stepExecutors?: StepExecutor[];
31
+ /** Host default execution policies; manifests and steps override them. */
32
+ policies?: ExecutionPolicies;
33
+ /** Host execution policies applied last; manifests cannot override them. */
34
+ enforcedPolicies?: ExecutionPolicies;
35
+ /** Observes, changes, or replaces context summarization. */
36
+ summarizer?: ContextSummarizerAdapter;
31
37
  }
32
38
  export interface CliRuntimeContext {
33
39
  manifest: AgentManifest;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { access, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath, pathToFileURL } from "node:url";
4
4
  import { JexlConditionEvaluator } from "@clearideas/agent-runtime-condition-jexl";
5
- import { parseAgentVariableOverrides } from "@clearideas/agent-runtime-contracts";
5
+ import { executionPoliciesSchema, parseAgentVariableOverrides, } from "@clearideas/agent-runtime-contracts";
6
6
  import { AgentRuntime, } from "@clearideas/agent-runtime-core";
7
7
  import { EXECUTION_PROTOCOL_VERSION, parseWorkerInvocation, serializeWorkerMessage, } from "@clearideas/agent-runtime-execution";
8
8
  import { composeRuntime, discoverMcpConnectionTools, emptyAgentRuntimeConfig, loadAgentRuntimeConfig, parseAgentRuntimeConfig, validateRuntimeConfiguration, } from "@clearideas/agent-runtime-config";
@@ -338,6 +338,8 @@ const validateRuntime = (runtime) => {
338
338
  throw new Error("Runtime sandbox must implement SandboxAdapter.execute().");
339
339
  if (runtime.subRuns && !adapterMethod(runtime.subRuns, "execute"))
340
340
  throw new Error("Runtime subRuns must implement SubRunAdapter.execute().");
341
+ if (runtime.summarizer && !adapterMethod(runtime.summarizer, "summarize"))
342
+ throw new Error("Runtime summarizer must implement ContextSummarizerAdapter.summarize().");
341
343
  if (runtime.workspaces &&
342
344
  !adapterMethod(runtime.workspaces, "resolveWorkspace")) {
343
345
  throw new Error("Runtime workspaces must implement WorkspaceProvider.resolveWorkspace().");
@@ -406,6 +408,15 @@ const normalizeRuntime = (runtime) => ({
406
408
  ...(runtime.sandboxProvider
407
409
  ? { sandboxProvider: runtime.sandboxProvider }
408
410
  : {}),
411
+ ...(runtime.policies
412
+ ? { policies: executionPoliciesSchema.parse(runtime.policies) }
413
+ : {}),
414
+ ...(runtime.enforcedPolicies
415
+ ? {
416
+ enforcedPolicies: executionPoliciesSchema.parse(runtime.enforcedPolicies),
417
+ }
418
+ : {}),
419
+ ...(runtime.summarizer ? { summarizer: runtime.summarizer } : {}),
409
420
  ...((runtime.eventSinks?.length ?? 0) > 0 || runtime.eventSink
410
421
  ? {
411
422
  eventSinks: [
@@ -638,6 +649,16 @@ class CliStreamingEventSink {
638
649
  return `✗ run failed (${event.runId})`;
639
650
  case "run.suspended":
640
651
  return `Ⅱ run suspended (${event.runId}): ${String(event.data?.reason ?? "awaiting input")}; resume with agent-runtime resume ${event.runId}`;
652
+ case "run.interrupted":
653
+ return `↯ run interrupted (${event.runId}): ${String(event.data?.reason ?? "interrupted")}; resume with agent-runtime resume ${event.runId}`;
654
+ case "step.failed":
655
+ return event.data?.handled === true
656
+ ? `! step failed, continuing (onError: continue)${event.stepId ? `: ${event.stepId}` : ""}`
657
+ : undefined;
658
+ case "context.reduced":
659
+ return ` context reduced: ${String(event.data?.scope ?? "")} by ${String(event.data?.strategy ?? "")}, ${String(event.data?.bytesBefore ?? "?")} → ${String(event.data?.bytesAfter ?? "?")} bytes`;
660
+ case "model.retry":
661
+ return ` model retry: ${String(event.data?.reason ?? "retry")}${event.data?.delayMs != null ? `, waiting ${String(event.data.delayMs)}ms` : ""}`;
641
662
  case "webhook.retry.scheduled":
642
663
  return ` webhook retry: ${String(event.data?.reason ?? "transient failure")}, waiting ${String(event.data?.delayMs ?? "unknown")}ms`;
643
664
  case "run.cancelled":
@@ -802,6 +823,11 @@ const execute = async (command, args, io, signal) => {
802
823
  ...(runtime.subRuns ? { subRuns: runtime.subRuns } : {}),
803
824
  ...(runtime.workspaces ? { workspaces: runtime.workspaces } : {}),
804
825
  ...(runtime.runSandbox ? { runSandbox: runtime.runSandbox } : {}),
826
+ ...(runtime.policies ? { policies: runtime.policies } : {}),
827
+ ...(runtime.enforcedPolicies
828
+ ? { enforcedPolicies: runtime.enforcedPolicies }
829
+ : {}),
830
+ ...(runtime.summarizer ? { summarizer: runtime.summarizer } : {}),
805
831
  ...(runtime.artifactStore
806
832
  ? { artifacts: runtime.artifactStore }
807
833
  : artifactDirectory
@@ -1029,6 +1055,11 @@ export const executeWorkerInvocation = async (invocation, options) => {
1029
1055
  ...(runtime.subRuns ? { subRuns: runtime.subRuns } : {}),
1030
1056
  ...(runtime.workspaces ? { workspaces: runtime.workspaces } : {}),
1031
1057
  ...(runtime.runSandbox ? { runSandbox: runtime.runSandbox } : {}),
1058
+ ...(runtime.policies ? { policies: runtime.policies } : {}),
1059
+ ...(runtime.enforcedPolicies
1060
+ ? { enforcedPolicies: runtime.enforcedPolicies }
1061
+ : {}),
1062
+ ...(runtime.summarizer ? { summarizer: runtime.summarizer } : {}),
1032
1063
  artifacts,
1033
1064
  ...(options.maxParallelSteps
1034
1065
  ? { maxParallelSteps: options.maxParallelSteps }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearideas/agent-runtime-cli",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Standalone CLI for validating, running, resuming, and inspecting declarative agents.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Clear Ideas Incorporated",
@@ -40,23 +40,23 @@
40
40
  "postpack": "node ../../scripts/cleanup-package-license.mjs"
41
41
  },
42
42
  "dependencies": {
43
- "@clearideas/agent-runtime-condition-jexl": "0.6.2",
44
- "@clearideas/agent-runtime-config": "0.6.2",
45
- "@clearideas/agent-runtime-contracts": "0.6.2",
46
- "@clearideas/agent-runtime-core": "0.6.2",
47
- "@clearideas/agent-runtime-execution": "0.6.2",
48
- "@clearideas/agent-runtime-sandbox": "0.6.2",
49
- "@clearideas/agent-runtime-step-loop": "0.6.2",
50
- "@clearideas/agent-runtime-step-prompt": "0.6.2",
51
- "@clearideas/agent-runtime-step-standard": "0.6.2",
52
- "@clearideas/agent-runtime-store-local": "0.6.2",
53
- "@clearideas/agent-runtime-store-sqlite": "0.6.2",
43
+ "@clearideas/agent-runtime-condition-jexl": "0.7.0",
44
+ "@clearideas/agent-runtime-config": "0.7.0",
45
+ "@clearideas/agent-runtime-contracts": "0.7.0",
46
+ "@clearideas/agent-runtime-core": "0.7.0",
47
+ "@clearideas/agent-runtime-execution": "0.7.0",
48
+ "@clearideas/agent-runtime-sandbox": "0.7.0",
49
+ "@clearideas/agent-runtime-step-loop": "0.7.0",
50
+ "@clearideas/agent-runtime-step-prompt": "0.7.0",
51
+ "@clearideas/agent-runtime-step-standard": "0.7.0",
52
+ "@clearideas/agent-runtime-store-local": "0.7.0",
53
+ "@clearideas/agent-runtime-store-sqlite": "0.7.0",
54
54
  "yaml": "^2.9.1"
55
55
  },
56
56
  "devDependencies": {
57
- "@types/node": "^26.4.0",
57
+ "@types/node": "^26.6.6",
58
58
  "typescript": "^7.0.2",
59
- "vitest": "^5.0.0"
59
+ "vitest": "^5.1.0"
60
60
  },
61
61
  "engines": {
62
62
  "node": ">=24"