@agimon-ai/po-author 0.0.0-alpha.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 +38 -0
- package/dist/apiContracts.cjs +348 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +343 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/authorFacade--Lc599Ft.mjs +84 -0
- package/dist/authorFacade--Lc599Ft.mjs.map +1 -0
- package/dist/authorFacade-89Eb2-sW.d.mts +132 -0
- package/dist/authorFacade-89Eb2-sW.d.mts.map +1 -0
- package/dist/authorFacade-BYvlm8Ff.cjs +119 -0
- package/dist/authorFacade-BYvlm8Ff.cjs.map +1 -0
- package/dist/authorFacade.cjs +27 -0
- package/dist/authorFacade.d.mts +3 -0
- package/dist/authorFacade.mjs +3 -0
- package/dist/extensions/server.cjs +845 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +838 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +4758 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +101 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +435 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +70 -0
- package/dist/index.mjs.map +1 -0
- package/dist/structuredDocuments-B914GLxx.mjs +1064 -0
- package/dist/structuredDocuments-B914GLxx.mjs.map +1 -0
- package/dist/structuredDocuments-CNac1JmJ.cjs +1316 -0
- package/dist/structuredDocuments-CNac1JmJ.cjs.map +1 -0
- package/llms.txt +11 -0
- package/package.json +140 -0
- package/src/prompts/po-use-author/SKILL.md +20 -0
- package/src/types/author.ts +61 -0
- package/src/types/authorPreview.ts +98 -0
- package/src/types/structuredDocuments.ts +63 -0
- package/src/types/webAuthor.ts +94 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_structuredDocuments = require("./structuredDocuments-CNac1JmJ.cjs");
|
|
3
|
+
//#region src/services/authorCatalog/monitor.ts
|
|
4
|
+
const CATALOG_POLL_MS = 500;
|
|
5
|
+
/** Hide Author tools until the mode and viewport catalog can serve them. */
|
|
6
|
+
function authorToolRestriction(active, _catalogReady) {
|
|
7
|
+
const hidden = /* @__PURE__ */ new Set([...active ? [] : [require_structuredDocuments.OPEN_AUTHORING_FILE_TOOL_NAME], ...active ? [] : [require_structuredDocuments.AUTHOR_DESCRIBE_TOOL_NAME, require_structuredDocuments.AUTHOR_USE_TOOL_NAME]]);
|
|
8
|
+
return (incoming) => hidden.size === 0 ? incoming : incoming.filter((name) => !hidden.has(name));
|
|
9
|
+
}
|
|
10
|
+
/** Author-specific viewport polling; the shared minor-mode factory owns activation. */
|
|
11
|
+
function createAuthorCatalogMonitor(catalog, clock) {
|
|
12
|
+
let current;
|
|
13
|
+
let active = false;
|
|
14
|
+
let disposed = false;
|
|
15
|
+
let generation = 0;
|
|
16
|
+
let cancelTimer;
|
|
17
|
+
let request;
|
|
18
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
19
|
+
const setCatalog = (snapshot) => {
|
|
20
|
+
const previous = current;
|
|
21
|
+
current = snapshot;
|
|
22
|
+
if (previous?.catalogToken !== snapshot?.catalogToken || previous?.tools.length !== snapshot?.tools.length || previous === void 0 !== (snapshot === void 0)) listeners.forEach((listener) => listener());
|
|
23
|
+
};
|
|
24
|
+
const poll = (owner) => {
|
|
25
|
+
if (!active || owner !== generation || disposed) return;
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
request = controller;
|
|
28
|
+
catalog.describe(controller.signal).then((snapshot) => {
|
|
29
|
+
if (active && owner === generation) setCatalog(snapshot);
|
|
30
|
+
}).catch(() => {
|
|
31
|
+
if (active && owner === generation) setCatalog(void 0);
|
|
32
|
+
}).finally(() => {
|
|
33
|
+
if (request === controller) request = void 0;
|
|
34
|
+
if (!active || owner !== generation || disposed) return;
|
|
35
|
+
cancelTimer = clock.schedule(() => poll(owner), CATALOG_POLL_MS);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const stop = () => {
|
|
39
|
+
active = false;
|
|
40
|
+
generation += 1;
|
|
41
|
+
cancelTimer?.();
|
|
42
|
+
cancelTimer = void 0;
|
|
43
|
+
request?.abort();
|
|
44
|
+
request = void 0;
|
|
45
|
+
setCatalog(void 0);
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
snapshot: () => current,
|
|
49
|
+
subscribe(listener) {
|
|
50
|
+
listeners.add(listener);
|
|
51
|
+
return () => listeners.delete(listener);
|
|
52
|
+
},
|
|
53
|
+
start() {
|
|
54
|
+
if (active || disposed) return;
|
|
55
|
+
active = true;
|
|
56
|
+
generation += 1;
|
|
57
|
+
poll(generation);
|
|
58
|
+
},
|
|
59
|
+
stop,
|
|
60
|
+
dispose() {
|
|
61
|
+
if (disposed) return;
|
|
62
|
+
disposed = true;
|
|
63
|
+
stop();
|
|
64
|
+
listeners.clear();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
exports.AUTHOR_MODE_ID = require_structuredDocuments.AUTHOR_MODE_ID;
|
|
70
|
+
exports.AUTHOR_OWNER_LEASE_MS = require_structuredDocuments.AUTHOR_OWNER_LEASE_MS;
|
|
71
|
+
exports.AUTHOR_REQUEST_TIMEOUT_MS = require_structuredDocuments.AUTHOR_REQUEST_TIMEOUT_MS;
|
|
72
|
+
exports.AuthorBridgeError = require_structuredDocuments.AuthorBridgeError;
|
|
73
|
+
exports.DescribeAuthorToolsInputSchema = require_structuredDocuments.DescribeAuthorToolsInputSchema;
|
|
74
|
+
exports.UseAuthorToolInputSchema = require_structuredDocuments.UseAuthorToolInputSchema;
|
|
75
|
+
exports.authorMinorMode = require_structuredDocuments.authorMinorMode;
|
|
76
|
+
exports.authorToolRestriction = authorToolRestriction;
|
|
77
|
+
exports.createAuthorBridgeState = require_structuredDocuments.createAuthorBridgeState;
|
|
78
|
+
exports.createAuthorCatalog = require_structuredDocuments.createAuthorCatalog;
|
|
79
|
+
exports.createAuthorCatalogMonitor = createAuthorCatalogMonitor;
|
|
80
|
+
exports.createAuthorCommand = require_structuredDocuments.createAuthorCommand;
|
|
81
|
+
exports.createAuthorTools = require_structuredDocuments.createAuthorTools;
|
|
82
|
+
exports.parseCsv = require_structuredDocuments.parseCsv;
|
|
83
|
+
exports.parseDescribeAuthorToolsInput = require_structuredDocuments.parseDescribeAuthorToolsInput;
|
|
84
|
+
exports.parseMarkdownSlides = require_structuredDocuments.parseMarkdownSlides;
|
|
85
|
+
exports.parsePptx = require_structuredDocuments.parsePptx;
|
|
86
|
+
exports.parseStructuredDocument = require_structuredDocuments.parseStructuredDocument;
|
|
87
|
+
exports.parseUseAuthorToolInput = require_structuredDocuments.parseUseAuthorToolInput;
|
|
88
|
+
exports.parseXlsx = require_structuredDocuments.parseXlsx;
|
|
89
|
+
exports.preflightCsv = require_structuredDocuments.preflightCsv;
|
|
90
|
+
exports.preflightMarkdownSlides = require_structuredDocuments.preflightMarkdownSlides;
|
|
91
|
+
exports.preflightPptx = require_structuredDocuments.preflightPptx;
|
|
92
|
+
exports.preflightStructuredDocument = require_structuredDocuments.preflightStructuredDocument;
|
|
93
|
+
exports.preflightXlsx = require_structuredDocuments.preflightXlsx;
|
|
94
|
+
exports.readOoxmlArchive = require_structuredDocuments.readOoxmlArchive;
|
|
95
|
+
exports.serializeCsv = require_structuredDocuments.serializeCsv;
|
|
96
|
+
exports.serializeMarkdownSlides = require_structuredDocuments.serializeMarkdownSlides;
|
|
97
|
+
exports.serializePptx = require_structuredDocuments.serializePptx;
|
|
98
|
+
exports.serializeStructuredDocument = require_structuredDocuments.serializeStructuredDocument;
|
|
99
|
+
exports.serializeXlsx = require_structuredDocuments.serializeXlsx;
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["OPEN_AUTHORING_FILE_TOOL_NAME","AUTHOR_DESCRIBE_TOOL_NAME","AUTHOR_USE_TOOL_NAME"],"sources":["../src/services/authorCatalog/monitor.ts"],"sourcesContent":["import type { DoomToolRestriction } from '@agimon-ai/po-core/toolSurface';\n\nimport { AUTHOR_DESCRIBE_TOOL_NAME, AUTHOR_USE_TOOL_NAME } from '../../constants/author';\nimport { OPEN_AUTHORING_FILE_TOOL_NAME, type AuthorViewportCatalogSnapshot } from '../../types/author';\nimport type { AuthorCatalog } from './type';\n\nconst CATALOG_POLL_MS = 500;\n\nexport interface AuthorModeMonitorClock {\n schedule(callback: () => void, delayMs: number): () => void;\n}\n\nexport interface AuthorCatalogMonitor {\n snapshot(): AuthorViewportCatalogSnapshot | undefined;\n subscribe(listener: () => void): () => void;\n start(): void;\n stop(): void;\n dispose(): void;\n}\n\n/** Hide Author tools until the mode and viewport catalog can serve them. */\nexport function authorToolRestriction(active: boolean, _catalogReady: boolean): DoomToolRestriction {\n const hidden = new Set<string>([\n ...(active ? [] : [OPEN_AUTHORING_FILE_TOOL_NAME]),\n ...(active ? [] : [AUTHOR_DESCRIBE_TOOL_NAME, AUTHOR_USE_TOOL_NAME]),\n ]);\n return (incoming) => (hidden.size === 0 ? incoming : incoming.filter((name) => !hidden.has(name)));\n}\n\n/** Author-specific viewport polling; the shared minor-mode factory owns activation. */\nexport function createAuthorCatalogMonitor(\n catalog: AuthorCatalog,\n clock: AuthorModeMonitorClock,\n): AuthorCatalogMonitor {\n let current: AuthorViewportCatalogSnapshot | undefined;\n let active = false;\n let disposed = false;\n let generation = 0;\n let cancelTimer: (() => void) | undefined;\n let request: AbortController | undefined;\n const listeners = new Set<() => void>();\n const setCatalog = (snapshot: AuthorViewportCatalogSnapshot | undefined): void => {\n const previous = current;\n current = snapshot;\n if (\n previous?.catalogToken !== snapshot?.catalogToken ||\n previous?.tools.length !== snapshot?.tools.length ||\n (previous === undefined) !== (snapshot === undefined)\n )\n listeners.forEach((listener) => listener());\n };\n const poll = (owner: number): void => {\n if (!active || owner !== generation || disposed) return;\n const controller = new AbortController();\n request = controller;\n void catalog\n .describe(controller.signal)\n .then((snapshot) => {\n if (active && owner === generation) setCatalog(snapshot);\n })\n .catch(() => {\n if (active && owner === generation) setCatalog(undefined);\n })\n .finally(() => {\n if (request === controller) request = undefined;\n if (!active || owner !== generation || disposed) return;\n cancelTimer = clock.schedule(() => poll(owner), CATALOG_POLL_MS);\n });\n };\n const stop = (): void => {\n active = false;\n generation += 1;\n cancelTimer?.();\n cancelTimer = undefined;\n request?.abort();\n request = undefined;\n setCatalog(undefined);\n };\n return {\n snapshot: () => current,\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n start() {\n if (active || disposed) return;\n active = true;\n generation += 1;\n poll(generation);\n },\n stop,\n dispose() {\n if (disposed) return;\n disposed = true;\n stop();\n listeners.clear();\n },\n };\n}\n"],"mappings":";;;AAMA,MAAM,kBAAkB;;AAexB,SAAgB,sBAAsB,QAAiB,eAA6C;CAClG,MAAM,yBAAS,IAAI,IAAY,CAC7B,GAAI,SAAS,CAAC,IAAI,CAACA,4BAAAA,6BAA6B,GAChD,GAAI,SAAS,CAAC,IAAI,CAACC,4BAAAA,2BAA2BC,4BAAAA,oBAAoB,CACpE,CAAC;CACD,QAAQ,aAAc,OAAO,SAAS,IAAI,WAAW,SAAS,QAAQ,SAAS,CAAC,OAAO,IAAI,IAAI,CAAC;AAClG;;AAGA,SAAgB,2BACd,SACA,OACsB;CACtB,IAAI;CACJ,IAAI,SAAS;CACb,IAAI,WAAW;CACf,IAAI,aAAa;CACjB,IAAI;CACJ,IAAI;CACJ,MAAM,4BAAY,IAAI,IAAgB;CACtC,MAAM,cAAc,aAA8D;EAChF,MAAM,WAAW;EACjB,UAAU;EACV,IACE,UAAU,iBAAiB,UAAU,gBACrC,UAAU,MAAM,WAAW,UAAU,MAAM,UAC1C,aAAa,KAAA,OAAgB,aAAa,KAAA,IAE3C,UAAU,SAAS,aAAa,SAAS,CAAC;CAC9C;CACA,MAAM,QAAQ,UAAwB;EACpC,IAAI,CAAC,UAAU,UAAU,cAAc,UAAU;EACjD,MAAM,aAAa,IAAI,gBAAgB;EACvC,UAAU;EACV,QACG,SAAS,WAAW,MAAM,CAAC,CAC3B,MAAM,aAAa;GAClB,IAAI,UAAU,UAAU,YAAY,WAAW,QAAQ;EACzD,CAAC,CAAC,CACD,YAAY;GACX,IAAI,UAAU,UAAU,YAAY,WAAW,KAAA,CAAS;EAC1D,CAAC,CAAC,CACD,cAAc;GACb,IAAI,YAAY,YAAY,UAAU,KAAA;GACtC,IAAI,CAAC,UAAU,UAAU,cAAc,UAAU;GACjD,cAAc,MAAM,eAAe,KAAK,KAAK,GAAG,eAAe;EACjE,CAAC;CACL;CACA,MAAM,aAAmB;EACvB,SAAS;EACT,cAAc;EACd,cAAc;EACd,cAAc,KAAA;EACd,SAAS,MAAM;EACf,UAAU,KAAA;EACV,WAAW,KAAA,CAAS;CACtB;CACA,OAAO;EACL,gBAAgB;EAChB,UAAU,UAAU;GAClB,UAAU,IAAI,QAAQ;GACtB,aAAa,UAAU,OAAO,QAAQ;EACxC;EACA,QAAQ;GACN,IAAI,UAAU,UAAU;GACxB,SAAS;GACT,cAAc;GACd,KAAK,UAAU;EACjB;EACA;EACA,UAAU;GACR,IAAI,UAAU;GACd,WAAW;GACX,KAAK;GACL,UAAU,MAAM;EAClB;CACF;AACF"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { o as AuthorUseToolsInput } from "./authorFacade-89Eb2-sW.mjs";
|
|
2
|
+
import { DoomPluginTool } from "@agimon-ai/po-core/serverFacet";
|
|
3
|
+
import { SlotDeclaration, TransientTab, WebPluginSlotProps } from "@agimon-ai/po-core/web";
|
|
4
|
+
import { DoomToolRestriction } from "@agimon-ai/po-core/toolSurface";
|
|
5
|
+
import { ComponentType } from "react";
|
|
6
|
+
//#region src/types/author.d.ts
|
|
7
|
+
export declare const AUTHOR_MODE_ID: 'author';
|
|
8
|
+
declare const OPEN_AUTHORING_FILE_TOOL_NAME: 'open_authoring_file';
|
|
9
|
+
type AuthorModeActivation = 'inactive' | 'active';
|
|
10
|
+
interface AuthorModeSnapshot {
|
|
11
|
+
activation: AuthorModeActivation;
|
|
12
|
+
catalogToken: string;
|
|
13
|
+
capabilityCount: number;
|
|
14
|
+
}
|
|
15
|
+
type AuthorJsonSchema = Readonly<Record<string, unknown>>;
|
|
16
|
+
interface AuthorViewportCapabilityDescriptor {
|
|
17
|
+
name: string;
|
|
18
|
+
label: string;
|
|
19
|
+
description: string;
|
|
20
|
+
inputSchema: AuthorJsonSchema;
|
|
21
|
+
}
|
|
22
|
+
interface AuthorViewportCapability extends AuthorViewportCapabilityDescriptor {
|
|
23
|
+
execute(argumentsValue: Record<string, unknown>, signal?: AbortSignal): Promise<unknown>;
|
|
24
|
+
}
|
|
25
|
+
interface AuthorCanvasView {
|
|
26
|
+
alias: string;
|
|
27
|
+
path: string;
|
|
28
|
+
status: 'opening' | 'ready' | 'unavailable';
|
|
29
|
+
}
|
|
30
|
+
interface AuthorViewportCatalogSnapshot {
|
|
31
|
+
catalogToken: string;
|
|
32
|
+
tools: AuthorViewportCapabilityDescriptor[];
|
|
33
|
+
canvases?: AuthorCanvasView[];
|
|
34
|
+
alias?: string;
|
|
35
|
+
path?: string;
|
|
36
|
+
status?: AuthorCanvasView['status'];
|
|
37
|
+
nextStep?: string;
|
|
38
|
+
}
|
|
39
|
+
interface AuthorOpenFileResult {
|
|
40
|
+
path: string;
|
|
41
|
+
byteLength: number;
|
|
42
|
+
alias?: string;
|
|
43
|
+
status?: AuthorCanvasView['status'];
|
|
44
|
+
reused?: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface UseAuthorToolInput {
|
|
47
|
+
alias?: string;
|
|
48
|
+
catalogToken: string;
|
|
49
|
+
name: string;
|
|
50
|
+
arguments: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
interface AuthorToolResult {
|
|
53
|
+
alias?: string;
|
|
54
|
+
catalogToken: string;
|
|
55
|
+
name: string;
|
|
56
|
+
result: unknown;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/services/authorCatalog/type.d.ts
|
|
60
|
+
/** Typed catalog supplied to Pi and headless Author tools. */
|
|
61
|
+
interface AuthorCatalog {
|
|
62
|
+
open(path: string, signal?: AbortSignal, alias?: string): Promise<AuthorOpenFileResult>;
|
|
63
|
+
describe(signal?: AbortSignal, alias?: string): Promise<AuthorViewportCatalogSnapshot>;
|
|
64
|
+
execute(input: UseAuthorToolInput, signal?: AbortSignal): Promise<AuthorToolResult>;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/services/authorTools/index.d.ts
|
|
68
|
+
export declare function createAuthorTools(catalog: AuthorCatalog, assertAvailable?: () => void): readonly DoomPluginTool[];
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/schemas/authorTools.d.ts
|
|
71
|
+
export declare const DescribeAuthorToolsInputSchema: import("typebox").TObject<{
|
|
72
|
+
alias: import("typebox").TOptional<import("typebox").TString>;
|
|
73
|
+
}>;
|
|
74
|
+
export declare const UseAuthorToolInputSchema: import("typebox").TObject<{
|
|
75
|
+
alias: import("typebox").TOptional<import("typebox").TString>;
|
|
76
|
+
catalogToken: import("typebox").TString;
|
|
77
|
+
name: import("typebox").TString;
|
|
78
|
+
arguments: import("typebox").TRecord<"^.*$", import("typebox").TUnknown>;
|
|
79
|
+
}>;
|
|
80
|
+
export declare function parseDescribeAuthorToolsInput(value: unknown): {
|
|
81
|
+
alias?: string;
|
|
82
|
+
};
|
|
83
|
+
export declare function parseUseAuthorToolInput(value: unknown): AuthorUseToolsInput;
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/services/authorCatalog/index.d.ts
|
|
86
|
+
/** Uses an injected typed service directly. No internal transport is discovered here. */
|
|
87
|
+
export declare function createAuthorCatalog(host?: AuthorCatalog): AuthorCatalog;
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/types/webAuthor.d.ts
|
|
90
|
+
declare const authorChannelType = "author_webmcp";
|
|
91
|
+
interface AuthorRegisterMessage {
|
|
92
|
+
alias: string;
|
|
93
|
+
kind: 'register';
|
|
94
|
+
generation: number;
|
|
95
|
+
}
|
|
96
|
+
interface AuthorReleaseMessage {
|
|
97
|
+
alias: string;
|
|
98
|
+
kind: 'release';
|
|
99
|
+
generation: number;
|
|
100
|
+
}
|
|
101
|
+
interface AuthorCatalogMessage {
|
|
102
|
+
alias: string;
|
|
103
|
+
kind: 'catalog';
|
|
104
|
+
generation: number;
|
|
105
|
+
ownerToken: string;
|
|
106
|
+
tools: AuthorViewportCapabilityDescriptor[];
|
|
107
|
+
}
|
|
108
|
+
interface AuthorResultMessage {
|
|
109
|
+
alias: string;
|
|
110
|
+
kind: 'result';
|
|
111
|
+
generation: number;
|
|
112
|
+
ownerToken: string;
|
|
113
|
+
catalogToken: string;
|
|
114
|
+
requestId: string;
|
|
115
|
+
result: unknown;
|
|
116
|
+
}
|
|
117
|
+
interface AuthorCancelledMessage {
|
|
118
|
+
alias: string;
|
|
119
|
+
kind: 'cancelled';
|
|
120
|
+
generation: number;
|
|
121
|
+
ownerToken: string;
|
|
122
|
+
catalogToken: string;
|
|
123
|
+
requestId: string;
|
|
124
|
+
}
|
|
125
|
+
type AuthorBrowserMessage = AuthorRegisterMessage | AuthorReleaseMessage | AuthorCatalogMessage | AuthorResultMessage | AuthorCancelledMessage;
|
|
126
|
+
interface AuthorAcceptedMessage {
|
|
127
|
+
alias?: string;
|
|
128
|
+
kind: 'accepted';
|
|
129
|
+
generation: number;
|
|
130
|
+
ownerToken: string;
|
|
131
|
+
catalogToken?: string;
|
|
132
|
+
leaseMs: number;
|
|
133
|
+
}
|
|
134
|
+
interface AuthorRequestMessage {
|
|
135
|
+
alias?: string;
|
|
136
|
+
kind: 'request';
|
|
137
|
+
generation: number;
|
|
138
|
+
ownerToken: string;
|
|
139
|
+
catalogToken: string;
|
|
140
|
+
requestId: string;
|
|
141
|
+
name: string;
|
|
142
|
+
arguments: Record<string, unknown>;
|
|
143
|
+
}
|
|
144
|
+
interface AuthorCancelMessage {
|
|
145
|
+
alias?: string;
|
|
146
|
+
kind: 'cancel';
|
|
147
|
+
generation: number;
|
|
148
|
+
ownerToken: string;
|
|
149
|
+
catalogToken: string;
|
|
150
|
+
requestId: string;
|
|
151
|
+
}
|
|
152
|
+
interface AuthorRejectedMessage {
|
|
153
|
+
alias?: string;
|
|
154
|
+
kind: 'rejected';
|
|
155
|
+
reason: string;
|
|
156
|
+
}
|
|
157
|
+
type AuthorHubMessage = AuthorAcceptedMessage | AuthorRequestMessage | AuthorCancelMessage | AuthorRejectedMessage;
|
|
158
|
+
interface AuthorWebView {
|
|
159
|
+
activation: 'inactive' | 'active';
|
|
160
|
+
capabilityCount: number;
|
|
161
|
+
}
|
|
162
|
+
//#endregion
|
|
163
|
+
//#region src/models/authorBridgeState.d.ts
|
|
164
|
+
export declare const AUTHOR_REQUEST_TIMEOUT_MS = 15000;
|
|
165
|
+
export declare const AUTHOR_OWNER_LEASE_MS = 10000;
|
|
166
|
+
export declare class AuthorBridgeError extends Error {
|
|
167
|
+
readonly status: 400 | 404 | 409 | 503;
|
|
168
|
+
constructor(message: string, status?: 400 | 404 | 409 | 503);
|
|
169
|
+
}
|
|
170
|
+
type Delivery = AuthorRequestMessage | AuthorCancelMessage;
|
|
171
|
+
interface AuthorBridgeStateOptions {
|
|
172
|
+
now: () => number;
|
|
173
|
+
issueToken: () => string;
|
|
174
|
+
scheduleTimeout: (callback: () => void, delayMs: number) => () => void;
|
|
175
|
+
requestTimeoutMs?: number;
|
|
176
|
+
leaseMs?: number;
|
|
177
|
+
}
|
|
178
|
+
interface AuthorBridgeState {
|
|
179
|
+
register(bindingId: string, generation: number): AuthorAcceptedMessage;
|
|
180
|
+
catalog(bindingId: string, generation: number, ownerToken: string, tools: AuthorViewportCapabilityDescriptor[]): AuthorAcceptedMessage;
|
|
181
|
+
describe(): AuthorViewportCatalogSnapshot;
|
|
182
|
+
invoke(input: UseAuthorToolInput, signal?: AbortSignal): Promise<AuthorToolResult>;
|
|
183
|
+
next(bindingId: string, generation: number, ownerToken: string, signal?: AbortSignal): Promise<Delivery>;
|
|
184
|
+
result(bindingId: string, generation: number, ownerToken: string, catalogToken: string, requestId: string, result: unknown): void;
|
|
185
|
+
cancelled(bindingId: string, generation: number, ownerToken: string, catalogToken: string, requestId: string): void;
|
|
186
|
+
disconnect(bindingId: string, generation: number): void;
|
|
187
|
+
close(): void;
|
|
188
|
+
}
|
|
189
|
+
export declare function createAuthorBridgeState(options: AuthorBridgeStateOptions): AuthorBridgeState;
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/models/authorMode.d.ts
|
|
192
|
+
interface AuthorModeBackend {
|
|
193
|
+
isActive(): boolean;
|
|
194
|
+
detail(): string | undefined;
|
|
195
|
+
setActive(active: boolean, signal: AbortSignal): void | Promise<void>;
|
|
196
|
+
}
|
|
197
|
+
export declare const authorMinorMode: import("@agimon-ai/po-minor-mode").DefinedMinorMode<AuthorModeBackend, import("@agimon-ai/po-minor-mode").MinorModeExecution>;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/services/authorCatalog/monitor.d.ts
|
|
200
|
+
interface AuthorModeMonitorClock {
|
|
201
|
+
schedule(callback: () => void, delayMs: number): () => void;
|
|
202
|
+
}
|
|
203
|
+
interface AuthorCatalogMonitor {
|
|
204
|
+
snapshot(): AuthorViewportCatalogSnapshot | undefined;
|
|
205
|
+
subscribe(listener: () => void): () => void;
|
|
206
|
+
start(): void;
|
|
207
|
+
stop(): void;
|
|
208
|
+
dispose(): void;
|
|
209
|
+
}
|
|
210
|
+
/** Hide Author tools until the mode and viewport catalog can serve them. */
|
|
211
|
+
export declare function authorToolRestriction(active: boolean, _catalogReady: boolean): DoomToolRestriction;
|
|
212
|
+
/** Author-specific viewport polling; the shared minor-mode factory owns activation. */
|
|
213
|
+
export declare function createAuthorCatalogMonitor(catalog: AuthorCatalog, clock: AuthorModeMonitorClock): AuthorCatalogMonitor;
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/types/extension.d.ts
|
|
216
|
+
type AuthorNotificationLevel = 'info';
|
|
217
|
+
interface AuthorExtensionResult {
|
|
218
|
+
message: string;
|
|
219
|
+
level: AuthorNotificationLevel;
|
|
220
|
+
}
|
|
221
|
+
interface AuthorExtensionService {
|
|
222
|
+
execute(): Promise<AuthorExtensionResult>;
|
|
223
|
+
}
|
|
224
|
+
interface AuthorExtensionDependencies {
|
|
225
|
+
catalog: AuthorCatalog;
|
|
226
|
+
service?: AuthorExtensionService;
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/services/authorCommand/index.d.ts
|
|
230
|
+
export declare function createAuthorCommand(service?: AuthorExtensionService): import("@agimon-ai/po-core/serverFacet").DoomPluginCommand;
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/types/structuredDocuments.d.ts
|
|
233
|
+
type StructuredDocumentFormat = 'markdown-slides' | 'csv' | 'pptx' | 'xlsx';
|
|
234
|
+
interface DocumentManifest {
|
|
235
|
+
format: StructuredDocumentFormat;
|
|
236
|
+
sourceDigest: string;
|
|
237
|
+
byteLength: number;
|
|
238
|
+
fragmentCount: number;
|
|
239
|
+
metadata: Record<string, string | number | boolean>;
|
|
240
|
+
}
|
|
241
|
+
interface DocumentFragment {
|
|
242
|
+
id: string;
|
|
243
|
+
kind: 'slide' | 'cell' | 'text-run';
|
|
244
|
+
text: string;
|
|
245
|
+
readOnly?: boolean;
|
|
246
|
+
location: string;
|
|
247
|
+
}
|
|
248
|
+
interface DocumentRenderModel {
|
|
249
|
+
format: StructuredDocumentFormat;
|
|
250
|
+
blocks: Array<{
|
|
251
|
+
id: string;
|
|
252
|
+
text: string;
|
|
253
|
+
readOnly: boolean;
|
|
254
|
+
}>;
|
|
255
|
+
}
|
|
256
|
+
interface DocumentOperation {
|
|
257
|
+
fragmentId: string;
|
|
258
|
+
replacement: string;
|
|
259
|
+
}
|
|
260
|
+
interface DocumentOperationLogEntry extends DocumentOperation {
|
|
261
|
+
previous: string;
|
|
262
|
+
}
|
|
263
|
+
interface DocumentPreflightIssue {
|
|
264
|
+
code: string;
|
|
265
|
+
message: string;
|
|
266
|
+
fragmentId?: string;
|
|
267
|
+
}
|
|
268
|
+
interface DocumentPreflightReport {
|
|
269
|
+
accepted: boolean;
|
|
270
|
+
digest: string;
|
|
271
|
+
sourceDigest: string;
|
|
272
|
+
operations: DocumentOperationLogEntry[];
|
|
273
|
+
issues: DocumentPreflightIssue[];
|
|
274
|
+
}
|
|
275
|
+
interface ParsedStructuredDocument {
|
|
276
|
+
manifest: DocumentManifest;
|
|
277
|
+
fragments: DocumentFragment[];
|
|
278
|
+
renderModel: DocumentRenderModel;
|
|
279
|
+
}
|
|
280
|
+
interface SerializedStructuredDocument {
|
|
281
|
+
bytes: Uint8Array;
|
|
282
|
+
operationLog: DocumentOperationLogEntry[];
|
|
283
|
+
manifest: DocumentManifest;
|
|
284
|
+
}
|
|
285
|
+
interface CsvDialect {
|
|
286
|
+
delimiter: ',' | ';' | '\t' | '|';
|
|
287
|
+
quote: '"' | "'";
|
|
288
|
+
recordDelimiter: '\n' | '\r\n';
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/services/structuredDocuments/csv.d.ts
|
|
292
|
+
export declare function parseCsv(source: Uint8Array | string, requestedDialect?: Partial<CsvDialect>): ParsedStructuredDocument;
|
|
293
|
+
export declare function preflightCsv(source: Uint8Array | string, operations: DocumentOperation[], dialect?: Partial<CsvDialect>): DocumentPreflightReport;
|
|
294
|
+
export declare function serializeCsv(source: Uint8Array | string, operations: DocumentOperation[], acceptedReportDigest: string, requestedDialect?: Partial<CsvDialect>): SerializedStructuredDocument;
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/services/structuredDocuments/markdownSlides.d.ts
|
|
297
|
+
export declare function parseMarkdownSlides(source: Uint8Array | string): ParsedStructuredDocument;
|
|
298
|
+
export declare function preflightMarkdownSlides(source: Uint8Array | string, operations: DocumentOperation[]): DocumentPreflightReport;
|
|
299
|
+
export declare function serializeMarkdownSlides(source: Uint8Array | string, operations: DocumentOperation[], acceptedReportDigest: string): SerializedStructuredDocument;
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/services/structuredDocuments/ooxmlArchive.d.ts
|
|
302
|
+
interface OoxmlArchiveEntry {
|
|
303
|
+
name: string;
|
|
304
|
+
data: Buffer;
|
|
305
|
+
compressionMethod: number;
|
|
306
|
+
}
|
|
307
|
+
interface OoxmlArchive {
|
|
308
|
+
entries: OoxmlArchiveEntry[];
|
|
309
|
+
byName: Map<string, OoxmlArchiveEntry>;
|
|
310
|
+
}
|
|
311
|
+
export declare function readOoxmlArchive(source: Uint8Array): Promise<OoxmlArchive>;
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/services/structuredDocuments/pptx.d.ts
|
|
314
|
+
export declare function parsePptx(source: Uint8Array): Promise<ParsedStructuredDocument>;
|
|
315
|
+
export declare function preflightPptx(source: Uint8Array, operations: DocumentOperation[]): Promise<DocumentPreflightReport>;
|
|
316
|
+
export declare function serializePptx(source: Uint8Array, operations: DocumentOperation[], acceptedReportDigest: string): Promise<SerializedStructuredDocument>;
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/services/structuredDocuments/xlsx.d.ts
|
|
319
|
+
export declare function parseXlsx(source: Uint8Array): Promise<ParsedStructuredDocument>;
|
|
320
|
+
export declare function preflightXlsx(source: Uint8Array, operations: DocumentOperation[]): Promise<DocumentPreflightReport>;
|
|
321
|
+
export declare function serializeXlsx(source: Uint8Array, operations: DocumentOperation[], acceptedReportDigest: string): Promise<SerializedStructuredDocument>;
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/services/structuredDocuments/index.d.ts
|
|
324
|
+
export declare function parseStructuredDocument(format: StructuredDocumentFormat, bytes: Uint8Array, csvDialect?: Partial<CsvDialect>): Promise<ParsedStructuredDocument>;
|
|
325
|
+
export declare function preflightStructuredDocument(format: StructuredDocumentFormat, bytes: Uint8Array, operations: DocumentOperation[], csvDialect?: Partial<CsvDialect>): Promise<DocumentPreflightReport>;
|
|
326
|
+
export declare function serializeStructuredDocument(format: StructuredDocumentFormat, bytes: Uint8Array, operations: DocumentOperation[], acceptedReportDigest: string, csvDialect?: Partial<CsvDialect>): Promise<SerializedStructuredDocument>;
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/types/authorApi.d.ts
|
|
329
|
+
/**
|
|
330
|
+
* The wire vocabulary this package's API shares with whatever calls it.
|
|
331
|
+
*
|
|
332
|
+
* Paths live in `./apiRoutes`, which the Hono apps register from and the
|
|
333
|
+
* generated client addresses, so neither half can move alone. What stays here
|
|
334
|
+
* is the mount segment the server registers under and the shape the state
|
|
335
|
+
* route answers with.
|
|
336
|
+
*/
|
|
337
|
+
/** Where a host mounts this package's API; the segment after /api/plugins/. */
|
|
338
|
+
declare const API_BASE_PATH = "author";
|
|
339
|
+
/** Query parameter naming the session a document request belongs to. */
|
|
340
|
+
declare const SESSION_QUERY_PARAM = "session";
|
|
341
|
+
interface AuthorSessionView {
|
|
342
|
+
sessionId: string | null;
|
|
343
|
+
activation: AuthorModeActivation;
|
|
344
|
+
capabilityCount: number;
|
|
345
|
+
}
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/types/authorPreview.d.ts
|
|
348
|
+
interface AuthorPreviewSelection {
|
|
349
|
+
appPath: string;
|
|
350
|
+
storyExport: string;
|
|
351
|
+
snapshot?: boolean;
|
|
352
|
+
}
|
|
353
|
+
interface AuthorOpenSourceAction {
|
|
354
|
+
version: 1;
|
|
355
|
+
createTab(input: {
|
|
356
|
+
sessionId: string;
|
|
357
|
+
path: string;
|
|
358
|
+
preview?: AuthorPreviewSelection;
|
|
359
|
+
}): TransientTab;
|
|
360
|
+
}
|
|
361
|
+
declare function parseAuthorOpenSourceAction(input: unknown): AuthorOpenSourceAction | null;
|
|
362
|
+
interface AuthorPreviewActionSource {
|
|
363
|
+
path: string;
|
|
364
|
+
hasUnsavedChanges: boolean;
|
|
365
|
+
kind?: string;
|
|
366
|
+
revision?: number;
|
|
367
|
+
sourceSha256?: string;
|
|
368
|
+
preview?: AuthorPreviewSelection;
|
|
369
|
+
}
|
|
370
|
+
interface AuthorPreviewAnnotationLocation {
|
|
371
|
+
mode: 'region' | 'point';
|
|
372
|
+
/** Feedback-only normalized location mark, never an editable source region. */
|
|
373
|
+
stroke?: readonly {
|
|
374
|
+
x: number;
|
|
375
|
+
y: number;
|
|
376
|
+
}[];
|
|
377
|
+
point: {
|
|
378
|
+
x: number;
|
|
379
|
+
y: number;
|
|
380
|
+
};
|
|
381
|
+
rect?: {
|
|
382
|
+
x: number;
|
|
383
|
+
y: number;
|
|
384
|
+
width: number;
|
|
385
|
+
height: number;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
interface AuthorPreviewDisplayedAnnotation extends AuthorPreviewAnnotationLocation {
|
|
389
|
+
ordinal: number;
|
|
390
|
+
}
|
|
391
|
+
interface AuthorPreviewAnnotationCandidate extends AuthorPreviewAnnotationLocation {
|
|
392
|
+
preview: AuthorStoryPreviewIdentity;
|
|
393
|
+
evidence: Blob;
|
|
394
|
+
thumbnailUrl: string;
|
|
395
|
+
}
|
|
396
|
+
interface AuthorPreviewPanelProps extends WebPluginSlotProps {
|
|
397
|
+
source: AuthorPreviewActionSource;
|
|
398
|
+
activeTool?: 'select' | 'mark' | 'comment' | 'draw' | 'pan';
|
|
399
|
+
displayedAnnotations?: readonly AuthorPreviewDisplayedAnnotation[];
|
|
400
|
+
pendingCandidate?: boolean;
|
|
401
|
+
onAnnotationCandidate?: (candidate: AuthorPreviewAnnotationCandidate) => void;
|
|
402
|
+
}
|
|
403
|
+
interface AuthorPreviewAction {
|
|
404
|
+
version: 1;
|
|
405
|
+
label: string;
|
|
406
|
+
detail?: string;
|
|
407
|
+
createTab(input: {
|
|
408
|
+
source?: AuthorPreviewActionSource;
|
|
409
|
+
}): TransientTab;
|
|
410
|
+
supportsSource?: (source: AuthorPreviewActionSource) => boolean;
|
|
411
|
+
embeddedPanel?: ComponentType<AuthorPreviewPanelProps>;
|
|
412
|
+
}
|
|
413
|
+
declare function parseAuthorPreviewAction(input: unknown): AuthorPreviewAction | null;
|
|
414
|
+
declare const authorPreviewActionSlot: SlotDeclaration<AuthorPreviewAction>;
|
|
415
|
+
interface AuthorStoryPreviewSource {
|
|
416
|
+
path: string;
|
|
417
|
+
sha256: string;
|
|
418
|
+
}
|
|
419
|
+
/** Browser-safe identity retained with an immutable story-preview capture. */
|
|
420
|
+
interface AuthorStoryPreviewIdentity {
|
|
421
|
+
version: 1;
|
|
422
|
+
provider: string;
|
|
423
|
+
projectPath: string;
|
|
424
|
+
storyPath: string;
|
|
425
|
+
storyExport: string;
|
|
426
|
+
buildRevision: string;
|
|
427
|
+
viewport: {
|
|
428
|
+
width: number;
|
|
429
|
+
height: number;
|
|
430
|
+
};
|
|
431
|
+
sources: readonly AuthorStoryPreviewSource[];
|
|
432
|
+
}
|
|
433
|
+
//#endregion
|
|
434
|
+
export type { API_BASE_PATH, AuthorAcceptedMessage, AuthorBridgeState, AuthorBridgeStateOptions, AuthorBrowserMessage, AuthorCancelMessage, AuthorCancelledMessage, AuthorCanvasView, AuthorCatalog, AuthorCatalogMessage, AuthorCatalogMonitor, AuthorExtensionDependencies, AuthorExtensionResult, AuthorExtensionService, AuthorHubMessage, AuthorJsonSchema, AuthorModeActivation, AuthorModeMonitorClock, AuthorModeSnapshot, AuthorNotificationLevel, AuthorOpenFileResult, AuthorOpenSourceAction, AuthorPreviewAction, AuthorPreviewActionSource, AuthorPreviewAnnotationCandidate, AuthorPreviewAnnotationLocation, AuthorPreviewDisplayedAnnotation, AuthorPreviewPanelProps, AuthorPreviewSelection, AuthorRegisterMessage, AuthorRejectedMessage, AuthorReleaseMessage, AuthorRequestMessage, AuthorResultMessage, AuthorSessionView, AuthorStoryPreviewIdentity, AuthorStoryPreviewSource, AuthorToolResult, AuthorViewportCapability, AuthorViewportCapabilityDescriptor, AuthorViewportCatalogSnapshot, AuthorWebView, CsvDialect, DocumentFragment, DocumentManifest, DocumentOperation, DocumentOperationLogEntry, DocumentPreflightIssue, DocumentPreflightReport, DocumentRenderModel, OPEN_AUTHORING_FILE_TOOL_NAME, ParsedStructuredDocument, SESSION_QUERY_PARAM, SerializedStructuredDocument, StructuredDocumentFormat, UseAuthorToolInput, authorChannelType, authorPreviewActionSlot, parseAuthorOpenSourceAction, parseAuthorPreviewAction };
|
|
435
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/author.ts","../src/services/authorCatalog/type.ts","../src/services/authorTools/index.ts","../src/schemas/authorTools.ts","../src/services/authorCatalog/index.ts","../src/types/webAuthor.ts","../src/models/authorBridgeState.ts","../src/models/authorMode.ts","../src/services/authorCatalog/monitor.ts","../src/types/extension.ts","../src/services/authorCommand/index.ts","../src/types/structuredDocuments.ts","../src/services/structuredDocuments/csv.ts","../src/services/structuredDocuments/markdownSlides.ts","../src/services/structuredDocuments/ooxmlArchive.ts","../src/services/structuredDocuments/pptx.ts","../src/services/structuredDocuments/xlsx.ts","../src/services/structuredDocuments/index.ts","../src/types/authorApi.ts","../src/types/authorPreview.ts"],"mappings":";;;;;;qBAAa;cACA;KAED;UAEK;EACf,YAAY;EACZ;EACA;;KAGU,mBAAmB,SAAS;UAEvB;EACf;EACA;EACA;EACA,aAAa;;UAGE,iCAAiC;EAChD,QAAQ,gBAAgB,yBAAyB,SAAS,cAAc;;UAGzD;EACf;EACA;EACA;;UAGe;EACf;EACA,OAAO;EACP,WAAW;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USE_TOOL_NAME, M as UseAuthorToolInputSchema, N as parseDescribeAuthorToolsInput, O as AUTHOR_MODE_ID, P as parseUseAuthorToolInput, S as AUTHOR_REQUEST_TIMEOUT_MS, T as createAuthorCatalog, a as preflightXlsx, b as authorMinorMode, c as preflightPptx, d as parseMarkdownSlides, f as preflightMarkdownSlides, g as serializeCsv, h as preflightCsv, i as parseXlsx, j as DescribeAuthorToolsInputSchema, k as OPEN_AUTHORING_FILE_TOOL_NAME, l as serializePptx, m as parseCsv, n as preflightStructuredDocument, o as serializeXlsx, p as serializeMarkdownSlides, r as serializeStructuredDocument, s as parsePptx, t as parseStructuredDocument, u as readOoxmlArchive, w as createAuthorBridgeState, x as AUTHOR_OWNER_LEASE_MS, y as createAuthorCommand } from "./structuredDocuments-B914GLxx.mjs";
|
|
2
|
+
//#region src/services/authorCatalog/monitor.ts
|
|
3
|
+
const CATALOG_POLL_MS = 500;
|
|
4
|
+
/** Hide Author tools until the mode and viewport catalog can serve them. */
|
|
5
|
+
function authorToolRestriction(active, _catalogReady) {
|
|
6
|
+
const hidden = /* @__PURE__ */ new Set([...active ? [] : [OPEN_AUTHORING_FILE_TOOL_NAME], ...active ? [] : [AUTHOR_DESCRIBE_TOOL_NAME, AUTHOR_USE_TOOL_NAME]]);
|
|
7
|
+
return (incoming) => hidden.size === 0 ? incoming : incoming.filter((name) => !hidden.has(name));
|
|
8
|
+
}
|
|
9
|
+
/** Author-specific viewport polling; the shared minor-mode factory owns activation. */
|
|
10
|
+
function createAuthorCatalogMonitor(catalog, clock) {
|
|
11
|
+
let current;
|
|
12
|
+
let active = false;
|
|
13
|
+
let disposed = false;
|
|
14
|
+
let generation = 0;
|
|
15
|
+
let cancelTimer;
|
|
16
|
+
let request;
|
|
17
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
18
|
+
const setCatalog = (snapshot) => {
|
|
19
|
+
const previous = current;
|
|
20
|
+
current = snapshot;
|
|
21
|
+
if (previous?.catalogToken !== snapshot?.catalogToken || previous?.tools.length !== snapshot?.tools.length || previous === void 0 !== (snapshot === void 0)) listeners.forEach((listener) => listener());
|
|
22
|
+
};
|
|
23
|
+
const poll = (owner) => {
|
|
24
|
+
if (!active || owner !== generation || disposed) return;
|
|
25
|
+
const controller = new AbortController();
|
|
26
|
+
request = controller;
|
|
27
|
+
catalog.describe(controller.signal).then((snapshot) => {
|
|
28
|
+
if (active && owner === generation) setCatalog(snapshot);
|
|
29
|
+
}).catch(() => {
|
|
30
|
+
if (active && owner === generation) setCatalog(void 0);
|
|
31
|
+
}).finally(() => {
|
|
32
|
+
if (request === controller) request = void 0;
|
|
33
|
+
if (!active || owner !== generation || disposed) return;
|
|
34
|
+
cancelTimer = clock.schedule(() => poll(owner), CATALOG_POLL_MS);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const stop = () => {
|
|
38
|
+
active = false;
|
|
39
|
+
generation += 1;
|
|
40
|
+
cancelTimer?.();
|
|
41
|
+
cancelTimer = void 0;
|
|
42
|
+
request?.abort();
|
|
43
|
+
request = void 0;
|
|
44
|
+
setCatalog(void 0);
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
snapshot: () => current,
|
|
48
|
+
subscribe(listener) {
|
|
49
|
+
listeners.add(listener);
|
|
50
|
+
return () => listeners.delete(listener);
|
|
51
|
+
},
|
|
52
|
+
start() {
|
|
53
|
+
if (active || disposed) return;
|
|
54
|
+
active = true;
|
|
55
|
+
generation += 1;
|
|
56
|
+
poll(generation);
|
|
57
|
+
},
|
|
58
|
+
stop,
|
|
59
|
+
dispose() {
|
|
60
|
+
if (disposed) return;
|
|
61
|
+
disposed = true;
|
|
62
|
+
stop();
|
|
63
|
+
listeners.clear();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { AUTHOR_MODE_ID, AUTHOR_OWNER_LEASE_MS, AUTHOR_REQUEST_TIMEOUT_MS, AuthorBridgeError, DescribeAuthorToolsInputSchema, UseAuthorToolInputSchema, authorMinorMode, authorToolRestriction, createAuthorBridgeState, createAuthorCatalog, createAuthorCatalogMonitor, createAuthorCommand, createAuthorTools, parseCsv, parseDescribeAuthorToolsInput, parseMarkdownSlides, parsePptx, parseStructuredDocument, parseUseAuthorToolInput, parseXlsx, preflightCsv, preflightMarkdownSlides, preflightPptx, preflightStructuredDocument, preflightXlsx, readOoxmlArchive, serializeCsv, serializeMarkdownSlides, serializePptx, serializeStructuredDocument, serializeXlsx };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/services/authorCatalog/monitor.ts"],"sourcesContent":["import type { DoomToolRestriction } from '@agimon-ai/po-core/toolSurface';\n\nimport { AUTHOR_DESCRIBE_TOOL_NAME, AUTHOR_USE_TOOL_NAME } from '../../constants/author';\nimport { OPEN_AUTHORING_FILE_TOOL_NAME, type AuthorViewportCatalogSnapshot } from '../../types/author';\nimport type { AuthorCatalog } from './type';\n\nconst CATALOG_POLL_MS = 500;\n\nexport interface AuthorModeMonitorClock {\n schedule(callback: () => void, delayMs: number): () => void;\n}\n\nexport interface AuthorCatalogMonitor {\n snapshot(): AuthorViewportCatalogSnapshot | undefined;\n subscribe(listener: () => void): () => void;\n start(): void;\n stop(): void;\n dispose(): void;\n}\n\n/** Hide Author tools until the mode and viewport catalog can serve them. */\nexport function authorToolRestriction(active: boolean, _catalogReady: boolean): DoomToolRestriction {\n const hidden = new Set<string>([\n ...(active ? [] : [OPEN_AUTHORING_FILE_TOOL_NAME]),\n ...(active ? [] : [AUTHOR_DESCRIBE_TOOL_NAME, AUTHOR_USE_TOOL_NAME]),\n ]);\n return (incoming) => (hidden.size === 0 ? incoming : incoming.filter((name) => !hidden.has(name)));\n}\n\n/** Author-specific viewport polling; the shared minor-mode factory owns activation. */\nexport function createAuthorCatalogMonitor(\n catalog: AuthorCatalog,\n clock: AuthorModeMonitorClock,\n): AuthorCatalogMonitor {\n let current: AuthorViewportCatalogSnapshot | undefined;\n let active = false;\n let disposed = false;\n let generation = 0;\n let cancelTimer: (() => void) | undefined;\n let request: AbortController | undefined;\n const listeners = new Set<() => void>();\n const setCatalog = (snapshot: AuthorViewportCatalogSnapshot | undefined): void => {\n const previous = current;\n current = snapshot;\n if (\n previous?.catalogToken !== snapshot?.catalogToken ||\n previous?.tools.length !== snapshot?.tools.length ||\n (previous === undefined) !== (snapshot === undefined)\n )\n listeners.forEach((listener) => listener());\n };\n const poll = (owner: number): void => {\n if (!active || owner !== generation || disposed) return;\n const controller = new AbortController();\n request = controller;\n void catalog\n .describe(controller.signal)\n .then((snapshot) => {\n if (active && owner === generation) setCatalog(snapshot);\n })\n .catch(() => {\n if (active && owner === generation) setCatalog(undefined);\n })\n .finally(() => {\n if (request === controller) request = undefined;\n if (!active || owner !== generation || disposed) return;\n cancelTimer = clock.schedule(() => poll(owner), CATALOG_POLL_MS);\n });\n };\n const stop = (): void => {\n active = false;\n generation += 1;\n cancelTimer?.();\n cancelTimer = undefined;\n request?.abort();\n request = undefined;\n setCatalog(undefined);\n };\n return {\n snapshot: () => current,\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n start() {\n if (active || disposed) return;\n active = true;\n generation += 1;\n poll(generation);\n },\n stop,\n dispose() {\n if (disposed) return;\n disposed = true;\n stop();\n listeners.clear();\n },\n };\n}\n"],"mappings":";;AAMA,MAAM,kBAAkB;;AAexB,SAAgB,sBAAsB,QAAiB,eAA6C;CAClG,MAAM,yBAAS,IAAI,IAAY,CAC7B,GAAI,SAAS,CAAC,IAAI,CAAC,6BAA6B,GAChD,GAAI,SAAS,CAAC,IAAI,CAAC,2BAA2B,oBAAoB,CACpE,CAAC;CACD,QAAQ,aAAc,OAAO,SAAS,IAAI,WAAW,SAAS,QAAQ,SAAS,CAAC,OAAO,IAAI,IAAI,CAAC;AAClG;;AAGA,SAAgB,2BACd,SACA,OACsB;CACtB,IAAI;C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