@unson/brainbase-mcp 0.4.1 → 0.5.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/README.md +5 -5
- package/contracts/judgment-dag/digest.json +4 -4
- package/contracts/judgment-dag/source-lock.json +65 -1
- package/contracts/judgment-value-proof/fixture.json +54 -0
- package/contracts/judgment-value-proof/schema.json +163 -0
- package/dist/cli.js +17 -0
- package/dist/embedding-provider.d.ts +72 -0
- package/dist/embedding-provider.js +391 -0
- package/dist/graph-retrieval.d.ts +94 -0
- package/dist/graph-retrieval.js +443 -0
- package/dist/judgment-dag-artifact-store.d.ts +29 -0
- package/dist/judgment-dag-artifact-store.js +416 -0
- package/dist/judgment-dag-replay-evaluation.d.ts +108 -0
- package/dist/judgment-dag-replay-evaluation.js +424 -0
- package/dist/judgment-dag.d.ts +4 -0
- package/dist/judgment-dag.js +2 -0
- package/dist/judgment-value-proof.d.ts +92 -0
- package/dist/judgment-value-proof.js +229 -0
- package/dist/organization-graph.d.ts +76 -0
- package/dist/organization-graph.js +331 -0
- package/dist/portable-graph.d.ts +39 -0
- package/dist/portable-graph.js +240 -0
- package/dist/server.d.ts +42 -3
- package/dist/server.js +52 -7
- package/docs/management/judgment-dag-milestones.md +31 -1
- package/package.json +16 -6
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<!-- brainbase:public-message:start -->
|
|
2
2
|
# Brainbase
|
|
3
3
|
|
|
4
|
-
##
|
|
4
|
+
## 自分の判断力を、ひとり分で終わらせない。
|
|
5
5
|
|
|
6
|
-
Brainbase
|
|
6
|
+
Brainbaseは、あなたの目的、優先順位、判断基準、過去の決定を、複数のAIが使えるローカルの判断OSにします。CodexやClaude Codeは、同じ判断軸から深く考え、調査・設計・執筆・開発を進められます。
|
|
7
7
|
|
|
8
|
-
>
|
|
8
|
+
> **頭のいい自分を、壁打ち相手にも、実行部隊にも。**
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
AI
|
|
10
|
+
人間は、目的、判断基準、任せてよい範囲を決める。
|
|
11
|
+
AIは、それらを参照して探索・反証し、許可された範囲の仕事を進める。
|
|
12
12
|
<!-- brainbase:public-message:end -->
|
|
13
13
|
|
|
14
14
|
## なぜ必要か
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"path": "contracts/judgment-dag/source-lock.json",
|
|
16
|
-
"sha256": "
|
|
16
|
+
"sha256": "4d3fbc2f82c07f709d901fcda68718b12b45a0d11a16354edec32b3406370bfe"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"path": "docs/architecture/judgment-dag-core.md",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"path": "docs/management/judgment-dag-milestones.md",
|
|
24
|
-
"sha256": "
|
|
24
|
+
"sha256": "e028f084708aa4ef2dea9437b81d3c2de15cb62b2c9448f2c7fa7d9d32b1e6b2"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"path": "README.md",
|
|
28
|
-
"sha256": "
|
|
28
|
+
"sha256": "ec2f2419e7f43e2abdbedf6535e6d57a095e920f6c42b9e250bbabb50c00b745"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
|
-
"digest": "
|
|
31
|
+
"digest": "dbe232857d29a3178013c82fc80d87dadecf0fa07ebf5ca5d260b0eed35c34fb"
|
|
32
32
|
}
|
|
@@ -4,6 +4,70 @@
|
|
|
4
4
|
"repository": "https://github.com/Unson-LLC/brainbase",
|
|
5
5
|
"status": "accepted",
|
|
6
6
|
"accepted_base_commit": "7e5d5693f988f4ba84072c5910ef32f0e70871e1",
|
|
7
|
+
"program_governance": {
|
|
8
|
+
"repository": "https://github.com/Unson-LLC/brainbase-unson",
|
|
9
|
+
"commit": "18544f58a2a0298d97eab45de2f05544bed48a43",
|
|
10
|
+
"markdown": {
|
|
11
|
+
"path": "docs/management/milestones/brainbase-program-master-roadmap.md",
|
|
12
|
+
"sha256": "167afb6d3fc57198c9f5ffca06fbafea968a5435af04f44b55017199b6d859fe"
|
|
13
|
+
},
|
|
14
|
+
"machine_contract": {
|
|
15
|
+
"path": "docs/management/milestones/brainbase-program-master-roadmap.json",
|
|
16
|
+
"sha256": "f3e6e023060ef3976f367ed7efa62ac57f7091f517ea1ca1d13824d9e6ca429f"
|
|
17
|
+
},
|
|
18
|
+
"work_packages": [
|
|
19
|
+
"R0",
|
|
20
|
+
"J0",
|
|
21
|
+
"G0",
|
|
22
|
+
"R1",
|
|
23
|
+
"D0",
|
|
24
|
+
"P0",
|
|
25
|
+
"C0"
|
|
26
|
+
],
|
|
27
|
+
"milestone_crosswalk": {
|
|
28
|
+
"M0": [
|
|
29
|
+
"R0",
|
|
30
|
+
"J0"
|
|
31
|
+
],
|
|
32
|
+
"M1": [
|
|
33
|
+
"J0"
|
|
34
|
+
],
|
|
35
|
+
"M2": [
|
|
36
|
+
"G0"
|
|
37
|
+
],
|
|
38
|
+
"M3": [
|
|
39
|
+
"R1"
|
|
40
|
+
],
|
|
41
|
+
"M4": [
|
|
42
|
+
"D0"
|
|
43
|
+
],
|
|
44
|
+
"M5": [
|
|
45
|
+
"P0"
|
|
46
|
+
],
|
|
47
|
+
"M6": [
|
|
48
|
+
"G0",
|
|
49
|
+
"C0"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"status_vocabulary": [
|
|
53
|
+
"planned",
|
|
54
|
+
"contract_ready",
|
|
55
|
+
"implementing",
|
|
56
|
+
"verified",
|
|
57
|
+
"production_proven",
|
|
58
|
+
"done"
|
|
59
|
+
],
|
|
60
|
+
"snapshot_update_policy": {
|
|
61
|
+
"requires_new_commit": true,
|
|
62
|
+
"required_artifact_hashes": [
|
|
63
|
+
"markdown.sha256",
|
|
64
|
+
"machine_contract.sha256"
|
|
65
|
+
],
|
|
66
|
+
"requires_verification_evidence": true,
|
|
67
|
+
"requires_independent_review": true
|
|
68
|
+
},
|
|
69
|
+
"verification_boundary": "The OSS package records the accepted cross-repository commit and content hashes. Public tests do not fetch the organization repository or treat network access as runtime authority."
|
|
70
|
+
},
|
|
7
71
|
"sources": [
|
|
8
72
|
{
|
|
9
73
|
"kind": "architecture",
|
|
@@ -13,7 +77,7 @@
|
|
|
13
77
|
{
|
|
14
78
|
"kind": "milestones",
|
|
15
79
|
"path": "docs/management/judgment-dag-milestones.md",
|
|
16
|
-
"sha256": "
|
|
80
|
+
"sha256": "e028f084708aa4ef2dea9437b81d3c2de15cb62b2c9448f2c7fa7d9d32b1e6b2"
|
|
17
81
|
}
|
|
18
82
|
],
|
|
19
83
|
"notes": [
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "brainbase-judgment-value-proof-v1",
|
|
3
|
+
"intent_id": "intent_example",
|
|
4
|
+
"decision_attempt_id": "decision_attempt_example",
|
|
5
|
+
"recorded_at": "2026-09-01T00:00:00.000Z",
|
|
6
|
+
"state": "outcome_verified",
|
|
7
|
+
"interruption": {
|
|
8
|
+
"resolution": "continued_without_human",
|
|
9
|
+
"question_display_text": "新規文書を作るか、既存文書を更新するか",
|
|
10
|
+
"question_digest": "sha256:example-question",
|
|
11
|
+
"reason_code": "routine_reversible_work",
|
|
12
|
+
"human_reason": null
|
|
13
|
+
},
|
|
14
|
+
"decision": {
|
|
15
|
+
"summary": "既存SSOTを最小更新する",
|
|
16
|
+
"work_impact": "確認で作業を止めず、実装と検証まで継続した",
|
|
17
|
+
"basis": [
|
|
18
|
+
{
|
|
19
|
+
"entity_id": "dec_example",
|
|
20
|
+
"application": "正本が存在する場合は重複する文書を増やさない"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"prior_learning_reused": true
|
|
24
|
+
},
|
|
25
|
+
"execution": {
|
|
26
|
+
"status": "completed",
|
|
27
|
+
"summary": "既存文書を更新してPRを作成した",
|
|
28
|
+
"artifact_refs": [
|
|
29
|
+
{
|
|
30
|
+
"kind": "pull_request",
|
|
31
|
+
"ref": "github://pull/142",
|
|
32
|
+
"label": "PR #142"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"outcome": {
|
|
37
|
+
"status": "outcome_verified",
|
|
38
|
+
"summary": "PRを読み戻し、変更内容とテスト成功を確認した",
|
|
39
|
+
"evidence_refs": [
|
|
40
|
+
{
|
|
41
|
+
"kind": "canonical_readback",
|
|
42
|
+
"ref": "github://pull/142",
|
|
43
|
+
"status": "verified",
|
|
44
|
+
"label": "PR #142"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"human_decision": null,
|
|
49
|
+
"feedback": {
|
|
50
|
+
"status": "none",
|
|
51
|
+
"summary": null,
|
|
52
|
+
"evidence_ref": null
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://brainbase.local/contracts/judgment-value-proof/v1/schema.json",
|
|
4
|
+
"title": "Brainbase Judgment Value Proof v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"intent_id",
|
|
10
|
+
"decision_attempt_id",
|
|
11
|
+
"recorded_at",
|
|
12
|
+
"state",
|
|
13
|
+
"interruption",
|
|
14
|
+
"decision",
|
|
15
|
+
"execution",
|
|
16
|
+
"outcome",
|
|
17
|
+
"human_decision",
|
|
18
|
+
"feedback"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"schema_version": { "const": "brainbase-judgment-value-proof-v1" },
|
|
22
|
+
"intent_id": { "type": "string", "minLength": 1 },
|
|
23
|
+
"decision_attempt_id": { "type": "string", "minLength": 1 },
|
|
24
|
+
"recorded_at": { "type": "string", "format": "date-time" },
|
|
25
|
+
"state": {
|
|
26
|
+
"enum": ["captured", "executing", "waiting_human", "outcome_verified", "blocked", "unconfirmed"]
|
|
27
|
+
},
|
|
28
|
+
"interruption": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": false,
|
|
31
|
+
"required": ["resolution", "question_display_text", "question_digest", "reason_code", "human_reason"],
|
|
32
|
+
"properties": {
|
|
33
|
+
"resolution": { "enum": ["not_applicable", "continued_without_human", "human_required"] },
|
|
34
|
+
"question_display_text": { "type": ["string", "null"] },
|
|
35
|
+
"question_digest": { "type": ["string", "null"] },
|
|
36
|
+
"reason_code": { "type": ["string", "null"] },
|
|
37
|
+
"human_reason": { "type": ["string", "null"] }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"decision": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"required": ["summary", "work_impact", "basis", "prior_learning_reused"],
|
|
44
|
+
"properties": {
|
|
45
|
+
"summary": { "type": ["string", "null"] },
|
|
46
|
+
"work_impact": { "type": ["string", "null"] },
|
|
47
|
+
"basis": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"items": { "$ref": "#/$defs/basis" }
|
|
50
|
+
},
|
|
51
|
+
"prior_learning_reused": {
|
|
52
|
+
"oneOf": [
|
|
53
|
+
{ "type": "boolean" },
|
|
54
|
+
{ "const": "unconfirmed" }
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"execution": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"required": ["status", "summary", "artifact_refs"],
|
|
63
|
+
"properties": {
|
|
64
|
+
"status": { "enum": ["not_started", "executing", "completed", "blocked"] },
|
|
65
|
+
"summary": { "type": ["string", "null"] },
|
|
66
|
+
"artifact_refs": {
|
|
67
|
+
"type": "array",
|
|
68
|
+
"items": { "$ref": "#/$defs/artifact_ref" }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"outcome": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
"required": ["status", "summary", "evidence_refs"],
|
|
76
|
+
"properties": {
|
|
77
|
+
"status": { "enum": ["outcome_verified", "unconfirmed", "not_applicable"] },
|
|
78
|
+
"summary": { "type": ["string", "null"] },
|
|
79
|
+
"evidence_refs": {
|
|
80
|
+
"type": "array",
|
|
81
|
+
"items": { "$ref": "#/$defs/evidence_ref" }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"human_decision": {
|
|
86
|
+
"oneOf": [
|
|
87
|
+
{ "type": "null" },
|
|
88
|
+
{
|
|
89
|
+
"type": "object",
|
|
90
|
+
"additionalProperties": false,
|
|
91
|
+
"required": ["question", "why_human", "options"],
|
|
92
|
+
"properties": {
|
|
93
|
+
"question": { "type": "string", "minLength": 1 },
|
|
94
|
+
"why_human": { "type": "string", "minLength": 1 },
|
|
95
|
+
"options": {
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": { "$ref": "#/$defs/human_option" }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"feedback": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"required": ["status", "summary", "evidence_ref"],
|
|
107
|
+
"properties": {
|
|
108
|
+
"status": { "enum": ["none", "pending", "accepted", "corrected", "next_time_ask", "reverted"] },
|
|
109
|
+
"summary": { "type": ["string", "null"] },
|
|
110
|
+
"evidence_ref": {
|
|
111
|
+
"oneOf": [
|
|
112
|
+
{ "type": "null" },
|
|
113
|
+
{ "$ref": "#/$defs/evidence_ref" }
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"$defs": {
|
|
120
|
+
"basis": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"additionalProperties": false,
|
|
123
|
+
"required": ["entity_id", "application"],
|
|
124
|
+
"properties": {
|
|
125
|
+
"entity_id": { "type": "string", "minLength": 1 },
|
|
126
|
+
"application": { "type": "string", "minLength": 1 }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"artifact_ref": {
|
|
130
|
+
"type": "object",
|
|
131
|
+
"additionalProperties": false,
|
|
132
|
+
"required": ["kind", "ref"],
|
|
133
|
+
"properties": {
|
|
134
|
+
"kind": { "type": "string", "minLength": 1 },
|
|
135
|
+
"ref": { "type": "string", "minLength": 1 },
|
|
136
|
+
"label": { "type": "string", "minLength": 1 }
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"evidence_ref": {
|
|
140
|
+
"type": "object",
|
|
141
|
+
"additionalProperties": false,
|
|
142
|
+
"required": ["kind", "ref", "status"],
|
|
143
|
+
"properties": {
|
|
144
|
+
"kind": {
|
|
145
|
+
"enum": ["judgment_receipt", "autonomy_receipt", "tool_event", "artifact", "canonical_readback", "human_feedback"]
|
|
146
|
+
},
|
|
147
|
+
"ref": { "type": "string", "minLength": 1 },
|
|
148
|
+
"status": { "enum": ["verified", "unconfirmed"] },
|
|
149
|
+
"label": { "type": "string", "minLength": 1 }
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"human_option": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"additionalProperties": false,
|
|
155
|
+
"required": ["id", "label", "impact"],
|
|
156
|
+
"properties": {
|
|
157
|
+
"id": { "type": "string", "minLength": 1 },
|
|
158
|
+
"label": { "type": "string", "minLength": 1 },
|
|
159
|
+
"impact": { "type": "string", "minLength": 1 }
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { createPortableGraph, portableGraphDigest } from './portable-graph.js';
|
|
3
|
+
import { createOrganizationGraphConfig, createOrganizationGraphClient } from './organization-graph.js';
|
|
2
4
|
import { constants, realpathSync } from 'node:fs';
|
|
3
5
|
import { access, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
4
6
|
import { delimiter, dirname, isAbsolute, join } from 'node:path';
|
|
@@ -25,6 +27,20 @@ export async function runCli(argv = process.argv.slice(2), io = process) {
|
|
|
25
27
|
return 0;
|
|
26
28
|
}
|
|
27
29
|
switch (parsed.command) {
|
|
30
|
+
case 'graph:upgrade': {
|
|
31
|
+
const config = createOrganizationGraphConfig();
|
|
32
|
+
if (!config)
|
|
33
|
+
throw new Error('graph:upgrade requires all BRAINBASE_ORGANIZATION_* settings');
|
|
34
|
+
const bundle = createPortableGraph(await loadPersonalOs(resolveDataDir(first(parsed, 'dir'))));
|
|
35
|
+
const client = createOrganizationGraphClient(config);
|
|
36
|
+
const imported = await client.importPortableGraph(bundle);
|
|
37
|
+
const readback = await client.readPortableGraph();
|
|
38
|
+
if (readback.digest !== portableGraphDigest(bundle))
|
|
39
|
+
throw new Error('organization_graph_readback_mismatch');
|
|
40
|
+
write(io, JSON.stringify({ status: imported.status, digest: readback.digest, readbackVerified: true,
|
|
41
|
+
sourceFilesUnchanged: true, graphId: config.graphId }) + '\n');
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
28
44
|
case 'onboard:init':
|
|
29
45
|
return await onboardInit(parsed, io);
|
|
30
46
|
case 'onboard:seed':
|
|
@@ -1087,6 +1103,7 @@ function usage() {
|
|
|
1087
1103
|
brainbase onboard:skills --target codex|claude|portable [--skills id,id] [--out dir] [--format markdown|json]
|
|
1088
1104
|
brainbase ontology:show
|
|
1089
1105
|
brainbase ontology:audit [--dir path] [--ontology-version 0.0.0|1.0.0|2.0.0]
|
|
1106
|
+
brainbase graph:upgrade [--dir path]
|
|
1090
1107
|
brainbase ontology:migrate [--dir path] [--write --expected-input-digest digest]
|
|
1091
1108
|
brainbase judgment:install --target codex [--autonomy-mode off|canary|on] [--autonomy-project code] [--dry-run] [--output path]
|
|
1092
1109
|
brainbase judgment:hook [--autonomy-mode off|canary|on] [--autonomy-project code]
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A provider is deliberately small so the retrieval layer does not need to
|
|
3
|
+
* know whether embeddings are produced by a local service or a hosted one.
|
|
4
|
+
* Brainbase does not bundle a model; the HTTP adapter below is opt-in.
|
|
5
|
+
*/
|
|
6
|
+
export interface EmbeddingProvider {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
embed(texts: string[]): Promise<number[][]>;
|
|
9
|
+
}
|
|
10
|
+
export type EmbeddingFetchResponse = {
|
|
11
|
+
readonly status: number;
|
|
12
|
+
readonly ok?: boolean;
|
|
13
|
+
readonly headers?: {
|
|
14
|
+
get(name: string): string | null;
|
|
15
|
+
} | Map<string, string> | Record<string, string | undefined>;
|
|
16
|
+
readonly body?: {
|
|
17
|
+
getReader(): {
|
|
18
|
+
read(): Promise<{
|
|
19
|
+
done: boolean;
|
|
20
|
+
value?: Uint8Array;
|
|
21
|
+
}>;
|
|
22
|
+
cancel?(reason?: unknown): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
} | null;
|
|
25
|
+
text?(): Promise<string>;
|
|
26
|
+
json?(): Promise<unknown>;
|
|
27
|
+
};
|
|
28
|
+
export type EmbeddingFetch = (input: string, init: {
|
|
29
|
+
method: 'POST';
|
|
30
|
+
headers: Record<string, string>;
|
|
31
|
+
body: string;
|
|
32
|
+
redirect: 'error';
|
|
33
|
+
signal: AbortSignal;
|
|
34
|
+
}) => Promise<EmbeddingFetchResponse>;
|
|
35
|
+
export interface HttpEmbeddingProviderConfig {
|
|
36
|
+
/** Full OpenAI-compatible /embeddings endpoint. */
|
|
37
|
+
url: string;
|
|
38
|
+
model: string;
|
|
39
|
+
apiKey?: string;
|
|
40
|
+
/** Test injection point. The default is the host's global fetch. */
|
|
41
|
+
fetch?: EmbeddingFetch;
|
|
42
|
+
/** Alias accepted for callers that avoid shadowing the global fetch name. */
|
|
43
|
+
fetchImpl?: EmbeddingFetch;
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
cacheSize?: number;
|
|
46
|
+
}
|
|
47
|
+
export declare const EMBEDDING_MAX_INPUTS = 64;
|
|
48
|
+
/** Maximum number of texts accepted by one embed() call across all batches. */
|
|
49
|
+
export declare const EMBEDDING_MAX_TOTAL_INPUTS = 2048;
|
|
50
|
+
export declare const EMBEDDING_MAX_TEXT_LENGTH = 16000;
|
|
51
|
+
export declare const EMBEDDING_MAX_BATCH_BYTES = 1000000;
|
|
52
|
+
export declare const EMBEDDING_MAX_RESPONSE_BYTES = 4000000;
|
|
53
|
+
export declare const EMBEDDING_DEFAULT_TIMEOUT_MS = 10000;
|
|
54
|
+
export declare const EMBEDDING_DEFAULT_CACHE_SIZE = 2048;
|
|
55
|
+
export declare class EmbeddingProviderConfigError extends Error {
|
|
56
|
+
readonly code = "embedding_config_invalid";
|
|
57
|
+
constructor(message: string);
|
|
58
|
+
}
|
|
59
|
+
export declare class EmbeddingProviderError extends Error {
|
|
60
|
+
readonly code: string;
|
|
61
|
+
constructor(code: string, message: string);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Build an opt-in provider from environment variables.
|
|
65
|
+
*
|
|
66
|
+
* With no embedding variables configured this returns undefined and performs
|
|
67
|
+
* no network setup. A partial or invalid configuration throws instead of
|
|
68
|
+
* silently falling back to lexical search or another provider.
|
|
69
|
+
*/
|
|
70
|
+
export declare function createEmbeddingProviderFromEnv(env?: Record<string, string | undefined>): EmbeddingProvider | undefined;
|
|
71
|
+
/** Create the HTTP adapter. No request is made until embed() is called. */
|
|
72
|
+
export declare function createHttpEmbeddingProvider(config: HttpEmbeddingProviderConfig): EmbeddingProvider;
|