@orc-brain/shared 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/LICENSE +21 -0
- package/dist/config.d.ts +139 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/entities.d.ts +216 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +3 -0
- package/dist/entities.js.map +1 -0
- package/dist/enums.d.ts +47 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +3 -0
- package/dist/enums.js.map +1 -0
- package/dist/events.d.ts +151 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +6 -0
- package/dist/events.js.map +1 -0
- package/dist/ids.d.ts +12 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +3 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/plan.d.ts +47 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +112 -0
- package/dist/plan.js.map +1 -0
- package/dist/plugins.d.ts +134 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +12 -0
- package/dist/plugins.js.map +1 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Paulo Lima
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/** Configuration shapes for routing, budget, safety, and limits (§6, §7, §8). */
|
|
2
|
+
import type { ModelName, TaskType } from "./enums.js";
|
|
3
|
+
/** Budget thresholds and per-task bounds (§7). */
|
|
4
|
+
export interface BudgetConfig {
|
|
5
|
+
/** Fraction of run budget at which to warn (default 0.7). */
|
|
6
|
+
warn_at: number;
|
|
7
|
+
/** Fraction of run budget at which dispatch halts (default 0.9). */
|
|
8
|
+
hard_stop_at: number;
|
|
9
|
+
/** Floor for the per-task `maxBudgetUsd` bound (default 0.5). */
|
|
10
|
+
per_task_min_usd: number;
|
|
11
|
+
/** Cap for the per-task `maxBudgetUsd` bound (default 5). */
|
|
12
|
+
per_task_max_usd: number;
|
|
13
|
+
/** Secondary volume ceilings (§7.6). */
|
|
14
|
+
max_tasks_per_run: number;
|
|
15
|
+
max_tasks_per_hour: number;
|
|
16
|
+
}
|
|
17
|
+
/** A single model-routing rule (§6). Evaluated in order; first match wins. */
|
|
18
|
+
export interface RoutingRule {
|
|
19
|
+
id: string;
|
|
20
|
+
description: string;
|
|
21
|
+
when: {
|
|
22
|
+
task_types?: TaskType[];
|
|
23
|
+
/** Applies only when the scope did not pin a tier. */
|
|
24
|
+
unpinned_only?: boolean;
|
|
25
|
+
};
|
|
26
|
+
model: ModelName;
|
|
27
|
+
}
|
|
28
|
+
/** Model routing policy (§6). */
|
|
29
|
+
export interface RoutingConfig {
|
|
30
|
+
rules: RoutingRule[];
|
|
31
|
+
/** Fallback model when no rule matches. */
|
|
32
|
+
default_model: ModelName;
|
|
33
|
+
/**
|
|
34
|
+
* When set, every task runs on this model — overrides scope pins, the static
|
|
35
|
+
* table, and the dynamic escalations (R1–R7). Configurable via the
|
|
36
|
+
* `ORC_FORCE_MODEL` environment variable on `orc serve`.
|
|
37
|
+
*/
|
|
38
|
+
force_model?: ModelName | null;
|
|
39
|
+
}
|
|
40
|
+
/** Dev-scope posture per destructive rule class (§8.2, Open Decision 5). */
|
|
41
|
+
export type DevPosture = "allow_with_audit" | "require_approval" | "deny";
|
|
42
|
+
/** Safety configuration (§8). Production rules are never disableable. */
|
|
43
|
+
export interface SafetyConfig {
|
|
44
|
+
/**
|
|
45
|
+
* Host/URL substrings that force a `production` classification (§8.1).
|
|
46
|
+
* Anything not matching a local/RFC-1918 pattern is `unknown` ⇒ production.
|
|
47
|
+
*/
|
|
48
|
+
prod_host_indicators: string[];
|
|
49
|
+
/** Branch names that classify the cwd as production (§8.1). */
|
|
50
|
+
prod_branches: string[];
|
|
51
|
+
/** Per-class dev-scope posture (§8.2). Prod scopes always deny. */
|
|
52
|
+
dev_posture: Record<string, DevPosture>;
|
|
53
|
+
}
|
|
54
|
+
/** Rate-limit detection patterns, kept in config because they drift (§7.4). */
|
|
55
|
+
export interface LimitConfig {
|
|
56
|
+
/** Regex sources matched against worker error text. */
|
|
57
|
+
patterns: {
|
|
58
|
+
session_limit: string;
|
|
59
|
+
weekly_limit: string;
|
|
60
|
+
model_limit: string;
|
|
61
|
+
};
|
|
62
|
+
/** Backoff schedule in ms when a reset time can't be parsed (§7.4). */
|
|
63
|
+
backoff_ms: number[];
|
|
64
|
+
/** Cap on backoff in ms. */
|
|
65
|
+
backoff_cap_ms: number;
|
|
66
|
+
}
|
|
67
|
+
/** Planner configuration (§3, §15 Phase 2). */
|
|
68
|
+
export interface PlannerConfig {
|
|
69
|
+
/** Model the plan-only session is pinned to (§3: Opus). */
|
|
70
|
+
model: ModelName;
|
|
71
|
+
/** Read-only tools the Planner may use to inspect the repo (§3). */
|
|
72
|
+
allowed_tools: string[];
|
|
73
|
+
/** Turn ceiling for a planning session. */
|
|
74
|
+
max_turns: number;
|
|
75
|
+
}
|
|
76
|
+
/** Retry policy for failed tasks (§5, §13; router R5 escalates on retry). */
|
|
77
|
+
export interface RetryConfig {
|
|
78
|
+
/** Maximum attempts per task before it is left `failed` (attempt 0 = first try). */
|
|
79
|
+
max_attempts: number;
|
|
80
|
+
}
|
|
81
|
+
/** Reporting cadence (§11). */
|
|
82
|
+
export interface ReportingConfig {
|
|
83
|
+
/** Minutes between interval reports while Running (default 15). */
|
|
84
|
+
interval_minutes: number;
|
|
85
|
+
}
|
|
86
|
+
/** Escalation / blocked-queue posture (§8.5). */
|
|
87
|
+
export interface EscalationConfig {
|
|
88
|
+
/**
|
|
89
|
+
* Number of same-rule denials in one task before it transitions to `blocked`
|
|
90
|
+
* and an escalation is raised (§8.5 default: halt on the 2nd denial).
|
|
91
|
+
*/
|
|
92
|
+
block_on_denial_count: number;
|
|
93
|
+
}
|
|
94
|
+
/** Pause / interrupt grace behaviour (§5). */
|
|
95
|
+
export interface PauseConfig {
|
|
96
|
+
/** Grace window (ms) for workers to yield before SIGTERM (§5). */
|
|
97
|
+
grace_ms: number;
|
|
98
|
+
/** Additional window (ms) after SIGTERM before SIGKILL (§5). */
|
|
99
|
+
sigkill_after_ms: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Autonomous outer-loop ("auto-replan controller") posture
|
|
103
|
+
* (.specs/active/autonomous-loop.md §3.5). Opt-in; default preserves the
|
|
104
|
+
* static plan-once/execute-fixed-DAG behavior.
|
|
105
|
+
*/
|
|
106
|
+
export interface AutoLoopConfig {
|
|
107
|
+
/** When false, the controller never engages — behavior is unchanged (AC1). */
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* `supervised` keeps the human plan-approval gate for re-planned scopes;
|
|
111
|
+
* `unattended` auto-approves them (still fully bound by the safety layer,
|
|
112
|
+
* scope boundaries, budget, and escalations).
|
|
113
|
+
*/
|
|
114
|
+
mode: "supervised" | "unattended";
|
|
115
|
+
/** Re-plan trigger granularity. `scope` = after each scope completes. */
|
|
116
|
+
replan_on: "scope";
|
|
117
|
+
/** Runaway ceiling: max re-plan cycles before the run is paused (G5). */
|
|
118
|
+
max_replan_cycles: number;
|
|
119
|
+
}
|
|
120
|
+
/** Top-level orchestrator configuration (`orchestrator.toml`, §12). */
|
|
121
|
+
export interface OrchestratorConfig {
|
|
122
|
+
concurrency_limit: number;
|
|
123
|
+
/**
|
|
124
|
+
* Cap on simultaneously running workers across ALL runs (spec 002 §R13) —
|
|
125
|
+
* the subscription is shared, so per-run limits alone don't bound total load.
|
|
126
|
+
*/
|
|
127
|
+
global_concurrency_limit: number;
|
|
128
|
+
budget: BudgetConfig;
|
|
129
|
+
routing: RoutingConfig;
|
|
130
|
+
safety: SafetyConfig;
|
|
131
|
+
limits: LimitConfig;
|
|
132
|
+
planner: PlannerConfig;
|
|
133
|
+
retry: RetryConfig;
|
|
134
|
+
reporting: ReportingConfig;
|
|
135
|
+
escalation: EscalationConfig;
|
|
136
|
+
pause: PauseConfig;
|
|
137
|
+
autoLoop: AutoLoopConfig;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAEjF,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtD,kDA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AAE,WAAW,CAAC;IACnB,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;CAC1B"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,iFAAiF"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/** Core entities of the orc-brain data model (§4). */
|
|
2
|
+
import type { EntityBase, IsoTimestamp, Ulid } from "./ids.js";
|
|
3
|
+
import type { BudgetState, Environment, EscalationAction, EscalationStatus, GoalStatus, ModelName, ModelTier, ProjectExecutionMode, ReportTrigger, RunState, ScopePermissionMode, ScopeStatus, SubagentState, TaskStatus, TaskType } from "./enums.js";
|
|
4
|
+
/** A checkable success statement attached to a Goal or Scope (§4). */
|
|
5
|
+
export interface SuccessCriterion {
|
|
6
|
+
description: string;
|
|
7
|
+
verification_method?: string;
|
|
8
|
+
}
|
|
9
|
+
/** A human-readable + machine-matchable forbidden action on a Scope (§4, §8). */
|
|
10
|
+
export interface ForbiddenAction {
|
|
11
|
+
description: string;
|
|
12
|
+
/** Optional machine pattern appended to the scope's deny rules. */
|
|
13
|
+
pattern?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Project: a registered local repository orc operates on (spec 002 §R1).
|
|
17
|
+
* `repo_root` is unique; `execution_mode` decides worktree isolation (§R8) and
|
|
18
|
+
* the `default_*` fields seed runs started by the feature flow (§R5).
|
|
19
|
+
*/
|
|
20
|
+
export interface Project extends EntityBase {
|
|
21
|
+
name: string;
|
|
22
|
+
repo_root: string;
|
|
23
|
+
execution_mode: ProjectExecutionMode;
|
|
24
|
+
default_budget_usd: number;
|
|
25
|
+
default_concurrency: number;
|
|
26
|
+
/**
|
|
27
|
+
* When true (worktree mode only), a successfully settled scope branch is
|
|
28
|
+
* merged (`--no-ff`) into the run's base branch automatically (spec 002 v2).
|
|
29
|
+
* Skipped — branch kept for manual merge — if the checkout is dirty, on a
|
|
30
|
+
* different branch, or the merge conflicts.
|
|
31
|
+
*/
|
|
32
|
+
auto_merge: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Back-reference from a Goal to the external tracker task it was imported
|
|
36
|
+
* from (spec 003 §R2, §3.5). Null for goals typed by the operator.
|
|
37
|
+
*/
|
|
38
|
+
export interface ExternalRef {
|
|
39
|
+
/** Plugin name that owns the task (e.g. `"linear"`). */
|
|
40
|
+
provider: string;
|
|
41
|
+
/** Provider-native stable id. */
|
|
42
|
+
id: string;
|
|
43
|
+
/** Human identifier (e.g. `"ENG-123"`). */
|
|
44
|
+
identifier: string;
|
|
45
|
+
url: string;
|
|
46
|
+
title: string;
|
|
47
|
+
}
|
|
48
|
+
/** Goal: the top-level objective (§4). */
|
|
49
|
+
export interface Goal extends EntityBase {
|
|
50
|
+
title: string;
|
|
51
|
+
objective: string;
|
|
52
|
+
success_criteria: SuccessCriterion[];
|
|
53
|
+
constraints: string[];
|
|
54
|
+
out_of_scope: string[];
|
|
55
|
+
/** Owning project (spec 002 §R2); null only for pre-project legacy goals. */
|
|
56
|
+
project_id: Ulid | null;
|
|
57
|
+
/** Denormalized from the project at creation so consumers stay unchanged. */
|
|
58
|
+
repo_root: string;
|
|
59
|
+
status: GoalStatus;
|
|
60
|
+
/** Origin tracker task when imported via a plugin (spec 003 §R2). */
|
|
61
|
+
external_ref: ExternalRef | null;
|
|
62
|
+
}
|
|
63
|
+
/** Scope: a bounded region of work and the unit of safety config (§4). */
|
|
64
|
+
export interface Scope extends EntityBase {
|
|
65
|
+
goal_id: Ulid;
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
path_allowlist: string[];
|
|
69
|
+
path_denylist: string[];
|
|
70
|
+
allowed_tools: string[];
|
|
71
|
+
disallowed_tools: string[];
|
|
72
|
+
model_tier: ModelTier;
|
|
73
|
+
environment: Environment;
|
|
74
|
+
permission_mode: ScopePermissionMode;
|
|
75
|
+
forbidden_actions: ForbiddenAction[];
|
|
76
|
+
success_criteria: SuccessCriterion[];
|
|
77
|
+
max_budget_usd: number;
|
|
78
|
+
status: ScopeStatus;
|
|
79
|
+
depends_on: Ulid[];
|
|
80
|
+
/** Worktree the scope's workers run in, when isolated (spec 002 §R8). */
|
|
81
|
+
worktree_path: string | null;
|
|
82
|
+
/** Scope branch (`orc/<goal>/<scope>`), kept after the worktree is removed. */
|
|
83
|
+
branch_name: string | null;
|
|
84
|
+
}
|
|
85
|
+
/** Task: an atomic dispatchable unit inside a Scope (§4). */
|
|
86
|
+
export interface Task extends EntityBase {
|
|
87
|
+
scope_id: Ulid;
|
|
88
|
+
title: string;
|
|
89
|
+
prompt: string;
|
|
90
|
+
task_type: TaskType;
|
|
91
|
+
depends_on: Ulid[];
|
|
92
|
+
status: TaskStatus;
|
|
93
|
+
/**
|
|
94
|
+
* Dispatch priority (spec 002 v2, kanban drag): higher dispatches first;
|
|
95
|
+
* ties fall back to creation order. 0 for every task by default.
|
|
96
|
+
*/
|
|
97
|
+
priority: number;
|
|
98
|
+
attempt: number;
|
|
99
|
+
model_used: ModelName | null;
|
|
100
|
+
routing_reason: string | null;
|
|
101
|
+
session_id: string | null;
|
|
102
|
+
cost_usd: number;
|
|
103
|
+
result_summary: unknown | null;
|
|
104
|
+
error: unknown | null;
|
|
105
|
+
/** Set when a non-graceful stop may have left half-applied edits (§5, §13.6). */
|
|
106
|
+
dirty: boolean;
|
|
107
|
+
}
|
|
108
|
+
/** SubagentRecord: a live/finished worker session, 1:1 with a Task attempt (§4). */
|
|
109
|
+
export interface SubagentRecord extends EntityBase {
|
|
110
|
+
task_id: Ulid;
|
|
111
|
+
session_id: string | null;
|
|
112
|
+
model: ModelName;
|
|
113
|
+
pid: number | null;
|
|
114
|
+
state: SubagentState;
|
|
115
|
+
started_at: IsoTimestamp | null;
|
|
116
|
+
ended_at: IsoTimestamp | null;
|
|
117
|
+
num_turns: number;
|
|
118
|
+
cost_usd: number;
|
|
119
|
+
last_tool_call: unknown | null;
|
|
120
|
+
transcript_path: string | null;
|
|
121
|
+
}
|
|
122
|
+
/** Run: one execution of a Goal (§4). */
|
|
123
|
+
export interface Run extends EntityBase {
|
|
124
|
+
goal_id: Ulid;
|
|
125
|
+
state: RunState;
|
|
126
|
+
budget_usd: number;
|
|
127
|
+
budget_spent_usd: number;
|
|
128
|
+
budget_state: BudgetState;
|
|
129
|
+
concurrency_limit: number;
|
|
130
|
+
started_at: IsoTimestamp | null;
|
|
131
|
+
paused_at: IsoTimestamp | null;
|
|
132
|
+
finished_at: IsoTimestamp | null;
|
|
133
|
+
pause_reason: string | null;
|
|
134
|
+
/**
|
|
135
|
+
* Branch of the repo when the run started (spec 002 §R8, §R10): worktrees
|
|
136
|
+
* fork from it and environment classification uses it, never the `orc/…`
|
|
137
|
+
* worktree branch. Null when the repo branch could not be read.
|
|
138
|
+
*/
|
|
139
|
+
base_branch: string | null;
|
|
140
|
+
/**
|
|
141
|
+
* True for runs started by the feature flow (spec 002 §R5): the run hands
|
|
142
|
+
* off to the autonomous controller on quiescence even when the global
|
|
143
|
+
* `autoLoop.enabled` config is off, and replan cycles are unattended.
|
|
144
|
+
*/
|
|
145
|
+
auto_loop: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Count of autonomous re-plan cycles executed for this run
|
|
148
|
+
* (.specs/active/autonomous-loop.md §3.5, G5). Guards against runaway loops
|
|
149
|
+
* via `AutoLoopConfig.max_replan_cycles`. 0 for static (non-auto) runs.
|
|
150
|
+
*/
|
|
151
|
+
replan_cycle: number;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Escalation: a blocked tool call awaiting operator resolution (§8.5). Raised
|
|
155
|
+
* when a task hits the same deny rule twice; the run continues elsewhere.
|
|
156
|
+
*/
|
|
157
|
+
export interface Escalation extends EntityBase {
|
|
158
|
+
run_id: Ulid;
|
|
159
|
+
task_id: Ulid;
|
|
160
|
+
rule_id: string;
|
|
161
|
+
tool_name: string;
|
|
162
|
+
/** Redacted, truncated tool input for display (§8.6). */
|
|
163
|
+
input_summary: string;
|
|
164
|
+
/** The subagent's stated intent, if captured. */
|
|
165
|
+
stated_intent: string | null;
|
|
166
|
+
status: EscalationStatus;
|
|
167
|
+
/** How the operator resolved it, once resolved. */
|
|
168
|
+
action: EscalationAction | null;
|
|
169
|
+
/** Operator guidance sent back to the subagent (deny_instruct). */
|
|
170
|
+
message: string | null;
|
|
171
|
+
resolved_at: IsoTimestamp | null;
|
|
172
|
+
}
|
|
173
|
+
/** Report: a rendered Markdown status report (§4, §11). */
|
|
174
|
+
export interface Report extends EntityBase {
|
|
175
|
+
run_id: Ulid;
|
|
176
|
+
trigger: ReportTrigger;
|
|
177
|
+
content_md: string;
|
|
178
|
+
path: string | null;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* BudgetLedgerEntry: one row per SDK result message; the source of truth for
|
|
182
|
+
* cost aggregation (§4, §7). Aggregation is `SUM()` over this table.
|
|
183
|
+
*/
|
|
184
|
+
export interface BudgetLedgerEntry extends EntityBase {
|
|
185
|
+
run_id: Ulid;
|
|
186
|
+
task_id: Ulid;
|
|
187
|
+
session_id: string | null;
|
|
188
|
+
cost_usd: number;
|
|
189
|
+
num_turns: number;
|
|
190
|
+
model: string;
|
|
191
|
+
tokens_in: number;
|
|
192
|
+
tokens_out: number;
|
|
193
|
+
cache_read: number;
|
|
194
|
+
cache_write: number;
|
|
195
|
+
recorded_at: IsoTimestamp;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* AuditEvent: an append-only JSONL record. Never stored in SQLite (§4, §8.6).
|
|
199
|
+
* `tool_input` is redacted per §8.6 before it is written.
|
|
200
|
+
*/
|
|
201
|
+
export interface AuditEvent {
|
|
202
|
+
ts: IsoTimestamp;
|
|
203
|
+
/** Who acted, when not a worker — e.g. `"plugin:linear"` (spec 003 §R6). */
|
|
204
|
+
actor?: string;
|
|
205
|
+
run_id: Ulid | null;
|
|
206
|
+
task_id: Ulid | null;
|
|
207
|
+
session_id: string | null;
|
|
208
|
+
kind: import("./enums.js").AuditKind;
|
|
209
|
+
tool_name: string | null;
|
|
210
|
+
tool_input_hash: string | null;
|
|
211
|
+
tool_input: unknown;
|
|
212
|
+
decision: string | null;
|
|
213
|
+
rule_id: string | null;
|
|
214
|
+
detail: unknown;
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,aAAa,EACb,QAAQ,EACR,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,UAAU,EACV,QAAQ,EACT,MAAM,YAAY,CAAC;AAEpB,sEAAsE;AACtE,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,OAAQ,SAAQ,UAAU;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,oBAAoB,CAAC;IACrC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,UAAU,EAAE,OAAO,CA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AM,EAAE,IAAI,CAAC;IACb,OAAO,EAAE,IAAI,CAAC;IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,YAAY,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,YAAY,CAAC;IACjB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,OAAO,YAAY,EAAE,SAAS,CAAC;IACrC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB"}
|
package/dist/entities.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA,sDAAsD"}
|
package/dist/enums.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Enumerations for the orc-brain data model (§4) and state machines (§5). */
|
|
2
|
+
/**
|
|
3
|
+
* Execution isolation mode of a registered Project (spec 002 §R1, §R8).
|
|
4
|
+
* `worktree` runs each scope in a dedicated git worktree on an `orc/<goal>/
|
|
5
|
+
* <scope>` branch; `in_repo` runs workers directly in the repo working tree
|
|
6
|
+
* (the pre-project behavior).
|
|
7
|
+
*/
|
|
8
|
+
export type ProjectExecutionMode = "worktree" | "in_repo";
|
|
9
|
+
/** Goal lifecycle status. */
|
|
10
|
+
export type GoalStatus = "draft" | "planning" | "awaiting_approval" | "active" | "done" | "abandoned";
|
|
11
|
+
/**
|
|
12
|
+
* Environment classification of a Scope (§4, §8.1). `unknown` is treated as
|
|
13
|
+
* `production` everywhere enforcement happens — see the safety layer.
|
|
14
|
+
*/
|
|
15
|
+
export type Environment = "development" | "staging" | "production" | "unknown";
|
|
16
|
+
/**
|
|
17
|
+
* Permission mode a Scope may request (§4, §8.3). `bypassPermissions` is
|
|
18
|
+
* deliberately NOT representable — the safety layer refuses it structurally.
|
|
19
|
+
*/
|
|
20
|
+
export type ScopePermissionMode = "plan" | "default" | "acceptEdits";
|
|
21
|
+
/** Model tier a Scope pins, or `auto` to let the router decide (§6). */
|
|
22
|
+
export type ModelTier = "haiku" | "sonnet" | "opus" | "auto";
|
|
23
|
+
/** Concrete model a worker runs on. `inherit` defers to the session default. */
|
|
24
|
+
export type ModelName = "haiku" | "sonnet" | "opus" | "inherit";
|
|
25
|
+
/** Scope lifecycle status (§4). */
|
|
26
|
+
export type ScopeStatus = "proposed" | "approved" | "running" | "blocked" | "done" | "failed";
|
|
27
|
+
/** Router-relevant classification of a Task (§4, §6). */
|
|
28
|
+
export type TaskType = "mechanical" | "codegen" | "refactor" | "test" | "review" | "planning" | "research";
|
|
29
|
+
/** Task lifecycle status (§5). */
|
|
30
|
+
export type TaskStatus = "pending" | "queued" | "running" | "paused" | "blocked" | "done" | "failed" | "skipped" | "cancelled";
|
|
31
|
+
/** Run state machine states (§5). */
|
|
32
|
+
export type RunState = "draft" | "planning" | "awaiting_approval" | "running" | "pausing" | "paused" | "done" | "failed";
|
|
33
|
+
/** Budget backpressure state (§7). */
|
|
34
|
+
export type BudgetState = "ok" | "warn" | "stopped";
|
|
35
|
+
/** Live worker session state (§4 SubagentRecord). */
|
|
36
|
+
export type SubagentState = "spawning" | "running" | "interrupting" | "paused" | "exited";
|
|
37
|
+
/** What triggered a report (§11). */
|
|
38
|
+
export type ReportTrigger = "interval" | "scope_done" | "task_done" | "budget_threshold" | "manual" | "final";
|
|
39
|
+
/** Lifecycle of an operator escalation raised by a blocked tool call (§8.5). */
|
|
40
|
+
export type EscalationStatus = "open" | "resolved";
|
|
41
|
+
/** The three operator resolutions for a blocked action (§8.5). */
|
|
42
|
+
export type EscalationAction = "deny_instruct" | "approve_once" | "skip_task";
|
|
43
|
+
/** Scope of an engaged rate-limit backpressure (§7.4). */
|
|
44
|
+
export type BackpressureScope = "global" | "model";
|
|
45
|
+
/** Kinds of audit event recorded to the append-only JSONL log (§4, §8.6). */
|
|
46
|
+
export type AuditKind = "tool_call" | "tool_result" | "hook_block" | "permission_deny" | "permission_allow" | "interrupt" | "dispatch" | "state_change" | "routing_decision" | "escalation" | "exemption" | "backpressure" | "report" | "plugin";
|
|
47
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,SAAS,CAAC;AAE1D,6BAA6B;AAC7B,MAAM,MAAM,UAAU,GACpB,OAAO,GAAG,UAAU,GAAG,mBAAmB,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAE/E;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAC;AAE/E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC;AAErE,wEAAwE;AACxE,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;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b,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,WAAW,GACX,UAAU,GACV,cAAc,GACd,kBAAkB,GAClB,YAAY,GACZ,WAAW,GACX,cAAc,GACd,QAAQ,GACR,QAAQ,CAAC"}
|
package/dist/enums.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,8EAA8E"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event bus / SSE event schemas (§3, §10). Every event is appended to the
|
|
3
|
+
* store before fan-out, so the persisted log is never behind the UI.
|
|
4
|
+
*/
|
|
5
|
+
import type { IsoTimestamp, Ulid } from "./ids.js";
|
|
6
|
+
import type { BudgetState, ModelName, RunState, TaskStatus } from "./enums.js";
|
|
7
|
+
import type { ExternalRef } from "./entities.js";
|
|
8
|
+
/** Envelope carried by every bus/SSE event. */
|
|
9
|
+
export interface EventEnvelope<K extends string, P> {
|
|
10
|
+
/** Monotonic per-run sequence id; also the SSE `id:` for Last-Event-ID resume. */
|
|
11
|
+
seq: number;
|
|
12
|
+
ts: IsoTimestamp;
|
|
13
|
+
run_id: Ulid | null;
|
|
14
|
+
type: K;
|
|
15
|
+
payload: P;
|
|
16
|
+
}
|
|
17
|
+
/** A task changed state (§10 `task.state`). */
|
|
18
|
+
export type TaskStateEvent = EventEnvelope<"task.state", {
|
|
19
|
+
task_id: Ulid;
|
|
20
|
+
scope_id: Ulid;
|
|
21
|
+
status: TaskStatus;
|
|
22
|
+
model?: ModelName;
|
|
23
|
+
routing_reason?: string;
|
|
24
|
+
attempt?: number;
|
|
25
|
+
error?: unknown;
|
|
26
|
+
}>;
|
|
27
|
+
/** A worker began a tool call (§10 `tool.call`). */
|
|
28
|
+
export type ToolCallEvent = EventEnvelope<"tool.call", {
|
|
29
|
+
task_id: Ulid;
|
|
30
|
+
session_id: string | null;
|
|
31
|
+
tool_name: string;
|
|
32
|
+
/** Truncated/redacted input summary for display. */
|
|
33
|
+
input_summary: string;
|
|
34
|
+
decision?: "allow" | "deny";
|
|
35
|
+
rule_id?: string;
|
|
36
|
+
}>;
|
|
37
|
+
/** A tool call produced a result (§10 `tool.result`). */
|
|
38
|
+
export type ToolResultEvent = EventEnvelope<"tool.result", {
|
|
39
|
+
task_id: Ulid;
|
|
40
|
+
session_id: string | null;
|
|
41
|
+
tool_name: string;
|
|
42
|
+
is_error: boolean;
|
|
43
|
+
summary: string;
|
|
44
|
+
}>;
|
|
45
|
+
/** A streamed text delta from a worker (§10 `text.delta`). */
|
|
46
|
+
export type TextDeltaEvent = EventEnvelope<"text.delta", {
|
|
47
|
+
task_id: Ulid;
|
|
48
|
+
session_id: string | null;
|
|
49
|
+
delta: string;
|
|
50
|
+
}>;
|
|
51
|
+
/** Budget ledger updated (§10 `budget.tick`). */
|
|
52
|
+
export type BudgetTickEvent = EventEnvelope<"budget.tick", {
|
|
53
|
+
budget_usd: number;
|
|
54
|
+
spent_usd: number;
|
|
55
|
+
state: BudgetState;
|
|
56
|
+
warn_at: number;
|
|
57
|
+
stop_at: number;
|
|
58
|
+
}>;
|
|
59
|
+
/** Rate-limit backpressure engaged/cleared (§7, §10 `limit.backpressure`). */
|
|
60
|
+
export type LimitBackpressureEvent = EventEnvelope<"limit.backpressure", {
|
|
61
|
+
engaged: boolean;
|
|
62
|
+
scope: "global" | "model";
|
|
63
|
+
model?: ModelName;
|
|
64
|
+
reason: string;
|
|
65
|
+
/** Epoch ms when backpressure is expected to clear, if known. */
|
|
66
|
+
resets_at?: number;
|
|
67
|
+
}>;
|
|
68
|
+
/** Run state machine transition (§10 `run.state`). */
|
|
69
|
+
export type RunStateEvent = EventEnvelope<"run.state", {
|
|
70
|
+
state: RunState;
|
|
71
|
+
reason?: string;
|
|
72
|
+
}>;
|
|
73
|
+
/** A tool call was blocked and needs operator action (§8.5, §10 `escalation.new`). */
|
|
74
|
+
export type EscalationEvent = EventEnvelope<"escalation.new", {
|
|
75
|
+
escalation_id: Ulid;
|
|
76
|
+
task_id: Ulid;
|
|
77
|
+
rule_id: string;
|
|
78
|
+
tool_name: string;
|
|
79
|
+
input_summary: string;
|
|
80
|
+
stated_intent?: string;
|
|
81
|
+
}>;
|
|
82
|
+
/** A new report was generated (§10 `report.new`). */
|
|
83
|
+
export type ReportEvent = EventEnvelope<"report.new", {
|
|
84
|
+
report_id: Ulid;
|
|
85
|
+
trigger: string;
|
|
86
|
+
path: string | null;
|
|
87
|
+
}>;
|
|
88
|
+
/** A worker was dispatched (§5 dispatch loop). */
|
|
89
|
+
export type DispatchEvent = EventEnvelope<"dispatch", {
|
|
90
|
+
task_id: Ulid;
|
|
91
|
+
scope_id: Ulid;
|
|
92
|
+
model: ModelName;
|
|
93
|
+
routing_reason: string;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* A scope reached a terminal state — all its tasks settled
|
|
97
|
+
* (.specs/active/autonomous-loop.md §3.2, G1). `scope.done` = none failed;
|
|
98
|
+
* `scope.failed` = at least one task failed after retries.
|
|
99
|
+
*/
|
|
100
|
+
export type ScopeSettledEvent = EventEnvelope<"scope.done" | "scope.failed", {
|
|
101
|
+
scope_id: Ulid;
|
|
102
|
+
goal_id: Ulid;
|
|
103
|
+
task_count: number;
|
|
104
|
+
failed_count: number;
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* The autonomous controller ran a re-plan cycle
|
|
108
|
+
* (.specs/active/autonomous-loop.md §3.1, G2). `added_tasks` = 0 signals the
|
|
109
|
+
* no-progress guard (G5).
|
|
110
|
+
*/
|
|
111
|
+
export type ReplanCycleEvent = EventEnvelope<"replan_cycle", {
|
|
112
|
+
cycle: number;
|
|
113
|
+
added_scopes: number;
|
|
114
|
+
added_tasks: number;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* The hybrid goal-satisfaction evaluator produced a verdict
|
|
118
|
+
* (.specs/active/autonomous-loop.md §3.4, G3).
|
|
119
|
+
*/
|
|
120
|
+
export type GoalEvaluatedEvent = EventEnvelope<"goal_evaluated", {
|
|
121
|
+
satisfied: boolean;
|
|
122
|
+
unmet: string[];
|
|
123
|
+
rationale: string;
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* Dispatch was deferred by proactive pacing (spec 002 §R16): the global
|
|
127
|
+
* concurrency cap, the tasks-per-hour throttle, or the per-run task ceiling.
|
|
128
|
+
* Edge-triggered — published when the gate first engages, not every tick.
|
|
129
|
+
*/
|
|
130
|
+
export type PacingHoldEvent = EventEnvelope<"pacing.hold", {
|
|
131
|
+
reason: "global_concurrency" | "tasks_per_hour" | "tasks_per_run";
|
|
132
|
+
/** ISO timestamp when dispatch is expected to resume, if known. */
|
|
133
|
+
resume_at?: IsoTimestamp;
|
|
134
|
+
}>;
|
|
135
|
+
/**
|
|
136
|
+
* A plugin performed (or failed) an outbound sync action against its external
|
|
137
|
+
* tracker (spec 003 §R9, §R12) — e.g. a Linear comment or state transition.
|
|
138
|
+
* Published by the plugin host via `host.reportSync`.
|
|
139
|
+
*/
|
|
140
|
+
export type PluginSyncEvent = EventEnvelope<"plugin.sync", {
|
|
141
|
+
plugin: string;
|
|
142
|
+
action: string;
|
|
143
|
+
ref?: ExternalRef;
|
|
144
|
+
ok: boolean;
|
|
145
|
+
detail?: string;
|
|
146
|
+
}>;
|
|
147
|
+
/** Discriminated union of all bus/SSE events. */
|
|
148
|
+
export type BusEvent = TaskStateEvent | ToolCallEvent | ToolResultEvent | TextDeltaEvent | BudgetTickEvent | LimitBackpressureEvent | RunStateEvent | EscalationEvent | ReportEvent | DispatchEvent | ScopeSettledEvent | ReplanCycleEvent | GoalEvaluatedEvent | PacingHoldEvent | PluginSyncEvent;
|
|
149
|
+
/** String literal type of every event kind. */
|
|
150
|
+
export type BusEventType = BusEvent["type"];
|
|
151
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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,CAAC,EAAE,YAAY,CAAC;CAC1B,CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,aAAa,CACzC,aAAa,EACb;IACE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CACF,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GAChB,cAAc,GACd,aAAa,GACb,eAAe,GACf,cAAc,GACd,eAAe,GACf,sBAAsB,GACtB,aAAa,GACb,eAAe,GACf,WAAW,GACX,aAAa,GACb,iBAAiB,GACjB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,eAAe,CAAC;AAEpB,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/dist/ids.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Branded ID helpers. All entities carry a ULID `id` (§4). */
|
|
2
|
+
/** A ULID string identifying any orc-brain entity. */
|
|
3
|
+
export type Ulid = string;
|
|
4
|
+
/** ISO-8601 timestamp string (UTC). */
|
|
5
|
+
export type IsoTimestamp = string;
|
|
6
|
+
/** Fields shared by every persisted entity (§4). */
|
|
7
|
+
export interface EntityBase {
|
|
8
|
+
id: Ulid;
|
|
9
|
+
created_at: IsoTimestamp;
|
|
10
|
+
updated_at: IsoTimestamp;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,sDAAsD;AACtD,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC;AAE1B,uCAAuC;AACvC,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,IAAI,CAAC;IACT,UAAU,EAAE,YAAY,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;CAC1B"}
|
package/dist/ids.js
ADDED
package/dist/ids.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAAA,+DAA+D"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Shared types and event schemas for orc-brain. See specs/001-orchestrator-spec.md (source of truth). */
|
|
2
|
+
/** Semantic version of the shared contract. Bumped when event schemas change. */
|
|
3
|
+
export declare const SHARED_SCHEMA_VERSION: "0.4.0";
|
|
4
|
+
export * from "./ids.js";
|
|
5
|
+
export * from "./enums.js";
|
|
6
|
+
export * from "./entities.js";
|
|
7
|
+
export * from "./events.js";
|
|
8
|
+
export * from "./config.js";
|
|
9
|
+
export * from "./plan.js";
|
|
10
|
+
export * from "./plugins.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,EAAG,OAAgB,CAAC;AAEtD,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Shared types and event schemas for orc-brain. See specs/001-orchestrator-spec.md (source of truth). */
|
|
2
|
+
/** Semantic version of the shared contract. Bumped when event schemas change. */
|
|
3
|
+
export const SHARED_SCHEMA_VERSION = "0.4.0";
|
|
4
|
+
export * from "./ids.js";
|
|
5
|
+
export * from "./enums.js";
|
|
6
|
+
export * from "./entities.js";
|
|
7
|
+
export * from "./events.js";
|
|
8
|
+
export * from "./config.js";
|
|
9
|
+
export * from "./plan.js";
|
|
10
|
+
export * from "./plugins.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,iFAAiF;AACjF,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAgB,CAAC;AAEtD,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/dist/plan.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planner output contract (§3, §15 Phase 2). The Planner emits a structured
|
|
3
|
+
* Scope/Task breakdown validated against this shape before it is materialized
|
|
4
|
+
* into {@link Scope}/{@link Task} rows for operator approval. Dependencies are
|
|
5
|
+
* expressed by human-readable reference (scope `name`, task `title`) so the LLM
|
|
6
|
+
* never has to invent ULIDs; the orchestrator resolves them at materialization.
|
|
7
|
+
*/
|
|
8
|
+
import type { Environment, ModelTier, ScopePermissionMode, TaskType } from "./enums.js";
|
|
9
|
+
import type { ForbiddenAction, SuccessCriterion } from "./entities.js";
|
|
10
|
+
/** A planned task inside a planned scope (materializes to a {@link Task}). */
|
|
11
|
+
export interface PlannedTask {
|
|
12
|
+
title: string;
|
|
13
|
+
prompt: string;
|
|
14
|
+
task_type: TaskType;
|
|
15
|
+
/** Titles of sibling tasks (within the same scope) this task depends on. */
|
|
16
|
+
depends_on?: string[];
|
|
17
|
+
}
|
|
18
|
+
/** A planned scope (materializes to a {@link Scope}). */
|
|
19
|
+
export interface PlannedScope {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
path_allowlist: string[];
|
|
23
|
+
path_denylist?: string[];
|
|
24
|
+
allowed_tools: string[];
|
|
25
|
+
disallowed_tools?: string[];
|
|
26
|
+
model_tier: ModelTier;
|
|
27
|
+
environment: Environment;
|
|
28
|
+
permission_mode: ScopePermissionMode;
|
|
29
|
+
forbidden_actions?: ForbiddenAction[];
|
|
30
|
+
success_criteria?: SuccessCriterion[];
|
|
31
|
+
max_budget_usd: number;
|
|
32
|
+
/** Names of other scopes this scope depends on (scope-level DAG). */
|
|
33
|
+
depends_on?: string[];
|
|
34
|
+
tasks: PlannedTask[];
|
|
35
|
+
}
|
|
36
|
+
/** The Planner's full output: a proposed Scope/Task DAG for a Goal. */
|
|
37
|
+
export interface Plan {
|
|
38
|
+
scopes: PlannedScope[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* JSON Schema handed to the SDK via `outputFormat: { type: "json_schema" }` so
|
|
42
|
+
* the Planner returns a machine-checkable {@link Plan}. Kept deliberately strict
|
|
43
|
+
* on enums (they mirror {@link ModelTier}/{@link Environment}/etc.) so an invalid
|
|
44
|
+
* plan fails fast at validation rather than at dispatch.
|
|
45
|
+
*/
|
|
46
|
+
export declare const PLAN_JSON_SCHEMA: Record<string, unknown>;
|
|
47
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../src/plan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACT,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEvE,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,CAAC;IACpB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,EAAE,SAAS,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,mBAAmB,CAAC;IACrC,iBAAiB,CAAC,EAAE,eAAe,EAAE,CAAC;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,uEAAuE;AACvE,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAiGpD,CAAC"}
|
package/dist/plan.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Planner output contract (§3, §15 Phase 2). The Planner emits a structured
|
|
3
|
+
* Scope/Task breakdown validated against this shape before it is materialized
|
|
4
|
+
* into {@link Scope}/{@link Task} rows for operator approval. Dependencies are
|
|
5
|
+
* expressed by human-readable reference (scope `name`, task `title`) so the LLM
|
|
6
|
+
* never has to invent ULIDs; the orchestrator resolves them at materialization.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* JSON Schema handed to the SDK via `outputFormat: { type: "json_schema" }` so
|
|
10
|
+
* the Planner returns a machine-checkable {@link Plan}. Kept deliberately strict
|
|
11
|
+
* on enums (they mirror {@link ModelTier}/{@link Environment}/etc.) so an invalid
|
|
12
|
+
* plan fails fast at validation rather than at dispatch.
|
|
13
|
+
*/
|
|
14
|
+
export const PLAN_JSON_SCHEMA = {
|
|
15
|
+
type: "object",
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
required: ["scopes"],
|
|
18
|
+
properties: {
|
|
19
|
+
scopes: {
|
|
20
|
+
type: "array",
|
|
21
|
+
minItems: 1,
|
|
22
|
+
items: {
|
|
23
|
+
type: "object",
|
|
24
|
+
additionalProperties: false,
|
|
25
|
+
required: [
|
|
26
|
+
"name",
|
|
27
|
+
"description",
|
|
28
|
+
"path_allowlist",
|
|
29
|
+
"allowed_tools",
|
|
30
|
+
"model_tier",
|
|
31
|
+
"environment",
|
|
32
|
+
"permission_mode",
|
|
33
|
+
"max_budget_usd",
|
|
34
|
+
"tasks",
|
|
35
|
+
],
|
|
36
|
+
properties: {
|
|
37
|
+
name: { type: "string" },
|
|
38
|
+
description: { type: "string" },
|
|
39
|
+
path_allowlist: { type: "array", items: { type: "string" } },
|
|
40
|
+
path_denylist: { type: "array", items: { type: "string" } },
|
|
41
|
+
allowed_tools: { type: "array", items: { type: "string" } },
|
|
42
|
+
disallowed_tools: { type: "array", items: { type: "string" } },
|
|
43
|
+
model_tier: {
|
|
44
|
+
type: "string",
|
|
45
|
+
enum: ["haiku", "sonnet", "opus", "auto"],
|
|
46
|
+
},
|
|
47
|
+
environment: {
|
|
48
|
+
type: "string",
|
|
49
|
+
enum: ["development", "staging", "production", "unknown"],
|
|
50
|
+
},
|
|
51
|
+
permission_mode: {
|
|
52
|
+
type: "string",
|
|
53
|
+
enum: ["plan", "default", "acceptEdits"],
|
|
54
|
+
},
|
|
55
|
+
forbidden_actions: {
|
|
56
|
+
type: "array",
|
|
57
|
+
items: {
|
|
58
|
+
type: "object",
|
|
59
|
+
additionalProperties: false,
|
|
60
|
+
required: ["description"],
|
|
61
|
+
properties: {
|
|
62
|
+
description: { type: "string" },
|
|
63
|
+
pattern: { type: "string" },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
success_criteria: {
|
|
68
|
+
type: "array",
|
|
69
|
+
items: {
|
|
70
|
+
type: "object",
|
|
71
|
+
additionalProperties: false,
|
|
72
|
+
required: ["description"],
|
|
73
|
+
properties: {
|
|
74
|
+
description: { type: "string" },
|
|
75
|
+
verification_method: { type: "string" },
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
max_budget_usd: { type: "number", minimum: 0 },
|
|
80
|
+
depends_on: { type: "array", items: { type: "string" } },
|
|
81
|
+
tasks: {
|
|
82
|
+
type: "array",
|
|
83
|
+
minItems: 1,
|
|
84
|
+
items: {
|
|
85
|
+
type: "object",
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
required: ["title", "prompt", "task_type"],
|
|
88
|
+
properties: {
|
|
89
|
+
title: { type: "string" },
|
|
90
|
+
prompt: { type: "string" },
|
|
91
|
+
task_type: {
|
|
92
|
+
type: "string",
|
|
93
|
+
enum: [
|
|
94
|
+
"mechanical",
|
|
95
|
+
"codegen",
|
|
96
|
+
"refactor",
|
|
97
|
+
"test",
|
|
98
|
+
"review",
|
|
99
|
+
"planning",
|
|
100
|
+
"research",
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
depends_on: { type: "array", items: { type: "string" } },
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=plan.js.map
|
package/dist/plan.js.map
ADDED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,QAAQ,EAAE;gCACzB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gCAC1B,SAAS,EAAE;oCACT,IAAI,EAAE,QAAQ;oCACd,IAAI,EAAE;wCACJ,YAAY;wCACZ,SAAS;wCACT,UAAU;wCACV,MAAM;wCACN,QAAQ;wCACR,UAAU;wCACV,UAAU;qCACX;iCACF;gCACD,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;6BACzD;yBACF;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin contract (spec 003 §R1). Types only — the host implementation lives
|
|
3
|
+
* in `@orc-brain/core` (`src/plugins/`). Third-party plugins depend on
|
|
4
|
+
* `@orc-brain/shared` alone and export a default factory returning an
|
|
5
|
+
* {@link OrcPlugin}. See `packages/plugin-linear` for the reference plugin.
|
|
6
|
+
*/
|
|
7
|
+
import type { ExternalRef, Goal, Project, Run, Scope } from "./entities.js";
|
|
8
|
+
import type { BusEvent } from "./events.js";
|
|
9
|
+
/**
|
|
10
|
+
* Version of this contract. The registry refuses to load a plugin whose
|
|
11
|
+
* manifest declares a different `apiVersion` (spec 003 §R3).
|
|
12
|
+
*/
|
|
13
|
+
export declare const PLUGIN_API_VERSION = 1;
|
|
14
|
+
/** Standardized capabilities a plugin may declare (spec 003 §3.2). */
|
|
15
|
+
export type PluginCapability = "task-provider";
|
|
16
|
+
/** Static description a plugin declares about itself (spec 003 §R1). */
|
|
17
|
+
export interface PluginManifest {
|
|
18
|
+
/** Unique kebab-case plugin name (e.g. `"linear"`). */
|
|
19
|
+
name: string;
|
|
20
|
+
version: string;
|
|
21
|
+
/** Must equal {@link PLUGIN_API_VERSION} or the plugin is not loaded. */
|
|
22
|
+
apiVersion: number;
|
|
23
|
+
capabilities: PluginCapability[];
|
|
24
|
+
/**
|
|
25
|
+
* Env-style secret key names the plugin reads via `host.getSecret` (e.g.
|
|
26
|
+
* `"LINEAR_API_KEY"`). Every declared key is stripped from worker envs and
|
|
27
|
+
* its value registered for redaction (spec 003 §R5).
|
|
28
|
+
*/
|
|
29
|
+
secrets?: string[];
|
|
30
|
+
}
|
|
31
|
+
/** A task in an external tracker, normalized by a `task-provider` (§R1). */
|
|
32
|
+
export interface ExternalTask {
|
|
33
|
+
/** Plugin name that produced this task (e.g. `"linear"`). */
|
|
34
|
+
provider: string;
|
|
35
|
+
/** Provider-native stable id (e.g. a Linear issue UUID). */
|
|
36
|
+
id: string;
|
|
37
|
+
/** Human identifier (e.g. `"ENG-123"`). */
|
|
38
|
+
identifier: string;
|
|
39
|
+
title: string;
|
|
40
|
+
/** Full description, markdown as-is; empty string when the tracker has none. */
|
|
41
|
+
description: string;
|
|
42
|
+
url: string;
|
|
43
|
+
/** Provider workflow-state name (display only). */
|
|
44
|
+
state: string;
|
|
45
|
+
assignee?: string;
|
|
46
|
+
labels: string[];
|
|
47
|
+
updated_at: string;
|
|
48
|
+
}
|
|
49
|
+
/** Query accepted by {@link TaskProvider.listTasks} (spec 003 §R1). */
|
|
50
|
+
export interface TaskQuery {
|
|
51
|
+
search?: string;
|
|
52
|
+
assigned_to_me?: boolean;
|
|
53
|
+
state?: string;
|
|
54
|
+
team?: string;
|
|
55
|
+
limit?: number;
|
|
56
|
+
}
|
|
57
|
+
/** The `task-provider` capability surface (spec 003 §R1, §R11). */
|
|
58
|
+
export interface TaskProvider {
|
|
59
|
+
listTasks(query: TaskQuery): Promise<ExternalTask[]>;
|
|
60
|
+
/** Accepts the provider-native id or the human identifier (§R11). */
|
|
61
|
+
getTask(id: string): Promise<ExternalTask | null>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The narrow host API handed to a plugin's `init` (spec 003 §R1). Implemented
|
|
65
|
+
* by core; every method is safe to call from plugin callbacks — failures in
|
|
66
|
+
* the plugin never propagate into orchestrator control flow (§N2).
|
|
67
|
+
*/
|
|
68
|
+
export interface PluginHost {
|
|
69
|
+
log(msg: string): void;
|
|
70
|
+
/** Appends an audit entry with `actor: "plugin:<name>"` (spec 003 §R6). */
|
|
71
|
+
audit(action: string, detail?: unknown): void;
|
|
72
|
+
/**
|
|
73
|
+
* Audits a sync action AND publishes a `plugin.sync` bus event
|
|
74
|
+
* (spec 003 §R9, §R12).
|
|
75
|
+
*/
|
|
76
|
+
reportSync(action: string, info: {
|
|
77
|
+
ref?: ExternalRef;
|
|
78
|
+
ok: boolean;
|
|
79
|
+
detail?: string;
|
|
80
|
+
run_id?: string;
|
|
81
|
+
}): void;
|
|
82
|
+
/** Secrets file first, then `process.env[key]` fallback (spec 003 §R5). */
|
|
83
|
+
getSecret(key: string): string | undefined;
|
|
84
|
+
/** Per-plugin settings from `plugins.json` (spec 003 §R3). */
|
|
85
|
+
settings: Record<string, unknown>;
|
|
86
|
+
subscribe(fn: (e: BusEvent) => void): () => void;
|
|
87
|
+
listProjects(): Promise<Project[]>;
|
|
88
|
+
getGoal(id: string): Promise<Goal | null>;
|
|
89
|
+
getRun(id: string): Promise<Run | null>;
|
|
90
|
+
listScopesByGoal(goalId: string): Promise<Scope[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Creates a goal under a project from an external task via the feature-flow
|
|
93
|
+
* code path — planning kicks off immediately (spec 003 §R4).
|
|
94
|
+
*/
|
|
95
|
+
createGoalFromExternalTask(projectId: string, task: ExternalTask): Promise<Goal>;
|
|
96
|
+
}
|
|
97
|
+
/** A constructed plugin instance (spec 003 §R1). */
|
|
98
|
+
export interface OrcPlugin {
|
|
99
|
+
manifest: PluginManifest;
|
|
100
|
+
init(host: PluginHost): Promise<void> | void;
|
|
101
|
+
close?(): Promise<void> | void;
|
|
102
|
+
/** Present when `manifest.capabilities` includes `"task-provider"`. */
|
|
103
|
+
taskProvider?: TaskProvider;
|
|
104
|
+
/**
|
|
105
|
+
* Called by the host after one of this provider's tasks is imported as a
|
|
106
|
+
* goal (spec 003 §R12 import comment). Fire-and-forget; errors are audited.
|
|
107
|
+
*/
|
|
108
|
+
onTaskImported?(task: ExternalTask, goal: Goal): Promise<void> | void;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Shape of a plugin module: the default export is a factory taking the
|
|
112
|
+
* declaration's `settings` (spec 003 §R1). Tests construct plugins directly.
|
|
113
|
+
*/
|
|
114
|
+
export type OrcPluginModule = {
|
|
115
|
+
default: (settings: Record<string, unknown>) => OrcPlugin;
|
|
116
|
+
};
|
|
117
|
+
/** One entry of `<stateDir>/plugins.json` (spec 003 §R3). */
|
|
118
|
+
export interface PluginDeclaration {
|
|
119
|
+
name: string;
|
|
120
|
+
/** Absolute path to an ESM module, or a builtin alias (e.g. `"linear"`). */
|
|
121
|
+
specifier: string;
|
|
122
|
+
enabled: boolean;
|
|
123
|
+
settings?: Record<string, unknown>;
|
|
124
|
+
}
|
|
125
|
+
/** Load status of a declared plugin, as reported by `GET /api/plugins` (§R3). */
|
|
126
|
+
export interface PluginStatus {
|
|
127
|
+
name: string;
|
|
128
|
+
version: string | null;
|
|
129
|
+
capabilities: PluginCapability[];
|
|
130
|
+
enabled: boolean;
|
|
131
|
+
status: "active" | "disabled" | "error";
|
|
132
|
+
error?: string;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=plugins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAE/C,wEAAwE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AC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,cAAc,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACvE;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS,CAAC;CAC3D,CAAC;AAEF,6DAA6D;AAC7D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/plugins.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin contract (spec 003 §R1). Types only — the host implementation lives
|
|
3
|
+
* in `@orc-brain/core` (`src/plugins/`). Third-party plugins depend on
|
|
4
|
+
* `@orc-brain/shared` alone and export a default factory returning an
|
|
5
|
+
* {@link OrcPlugin}. See `packages/plugin-linear` for the reference plugin.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Version of this contract. The registry refuses to load a plugin whose
|
|
9
|
+
* manifest declares a different `apiVersion` (spec 003 §R3).
|
|
10
|
+
*/
|
|
11
|
+
export const PLUGIN_API_VERSION = 1;
|
|
12
|
+
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@orc-brain/shared",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared types and event schemas for orc-brain (no runtime logic).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Paulo Lima",
|
|
8
|
+
"homepage": "https://github.com/anplabs/orc-brain#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/anplabs/orc-brain.git",
|
|
12
|
+
"directory": "packages/shared"
|
|
13
|
+
},
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.json",
|
|
33
|
+
"clean": "rm -rf dist"
|
|
34
|
+
}
|
|
35
|
+
}
|