@adhd/agent-mcp 2.1.0 → 2.1.2
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/docs/marketing/.catalog/capabilities.md +1 -1
- package/docs/plan/accounting/SCOPE.md +316 -0
- package/docs/provider-call-audit.md +83 -1
- package/drizzle/0000_nifty_sasquatch.sql +55 -0
- package/drizzle/0001_task_usage.sql +16 -0
- package/drizzle/0002_lumpy_silver_centurion.sql +2 -0
- package/drizzle/0003_nifty_shriek.sql +2 -0
- package/drizzle/0004_brief_shocker.sql +4 -0
- package/drizzle/0005_clear_lenny_balinger.sql +25 -0
- package/drizzle/0006_composed_prompts_cache.sql +24 -0
- package/drizzle/0007_smart_callisto.sql +40 -0
- package/drizzle/0008_cache_and_peak_context_usage.sql +19 -0
- package/drizzle/0009_restore_sessions_agent_fk.sql +29 -0
- package/drizzle/meta/0000_snapshot.json +387 -0
- package/drizzle/meta/0001_snapshot.json +495 -0
- package/drizzle/meta/0002_snapshot.json +509 -0
- package/drizzle/meta/0003_snapshot.json +523 -0
- package/drizzle/meta/0004_snapshot.json +551 -0
- package/drizzle/meta/0005_snapshot.json +545 -0
- package/drizzle/meta/0006_snapshot.json +651 -0
- package/drizzle/meta/0007_snapshot.json +658 -0
- package/drizzle/meta/_journal.json +76 -0
- package/package.json +14 -17
- package/src/config.d.ts +59 -30
- package/src/config.d.ts.map +1 -1
- package/src/config.js +202 -205
- package/src/config.js.map +1 -1
- package/src/db/client.d.ts.map +1 -1
- package/src/db/client.js +6 -2
- package/src/db/client.js.map +1 -1
- package/src/db/migrate-runner.d.ts.map +1 -1
- package/src/db/migrate-runner.js.map +1 -1
- package/src/db/migrate.d.ts.map +1 -1
- package/src/db/migrate.js.map +1 -1
- package/src/db/schema.d.ts.map +1 -1
- package/src/db/schema.js.map +1 -1
- package/src/index.d.ts.map +1 -1
- package/src/index.js +20 -13
- package/src/index.js.map +1 -1
- package/src/logger.d.ts.map +1 -1
- package/src/logger.js +2 -2
- package/src/logger.js.map +1 -1
- package/src/scripts/agent-mcp-tail.d.ts.map +1 -1
- package/src/scripts/agent-mcp-tail.js +202 -122
- package/src/scripts/agent-mcp-tail.js.map +1 -1
- package/src/server.d.ts.map +1 -1
- package/src/server.js +7 -7
- package/src/server.js.map +1 -1
- package/src/store/agent-store.d.ts.map +1 -1
- package/src/store/agent-store.js.map +1 -1
- package/src/streaming/chat-gateway.d.ts.map +1 -1
- package/src/streaming/chat-gateway.js.map +1 -1
- package/src/streaming/event-bus.d.ts.map +1 -1
- package/src/streaming/event-bus.js.map +1 -1
- package/src/streaming/sse-server.d.ts.map +1 -1
- package/src/streaming/sse-server.js +2 -2
- package/src/streaming/sse-server.js.map +1 -1
- package/src/__tests__/integration/harness.d.ts +0 -1027
- package/src/__tests__/integration/harness.d.ts.map +0 -1
- package/src/__tests__/integration/harness.js +0 -409
- package/src/__tests__/integration/harness.js.map +0 -1
- package/src/__tests__/integration/scripted-provider.d.ts +0 -43
- package/src/__tests__/integration/scripted-provider.d.ts.map +0 -1
- package/src/__tests__/integration/scripted-provider.js +0 -80
- package/src/__tests__/integration/scripted-provider.js.map +0 -1
- package/src/utils/load-env.d.ts +0 -2
- package/src/utils/load-env.d.ts.map +0 -1
- package/src/utils/load-env.js +0 -9
- package/src/utils/load-env.js.map +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "6",
|
|
8
|
+
"when": 1778793918653,
|
|
9
|
+
"tag": "0000_nifty_sasquatch",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "6",
|
|
15
|
+
"when": 1781059973506,
|
|
16
|
+
"tag": "0001_task_usage",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "6",
|
|
22
|
+
"when": 1781068864364,
|
|
23
|
+
"tag": "0002_lumpy_silver_centurion",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "6",
|
|
29
|
+
"when": 1781069217143,
|
|
30
|
+
"tag": "0003_nifty_shriek",
|
|
31
|
+
"breakpoints": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idx": 4,
|
|
35
|
+
"version": "6",
|
|
36
|
+
"when": 1781408344547,
|
|
37
|
+
"tag": "0004_brief_shocker",
|
|
38
|
+
"breakpoints": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"idx": 5,
|
|
42
|
+
"version": "6",
|
|
43
|
+
"when": 1781497705486,
|
|
44
|
+
"tag": "0005_clear_lenny_balinger",
|
|
45
|
+
"breakpoints": true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"idx": 6,
|
|
49
|
+
"version": "6",
|
|
50
|
+
"when": 1781497706486,
|
|
51
|
+
"tag": "0006_composed_prompts_cache",
|
|
52
|
+
"breakpoints": true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"idx": 7,
|
|
56
|
+
"version": "6",
|
|
57
|
+
"when": 1782874595963,
|
|
58
|
+
"tag": "0007_smart_callisto",
|
|
59
|
+
"breakpoints": true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"idx": 8,
|
|
63
|
+
"version": "6",
|
|
64
|
+
"when": 1782874595964,
|
|
65
|
+
"tag": "0008_cache_and_peak_context_usage",
|
|
66
|
+
"breakpoints": true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"idx": 9,
|
|
70
|
+
"version": "6",
|
|
71
|
+
"when": 1782874595965,
|
|
72
|
+
"tag": "0009_restore_sessions_agent_fk",
|
|
73
|
+
"breakpoints": true
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhd/agent-mcp",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agent-mcp": "./src/index.js",
|
|
7
7
|
"agent-mcp-tail": "./src/scripts/agent-mcp-tail.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@adhd/agent-store-runtime": "^2.1.
|
|
11
|
-
"@adhd/agent-store-prompts": "^2.1.
|
|
12
|
-
"@adhd/agent-engine-orchestrator": "^2.1.
|
|
13
|
-
"@modelcontextprotocol/sdk": "
|
|
14
|
-
"pino": "
|
|
15
|
-
"drizzle-orm": "
|
|
16
|
-
"better-sqlite3": "
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"@adhd/
|
|
20
|
-
"@adhd/agent-
|
|
10
|
+
"@adhd/agent-store-runtime": "^2.1.1",
|
|
11
|
+
"@adhd/agent-store-prompts": "^2.1.1",
|
|
12
|
+
"@adhd/agent-engine-orchestrator": "^2.1.1",
|
|
13
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
14
|
+
"pino": "^10.3.1",
|
|
15
|
+
"drizzle-orm": "^0.45.2",
|
|
16
|
+
"better-sqlite3": "^12.10.0",
|
|
17
|
+
"zod": "^4.4.3",
|
|
18
|
+
"@adhd/environment": "^0.0.1",
|
|
19
|
+
"@adhd/environment-base-spec": "^0.0.1",
|
|
20
|
+
"@adhd/agent-base-types": "^2.1.1",
|
|
21
|
+
"@adhd/agent-engine-compiler": "^2.1.1",
|
|
21
22
|
"tslib": "^2.3.0"
|
|
22
23
|
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@adhd/agent-base-types": "^2.1.0"
|
|
25
|
-
},
|
|
26
24
|
"main": "./src/index.js",
|
|
27
25
|
"license": "MIT",
|
|
28
26
|
"repository": {
|
|
@@ -36,6 +34,5 @@
|
|
|
36
34
|
},
|
|
37
35
|
"publishConfig": {
|
|
38
36
|
"access": "public"
|
|
39
|
-
}
|
|
40
|
-
"module": "./src/index.js"
|
|
37
|
+
}
|
|
41
38
|
}
|
package/src/config.d.ts
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
|
+
import { Environment } from "@adhd/environment";
|
|
2
|
+
import type { EnvironmentSpec } from "@adhd/environment-base-spec";
|
|
1
3
|
import type { EngineConfig } from "@adhd/agent-engine-orchestrator";
|
|
2
|
-
export
|
|
3
|
-
provider: "openai" | "anthropic" | "claudecli";
|
|
4
|
-
secret?: string;
|
|
5
|
-
url?: string;
|
|
6
|
-
model?: string;
|
|
7
|
-
inlineBaseURL?: string;
|
|
8
|
-
inlineModel?: string;
|
|
9
|
-
};
|
|
10
|
-
export type ProviderConfigResolved = {
|
|
11
|
-
secret?: string;
|
|
12
|
-
baseURL?: string;
|
|
13
|
-
model?: string;
|
|
14
|
-
};
|
|
15
|
-
export interface Config extends EngineConfig {
|
|
4
|
+
export interface AgentMcpConfig {
|
|
16
5
|
readonly db: {
|
|
17
|
-
readonly path: string;
|
|
6
|
+
readonly path: string | undefined;
|
|
18
7
|
};
|
|
19
8
|
readonly logging: {
|
|
20
9
|
readonly level: string;
|
|
21
10
|
};
|
|
22
|
-
readonly
|
|
11
|
+
readonly queue: {
|
|
12
|
+
readonly concurrency: number;
|
|
13
|
+
};
|
|
14
|
+
readonly server: {
|
|
23
15
|
readonly maxDepth: number;
|
|
24
16
|
readonly maxToolLoops: number;
|
|
17
|
+
readonly defaultMaxTokens: number;
|
|
18
|
+
readonly contextLimit: number;
|
|
25
19
|
readonly allowedAgents: readonly string[] | undefined;
|
|
26
20
|
readonly registryDbPath: string;
|
|
27
21
|
};
|
|
@@ -29,23 +23,58 @@ export interface Config extends EngineConfig {
|
|
|
29
23
|
readonly kind: string;
|
|
30
24
|
readonly port: number;
|
|
31
25
|
};
|
|
32
|
-
readonly sse:
|
|
26
|
+
readonly sse: {
|
|
33
27
|
readonly port: number;
|
|
34
28
|
readonly host: string;
|
|
29
|
+
readonly baseUrl: string | undefined;
|
|
35
30
|
};
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
|
|
39
|
-
readonly queue: EngineConfig["queue"];
|
|
40
|
-
readonly plugins: EngineConfig["plugins"];
|
|
41
|
-
getProviderConfig(opts: GetProviderConfigOpts): ProviderConfigResolved;
|
|
42
|
-
resolveEnvRef(name: string): string | undefined;
|
|
43
|
-
verifyEnvRefs(names: string[]): {
|
|
44
|
-
missing: string[];
|
|
45
|
-
disallowed: string[];
|
|
31
|
+
readonly plugins: {
|
|
32
|
+
readonly configPath: string | undefined;
|
|
33
|
+
readonly entries: readonly string[];
|
|
46
34
|
};
|
|
47
|
-
subprocessEnv(): Record<string, string>;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Exported so tests (and any other real consumer that needs an isolated
|
|
38
|
+
* instance — e.g. `__tests__/integration/harness.ts`) can construct their
|
|
39
|
+
* own `new Environment<AgentMcpConfig>('agent-mcp', agentMcpEnvironmentSpec, {...})`
|
|
40
|
+
* against a temp `adhdRoot` without touching the real machine's `~/.adhd`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const agentMcpEnvironmentSpec: EnvironmentSpec<AgentMcpConfig>;
|
|
43
|
+
export type GetProviderConfigOpts = {
|
|
44
|
+
provider: "openai" | "anthropic" | "claudecli";
|
|
45
|
+
secret?: string;
|
|
46
|
+
url?: string;
|
|
47
|
+
model?: string;
|
|
48
|
+
inlineBaseURL?: string;
|
|
49
|
+
inlineModel?: string;
|
|
50
|
+
};
|
|
51
|
+
export type ProviderConfigResolved = {
|
|
52
|
+
secret?: string;
|
|
53
|
+
baseURL?: string;
|
|
54
|
+
model?: string;
|
|
55
|
+
};
|
|
56
|
+
declare function getProviderConfig(opts: GetProviderConfigOpts): ProviderConfigResolved;
|
|
57
|
+
/**
|
|
58
|
+
* Snapshot of the current `process.env`, for subprocess spawning
|
|
59
|
+
* (`EngineConfig.subprocessEnv`, consumed by the `claudecli` provider and
|
|
60
|
+
* the stdio MCP-client transport to forward the parent's environment to a
|
|
61
|
+
* spawned child). Matches the pre-redesign `Config.subprocessEnv()`
|
|
62
|
+
* behavior exactly: the full current env snapshot, not prefix-filtered.
|
|
63
|
+
*/
|
|
64
|
+
declare function subprocessEnv(): Record<string, string>;
|
|
65
|
+
export declare const env: Environment<AgentMcpConfig> & {
|
|
66
|
+
getProviderConfig: typeof getProviderConfig;
|
|
67
|
+
subprocessEnv: typeof subprocessEnv;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Builds the `EngineConfig`-shaped adapter the orchestrator layer (`server.ts`,
|
|
71
|
+
* `index.ts`) is injected with — the engine MUST NOT import `config.ts`
|
|
72
|
+
* directly (`packages/agent/agent-engine-orchestrator/src/interfaces.ts`).
|
|
73
|
+
* Derived live from `env.config` plus `env`'s own methods
|
|
74
|
+
* (`getProviderConfig`/`isEnvNameAllowed`/`subprocessEnv`) on every call, so
|
|
75
|
+
* it always reflects the current cascade (relevant for `at:'runtime'`/
|
|
76
|
+
* `secret` fields, though this spec declares none).
|
|
77
|
+
*/
|
|
78
|
+
export declare function toEngineConfig(): EngineConfig;
|
|
79
|
+
export {};
|
|
51
80
|
//# sourceMappingURL=config.d.ts.map
|
package/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAMpE,MAAM,WAAW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