@jmanuelcorral/openteam 0.1.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 (66) hide show
  1. package/.opencode/openteam.example.json +57 -0
  2. package/AGENTS.md +41 -0
  3. package/LICENSE +21 -0
  4. package/README.md +315 -0
  5. package/dist/capabilities/budget.d.ts +12 -0
  6. package/dist/capabilities/budget.d.ts.map +1 -0
  7. package/dist/capabilities/catalog.d.ts +27 -0
  8. package/dist/capabilities/catalog.d.ts.map +1 -0
  9. package/dist/capabilities/classify.d.ts +10 -0
  10. package/dist/capabilities/classify.d.ts.map +1 -0
  11. package/dist/capabilities/curated.d.ts +3 -0
  12. package/dist/capabilities/curated.d.ts.map +1 -0
  13. package/dist/capabilities/normalize.d.ts +3 -0
  14. package/dist/capabilities/normalize.d.ts.map +1 -0
  15. package/dist/capabilities/select.d.ts +6 -0
  16. package/dist/capabilities/select.d.ts.map +1 -0
  17. package/dist/capabilities/types.d.ts +58 -0
  18. package/dist/capabilities/types.d.ts.map +1 -0
  19. package/dist/classifier/localClassifier.d.ts +19 -0
  20. package/dist/classifier/localClassifier.d.ts.map +1 -0
  21. package/dist/classifier/types.d.ts +20 -0
  22. package/dist/classifier/types.d.ts.map +1 -0
  23. package/dist/config/load.d.ts +4 -0
  24. package/dist/config/load.d.ts.map +1 -0
  25. package/dist/config/schema.d.ts +103 -0
  26. package/dist/config/schema.d.ts.map +1 -0
  27. package/dist/index.d.ts +13 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +1199 -0
  30. package/dist/local/foundry-local.d.ts +17 -0
  31. package/dist/local/foundry-local.d.ts.map +1 -0
  32. package/dist/local/lmstudio.d.ts +4 -0
  33. package/dist/local/lmstudio.d.ts.map +1 -0
  34. package/dist/local/ollama.d.ts +4 -0
  35. package/dist/local/ollama.d.ts.map +1 -0
  36. package/dist/local/openai-compatible.d.ts +25 -0
  37. package/dist/local/openai-compatible.d.ts.map +1 -0
  38. package/dist/local/registry.d.ts +20 -0
  39. package/dist/local/registry.d.ts.map +1 -0
  40. package/dist/local/types.d.ts +39 -0
  41. package/dist/local/types.d.ts.map +1 -0
  42. package/dist/orchestrator/coordinator.d.ts +43 -0
  43. package/dist/orchestrator/coordinator.d.ts.map +1 -0
  44. package/dist/orchestrator/permissions.d.ts +14 -0
  45. package/dist/orchestrator/permissions.d.ts.map +1 -0
  46. package/dist/orchestrator/roles.d.ts +40 -0
  47. package/dist/orchestrator/roles.d.ts.map +1 -0
  48. package/dist/orchestrator/subsessions.d.ts +62 -0
  49. package/dist/orchestrator/subsessions.d.ts.map +1 -0
  50. package/dist/plugin/availability.d.ts +20 -0
  51. package/dist/plugin/availability.d.ts.map +1 -0
  52. package/dist/plugin/hooks.d.ts +14 -0
  53. package/dist/plugin/hooks.d.ts.map +1 -0
  54. package/dist/router/chooseModel.d.ts +3 -0
  55. package/dist/router/chooseModel.d.ts.map +1 -0
  56. package/dist/router/types.d.ts +49 -0
  57. package/dist/router/types.d.ts.map +1 -0
  58. package/dist/telemetry/cost.d.ts +12 -0
  59. package/dist/telemetry/cost.d.ts.map +1 -0
  60. package/dist/telemetry/hash.d.ts +2 -0
  61. package/dist/telemetry/hash.d.ts.map +1 -0
  62. package/dist/telemetry/sink.d.ts +12 -0
  63. package/dist/telemetry/sink.d.ts.map +1 -0
  64. package/dist/telemetry/types.d.ts +30 -0
  65. package/dist/telemetry/types.d.ts.map +1 -0
  66. package/package.json +76 -0
