@miller-tech/uap 1.0.0 → 1.3.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/dist/benchmarks/benchmark.d.ts +8 -8
- package/dist/benchmarks/improved-benchmark.d.ts.map +1 -1
- package/dist/benchmarks/improved-benchmark.js +10 -23
- package/dist/benchmarks/improved-benchmark.js.map +1 -1
- package/dist/benchmarks/model-integration.d.ts.map +1 -1
- package/dist/benchmarks/model-integration.js +22 -23
- package/dist/benchmarks/model-integration.js.map +1 -1
- package/dist/bin/policy.js +67 -11
- package/dist/bin/policy.js.map +1 -1
- package/dist/cli/dashboard.d.ts +2 -1
- package/dist/cli/dashboard.d.ts.map +1 -1
- package/dist/cli/dashboard.js +399 -10
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/model.js +12 -12
- package/dist/cli/model.js.map +1 -1
- package/dist/cli/setup-wizard.d.ts.map +1 -1
- package/dist/cli/setup-wizard.js +24 -0
- package/dist/cli/setup-wizard.js.map +1 -1
- package/dist/coordination/deploy-batcher.d.ts +1 -0
- package/dist/coordination/deploy-batcher.d.ts.map +1 -1
- package/dist/coordination/deploy-batcher.js +24 -25
- package/dist/coordination/deploy-batcher.js.map +1 -1
- package/dist/dashboard/data-service.d.ts +94 -0
- package/dist/dashboard/data-service.d.ts.map +1 -0
- package/dist/dashboard/data-service.js +286 -0
- package/dist/dashboard/data-service.js.map +1 -0
- package/dist/dashboard/index.d.ts +5 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +3 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/dashboard/server.d.ts +15 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.js +158 -0
- package/dist/dashboard/server.js.map +1 -0
- package/dist/mcp-router/session-stats.d.ts +9 -0
- package/dist/mcp-router/session-stats.d.ts.map +1 -1
- package/dist/mcp-router/session-stats.js +19 -3
- package/dist/mcp-router/session-stats.js.map +1 -1
- package/dist/memory/adaptive-context.d.ts +1 -0
- package/dist/memory/adaptive-context.d.ts.map +1 -1
- package/dist/memory/adaptive-context.js +4 -0
- package/dist/memory/adaptive-context.js.map +1 -1
- package/dist/memory/embeddings.d.ts.map +1 -1
- package/dist/memory/embeddings.js +4 -4
- package/dist/memory/embeddings.js.map +1 -1
- package/dist/memory/model-router.d.ts +1 -1
- package/dist/memory/model-router.d.ts.map +1 -1
- package/dist/memory/model-router.js +52 -1
- package/dist/memory/model-router.js.map +1 -1
- package/dist/memory/predictive-memory.d.ts.map +1 -1
- package/dist/memory/predictive-memory.js +4 -3
- package/dist/memory/predictive-memory.js.map +1 -1
- package/dist/models/analytics.d.ts +93 -0
- package/dist/models/analytics.d.ts.map +1 -0
- package/dist/models/analytics.js +205 -0
- package/dist/models/analytics.js.map +1 -0
- package/dist/models/execution-profiles.d.ts +6 -0
- package/dist/models/execution-profiles.d.ts.map +1 -1
- package/dist/models/execution-profiles.js +15 -0
- package/dist/models/execution-profiles.js.map +1 -1
- package/dist/models/executor.d.ts.map +1 -1
- package/dist/models/executor.js +51 -17
- package/dist/models/executor.js.map +1 -1
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +2 -0
- package/dist/models/index.js.map +1 -1
- package/dist/models/router.d.ts +8 -0
- package/dist/models/router.d.ts.map +1 -1
- package/dist/models/router.js +46 -21
- package/dist/models/router.js.map +1 -1
- package/dist/models/types.d.ts +26 -0
- package/dist/models/types.d.ts.map +1 -1
- package/dist/models/types.js +43 -4
- package/dist/models/types.js.map +1 -1
- package/dist/models/unified-router.d.ts.map +1 -1
- package/dist/models/unified-router.js +4 -0
- package/dist/models/unified-router.js.map +1 -1
- package/dist/policies/database-manager.d.ts +1 -0
- package/dist/policies/database-manager.d.ts.map +1 -1
- package/dist/policies/database-manager.js +14 -2
- package/dist/policies/database-manager.js.map +1 -1
- package/dist/policies/enforced-tool-router.d.ts +2 -2
- package/dist/policies/enforced-tool-router.d.ts.map +1 -1
- package/dist/policies/enforced-tool-router.js +4 -4
- package/dist/policies/enforced-tool-router.js.map +1 -1
- package/dist/policies/policy-gate.d.ts +2 -2
- package/dist/policies/policy-gate.d.ts.map +1 -1
- package/dist/policies/policy-gate.js +6 -4
- package/dist/policies/policy-gate.js.map +1 -1
- package/dist/policies/policy-memory.d.ts +3 -0
- package/dist/policies/policy-memory.d.ts.map +1 -1
- package/dist/policies/policy-memory.js +11 -0
- package/dist/policies/policy-memory.js.map +1 -1
- package/dist/policies/schemas/policy.d.ts +3 -0
- package/dist/policies/schemas/policy.d.ts.map +1 -1
- package/dist/policies/schemas/policy.js +1 -0
- package/dist/policies/schemas/policy.js.map +1 -1
- package/dist/tasks/coordination.d.ts +18 -0
- package/dist/tasks/coordination.d.ts.map +1 -1
- package/dist/tasks/coordination.js +59 -1
- package/dist/tasks/coordination.js.map +1 -1
- package/dist/tasks/event-bus.d.ts +91 -0
- package/dist/tasks/event-bus.d.ts.map +1 -0
- package/dist/tasks/event-bus.js +123 -0
- package/dist/tasks/event-bus.js.map +1 -0
- package/dist/tasks/service.d.ts +5 -0
- package/dist/tasks/service.d.ts.map +1 -1
- package/dist/tasks/service.js +59 -0
- package/dist/tasks/service.js.map +1 -1
- package/dist/telemetry/session-telemetry.d.ts.map +1 -1
- package/dist/telemetry/session-telemetry.js +3 -0
- package/dist/telemetry/session-telemetry.js.map +1 -1
- package/dist/utils/concurrency-pool.d.ts +51 -0
- package/dist/utils/concurrency-pool.d.ts.map +1 -0
- package/dist/utils/concurrency-pool.js +80 -0
- package/dist/utils/concurrency-pool.js.map +1 -0
- package/dist/utils/system-resources.d.ts +47 -0
- package/dist/utils/system-resources.d.ts.map +1 -0
- package/dist/utils/system-resources.js +92 -0
- package/dist/utils/system-resources.js.map +1 -0
- package/docs/BENCHMARK_GAPS_AND_PLAN.md +146 -0
- package/docs/PARALLELISM_GAPS_AND_OPTIONS.md +422 -0
- package/docs/UAP_OPTIMIZATION_PLAN.md +638 -0
- package/docs/getting-started/INTEGRATION.md +193 -14
- package/docs/opencode-integration-guide.md +740 -0
- package/docs/opencode-integration-quickref.md +180 -0
- package/package.json +4 -1
- package/templates/hooks/session-start.sh +8 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# OpenCode Integration Quick Reference
|
|
2
|
+
|
|
3
|
+
## File Structure
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
.project/
|
|
7
|
+
├── .opencode/
|
|
8
|
+
│ ├── plugin/
|
|
9
|
+
│ │ ├── your-plugin.ts # Your custom plugin
|
|
10
|
+
│ │ └── index.ts # Optional: aggregate exports
|
|
11
|
+
│ └── package.json # Dependencies (add @opencode-ai/plugin)
|
|
12
|
+
└── opencode.json # OpenCode configuration
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Plugin Template
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { Plugin } from '@opencode-ai/plugin';
|
|
19
|
+
import { tool } from '@opencode-ai/plugin';
|
|
20
|
+
|
|
21
|
+
export const MyPlugin: Plugin = async ({ $, directory }) => {
|
|
22
|
+
return {
|
|
23
|
+
// Define tools
|
|
24
|
+
tool: {
|
|
25
|
+
my_tool: tool({
|
|
26
|
+
description: 'What this tool does',
|
|
27
|
+
args: {
|
|
28
|
+
param: tool.schema.string().describe('Parameter'),
|
|
29
|
+
},
|
|
30
|
+
async execute({ param }) {
|
|
31
|
+
const result = await $`command ${param}`;
|
|
32
|
+
return result.stdout.toString();
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
// Optional: Event hooks
|
|
38
|
+
event: async ({ event }) => {
|
|
39
|
+
if (event.type === 'session.created') {
|
|
40
|
+
console.log('Session started');
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Available Hooks
|
|
48
|
+
|
|
49
|
+
| Hook | Purpose | Example |
|
|
50
|
+
| ------------------------------------ | -------------------------- | ------------------------------ |
|
|
51
|
+
| `tool` | Define new tools | Custom commands for LLM |
|
|
52
|
+
| `event.session.created` | Session initialization | Load context, initialize state |
|
|
53
|
+
| `event.session.compacting` | Before context compression | Preserve important data |
|
|
54
|
+
| `tool.execute.before` | Before tool runs | Validate args, log activity |
|
|
55
|
+
| `tool.execute.after` | After tool completes | Record results, update state |
|
|
56
|
+
| `tool.definition` | Modify tool descriptions | Add policy constraints |
|
|
57
|
+
| `experimental.chat.system.transform` | Inject system context | RAG retrieval, dynamic context |
|
|
58
|
+
| `middleware` | Transform messages | Pre/post processing |
|
|
59
|
+
|
|
60
|
+
## Tool Schema Types
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// String
|
|
64
|
+
tool.schema.string().describe('Text parameter');
|
|
65
|
+
|
|
66
|
+
// Number with constraints
|
|
67
|
+
tool.schema.number().min(0).max(100).default(50);
|
|
68
|
+
|
|
69
|
+
// Enum
|
|
70
|
+
tool.schema.enum(['read', 'write', 'execute']).default('read');
|
|
71
|
+
|
|
72
|
+
// Array
|
|
73
|
+
tool.schema.array().of(tool.schema.string());
|
|
74
|
+
|
|
75
|
+
// Optional
|
|
76
|
+
tool.schema.string().optional();
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Common Patterns
|
|
80
|
+
|
|
81
|
+
### 1. CLI Wrapper
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
tool({
|
|
85
|
+
description: 'Run external command',
|
|
86
|
+
args: { cmd: tool.schema.string() },
|
|
87
|
+
async execute({ cmd }) {
|
|
88
|
+
return (await $`${cmd}`.quiet()).stdout.toString();
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 2. File Operations
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
97
|
+
|
|
98
|
+
tool({
|
|
99
|
+
description: 'Read project file',
|
|
100
|
+
args: { path: tool.schema.string() },
|
|
101
|
+
async execute({ path }) {
|
|
102
|
+
return await readFile(join(projectDir, path), 'utf-8');
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3. Memory Query
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
tool({
|
|
111
|
+
description: 'Query persistent memory',
|
|
112
|
+
args: { query: tool.schema.string() },
|
|
113
|
+
async execute({ query }) {
|
|
114
|
+
const result = await $`python3 ./scripts/query.py "${query}"`;
|
|
115
|
+
return result.stdout.toString().trim();
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 4. Context Injection (RAG)
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
middleware: async (input, next) => {
|
|
124
|
+
const lastMsg = input.messages?.[input.messages.length - 1];
|
|
125
|
+
if (lastMsg?.role === 'user') {
|
|
126
|
+
const context = await queryRAG(lastMsg.content);
|
|
127
|
+
input.messages.push({ role: 'system', content: `<context>${context}</context>` });
|
|
128
|
+
}
|
|
129
|
+
return next(input);
|
|
130
|
+
};
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Plugin Examples in This Repo
|
|
134
|
+
|
|
135
|
+
| Plugin | File | Purpose |
|
|
136
|
+
| --------------- | ----------------------------------------- | ----------------------------- |
|
|
137
|
+
| Commands | `.opencode/plugin/uap-commands.ts` | CLI commands as tools |
|
|
138
|
+
| Skills | `.opencode/plugin/uap-skills.ts` | Skill loading system |
|
|
139
|
+
| Droids | `.opencode/plugin/uap-droids.ts` | Specialized agent droids |
|
|
140
|
+
| Pattern RAG | `.opencode/plugin/uap-pattern-rag.ts` | On-demand pattern retrieval |
|
|
141
|
+
| Task Completion | `.opencode/plugin/uap-task-completion.ts` | Track task outcomes |
|
|
142
|
+
| Session Hooks | `.opencode/plugin/uap-session-hooks.ts` | Session lifecycle events |
|
|
143
|
+
| Enforcement | `tools/agents/plugins/uap-enforce.ts` | Loop detection, budget limits |
|
|
144
|
+
|
|
145
|
+
## Dependencies
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"dependencies": {
|
|
150
|
+
"@opencode-ai/plugin": "1.2.16"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Debugging
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Check plugin loads
|
|
159
|
+
opencode run "What tools are available?"
|
|
160
|
+
|
|
161
|
+
# View logs
|
|
162
|
+
tail -f ~/.opencode/logs/*.log
|
|
163
|
+
|
|
164
|
+
# Test TypeScript syntax
|
|
165
|
+
npx tsc --noEmit .opencode/plugin/your-plugin.ts
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Best Practices
|
|
169
|
+
|
|
170
|
+
1. **Error Handling**: Always use `.nothrow()` and check exit codes
|
|
171
|
+
2. **Security**: Validate inputs, prevent command injection
|
|
172
|
+
3. **Caching**: Cache expensive operations between tool calls
|
|
173
|
+
4. **Descriptions**: Write clear, comprehensive tool descriptions
|
|
174
|
+
5. **Naming**: Use snake_case, prefix with domain (`mydomain_tool`)
|
|
175
|
+
6. **Context**: Preserve important state across compaction
|
|
176
|
+
7. **Performance**: Use `--quiet` to reduce output noise
|
|
177
|
+
|
|
178
|
+
## Full Example
|
|
179
|
+
|
|
180
|
+
See: `.opencode/plugin/uap-commands.ts` for a complete implementation example.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miller-tech/uap",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"node": ">=18.0.0"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
+
"@miller-tech/uap": "^1.0.0",
|
|
69
70
|
"@octokit/rest": "^20.0.2",
|
|
70
71
|
"@qdrant/js-client-rest": "^1.11.0",
|
|
71
72
|
"better-sqlite3": "^11.0.0",
|
|
@@ -81,6 +82,7 @@
|
|
|
81
82
|
"ora": "^8.0.1",
|
|
82
83
|
"playwright-core": "^1.58.2",
|
|
83
84
|
"simple-git": "^3.22.0",
|
|
85
|
+
"ws": "^8.19.0",
|
|
84
86
|
"zod": "^3.23.8"
|
|
85
87
|
},
|
|
86
88
|
"devDependencies": {
|
|
@@ -89,6 +91,7 @@
|
|
|
89
91
|
"@types/inquirer": "^9.0.7",
|
|
90
92
|
"@types/js-yaml": "^4.0.9",
|
|
91
93
|
"@types/node": "^20.11.0",
|
|
94
|
+
"@types/ws": "^8.18.1",
|
|
92
95
|
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
93
96
|
"@typescript-eslint/parser": "^6.19.0",
|
|
94
97
|
"@vitest/coverage-v8": "^1.6.1",
|
|
@@ -248,7 +248,8 @@ output+="│ ${GIT_LINE}$(printf ' %.0s' $(seq 1 $((W - 1 - ${#GIT_LINE}))))│"
|
|
|
248
248
|
output+="├$(printf '─%.0s' $(seq 1 $W))┤"$'\n'
|
|
249
249
|
|
|
250
250
|
# Active policies
|
|
251
|
-
|
|
251
|
+
POLICY_LINE="Policies: [ON] IaC Pipeline [ON] kubectl Backport [ON] File Backup"
|
|
252
|
+
output+="│ ${POLICY_LINE}$(printf ' %.0s' $(seq 1 $((W - 1 - ${#POLICY_LINE}))))│"$'\n'
|
|
252
253
|
|
|
253
254
|
# Memory layers
|
|
254
255
|
L3_STATUS="?"
|
|
@@ -282,6 +283,12 @@ output+="### DURING WORK:"$'\n'
|
|
|
282
283
|
output+="6. ALL file changes MUST use worktree: uap worktree create <slug>"$'\n'
|
|
283
284
|
output+="7. Work in .worktrees/NNN-<slug>/ directory"$'\n'
|
|
284
285
|
output+=""$'\n'
|
|
286
|
+
output+="### IaC PIPELINE ENFORCEMENT (MANDATORY):"$'\n'
|
|
287
|
+
output+="- NEVER run terraform plan/apply/destroy locally. ALL Terraform ops go through CI/CD pipeline."$'\n'
|
|
288
|
+
output+="- kubectl MAY be used to diagnose, test, and verify fixes on clusters."$'\n'
|
|
289
|
+
output+="- ANY kubectl-created resource MUST be backported to Terraform .tf files (import or delete/recreate)."$'\n'
|
|
290
|
+
output+="- 100% IaC parity required. Infrastructure work is NOT DONE until pipeline apply succeeds + kubectl verifies."$'\n'
|
|
291
|
+
output+=""$'\n'
|
|
285
292
|
output+="### BEFORE COMMIT:"$'\n'
|
|
286
293
|
output+="8. Self-review: git diff"$'\n'
|
|
287
294
|
output+="9. Run tests if applicable"$'\n'
|