orizu 0.4.0 → 0.5.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.
Files changed (76) hide show
  1. package/README.md +22 -13
  2. package/dist/artifact-archive.js +152 -0
  3. package/dist/connectors-cli.js +80 -0
  4. package/dist/credentials.js +4 -1
  5. package/dist/daytona-slice-rehearsal.js +255 -0
  6. package/dist/daytona-slice.js +441 -0
  7. package/dist/egress-allowlist-cli.js +132 -0
  8. package/dist/egress-policy.js +159 -0
  9. package/dist/git-credential.js +131 -0
  10. package/dist/github-setup.js +226 -0
  11. package/dist/help.js +276 -21
  12. package/dist/hosted-bootstrap-rehearsal.js +235 -0
  13. package/dist/hosted-bootstrap.js +365 -0
  14. package/dist/hosted-broker-server.js +220 -0
  15. package/dist/hosted-git-http-server.js +136 -0
  16. package/dist/hosted-harness-claude.js +493 -0
  17. package/dist/hosted-harness-opencode.js +729 -0
  18. package/dist/hosted-harness.js +60 -0
  19. package/dist/hosted-loop.js +477 -0
  20. package/dist/hosted-run-event-sink.js +499 -0
  21. package/dist/hosted-runtime-assets.js +216 -0
  22. package/dist/hosted-session-cli.js +642 -0
  23. package/dist/index.js +945 -258
  24. package/dist/kill-switch-cli.js +89 -0
  25. package/dist/manifests-cli.js +143 -0
  26. package/dist/preview-runtime.js +4 -1
  27. package/dist/sandbox-provider.js +238 -0
  28. package/dist/secret-redaction.js +112 -0
  29. package/dist/session-timeline.js +103 -0
  30. package/dist/setup-prompt.js +4 -2
  31. package/dist/skill-installer.js +9 -1
  32. package/dist/smoke.js +250 -0
  33. package/dist/task-assignment-manifest.js +96 -0
  34. package/dist/vercel-sandbox-provider.js +260 -0
  35. package/dist/workbench-cli.js +493 -0
  36. package/dist/workspace-sync.js +924 -0
  37. package/dist/workspace.js +868 -57
  38. package/package.json +4 -1
  39. package/src/artifact-archive.ts +182 -0
  40. package/src/connectors-cli.ts +115 -0
  41. package/src/credentials.ts +6 -2
  42. package/src/daytona-slice-rehearsal.ts +320 -0
  43. package/src/daytona-slice.ts +598 -0
  44. package/src/egress-allowlist-cli.ts +147 -0
  45. package/src/egress-policy.ts +188 -0
  46. package/src/git-credential.ts +155 -0
  47. package/src/github-setup.ts +366 -0
  48. package/src/help.ts +277 -21
  49. package/src/hosted-bootstrap-rehearsal.ts +312 -0
  50. package/src/hosted-bootstrap.ts +571 -0
  51. package/src/hosted-broker-server.ts +278 -0
  52. package/src/hosted-git-http-server.ts +164 -0
  53. package/src/hosted-harness-claude.ts +621 -0
  54. package/src/hosted-harness-opencode.ts +823 -0
  55. package/src/hosted-harness.ts +124 -0
  56. package/src/hosted-loop.ts +680 -0
  57. package/src/hosted-run-event-sink.ts +632 -0
  58. package/src/hosted-runtime-assets.ts +272 -0
  59. package/src/hosted-session-cli.ts +844 -0
  60. package/src/index.ts +1102 -317
  61. package/src/kill-switch-cli.ts +113 -0
  62. package/src/manifests-cli.ts +168 -0
  63. package/src/preview-runtime.ts +14 -9
  64. package/src/sandbox-provider.ts +440 -0
  65. package/src/secret-redaction.ts +124 -0
  66. package/src/session-timeline.ts +152 -0
  67. package/src/setup-prompt.ts +4 -2
  68. package/src/skill-installer.ts +13 -1
  69. package/src/smoke.ts +342 -0
  70. package/src/task-assignment-manifest.ts +164 -0
  71. package/src/vercel-sandbox-provider.ts +388 -0
  72. package/src/workbench-cli.ts +701 -0
  73. package/src/workspace-sync.ts +1148 -0
  74. package/src/workspace.ts +1051 -64
  75. package/vendor/skills/orizu-cli/SKILL.md +8 -4
  76. package/vendor/skills/orizu-cli/references/cli-reference.md +12 -4