@@ -0,0 +1,17 @@
1
+ import type { RuntimeAdapter, RuntimeDiscovery, RuntimeDiscoveryResult, RuntimeListModelsOptions } from "./types";
2
+ export type ExecResult = {
3
+ exitCode: number;
4
+ stdout: string;
5
+ stderr: string;
6
+ };
7
+ export type ExecLike = (command: string, args: readonly string[]) => Promise<ExecResult>;
8
+ export declare function discoverFoundryLocalBaseURL(input: {
9
+ exec: ExecLike;
10
+ command?: string;
11
+ args?: readonly string[];
12
+ }): Promise<string>;
13
+ export declare function createFoundryLocalAdapter(): RuntimeAdapter;
14
+ export declare function resolveFoundryBaseURL(options: RuntimeListModelsOptions): Promise<string>;
15
+ export declare function normalizeFoundryDiscovery(discovery: RuntimeDiscoveryResult): string;
16
+ export declare function foundryDiscoveryFromExec(exec: ExecLike): RuntimeDiscovery;
17
+ //# sourceMappingURL=foundry-local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foundry-local.d.ts","sourceRoot":"","sources":["../../src/local/foundry-local.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EAEzB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,CACrB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,KACpB,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzB,wBAAsB,2BAA2B,CAAC,KAAK,EAAE;IACvD,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlB;AAED,wBAAgB,yBAAyB,IAAI,cAAc,CA+B1D;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,sBAAsB,GAChC,MAAM,CAYR;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,QAAQ,GAAG,gBAAgB,CAEzE"}
@@ -0,0 +1,4 @@
1
+ import type { RuntimeAdapter } from "./types";
2
+ export declare const LMSTUDIO_DEFAULT_BASE_URL = "http://localhost:1234/v1";
3
+ export declare function createLMStudioAdapter(): RuntimeAdapter;
4
+ //# sourceMappingURL=lmstudio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lmstudio.d.ts","sourceRoot":"","sources":["../../src/local/lmstudio.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,yBAAyB,6BAA6B,CAAC;AAEpE,wBAAgB,qBAAqB,IAAI,cAAc,CAmBtD"}
@@ -0,0 +1,4 @@
1
+ import type { RuntimeAdapter } from "./types";
2
+ export declare const OLLAMA_DEFAULT_BASE_URL = "http://localhost:11434/v1";
3
+ export declare function createOllamaAdapter(): RuntimeAdapter;
4
+ //# sourceMappingURL=ollama.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../src/local/ollama.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AAEnE,wBAAgB,mBAAmB,IAAI,cAAc,CAmBpD"}
@@ -0,0 +1,25 @@
1
+ import type { FetchLike, LocalModelInfo, LocalRuntimeId, LocalRuntimeSnapshot } from "./types";
2
+ export declare function normalizeBaseURL(baseURL: string): string;
3
+ export declare function modelsEndpoint(baseURL: string): string;
4
+ export declare function chatCompletionsEndpoint(baseURL: string): string;
5
+ export declare function errorMessage(error: unknown): string;
6
+ export declare function listOpenAICompatibleModels(baseURL: string, fetch: FetchLike): Promise<LocalModelInfo[]>;
7
+ export declare function parseOpenAIModels(payload: unknown): LocalModelInfo[];
8
+ export declare function unavailableSnapshot(input: {
9
+ id: LocalRuntimeId;
10
+ baseURL: string;
11
+ probedAt: string;
12
+ error: unknown;
13
+ }): LocalRuntimeSnapshot;
14
+ export declare function probeOpenAICompatibleRuntime(input: {
15
+ id: LocalRuntimeId;
16
+ baseURL: string;
17
+ fetch: FetchLike;
18
+ probedAt: string;
19
+ }): Promise<LocalRuntimeSnapshot>;
20
+ export declare function probeToolCalling(input: {
21
+ baseURL: string;
22
+ modelID: string;
23
+ fetch: FetchLike;
24
+ }): Promise<boolean>;
25
+ //# sourceMappingURL=openai-compatible.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openai-compatible.d.ts","sourceRoot":"","sources":["../../src/local/openai-compatible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAMnD;AAED,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,cAAc,EAAE,CAAC,CAkB3B;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,EAAE,CAMpE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,EAAE,EAAE,cAAc,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,oBAAoB,CASvB;AAED,wBAAsB,4BAA4B,CAAC,KAAK,EAAE;IACxD,EAAE,EAAE,cAAc,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAmBhC;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;CAClB,GAAG,OAAO,CAAC,OAAO,CAAC,CAiDnB"}
@@ -0,0 +1,20 @@
1
+ import type { LocalRuntime } from "../config/schema";
2
+ import type { ModelSelection } from "../router/types";
3
+ import type { Clock, FetchLike, LocalRuntimeId, LocalRuntimeSnapshot, RuntimeAdapter, RuntimeDiscovery } from "./types";
4
+ export type RuntimeRegistryOptions = {
5
+ fetch: FetchLike;
6
+ clock: Clock;
7
+ foundryDiscovery?: RuntimeDiscovery;
8
+ adapters?: Partial<Record<LocalRuntimeId, RuntimeAdapter>>;
9
+ };
10
+ export declare class RuntimeRegistry {
11
+ private readonly adapters;
12
+ private readonly clock;
13
+ private readonly fetch;
14
+ private readonly foundryDiscovery;
15
+ constructor(options: RuntimeRegistryOptions);
16
+ probe(runtimes: readonly LocalRuntime[]): Promise<LocalRuntimeSnapshot[]>;
17
+ private createProbeOptions;
18
+ }
19
+ export declare function flattenLocalModelSelections(snapshots: readonly LocalRuntimeSnapshot[]): ModelSelection[];
20
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/local/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKtD,OAAO,KAAK,EACV,KAAK,EACL,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAEjB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;CAC5D,CAAC;AAEF,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyC;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAClC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA+B;gBAEpD,OAAO,EAAE,sBAAsB;IAYrC,KAAK,CACT,QAAQ,EAAE,SAAS,YAAY,EAAE,GAChC,OAAO,CAAC,oBAAoB,EAAE,CAAC;IA6BlC,OAAO,CAAC,kBAAkB;CAuB3B;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,SAAS,oBAAoB,EAAE,GACzC,cAAc,EAAE,CAWlB"}
@@ -0,0 +1,39 @@
1
+ export type LocalRuntimeId = "ollama" | "lmstudio" | "foundry-local";
2
+ export type LocalModelInfo = {
3
+ modelID: string;
4
+ supportsTools: boolean | "unknown";
5
+ contextWindow?: number;
6
+ };
7
+ export type LocalRuntimeSnapshot = {
8
+ id: LocalRuntimeId;
9
+ baseURL: string;
10
+ reachable: boolean;
11
+ models: LocalModelInfo[];
12
+ probedAt: string;
13
+ error?: string;
14
+ };
15
+ export type FetchLike = typeof fetch;
16
+ export type Clock = () => string;
17
+ export type RuntimeDiscoveryResult = string | {
18
+ baseURL: string;
19
+ } | {
20
+ port: number;
21
+ host?: string;
22
+ protocol?: "http" | "https";
23
+ };
24
+ export type RuntimeDiscovery = () => Promise<RuntimeDiscoveryResult>;
25
+ export type RuntimeListModelsOptions = {
26
+ baseURL?: string;
27
+ fetch: FetchLike;
28
+ discovery?: RuntimeDiscovery;
29
+ };
30
+ export type RuntimeProbeOptions = RuntimeListModelsOptions & {
31
+ probedAt: string;
32
+ };
33
+ export type RuntimeAdapter = {
34
+ id: LocalRuntimeId;
35
+ defaultBaseURL?: string;
36
+ listModels(options: RuntimeListModelsOptions): Promise<LocalModelInfo[]>;
37
+ probe(options: RuntimeProbeOptions): Promise<LocalRuntimeSnapshot>;
38
+ };
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/local/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,eAAe,CAAC;AAErE,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,GAAG,SAAS,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,cAAc,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,MAAM,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC;AAEjC,MAAM,MAAM,sBAAsB,GAC9B,MAAM,GACN;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAErE,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,GAAG;IAC3D,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,cAAc,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IACzE,KAAK,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACpE,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { BudgetState } from "../capabilities/budget";
2
+ import type { ModelCapabilityProfile } from "../capabilities/types";
3
+ import type { OpenTeamConfig } from "../config/schema";
4
+ import type { AvailableModel, RoutingDecision, TaskSignals } from "../router/types";
5
+ import type { TelemetrySink } from "../telemetry/sink";
6
+ import type { CostRecord } from "../telemetry/types";
7
+ import { type OpencodeSessionClient, type SubsessionResult } from "./subsessions";
8
+ export type RoleTaskInput = {
9
+ roleID: string;
10
+ task: TaskSignals;
11
+ prompt: string;
12
+ profiles?: ModelCapabilityProfile[];
13
+ availableModels?: AvailableModel[];
14
+ budgetState?: BudgetState;
15
+ parentSessionID?: string;
16
+ config: OpenTeamConfig;
17
+ title?: string;
18
+ systemPrompt?: string;
19
+ directory?: string;
20
+ };
21
+ export type CoordinatorDeps = {
22
+ client: OpencodeSessionClient;
23
+ sink: TelemetrySink;
24
+ now: () => number;
25
+ newDecisionID: () => string;
26
+ timeoutMs?: number;
27
+ };
28
+ export type CorrelatedCostRecord = CostRecord & {
29
+ decisionID: string;
30
+ agent: string;
31
+ success: boolean;
32
+ batchID?: string;
33
+ failureReason?: string;
34
+ failureStage?: SubsessionResult["failureStage"];
35
+ };
36
+ export type RoleTaskResult = {
37
+ decision: RoutingDecision;
38
+ subsession: SubsessionResult;
39
+ record: CorrelatedCostRecord;
40
+ };
41
+ export declare function runRoleTask(input: RoleTaskInput, deps: CoordinatorDeps): Promise<RoleTaskResult>;
42
+ export declare function runRoleTasks(inputs: readonly RoleTaskInput[], deps: CoordinatorDeps): Promise<RoleTaskResult[]>;
43
+ //# sourceMappingURL=coordinator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/orchestrator/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQrD,OAAO,EACL,KAAK,qBAAqB,EAG1B,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACpC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,MAAM,EAAE,oBAAoB,CAAC;CAC9B,CAAC;AA0OF,wBAAsB,WAAW,CAC/B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,cAAc,CAAC,CAIzB;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,cAAc,EAAE,CAAC,CAW3B"}
@@ -0,0 +1,14 @@
1
+ import type { ComplexityTier } from "../capabilities/types";
2
+ export type RolePermission = "read" | "edit" | "multiFileEdit" | "destructive" | "network" | "shell";
3
+ export type RolePermissionSet = {
4
+ roleID: string;
5
+ allowed: RolePermission[];
6
+ };
7
+ export declare const ROLE_PERMISSIONS: Record<string, RolePermission[]>;
8
+ export declare function hasPermission(roleID: string, perm: RolePermission): boolean;
9
+ export declare function elevateTierForPermissions(baseTier: ComplexityTier, perms: RolePermission[]): ComplexityTier;
10
+ export declare function assertAllowed(roleID: string, perm: RolePermission): {
11
+ allowed: boolean;
12
+ reason?: string;
13
+ };
14
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/orchestrator/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,eAAe,GACf,aAAa,GACb,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAO7D,CAAC;AASF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAE3E;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,cAAc,EAAE,GACtB,cAAc,CAKhB;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,cAAc,GACnB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CASvC"}
@@ -0,0 +1,40 @@
1
+ import { z } from "zod";
2
+ import type { CapabilityRequirement, ComplexityTier } from "../capabilities/types";
3
+ import type { ModelSelection, TaskSignals } from "../router/types";
4
+ export type AgentRoleProfile = {
5
+ roleID: string;
6
+ opencodeAgent?: string;
7
+ defaultTier: ComplexityTier;
8
+ minReasoningTier: 1 | 2 | 3 | 4 | 5;
9
+ minCodeQualityTier: 1 | 2 | 3 | 4 | 5;
10
+ needsToolCallingByDefault: boolean;
11
+ preferredLocalModels: ModelSelection[];
12
+ preferredFrontierModels: Array<ModelSelection | "auto">;
13
+ localFirst: boolean;
14
+ };
15
+ export declare const AgentRoleProfileSchema: z.ZodObject<{
16
+ roleID: z.ZodString;
17
+ opencodeAgent: z.ZodOptional<z.ZodString>;
18
+ defaultTier: z.ZodEnum<{
19
+ trivial: "trivial";
20
+ simple: "simple";
21
+ moderate: "moderate";
22
+ hard: "hard";
23
+ }>;
24
+ minReasoningTier: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
25
+ minCodeQualityTier: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
26
+ needsToolCallingByDefault: z.ZodBoolean;
27
+ preferredLocalModels: z.ZodArray<z.ZodObject<{
28
+ providerID: z.ZodString;
29
+ modelID: z.ZodString;
30
+ }, z.core.$strip>>;
31
+ preferredFrontierModels: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
32
+ providerID: z.ZodString;
33
+ modelID: z.ZodString;
34
+ }, z.core.$strip>, z.ZodLiteral<"auto">]>>;
35
+ localFirst: z.ZodBoolean;
36
+ }, z.core.$strip>;
37
+ export declare const SQUAD_ROLES: Record<string, AgentRoleProfile>;
38
+ export declare function getRoleProfile(roleID: string): AgentRoleProfile | undefined;
39
+ export declare function roleToRequirement(role: AgentRoleProfile, task: TaskSignals, tier?: ComplexityTier): CapabilityRequirement;
40
+ //# sourceMappingURL=roles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../src/orchestrator/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,cAAc,CAAC;IAC5B,gBAAgB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpC,kBAAkB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,yBAAyB,EAAE,OAAO,CAAC;IACnC,oBAAoB,EAAE,cAAc,EAAE,CAAC;IACvC,uBAAuB,EAAE,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,CAAC;IACxD,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAeF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;iBAYjC,CAAC;AAGH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAqExD,CAAC;AAEF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAE3E;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,WAAW,EACjB,IAAI,CAAC,EAAE,cAAc,GACpB,qBAAqB,CAevB"}
@@ -0,0 +1,62 @@
1
+ import type { ModelSelection } from "../router/types";
2
+ export type OpencodeSessionCreateArgs = {
3
+ body?: {
4
+ parentID?: string;
5
+ title?: string;
6
+ };
7
+ query?: {
8
+ directory?: string;
9
+ };
10
+ };
11
+ export type OpencodeSessionPromptArgs = {
12
+ path: {
13
+ id: string;
14
+ };
15
+ body: {
16
+ model?: ModelSelection;
17
+ agent?: string;
18
+ system?: string;
19
+ parts: Array<{
20
+ type: "text";
21
+ text: string;
22
+ }>;
23
+ };
24
+ };
25
+ export type OpencodeSessionClient = {
26
+ session: {
27
+ create: (args: OpencodeSessionCreateArgs) => Promise<{
28
+ data?: {
29
+ id: string;
30
+ };
31
+ error?: unknown;
32
+ }>;
33
+ prompt: (args: OpencodeSessionPromptArgs) => Promise<{
34
+ data?: unknown;
35
+ error?: unknown;
36
+ }>;
37
+ };
38
+ };
39
+ export type SubsessionRequest = {
40
+ roleID: string;
41
+ parentSessionID?: string;
42
+ title?: string;
43
+ model: ModelSelection;
44
+ systemPrompt?: string;
45
+ prompt: string;
46
+ agent?: string;
47
+ directory?: string;
48
+ };
49
+ export type SubsessionResult = {
50
+ success: boolean;
51
+ sessionID?: string;
52
+ roleID: string;
53
+ model: ModelSelection;
54
+ response?: unknown;
55
+ failureReason?: string;
56
+ failureStage?: "create" | "prompt";
57
+ };
58
+ export type SubsessionDeps = {
59
+ timeoutMs?: number;
60
+ };
61
+ export declare function runSubsession(client: OpencodeSessionClient, req: SubsessionRequest, deps?: SubsessionDeps): Promise<SubsessionResult>;
62
+ //# sourceMappingURL=subsessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subsessions.d.ts","sourceRoot":"","sources":["../../src/orchestrator/subsessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,cAAc,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC9C,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE;QACP,MAAM,EAAE,CACN,IAAI,EAAE,yBAAyB,KAC5B,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAA;aAAE,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;QACzD,MAAM,EAAE,CACN,IAAI,EAAE,yBAAyB,KAC5B,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;KACnD,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,cAAc,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAmFF,wBAAsB,aAAa,CACjC,MAAM,EAAE,qBAAqB,EAC7B,GAAG,EAAE,iBAAiB,EACtB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAuE3B"}
@@ -0,0 +1,20 @@
1
+ import type { OpenTeamConfig } from "../config/schema";
2
+ import type { LocalRuntimeSnapshot } from "../local/types";
3
+ import type { AvailableModel } from "../router/types";
4
+ export type AvailabilityProvider = () => AvailableModel[];
5
+ type ProbeRegistry = {
6
+ probe(runtimes: OpenTeamConfig["local"]["runtimes"]): Promise<LocalRuntimeSnapshot[]>;
7
+ };
8
+ export type AvailabilityCache = {
9
+ get(): AvailableModel[];
10
+ refresh(): Promise<void>;
11
+ };
12
+ export type AvailabilityCacheOptions = {
13
+ config: OpenTeamConfig;
14
+ registry: ProbeRegistry;
15
+ onRefreshError?: (error: unknown) => void;
16
+ };
17
+ export declare function toAvailableModels(snapshots: LocalRuntimeSnapshot[], config: OpenTeamConfig): AvailableModel[];
18
+ export declare function createAvailabilityCache(options: AvailabilityCacheOptions): AvailabilityCache;
19
+ export {};
20
+ //# sourceMappingURL=availability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"availability.d.ts","sourceRoot":"","sources":["../../src/plugin/availability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,iBAAiB,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,MAAM,cAAc,EAAE,CAAC;AAE1D,KAAK,aAAa,GAAG;IACnB,KAAK,CACH,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,GAC5C,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,IAAI,cAAc,EAAE,CAAC;IACxB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC;IACxB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC3C,CAAC;AA2EF,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,oBAAoB,EAAE,EACjC,MAAM,EAAE,cAAc,GACrB,cAAc,EAAE,CA6BlB;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,wBAAwB,GAChC,iBAAiB,CAyBnB"}
@@ -0,0 +1,14 @@
1
+ import type { Hooks } from "@opencode-ai/plugin";
2
+ import type { OpenTeamConfig } from "../config/schema";
3
+ import type { TaskSignals } from "../router/types";
4
+ import { type TelemetrySink } from "../telemetry/sink";
5
+ import type { AvailabilityProvider } from "./availability";
6
+ export type ChatMessageHook = NonNullable<Hooks["chat.message"]>;
7
+ export type ChatMessageHookOptions = {
8
+ sink?: TelemetrySink;
9
+ now?: () => number;
10
+ };
11
+ export declare function deriveTaskSignals(input: Parameters<ChatMessageHook>[0], output: Parameters<ChatMessageHook>[1]): TaskSignals;
12
+ export declare function createChatMessageHook(config: OpenTeamConfig, getAvailable: AvailabilityProvider, options?: ChatMessageHookOptions): ChatMessageHook;
13
+ export declare function createHooks(config: OpenTeamConfig, getAvailable: AvailabilityProvider, options?: ChatMessageHookOptions): Hooks;
14
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/plugin/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAEjE,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB,CAAC;AA8CF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EACrC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GACrC,WAAW,CAqBb;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,oBAAoB,EAClC,OAAO,GAAE,sBAA2B,GACnC,eAAe,CA8BjB;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,oBAAoB,EAClC,OAAO,GAAE,sBAA2B,GACnC,KAAK,CAIP"}
@@ -0,0 +1,3 @@
1
+ import type { RoutingDecision, RoutingInput } from "./types";
2
+ export declare function chooseModel(input: RoutingInput): RoutingDecision;
3
+ //# sourceMappingURL=chooseModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chooseModel.d.ts","sourceRoot":"","sources":["../../src/router/chooseModel.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAIV,eAAe,EACf,YAAY,EACb,MAAM,SAAS,CAAC;AAoXjB,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAoHhE"}
@@ -0,0 +1,49 @@
1
+ import type { BudgetDecision, BudgetState } from "../capabilities/budget";
2
+ import type { ComplexityTier, ModelCapabilityProfile } from "../capabilities/types";
3
+ import type { OpenTeamConfig } from "../config/schema";
4
+ export type ProviderKind = "local" | "frontier" | "router";
5
+ export type ModelSelection = {
6
+ providerID: string;
7
+ modelID: string;
8
+ };
9
+ export type AvailableModel = ModelSelection & {
10
+ kind: ProviderKind;
11
+ available: boolean;
12
+ supportsTools?: boolean;
13
+ contextWindow?: number;
14
+ };
15
+ export type ExplicitOverride = "auto" | "alwaysLocal" | "alwaysFrontier" | ModelSelection;
16
+ export type TaskSignals = {
17
+ promptChars: number;
18
+ prompt?: string;
19
+ hasCode: boolean;
20
+ explicitOverride?: ExplicitOverride;
21
+ privacySensitive?: boolean;
22
+ requiresTools?: boolean;
23
+ requiresVision?: boolean;
24
+ estimatedInputTokens?: number;
25
+ estimatedOutputTokens?: number;
26
+ fileCount?: number;
27
+ diffHunks?: number;
28
+ userAskedForQuality?: boolean;
29
+ };
30
+ export type RoutingInput = {
31
+ config: OpenTeamConfig;
32
+ task: TaskSignals;
33
+ availableModels?: AvailableModel[];
34
+ profiles?: ModelCapabilityProfile[];
35
+ tier?: ComplexityTier;
36
+ budgetState?: BudgetState;
37
+ };
38
+ export type RoutingDecision = {
39
+ selected: ModelSelection;
40
+ tier: ComplexityTier;
41
+ routeKind: ProviderKind;
42
+ rationale: string[];
43
+ fallbackChain: ModelSelection[];
44
+ estimatedCostUSD: number;
45
+ baselineCostUSD: number;
46
+ estimatedSavingsUSD: number;
47
+ budgetAction: BudgetDecision;
48
+ };
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/router/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,aAAa,GACb,gBAAgB,GAChB,cAAc,CAAC;AAEnB,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,QAAQ,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACpC,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,cAAc,CAAC;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,YAAY,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,cAAc,CAAC;CAC9B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { RoutingDecision } from "../router/types";
2
+ import type { CostRecord } from "./types";
3
+ export type CostRecordContext = {
4
+ ts: number;
5
+ promptHash: string;
6
+ promptChars: number;
7
+ sessionID?: string;
8
+ tokensIn?: number;
9
+ tokensOut?: number;
10
+ };
11
+ export declare function toCostRecord(decision: RoutingDecision, context: CostRecordContext): CostRecord;
12
+ //# sourceMappingURL=cost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../src/telemetry/cost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAcF,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,iBAAiB,GACzB,UAAU,CA4BZ"}
@@ -0,0 +1,2 @@
1
+ export declare function hashPrompt(prompt: string): string;
2
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/telemetry/hash.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CASjD"}
@@ -0,0 +1,12 @@
1
+ import type { CostRecord } from "./types";
2
+ export type TelemetrySink = {
3
+ record: (record: CostRecord) => void | Promise<void>;
4
+ };
5
+ export type JsonlSinkDeps = {
6
+ append: (line: string) => Promise<void> | void;
7
+ now?: () => number;
8
+ onError?: (error: unknown) => void;
9
+ };
10
+ export declare function createJsonlSink(deps: JsonlSinkDeps): TelemetrySink;
11
+ export declare function createNullSink(): TelemetrySink;
12
+ //# sourceMappingURL=sink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sink.d.ts","sourceRoot":"","sources":["../../src/telemetry/sink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,CAWlE;AAED,wBAAgB,cAAc,IAAI,aAAa,CAI9C"}
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ export declare const CostRecordSchema: z.ZodObject<{
3
+ ts: z.ZodNumber;
4
+ sessionID: z.ZodOptional<z.ZodString>;
5
+ promptHash: z.ZodString;
6
+ promptChars: z.ZodNumber;
7
+ tier: z.ZodEnum<{
8
+ trivial: "trivial";
9
+ simple: "simple";
10
+ moderate: "moderate";
11
+ hard: "hard";
12
+ }>;
13
+ routeKind: z.ZodEnum<{
14
+ local: "local";
15
+ frontier: "frontier";
16
+ }>;
17
+ selected: z.ZodObject<{
18
+ providerID: z.ZodString;
19
+ modelID: z.ZodString;
20
+ }, z.core.$strip>;
21
+ rationale: z.ZodString;
22
+ estimatedCostUSD: z.ZodNumber;
23
+ baselineCostUSD: z.ZodNumber;
24
+ estimatedSavingsUSD: z.ZodNumber;
25
+ budgetAction: z.ZodString;
26
+ tokensIn: z.ZodOptional<z.ZodNumber>;
27
+ tokensOut: z.ZodOptional<z.ZodNumber>;
28
+ }, z.core.$strip>;
29
+ export type CostRecord = z.infer<typeof CostRecordSchema>;
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/telemetry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,76 @@
1
+ {
2
+ "name": "@jmanuelcorral/openteam",
3
+ "version": "0.1.0",
4
+ "description": "Plugin opencode de routing coste-consciente local-first con orquestación Squad.",
5
+ "license": "MIT",
6
+ "author": "Jose Manuel Corral",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/jmanuelcorral/openteam.git"
10
+ },
11
+ "homepage": "https://github.com/jmanuelcorral/openteam#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/jmanuelcorral/openteam/issues"
14
+ },
15
+ "keywords": [
16
+ "opencode",
17
+ "opencode-plugin",
18
+ "llm",
19
+ "routing",
20
+ "local-llm",
21
+ "ollama",
22
+ "lm-studio",
23
+ "foundry-local",
24
+ "cost-optimization",
25
+ "squad"
26
+ ],
27
+ "engines": {
28
+ "bun": ">=1.3",
29
+ "node": ">=20"
30
+ },
31
+ "type": "module",
32
+ "main": "./dist/index.js",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.js"
39
+ },
40
+ "./package.json": "./package.json"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "README.md",
45
+ "LICENSE",
46
+ "AGENTS.md",
47
+ ".opencode/openteam.example.json"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "sideEffects": false,
53
+ "scripts": {
54
+ "prebuild": "bun run clean",
55
+ "build": "bun run build:js && bun run build:types",
56
+ "build:js": "bun build ./src/index.ts --target=node --format=esm --outfile=dist/index.js --external @opencode-ai/plugin --external @opencode-ai/sdk --external zod",
57
+ "build:types": "tsc -p tsconfig.build.json",
58
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
59
+ "test": "bun test",
60
+ "test:cov": "bun test --coverage",
61
+ "typecheck": "tsc --noEmit",
62
+ "lint": "biome check .",
63
+ "format:check": "biome format .",
64
+ "prepublishOnly": "bun run build"
65
+ },
66
+ "dependencies": {
67
+ "@opencode-ai/plugin": "1.17.13",
68
+ "@opencode-ai/sdk": "1.17.13",
69
+ "zod": "4.4.3"
70
+ },
71
+ "devDependencies": {
72
+ "@biomejs/biome": "2.5.2",
73
+ "@types/bun": "1.3.14",
74
+ "typescript": "6.0.3"
75
+ }
76
+ }