@components-kit/open-workbook-backend 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.
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/addin-rpc-client.d.ts +17 -0
- package/dist/addin-rpc-client.d.ts.map +1 -0
- package/dist/addin-rpc-client.js +66 -0
- package/dist/addin-rpc-client.js.map +1 -0
- package/dist/addin-websocket-server.d.ts +13 -0
- package/dist/addin-websocket-server.d.ts.map +1 -0
- package/dist/addin-websocket-server.js +199 -0
- package/dist/addin-websocket-server.js.map +1 -0
- package/dist/file-bridge.d.ts +2 -0
- package/dist/file-bridge.d.ts.map +1 -0
- package/dist/file-bridge.js +15 -0
- package/dist/file-bridge.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/native-file-bridge-server.d.ts +28 -0
- package/dist/native-file-bridge-server.d.ts.map +1 -0
- package/dist/native-file-bridge-server.js +496 -0
- package/dist/native-file-bridge-server.js.map +1 -0
- package/dist/native-file-bridge.d.ts +20 -0
- package/dist/native-file-bridge.d.ts.map +1 -0
- package/dist/native-file-bridge.js +140 -0
- package/dist/native-file-bridge.js.map +1 -0
- package/dist/runtime-service.d.ts +3167 -0
- package/dist/runtime-service.d.ts.map +1 -0
- package/dist/runtime-service.js +6003 -0
- package/dist/runtime-service.js.map +1 -0
- package/dist/session-registry.d.ts +20 -0
- package/dist/session-registry.d.ts.map +1 -0
- package/dist/session-registry.js +53 -0
- package/dist/session-registry.js.map +1 -0
- package/dist/state-store.d.ts +26 -0
- package/dist/state-store.d.ts.map +1 -0
- package/dist/state-store.js +44 -0
- package/dist/state-store.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BackupRecord, PlanRecord, TemplateRecord } from "@components-kit/open-workbook-excel-core";
|
|
2
|
+
import type { AgentRecord, CollaborationEvent, ConflictRecord, ConflictTelemetryRecord, LockLeasePolicy, LockRecord, PermissionState, TaskRecord, TransactionRecord, WorkbookRegion } from "@components-kit/open-workbook-protocol";
|
|
3
|
+
export interface RuntimeStateSnapshot {
|
|
4
|
+
version: 1;
|
|
5
|
+
savedAt: string;
|
|
6
|
+
agents: AgentRecord[];
|
|
7
|
+
tasks: TaskRecord[];
|
|
8
|
+
locks: LockRecord[];
|
|
9
|
+
lockLeasePolicy?: LockLeasePolicy | undefined;
|
|
10
|
+
transactions: TransactionRecord[];
|
|
11
|
+
conflicts: ConflictRecord[];
|
|
12
|
+
conflictTelemetry?: ConflictTelemetryRecord[] | undefined;
|
|
13
|
+
collaborationEvents: CollaborationEvent[];
|
|
14
|
+
templates?: TemplateRecord[] | undefined;
|
|
15
|
+
regions?: WorkbookRegion[] | undefined;
|
|
16
|
+
permissions?: PermissionState | undefined;
|
|
17
|
+
plans?: PlanRecord[] | undefined;
|
|
18
|
+
backups?: BackupRecord[] | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare class RuntimeStateStore {
|
|
21
|
+
readonly filePath: string;
|
|
22
|
+
constructor(stateDir?: string);
|
|
23
|
+
load(): RuntimeStateSnapshot | undefined;
|
|
24
|
+
save(snapshot: RuntimeStateSnapshot): void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=state-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-store.d.ts","sourceRoot":"","sources":["../src/state-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AACzG,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,UAAU,EACV,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,cAAc,EACf,MAAM,wCAAwC,CAAC;AAEhD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAC9C,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,iBAAiB,CAAC,EAAE,uBAAuB,EAAE,GAAG,SAAS,CAAC;IAC1D,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,SAAS,CAAC,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACzC,OAAO,CAAC,EAAE,cAAc,EAAE,GAAG,SAAS,CAAC;IACvC,WAAW,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAC1C,KAAK,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;IACjC,OAAO,CAAC,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;CACtC;AAED,qBAAa,iBAAiB;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,QAAQ,SAAoB;IAIxC,IAAI,IAAI,oBAAoB,GAAG,SAAS;IA2BxC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;CAM3C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export class RuntimeStateStore {
|
|
4
|
+
filePath;
|
|
5
|
+
constructor(stateDir = defaultStateDir()) {
|
|
6
|
+
this.filePath = path.join(stateDir, "collaboration-state.json");
|
|
7
|
+
}
|
|
8
|
+
load() {
|
|
9
|
+
if (!existsSync(this.filePath)) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const parsed = JSON.parse(readFileSync(this.filePath, "utf8"));
|
|
13
|
+
if (parsed.version !== 1) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
version: 1,
|
|
18
|
+
savedAt: parsed.savedAt ?? new Date(0).toISOString(),
|
|
19
|
+
agents: parsed.agents ?? [],
|
|
20
|
+
tasks: parsed.tasks ?? [],
|
|
21
|
+
locks: parsed.locks ?? [],
|
|
22
|
+
lockLeasePolicy: parsed.lockLeasePolicy,
|
|
23
|
+
transactions: parsed.transactions ?? [],
|
|
24
|
+
conflicts: parsed.conflicts ?? [],
|
|
25
|
+
conflictTelemetry: parsed.conflictTelemetry ?? [],
|
|
26
|
+
collaborationEvents: parsed.collaborationEvents ?? [],
|
|
27
|
+
templates: parsed.templates ?? [],
|
|
28
|
+
regions: parsed.regions ?? [],
|
|
29
|
+
permissions: parsed.permissions,
|
|
30
|
+
plans: parsed.plans ?? [],
|
|
31
|
+
backups: parsed.backups ?? []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
save(snapshot) {
|
|
35
|
+
mkdirSync(path.dirname(this.filePath), { recursive: true });
|
|
36
|
+
const tmpPath = `${this.filePath}.${process.pid}.tmp`;
|
|
37
|
+
writeFileSync(tmpPath, `${JSON.stringify(snapshot, null, 2)}\n`, "utf8");
|
|
38
|
+
renameSync(tmpPath, this.filePath);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function defaultStateDir() {
|
|
42
|
+
return process.env.OPEN_WORKBOOK_STATE_DIR ?? path.resolve(process.cwd(), ".open-workbook/state");
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=state-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-store.js","sourceRoot":"","sources":["../src/state-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,IAAI,MAAM,WAAW,CAAC;AAiC7B,MAAM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,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,QAA8B;QACjC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;QACtD,aAAa,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzE,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;CACF;AAED,SAAS,eAAe;IACtB,OAAO,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,sBAAsB,CAAC,CAAC;AACpG,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@components-kit/open-workbook-backend",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local backend broker for Open Workbook add-in sessions, backups, snapshots, plans, and permissions.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"homepage": "https://github.com/components-kit/open-workbook#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/components-kit/open-workbook.git",
|
|
11
|
+
"directory": "apps/backend"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/components-kit/open-workbook/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"excel",
|
|
18
|
+
"mcp",
|
|
19
|
+
"office-js",
|
|
20
|
+
"websocket",
|
|
21
|
+
"spreadsheet"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
"./runtime": {
|
|
25
|
+
"types": "./dist/runtime-service.d.ts",
|
|
26
|
+
"default": "./dist/runtime-service.js"
|
|
27
|
+
},
|
|
28
|
+
"./server": {
|
|
29
|
+
"types": "./dist/addin-websocket-server.d.ts",
|
|
30
|
+
"default": "./dist/addin-websocket-server.js"
|
|
31
|
+
},
|
|
32
|
+
"./file-bridge": {
|
|
33
|
+
"types": "./dist/native-file-bridge-server.d.ts",
|
|
34
|
+
"default": "./dist/native-file-bridge-server.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md"
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"ws": "^8.18.0",
|
|
46
|
+
"@components-kit/open-workbook-excel-core": "0.1.0",
|
|
47
|
+
"@components-kit/open-workbook-protocol": "0.1.0",
|
|
48
|
+
"@components-kit/open-workbook-office-js-engine": "0.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/ws": "^8.5.13",
|
|
52
|
+
"typescript": "^5.7.3",
|
|
53
|
+
"vitest": "^2.1.8"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsc -p tsconfig.json",
|
|
57
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
58
|
+
"test": "vitest run --passWithNoTests",
|
|
59
|
+
"dev": "node --enable-source-maps dist/index.js"
|
|
60
|
+
}
|
|
61
|
+
}
|