@g3un/pi-orchestra 0.1.0 → 0.2.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/src/utils.ts CHANGED
@@ -1,10 +1,8 @@
1
- import type { OrchestraApi, WaitRunResult } from "./core/orchestra.ts";
2
- import type { AgentRun, AgentState } from "./core/subagent.ts";
1
+ import type { OrchestraApi } from "./core/orchestra.ts";
2
+ import type { AgentRun, AgentRunResult, AgentState } from "./core/subagent.ts";
3
3
  import type { AgentStore } from "./core/store.ts";
4
4
  import type { WorkflowRun } from "./core/workflow.ts";
5
5
 
6
- export const DEFAULT_WAIT_TIMEOUT_MS = 10 * 60 * 1000;
7
-
8
6
  export interface NamedEntity {
9
7
  id: string;
10
8
  name: string;
@@ -52,14 +50,6 @@ export function formatNamedEntityLabel(entity: NamedEntity): string {
52
50
  return entity.name === entity.id ? entity.id : `${entity.name} (${entity.id})`;
53
51
  }
54
52
 
55
- export function resolveWaitTimeoutMs(label: string, timeoutMs: number | null | undefined): number | null {
56
- const resolvedTimeoutMs = timeoutMs === undefined ? DEFAULT_WAIT_TIMEOUT_MS : timeoutMs;
57
- if (resolvedTimeoutMs !== null && (!Number.isFinite(resolvedTimeoutMs) || resolvedTimeoutMs <= 0)) {
58
- throw new Error(`${label} timeoutMs must be positive, or null to wait indefinitely.`);
59
- }
60
- return resolvedTimeoutMs;
61
- }
62
-
63
53
  export function findWorkflow(store: AgentStore, id: string): WorkflowRun | undefined {
64
54
  return store.getWorkflow(id) ?? store.listWorkflows().find((workflow) => workflow.name === id);
65
55
  }
@@ -85,8 +75,8 @@ export function formatError(error: unknown): string {
85
75
  return error instanceof Error ? error.message : String(error);
86
76
  }
87
77
 
88
- export function toWaitRunResult(run: AgentRun): WaitRunResult {
89
- const runResult: WaitRunResult = {
78
+ export function toAgentRunResult(run: AgentRun): AgentRunResult {
79
+ const runResult: AgentRunResult = {
90
80
  runId: run.id,
91
81
  name: run.name,
92
82
  profile: run.profile,