@@ -0,0 +1,124 @@
1
+ /**
2
+ * AgentHarness seam (ALI-926 / P3.4, interface 1 of ADR-005's swappability
3
+ * contract; sketch in audit §4a).
4
+ *
5
+ * `AgentHarness` abstracts "what starts and steps the agent" so the OpenCode
6
+ * driver (`hosted-harness-opencode.ts`) can be swapped for a Claude-Agent-SDK
7
+ * loop (ALI-929) WITHOUT touching the event bridge (`hosted-run-event-sink.ts`)
8
+ * or the RunAPI. The interface therefore carries ZERO OpenCode types: it speaks
9
+ * only in normalized `HarnessEvent`s whose `kind` is the audit §4b left column.
10
+ *
11
+ * Shape ported (in DESIGN, not code) from OpenInspect's `bridge.py`:
12
+ * create session → send prompt → stream parts → detect idle → stop.
13
+ * The OpenCode-specific SSE part schema, message-id correlation, and localhost
14
+ * HTTP driving live entirely behind this seam.
15
+ *
16
+ * Terminal semantics: `execution_complete` and `error` are emitted as ordinary
17
+ * stream events with `critical: true`. The bridge (§4b) routes those to the
18
+ * RunAPI terminal PATCH — they are NEVER appended as raw run events. The harness
19
+ * does not know about run status; "Orizu records win" (the disagreement rule) is
20
+ * enforced by the sink, not here.
21
+ */
22
+
23
+ /** Minimal MCP server descriptor. Kept structural so the seam does not depend on
24
+ * any concrete MCP client type; the driver interprets it. */
25
+ export interface McpServerConfig {
26
+ name: string
27
+ /** Transport hint the driver understands (e.g. 'stdio' | 'http'). */
28
+ transport?: string
29
+ command?: string
30
+ args?: readonly string[]
31
+ url?: string
32
+ env?: Record<string, string>
33
+ }
34
+
35
+ export interface HarnessStartOptions {
36
+ /** Absolute or repo-relative working directory the agent operates in. */
37
+ workspaceDir: string
38
+ /** Provider-qualified model, e.g. "anthropic/claude-opus-4-8". */
39
+ model: string
40
+ reasoningEffort?: string
41
+ mcpServers?: readonly McpServerConfig[]
42
+ /** OpenCode session id persisted across restarts (reconnect/resume). */
43
+ resumeAgentSessionId?: string
44
+ }
45
+
46
+ export interface HarnessPrompt {
47
+ runId: string
48
+ /** Idempotency / correlation key handed by the caller. */
49
+ messageId: string
50
+ content: string
51
+ /** Git identity used for commit attribution during the prompt. */
52
+ author: { name: string; email: string }
53
+ }
54
+
55
+ /**
56
+ * The normalized event vocabulary — the audit §4b left column. The bridge maps
57
+ * each kind onto a `workbench_run_events.event_type` (or drops it). Kept as a
58
+ * const map (no enums, per project guidelines).
59
+ *
60
+ * `push_complete` / `push_error` are deliberately OMITTED: they belong to the
61
+ * finish-branch / manifest push flow deferred to P3.5. `heartbeat` and
62
+ * `user_message` are not modeled at all — the harness never emits liveness or
63
+ * prompt-echo events (§4b drops both).
64
+ */
65
+ export const HARNESS_EVENT_KINDS = {
66
+ ready: 'ready',
67
+ token: 'token',
68
+ tool_call: 'tool_call',
69
+ tool_result: 'tool_result',
70
+ step_start: 'step_start',
71
+ step_finish: 'step_finish',
72
+ git_sync: 'git_sync',
73
+ artifact: 'artifact',
74
+ session_title: 'session_title',
75
+ // Egress-canary results (G5 / ALI-1006). NOT produced by a harness — the
76
+ // in-sandbox loop emits these through the SAME single-writer run-event sink
77
+ // right after bootstrap (the startup canary that proves the firewall is live).
78
+ // They are part of the §4b run-event vocabulary (G6 lists "egress attempt")
79
+ // and never terminal, so they append like any structural event.
80
+ egress_blocked: 'egress_blocked',
81
+ egress_allowed: 'egress_allowed',
82
+ error: 'error',
83
+ execution_complete: 'execution_complete',
84
+ } as const
85
+
86
+ export type HarnessEventKind = keyof typeof HARNESS_EVENT_KINDS
87
+
88
+ /** The two kinds that must NEVER be appended as raw events — they drive the
89
+ * terminal PATCH instead (§4b mapping rule). */
90
+ export const HARNESS_TERMINAL_KINDS = {
91
+ execution_complete: 'execution_complete',
92
+ error: 'error',
93
+ } as const
94
+
95
+ export function isHarnessTerminalKind(kind: HarnessEventKind): boolean {
96
+ return kind in HARNESS_TERMINAL_KINDS
97
+ }
98
+
99
+ export interface HarnessEvent {
100
+ kind: HarnessEventKind
101
+ /** Correlation key for coalescing (token snapshots) and attribution. */
102
+ messageId?: string
103
+ payload: Record<string, unknown>
104
+ /** Requires guaranteed delivery (execution_complete / error / push_*). */
105
+ critical?: boolean
106
+ }
107
+
108
+ export interface AgentHarness {
109
+ /** Stable driver name — "opencode" | "claude-agent-sdk". */
110
+ readonly name: string
111
+ /** Boot the agent process/session; returns the resumable agent session id. */
112
+ start(opts: HarnessStartOptions): Promise<{ agentSessionId: string }>
113
+ /**
114
+ * Drive one prompt to completion, yielding normalized events. Cancellable via
115
+ * `signal` (abort → the driver requests the agent to stop and ends the stream
116
+ * with a terminal event). The stream ALWAYS ends with exactly one terminal
117
+ * event (`execution_complete` or `error`).
118
+ */
119
+ runPrompt(prompt: HarnessPrompt, signal: AbortSignal): AsyncIterable<HarnessEvent>
120
+ /** Abort the in-flight prompt (e.g. OpenCode POST /session/{id}/abort). */
121
+ stop(): Promise<void>
122
+ /** Release all resources; the harness is unusable afterward. */
123
+ shutdown(): Promise<void>
124
+ }