opencode-titan 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.
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Per-provider, model-aware async scheduler.
3
+ *
4
+ * Enforces the provider constraint at runtime: a provider represents a physical
5
+ * backend (machine/host) that can only fit ONE model in VRAM at a time.
6
+ * Therefore:
7
+ *
8
+ * - Two tasks running *different models* on the same provider must be
9
+ * serialized (one must finish before the other's model can be loaded).
10
+ * - Two tasks running the *same model* on the same provider may run
11
+ * concurrently, up to that model's `maxInstances` — the model is already
12
+ * resident in VRAM, so extra instances add no load/unload cost.
13
+ *
14
+ * Tasks on *different* providers never block each other, preserving
15
+ * cross-machine parallelism.
16
+ *
17
+ * Usage:
18
+ * const release = await locks.acquire('provider-a', 'provider-a/model-x', 2);
19
+ * try { ...run task... } finally { release(); }
20
+ *
21
+ * Grants are FIFO per provider (the queue head is considered first), which
22
+ * prevents a stream of same-model tasks from starving a waiting different-model
23
+ * task.
24
+ */
25
+ export declare class ProviderLockManager {
26
+ private readonly providers;
27
+ /**
28
+ * Acquire a slot for `model` on `provider`. Resolves with an idempotent
29
+ * release function once a slot is available.
30
+ *
31
+ * @param provider Logical provider (physical backend) identifier.
32
+ * @param model The model to load — same-model acquisitions can share
33
+ * the provider concurrently.
34
+ * @param maxConcurrent Maximum concurrent instances of this model (>= 1).
35
+ */
36
+ acquire(provider: string, model: string, maxConcurrent?: number): Promise<() => void>;
37
+ private getState;
38
+ /**
39
+ * Grant as many queued waiters as the current provider state allows. Only the
40
+ * queue head is considered each step to preserve FIFO fairness (a different
41
+ * model cannot be skipped by later same-model waiters).
42
+ */
43
+ private pump;
44
+ private makeRelease;
45
+ }
@@ -0,0 +1,120 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "titan": {
6
+ "type": "object",
7
+ "description": "Configuration for the Titan orchestrator agent",
8
+ "properties": {
9
+ "model": {
10
+ "type": "string",
11
+ "description": "Model ID for Titan (provider/model format)"
12
+ },
13
+ "temperature": {
14
+ "type": "number",
15
+ "minimum": 0,
16
+ "maximum": 2
17
+ },
18
+ "variant": {
19
+ "type": "string"
20
+ },
21
+ "prompt": {
22
+ "type": "string",
23
+ "minLength": 1,
24
+ "description": "Custom system prompt to replace the default Titan prompt"
25
+ }
26
+ },
27
+ "additionalProperties": false
28
+ },
29
+ "myrmidons": {
30
+ "type": "array",
31
+ "description": "Myrmidon configurations. Each Myrmidon is a faster but more limited agent that Titan delegates work to.",
32
+ "items": {
33
+ "$ref": "#/$defs/myrmidon"
34
+ }
35
+ },
36
+ "children": {
37
+ "type": "array",
38
+ "deprecated": true,
39
+ "description": "DEPRECATED: use `myrmidons` instead. Retained for backwards compatibility. If both are set, `myrmidons` takes precedence.",
40
+ "items": {
41
+ "$ref": "#/$defs/myrmidon"
42
+ }
43
+ },
44
+ "disabled_tools": {
45
+ "type": "array",
46
+ "description": "Tool names to disable completely. Disabled tools are not registered with OpenCode.",
47
+ "items": {
48
+ "type": "string"
49
+ }
50
+ },
51
+ "backgroundJobs": {
52
+ "type": "object",
53
+ "properties": {
54
+ "maxSessionsPerAgent": {
55
+ "default": 2,
56
+ "type": "integer",
57
+ "minimum": 1,
58
+ "maximum": 10,
59
+ "description": "Maximum concurrent background sessions per Myrmidon"
60
+ }
61
+ },
62
+ "additionalProperties": false
63
+ }
64
+ },
65
+ "$defs": {
66
+ "myrmidon": {
67
+ "type": "object",
68
+ "properties": {
69
+ "model": {
70
+ "type": "string",
71
+ "description": "Model ID for this Myrmidon (provider/model format)"
72
+ },
73
+ "speed": {
74
+ "type": "integer",
75
+ "minimum": 1,
76
+ "maximum": 10,
77
+ "description": "Relative speed of this agent (1=slowest, 10=fastest). Used by Titan to prioritize dispatch."
78
+ },
79
+ "intelligence": {
80
+ "type": "integer",
81
+ "minimum": 1,
82
+ "maximum": 10,
83
+ "description": "Reasoning capability of this agent (1=limited, 10=strong). Used by Titan to match task complexity."
84
+ },
85
+ "modelType": {
86
+ "type": "string",
87
+ "enum": ["dense", "sparse"],
88
+ "description": "Model architecture type. 'dense' = slower but better at logic and complex reasoning. 'sparse' = faster, better at information gathering and broad search."
89
+ },
90
+ "maxInstances": {
91
+ "type": "integer",
92
+ "minimum": 1,
93
+ "description": "Maximum number of parallel instances Titan may run for this Myrmidon. Since instances share the same model (already loaded in the provider's VRAM), they can run concurrently on the same provider. Defaults to 1."
94
+ },
95
+ "temperature": {
96
+ "type": "number",
97
+ "minimum": 0,
98
+ "maximum": 2
99
+ },
100
+ "variant": {
101
+ "type": "string"
102
+ },
103
+ "displayName": {
104
+ "type": "string",
105
+ "minLength": 1,
106
+ "description": "Human-readable display name for this Myrmidon"
107
+ },
108
+ "provider": {
109
+ "type": "string",
110
+ "minLength": 1,
111
+ "description": "Provider identifier for this Myrmidon. Titan will not dispatch parallel tasks to Myrmidons sharing the same provider."
112
+ }
113
+ },
114
+ "required": ["model", "speed", "intelligence", "modelType"],
115
+ "additionalProperties": false
116
+ }
117
+ },
118
+ "title": "opencode-titan",
119
+ "description": "Configuration schema for opencode-titan plugin — Titan orchestrator with parallel Myrmidons"
120
+ }
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "opencode-titan",
3
+ "version": "0.1.0",
4
+ "description": "Distributed delegation plugin for OpenCode — Titan orchestrator with parallel Myrmidons",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "type": "module",
14
+ "license": "MIT",
15
+ "author": "Zack Duford <z.duford@gmail.com>",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/DEV-DUFORD/opencode-titan.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/DEV-DUFORD/opencode-titan/issues"
22
+ },
23
+ "homepage": "https://github.com/DEV-DUFORD/opencode-titan#readme",
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "keywords": [
28
+ "opencode",
29
+ "opencode-plugin",
30
+ "agents",
31
+ "delegation",
32
+ "titan",
33
+ "parallel"
34
+ ],
35
+ "files": [
36
+ "dist",
37
+ "!dist/meta.json",
38
+ "opencode-titan.schema.json",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "scripts": {
43
+ "clean:dist": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
44
+ "build": "npm run clean:dist && node_modules/.bin/esbuild src/index.ts --bundle --format=esm --platform=node --outdir=dist --external:@opencode-ai/plugin --external:@opencode-ai/plugin/* --external:@opencode-ai/sdk --external:@opencode-ai/sdk/* --external:zod --metafile=dist/meta.json && tsc --emitDeclarationOnly",
45
+ "typecheck": "tsc --noEmit",
46
+ "lint": "biome lint .",
47
+ "format": "biome format . --write",
48
+ "check": "biome check --write .",
49
+ "check:ci": "biome check ."
50
+ },
51
+ "dependencies": {
52
+ "@opencode-ai/plugin": "^1.3.17",
53
+ "@opencode-ai/sdk": "^1.3.17",
54
+ "zod": "^4.3.6"
55
+ },
56
+ "devDependencies": {
57
+ "@biomejs/biome": "2.4.11",
58
+ "@types/node": "^24.6.1",
59
+ "esbuild": "^0.28.1",
60
+ "typescript": "^5.9.3"
61
+ },
62
+ "peerDependencies": {
63
+ "zod": "^4.0.0"
64
+ }
65
+ }