@unson/brainbase-mcp 0.44.0 → 0.44.1
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/contracts/canonical-task/operation-schema.sql +58 -0
- package/contracts/canonical-task/search-indexes.sql +10 -0
- package/contracts/canonical-task/store-schema.sql +77 -0
- package/dist/automation-run.d.ts +213 -0
- package/dist/automation-run.js +479 -0
- package/dist/canonical-task-operations.d.ts +205 -0
- package/dist/canonical-task-operations.js +700 -0
- package/dist/canonical-task-postgres.d.ts +139 -0
- package/dist/canonical-task-postgres.js +554 -0
- package/dist/canonical-task-service.d.ts +13 -0
- package/dist/canonical-task-service.js +55 -3
- package/dist/canonical-task-store-config.d.ts +31 -0
- package/dist/canonical-task-store-config.js +53 -0
- package/dist/config-parser.d.ts +298 -0
- package/dist/config-parser.js +593 -0
- package/dist/connected-onboarding.d.ts +57 -0
- package/dist/connected-onboarding.js +37 -0
- package/dist/durable-wait-http.d.ts +3 -1
- package/dist/durable-wait-http.js +73 -6
- package/dist/durable-waits.d.ts +93 -3
- package/dist/durable-waits.js +320 -8
- package/dist/honcho.d.ts +25 -0
- package/dist/honcho.js +81 -0
- package/dist/judgment-event-adapter.d.ts +72 -0
- package/dist/judgment-event-adapter.js +114 -0
- package/dist/judgment-event-outbox.d.ts +182 -0
- package/dist/judgment-event-outbox.js +568 -0
- package/dist/judgment-execution-outcome.d.ts +46 -0
- package/dist/judgment-execution-outcome.js +149 -0
- package/dist/judgment-host.d.ts +18 -7
- package/dist/judgment-host.js +82 -34
- package/dist/judgment-lifecycle-core.d.ts +198 -0
- package/dist/judgment-lifecycle-core.js +464 -0
- package/dist/judgment-node-evidence.d.ts +57 -0
- package/dist/judgment-node-evidence.js +297 -0
- package/dist/judgment-runtime-resolution.d.ts +264 -0
- package/dist/judgment-runtime-resolution.js +1248 -0
- package/dist/judgment-runtime-resolution.public.d.ts +255 -0
- package/dist/knowledge-event.d.ts +28 -0
- package/dist/knowledge-event.js +114 -0
- package/dist/mcp-runtime.d.ts +75 -0
- package/dist/mcp-runtime.js +188 -0
- package/dist/meeting-automation-runtime.d.ts +102 -0
- package/dist/meeting-automation-runtime.js +249 -0
- package/dist/meeting-automation.d.ts +155 -0
- package/dist/meeting-automation.js +341 -0
- package/dist/meeting-minutes-context-receipt.d.ts +91 -0
- package/dist/meeting-minutes-context-receipt.js +280 -0
- package/dist/meeting-source-sync.d.ts +89 -0
- package/dist/meeting-source-sync.js +230 -0
- package/dist/mesh.d.ts +58 -0
- package/dist/mesh.js +134 -0
- package/dist/onboarding-runtime.d.ts +47 -0
- package/dist/onboarding-runtime.js +4719 -0
- package/dist/routine-cycle.d.ts +51 -0
- package/dist/routine-cycle.js +153 -0
- package/dist/routine-liveness.d.ts +49 -0
- package/dist/routine-liveness.js +227 -0
- package/dist/routine-runtime.d.ts +101 -0
- package/dist/routine-runtime.js +237 -0
- package/dist/routines.d.ts +3 -0
- package/dist/routines.js +3 -0
- package/dist/run-receipt.d.ts +40 -0
- package/dist/run-receipt.js +635 -0
- package/dist/runtime-host.d.ts +64 -0
- package/dist/runtime-host.js +70 -0
- package/dist/world-work.d.ts +16 -0
- package/package.json +115 -3
- package/ui/objective-editor.js +47 -11
- package/ui/world/world-district.js +18 -3
- package/ui/world/world-placement.js +13 -0
- package/ui/world/world-work-rail.js +7 -1
package/dist/mesh.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
/** Portable mesh envelope and host-port contracts. No network or auth dependency. */
|
|
3
|
+
export const MESH_CONTRACT_VERSION = 'mesh.v1';
|
|
4
|
+
export const MESH_ENVELOPE_TYPES = [
|
|
5
|
+
'query',
|
|
6
|
+
'response',
|
|
7
|
+
'ping',
|
|
8
|
+
'pong',
|
|
9
|
+
'peer_joined',
|
|
10
|
+
'peer_left'
|
|
11
|
+
];
|
|
12
|
+
export class MeshContractError extends Error {
|
|
13
|
+
code = 'mesh_contract_invalid';
|
|
14
|
+
constructor(field, message = `mesh field is invalid: ${field}`) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = 'MeshContractError';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function text(value, field) {
|
|
20
|
+
if (typeof value !== 'string' || !value.trim())
|
|
21
|
+
throw new MeshContractError(field);
|
|
22
|
+
return value.trim();
|
|
23
|
+
}
|
|
24
|
+
function isJson(value) {
|
|
25
|
+
if (value === null || ['string', 'number', 'boolean'].includes(typeof value))
|
|
26
|
+
return true;
|
|
27
|
+
if (Array.isArray(value))
|
|
28
|
+
return value.every(isJson);
|
|
29
|
+
if (typeof value === 'object')
|
|
30
|
+
return Object.values(value).every(isJson);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
export function createMeshEnvelope(input, options = {}) {
|
|
34
|
+
const from = text(input.from, 'from');
|
|
35
|
+
const to = text(input.to, 'to');
|
|
36
|
+
if (!MESH_ENVELOPE_TYPES.includes(input.type))
|
|
37
|
+
throw new MeshContractError('type');
|
|
38
|
+
if (input.payload !== undefined && !isJson(input.payload))
|
|
39
|
+
throw new MeshContractError('payload');
|
|
40
|
+
const ts = options.now ?? Date.now();
|
|
41
|
+
if (!Number.isFinite(ts))
|
|
42
|
+
throw new MeshContractError('ts');
|
|
43
|
+
return {
|
|
44
|
+
id: options.idFactory?.() ?? randomUUID(),
|
|
45
|
+
from,
|
|
46
|
+
to,
|
|
47
|
+
type: input.type,
|
|
48
|
+
payload: input.payload ?? null,
|
|
49
|
+
ts,
|
|
50
|
+
nonce: options.nonceFactory?.() ?? randomUUID()
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function normalizeMeshEnvelope(value) {
|
|
54
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
55
|
+
throw new MeshContractError('envelope');
|
|
56
|
+
const candidate = value;
|
|
57
|
+
const from = text(candidate.from, 'from');
|
|
58
|
+
const to = text(candidate.to, 'to');
|
|
59
|
+
const id = text(candidate.id, 'id');
|
|
60
|
+
const nonce = text(candidate.nonce, 'nonce');
|
|
61
|
+
if (typeof candidate.type !== 'string' || !MESH_ENVELOPE_TYPES.includes(candidate.type)) {
|
|
62
|
+
throw new MeshContractError('type');
|
|
63
|
+
}
|
|
64
|
+
if (!Number.isFinite(candidate.ts) || typeof candidate.ts !== 'number' || candidate.ts <= 0) {
|
|
65
|
+
throw new MeshContractError('ts');
|
|
66
|
+
}
|
|
67
|
+
if (!isJson(candidate.payload))
|
|
68
|
+
throw new MeshContractError('payload');
|
|
69
|
+
return {
|
|
70
|
+
id,
|
|
71
|
+
from,
|
|
72
|
+
to,
|
|
73
|
+
type: candidate.type,
|
|
74
|
+
payload: candidate.payload,
|
|
75
|
+
ts: candidate.ts,
|
|
76
|
+
nonce
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export function normalizeMeshNodeProfile(value) {
|
|
80
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
81
|
+
throw new MeshContractError('profile');
|
|
82
|
+
const candidate = value;
|
|
83
|
+
const projects = Array.isArray(candidate.projects) ? candidate.projects.map((project, index) => {
|
|
84
|
+
if (!project || typeof project !== 'object' || Array.isArray(project))
|
|
85
|
+
throw new MeshContractError(`projects.${index}`);
|
|
86
|
+
const item = project;
|
|
87
|
+
const projectId = text(item.projectId, `projects.${index}.projectId`);
|
|
88
|
+
const localPath = item.localPath === undefined ? undefined : text(item.localPath, `projects.${index}.localPath`);
|
|
89
|
+
const globInclude = item.globInclude === undefined
|
|
90
|
+
? undefined
|
|
91
|
+
: Array.isArray(item.globInclude) && item.globInclude.every((entry) => typeof entry === 'string')
|
|
92
|
+
? [...item.globInclude]
|
|
93
|
+
: (() => { throw new MeshContractError(`projects.${index}.globInclude`); })();
|
|
94
|
+
const ports = item.ports === undefined
|
|
95
|
+
? undefined
|
|
96
|
+
: item.ports && typeof item.ports === 'object' && !Array.isArray(item.ports)
|
|
97
|
+
&& Object.entries(item.ports).every(([key, port]) => Boolean(key) && (typeof port === 'string' || typeof port === 'number'))
|
|
98
|
+
? { ...item.ports }
|
|
99
|
+
: (() => { throw new MeshContractError(`projects.${index}.ports`); })();
|
|
100
|
+
return { projectId, localPath, globInclude, ports };
|
|
101
|
+
}) : [];
|
|
102
|
+
const roleRankValue = candidate.roleRank;
|
|
103
|
+
const roleRank = roleRankValue === undefined ? undefined : roleRankValue;
|
|
104
|
+
if (roleRank !== undefined && (typeof roleRank !== 'number' || !Number.isInteger(roleRank) || roleRank < 0)) {
|
|
105
|
+
throw new MeshContractError('roleRank');
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
nodeId: text(candidate.nodeId, 'nodeId'),
|
|
109
|
+
principalRef: text(candidate.principalRef, 'principalRef'),
|
|
110
|
+
roleRank,
|
|
111
|
+
agentRuntime: candidate.agentRuntime === undefined ? undefined : text(candidate.agentRuntime, 'agentRuntime'),
|
|
112
|
+
projects
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export function normalizeMeshQueryRequest(value) {
|
|
116
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
117
|
+
throw new MeshContractError('query');
|
|
118
|
+
const candidate = value;
|
|
119
|
+
return {
|
|
120
|
+
queryId: text(candidate.queryId, 'queryId'),
|
|
121
|
+
from: text(candidate.from, 'from'),
|
|
122
|
+
to: text(candidate.to, 'to'),
|
|
123
|
+
question: text(candidate.question, 'question'),
|
|
124
|
+
scope: candidate.scope === undefined ? undefined : text(candidate.scope, 'scope')
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export function createMeshSendReceipt(queryId) {
|
|
128
|
+
return {
|
|
129
|
+
queryId: text(queryId, 'queryId'),
|
|
130
|
+
status: 'sent',
|
|
131
|
+
receipt_kind: 'send_ack',
|
|
132
|
+
answer_status: 'unknown'
|
|
133
|
+
};
|
|
134
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { assertSafePersistentValue, normalizeSourceInventory, type CandidateInput, type ConnectedOnboardingRun, type FirstValueInput, type ReviewAction, type SourceInventoryInput, type SourceMode, type SourceReceiptInput, type SourceStatus, type WorkflowState } from './connected-onboarding.js';
|
|
2
|
+
/** Shared state and receipt vocabulary for host onboarding runtimes. */
|
|
3
|
+
export declare const ONBOARDING_RUNTIME_CONTRACT_VERSION: "connected_onboarding.v1";
|
|
4
|
+
export declare const ONBOARDING_WORKFLOW_STATES: readonly ["initialized", "source_ready", "candidates_ready", "promotion_reviewed", "first_value_ready", "first_value_answer_reviewed"];
|
|
5
|
+
export declare const ONBOARDING_SOURCE_MODES: readonly ["mcp", "drive", "gmail", "local_folder", "single_document"];
|
|
6
|
+
export declare const ONBOARDING_SOURCE_STATUSES: readonly ["ready", "waiting_for_authorization", "unavailable", "error", "unconfirmed"];
|
|
7
|
+
export declare const ONBOARDING_OBSERVATION_CLASSES: readonly ["observed", "inferred"];
|
|
8
|
+
export declare const FIRST_VALUE_PRESENTATION_CONTRACT: Readonly<{
|
|
9
|
+
version: "first_value_clarity.v1";
|
|
10
|
+
sections: readonly ["覚えていたこと", "つながったこと", "次にできること"];
|
|
11
|
+
humanReviewRequired: true;
|
|
12
|
+
}>;
|
|
13
|
+
export type { CandidateInput, ConnectedOnboardingRun, FirstValueInput, ReviewAction, SourceInventoryInput, SourceMode, SourceReceiptInput, SourceStatus, WorkflowState };
|
|
14
|
+
export { assertSafePersistentValue, normalizeSourceInventory };
|
|
15
|
+
export interface OnboardingPermissionSnapshot {
|
|
16
|
+
visibility?: string;
|
|
17
|
+
collectedBy?: string;
|
|
18
|
+
provider?: string;
|
|
19
|
+
connectionId?: string;
|
|
20
|
+
grantId?: string;
|
|
21
|
+
accountId?: string;
|
|
22
|
+
folderId?: string;
|
|
23
|
+
projectCode?: string;
|
|
24
|
+
roleMin?: string;
|
|
25
|
+
sensitivity?: string;
|
|
26
|
+
scope?: string;
|
|
27
|
+
scopes?: string[];
|
|
28
|
+
roles?: string[];
|
|
29
|
+
clearance?: string[];
|
|
30
|
+
authorizedAt?: string;
|
|
31
|
+
expiresAt?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface OnboardingSourceReceiptContract {
|
|
34
|
+
sourceId: string;
|
|
35
|
+
evidencePointer: string;
|
|
36
|
+
contentHash: string;
|
|
37
|
+
permissionSnapshot: OnboardingPermissionSnapshot;
|
|
38
|
+
collectionStatus: 'collected';
|
|
39
|
+
}
|
|
40
|
+
export interface FirstValueRecordContract {
|
|
41
|
+
answerHash: string;
|
|
42
|
+
usedCanonicalIds: string[];
|
|
43
|
+
missingContext: string[];
|
|
44
|
+
}
|
|
45
|
+
export declare function normalizeOnboardingPermissionSnapshot(value: unknown): OnboardingPermissionSnapshot;
|
|
46
|
+
export declare function normalizeOnboardingSourceReceipt(value: unknown): OnboardingSourceReceiptContract;
|
|
47
|
+
export declare function normalizeFirstValueRecord(value: unknown): FirstValueRecordContract;
|