@classic-homes/agent-contracts 0.0.0-stage → 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EACd,MAAM,EACN,SAAS,EACT,KAAK,EACL,UAAU,GACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,kFAAkF;AAClF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAGpD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC;IAC9B,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,WAAW;IACX,mBAAmB;IACnB,cAAc;IACd,sBAAsB;IACtB,gBAAgB;IAChB,SAAS;IACT,WAAW;IACX,UAAU;CACX,CAAC,CAAC;AAGH,MAAM,SAAS,GAAG;IAChB,SAAS,EAAE,SAAS;IACpB,2DAA2D;IAC3D,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CACpC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,KAAK,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,EAAE,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;AAErD,MAAM,CAAC,M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AAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CAC3D,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACpD,UAAU;IACV,UAAU;IACV,aAAa;IACb,UAAU;IACV,SAAS;IACT,aAAa;IACb,eAAe;IACf,eAAe;IACf,aAAa;IACb,OAAO;IACP,SAAS;IACT,UAAU;CACX,CAAC,CAAC;AAgBH,yGAAyG;AACzG,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO;IACP,OAAO;IACP,UAAU;IACV,OAAO;IACP,MAAM;CACqC,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;AAOzF,6DAA6D;AAC7D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;CAChG,CAAC,CAAC"}
package/dist/ids.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ /** Client-generated identifier for one chat turn; also used for cancellation and log correlation. */
3
+ export declare const RequestId: z.ZodUUID;
4
+ export type RequestId = z.infer<typeof RequestId>;
5
+ /** Identifier for a proposed document operation; prevents double application. */
6
+ export declare const OperationId: z.ZodUUID;
7
+ export type OperationId = z.infer<typeof OperationId>;
8
+ /**
9
+ * Conversation identifier. Opaque: the backend assigns it, so it is not required to be a UUID.
10
+ */
11
+ export declare const ConversationId: z.ZodString;
12
+ export type ConversationId = z.infer<typeof ConversationId>;
13
+ /**
14
+ * Opaque per-document identifier issued by the task pane for the life of the open
15
+ * document. Office does not provide a stable cross-session document ID.
16
+ */
17
+ export declare const DocumentId: z.ZodString;
18
+ export type DocumentId = z.infer<typeof DocumentId>;
19
+ /** Logical agent key from the catalog (never a backend database ID). */
20
+ export declare const AgentKey: z.ZodString;
21
+ export type AgentKey = z.infer<typeof AgentKey>;
22
+ export declare const FileId: z.ZodString;
23
+ export type FileId = z.infer<typeof FileId>;
24
+ /** One agent run inside a turn: the router's run, or a delegated child's run. */
25
+ export declare const RunId: z.ZodString;
26
+ export type RunId = z.infer<typeof RunId>;
27
+ export declare const ToolCallId: z.ZodString;
28
+ export type ToolCallId = z.infer<typeof ToolCallId>;
29
+ export declare const ArtifactId: z.ZodString;
30
+ export type ArtifactId = z.infer<typeof ArtifactId>;
31
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qGAAqG;AACrG,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,iFAAiF;AACjF,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,cAAc,aAIC,CAAC;AAC7B,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,UAAU,aAA6B,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,wEAAwE;AACxE,eAAO,MAAM,QAAQ,aAIW,CAAC;AACjC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAShD,eAAO,MAAM,MAAM,aAAW,CAAC;AAC/B,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5C,iFAAiF;AACjF,eAAO,MAAM,KAAK,aAAW,CAAC;AAC9B,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAE1C,eAAO,MAAM,UAAU,aAAW,CAAC;AACnC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,UAAU,aAAW,CAAC;AACnC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
package/dist/ids.js ADDED
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ /** Client-generated identifier for one chat turn; also used for cancellation and log correlation. */
3
+ export const RequestId = z.uuid();
4
+ /** Identifier for a proposed document operation; prevents double application. */
5
+ export const OperationId = z.uuid();
6
+ /**
7
+ * Conversation identifier. Opaque: the backend assigns it, so it is not required to be a UUID.
8
+ */
9
+ export const ConversationId = z
10
+ .string()
11
+ .min(1)
12
+ .max(128)
13
+ .regex(/^[A-Za-z0-9_-]+$/);
14
+ /**
15
+ * Opaque per-document identifier issued by the task pane for the life of the open
16
+ * document. Office does not provide a stable cross-session document ID.
17
+ */
18
+ export const DocumentId = z.string().min(1).max(200);
19
+ /** Logical agent key from the catalog (never a backend database ID). */
20
+ export const AgentKey = z
21
+ .string()
22
+ .min(1)
23
+ .max(64)
24
+ .regex(/^[a-z0-9][a-z0-9-]*$/);
25
+ /** Opaque backend-issued identifiers for uploaded files, agent runs, tool calls and artifacts. */
26
+ const opaqueId = z
27
+ .string()
28
+ .min(1)
29
+ .max(128)
30
+ .regex(/^[A-Za-z0-9_.:-]+$/);
31
+ export const FileId = opaqueId;
32
+ /** One agent run inside a turn: the router's run, or a delegated child's run. */
33
+ export const RunId = opaqueId;
34
+ export const ToolCallId = opaqueId;
35
+ export const ArtifactId = opaqueId;
36
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qGAAqG;AACrG,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAGlC,iFAAiF;AACjF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAGpC;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,kBAAkB,CAAC,CAAC;AAG7B;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAGrD,wEAAwE;AACxE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC;KACtB,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAGjC,kGAAkG;AAClG,MAAM,QAAQ,GAAG,CAAC;KACf,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,oBAAoB,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;AAG/B,iFAAiF;AACjF,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC;AAG9B,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;AAGnC,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,11 @@
1
+ export * from './a1.js';
2
+ export * from './api.js';
3
+ export * from './auth.js';
4
+ export * from './chat.js';
5
+ export * from './context.js';
6
+ export * from './events.js';
7
+ export * from './ids.js';
8
+ export * from './limits.js';
9
+ export * from './operations.js';
10
+ export * from './sse.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ export * from './a1.js';
2
+ export * from './api.js';
3
+ export * from './auth.js';
4
+ export * from './chat.js';
5
+ export * from './context.js';
6
+ export * from './events.js';
7
+ export * from './ids.js';
8
+ export * from './limits.js';
9
+ export * from './operations.js';
10
+ export * from './sse.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC"}
@@ -0,0 +1,30 @@
1
+ /** Bounds enforced on both sides of the wire. Change them here only. */
2
+ export declare const LIMITS: {
3
+ /** Maximum characters in one user chat message. */
4
+ readonly messageChars: 8000;
5
+ /** Maximum cells in a captured Excel selection or a proposed Excel write. */
6
+ readonly excelCells: 2500;
7
+ /** Maximum characters in a single Excel cell value or formula. */
8
+ readonly excelCellChars: 8192;
9
+ /** Maximum characters of captured Word selection text or proposed Word text. */
10
+ readonly wordChars: 20000;
11
+ /** Maximum operation results reported back with one chat request. */
12
+ readonly operationResults: 20;
13
+ /** Maximum characters of user-highlighted text sent as Classic App page context. */
14
+ readonly appSelectionChars: 4000;
15
+ /** Maximum whitelisted facts a Classic App page may attach as context. */
16
+ readonly appFacts: 40;
17
+ /** Maximum characters in one app context fact value. */
18
+ readonly appFactChars: 300;
19
+ /** Maximum uploaded files referenced by one chat request. */
20
+ readonly requestFiles: 20;
21
+ /** Maximum bytes of one uploaded file. */
22
+ readonly fileBytes: number;
23
+ /** Maximum characters in a tool call argument or result preview event. */
24
+ readonly toolPreviewChars: 500;
25
+ /** Maximum characters of sandboxed HTML in one MCP-UI event. */
26
+ readonly uiHtmlChars: 512000;
27
+ /** Maximum characters of artifact text carried by one artifact event. */
28
+ readonly artifactDeltaChars: 64000;
29
+ };
30
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,eAAO,MAAM,MAAM;IACjB,mDAAmD;;IAEnD,6EAA6E;;IAE7E,kEAAkE;;IAElE,gFAAgF;;IAEhF,qEAAqE;;IAErE,oFAAoF;;IAEpF,0EAA0E;;IAE1E,wDAAwD;;IAExD,6DAA6D;;IAE7D,0CAA0C;;IAE1C,0EAA0E;;IAE1E,gEAAgE;;IAEhE,yEAAyE;;CAEjE,CAAC"}
package/dist/limits.js ADDED
@@ -0,0 +1,30 @@
1
+ /** Bounds enforced on both sides of the wire. Change them here only. */
2
+ export const LIMITS = {
3
+ /** Maximum characters in one user chat message. */
4
+ messageChars: 8_000,
5
+ /** Maximum cells in a captured Excel selection or a proposed Excel write. */
6
+ excelCells: 2_500,
7
+ /** Maximum characters in a single Excel cell value or formula. */
8
+ excelCellChars: 8_192,
9
+ /** Maximum characters of captured Word selection text or proposed Word text. */
10
+ wordChars: 20_000,
11
+ /** Maximum operation results reported back with one chat request. */
12
+ operationResults: 20,
13
+ /** Maximum characters of user-highlighted text sent as Classic App page context. */
14
+ appSelectionChars: 4_000,
15
+ /** Maximum whitelisted facts a Classic App page may attach as context. */
16
+ appFacts: 40,
17
+ /** Maximum characters in one app context fact value. */
18
+ appFactChars: 300,
19
+ /** Maximum uploaded files referenced by one chat request. */
20
+ requestFiles: 20,
21
+ /** Maximum bytes of one uploaded file. */
22
+ fileBytes: 25 * 1024 * 1024,
23
+ /** Maximum characters in a tool call argument or result preview event. */
24
+ toolPreviewChars: 500,
25
+ /** Maximum characters of sandboxed HTML in one MCP-UI event. */
26
+ uiHtmlChars: 512_000,
27
+ /** Maximum characters of artifact text carried by one artifact event. */
28
+ artifactDeltaChars: 64_000,
29
+ };
30
+ //# sourceMappingURL=limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,mDAAmD;IACnD,YAAY,EAAE,KAAK;IACnB,6EAA6E;IAC7E,UAAU,EAAE,KAAK;IACjB,kEAAkE;IAClE,cAAc,EAAE,KAAK;IACrB,gFAAgF;IAChF,SAAS,EAAE,MAAM;IACjB,qEAAqE;IACrE,gBAAgB,EAAE,EAAE;IACpB,oFAAoF;IACpF,iBAAiB,EAAE,KAAK;IACxB,0EAA0E;IAC1E,QAAQ,EAAE,EAAE;IACZ,wDAAwD;IACxD,YAAY,EAAE,GAAG;IACjB,6DAA6D;IAC7D,YAAY,EAAE,EAAE;IAChB,0CAA0C;IAC1C,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;IAC3B,0EAA0E;IAC1E,gBAAgB,EAAE,GAAG;IACrB,gEAAgE;IAChE,WAAW,EAAE,OAAO;IACpB,yEAAyE;IACzE,kBAAkB,EAAE,MAAM;CAClB,CAAC"}
@@ -0,0 +1,137 @@
1
+ import { z } from 'zod';
2
+ export declare const ExcelWriteRange: z.ZodObject<{
3
+ target: z.ZodObject<{
4
+ sheet: z.ZodString;
5
+ address: z.ZodString;
6
+ }, z.core.$strip>;
7
+ write: z.ZodDiscriminatedUnion<[z.ZodObject<{
8
+ type: z.ZodLiteral<"values">;
9
+ values: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ type: z.ZodLiteral<"formulas">;
12
+ formulas: z.ZodArray<z.ZodArray<z.ZodString>>;
13
+ }, z.core.$strip>], "type">;
14
+ precondition: z.ZodObject<{
15
+ formulas: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
16
+ values: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>>;
17
+ }, z.core.$strip>;
18
+ operationId: z.ZodUUID;
19
+ documentId: z.ZodString;
20
+ summary: z.ZodString;
21
+ kind: z.ZodLiteral<"excel.writeRange">;
22
+ }, z.core.$strip>;
23
+ export type ExcelWriteRange = z.infer<typeof ExcelWriteRange>;
24
+ export declare const WordInsertText: z.ZodObject<{
25
+ target: z.ZodObject<{
26
+ targetId: z.ZodString;
27
+ expectedText: z.ZodString;
28
+ }, z.core.$strip>;
29
+ location: z.ZodEnum<{
30
+ before: "before";
31
+ after: "after";
32
+ }>;
33
+ text: z.ZodString;
34
+ operationId: z.ZodUUID;
35
+ documentId: z.ZodString;
36
+ summary: z.ZodString;
37
+ kind: z.ZodLiteral<"word.insertText">;
38
+ }, z.core.$strip>;
39
+ export type WordInsertText = z.infer<typeof WordInsertText>;
40
+ export declare const WordReplaceSelection: z.ZodObject<{
41
+ target: z.ZodObject<{
42
+ targetId: z.ZodString;
43
+ expectedText: z.ZodString;
44
+ }, z.core.$strip>;
45
+ text: z.ZodString;
46
+ operationId: z.ZodUUID;
47
+ documentId: z.ZodString;
48
+ summary: z.ZodString;
49
+ kind: z.ZodLiteral<"word.replaceSelection">;
50
+ }, z.core.$strip>;
51
+ export type WordReplaceSelection = z.infer<typeof WordReplaceSelection>;
52
+ export declare const ProposedOperation: z.ZodUnion<readonly [z.ZodObject<{
53
+ target: z.ZodObject<{
54
+ sheet: z.ZodString;
55
+ address: z.ZodString;
56
+ }, z.core.$strip>;
57
+ write: z.ZodDiscriminatedUnion<[z.ZodObject<{
58
+ type: z.ZodLiteral<"values">;
59
+ values: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
60
+ }, z.core.$strip>, z.ZodObject<{
61
+ type: z.ZodLiteral<"formulas">;
62
+ formulas: z.ZodArray<z.ZodArray<z.ZodString>>;
63
+ }, z.core.$strip>], "type">;
64
+ precondition: z.ZodObject<{
65
+ formulas: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
66
+ values: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>>;
67
+ }, z.core.$strip>;
68
+ operationId: z.ZodUUID;
69
+ documentId: z.ZodString;
70
+ summary: z.ZodString;
71
+ kind: z.ZodLiteral<"excel.writeRange">;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ target: z.ZodObject<{
74
+ targetId: z.ZodString;
75
+ expectedText: z.ZodString;
76
+ }, z.core.$strip>;
77
+ location: z.ZodEnum<{
78
+ before: "before";
79
+ after: "after";
80
+ }>;
81
+ text: z.ZodString;
82
+ operationId: z.ZodUUID;
83
+ documentId: z.ZodString;
84
+ summary: z.ZodString;
85
+ kind: z.ZodLiteral<"word.insertText">;
86
+ }, z.core.$strip>, z.ZodObject<{
87
+ target: z.ZodObject<{
88
+ targetId: z.ZodString;
89
+ expectedText: z.ZodString;
90
+ }, z.core.$strip>;
91
+ text: z.ZodString;
92
+ operationId: z.ZodUUID;
93
+ documentId: z.ZodString;
94
+ summary: z.ZodString;
95
+ kind: z.ZodLiteral<"word.replaceSelection">;
96
+ }, z.core.$strip>]>;
97
+ export type ProposedOperation = z.infer<typeof ProposedOperation>;
98
+ export type OperationKind = ProposedOperation['kind'];
99
+ export declare const OperationStatus: z.ZodEnum<{
100
+ pending: "pending";
101
+ applied: "applied";
102
+ failed: "failed";
103
+ rejected: "rejected";
104
+ }>;
105
+ export type OperationStatus = z.infer<typeof OperationStatus>;
106
+ export declare const OperationFailureCode: z.ZodEnum<{
107
+ stale_target: "stale_target";
108
+ already_applied: "already_applied";
109
+ host_mismatch: "host_mismatch";
110
+ unsupported_api: "unsupported_api";
111
+ invalid_operation: "invalid_operation";
112
+ host_error: "host_error";
113
+ user_rejected: "user_rejected";
114
+ }>;
115
+ export type OperationFailureCode = z.infer<typeof OperationFailureCode>;
116
+ /** Outcome of a proposal as confirmed by the host (or the user's rejection). */
117
+ export declare const OperationResult: z.ZodObject<{
118
+ operationId: z.ZodUUID;
119
+ status: z.ZodEnum<{
120
+ pending: "pending";
121
+ applied: "applied";
122
+ failed: "failed";
123
+ rejected: "rejected";
124
+ }>;
125
+ code: z.ZodOptional<z.ZodEnum<{
126
+ stale_target: "stale_target";
127
+ already_applied: "already_applied";
128
+ host_mismatch: "host_mismatch";
129
+ unsupported_api: "unsupported_api";
130
+ invalid_operation: "invalid_operation";
131
+ host_error: "host_error";
132
+ user_rejected: "user_rejected";
133
+ }>>;
134
+ message: z.ZodOptional<z.ZodString>;
135
+ }, z.core.$strip>;
136
+ export type OperationResult = z.infer<typeof OperationResult>;
137
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;iBA4CxB,CAAC;AACL,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;iBAOzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAK/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAmE,CAAC;AAClG,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAEtD,eAAO,MAAM,eAAe;;;;;EAAuD,CAAC;AACpF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,oBAAoB;;;;;;;;EAQ/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE,gFAAgF;AAChF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;iBAK1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -0,0 +1,103 @@
1
+ import { z } from 'zod';
2
+ import { parseA1Range } from './a1.js';
3
+ import { A1Address, Grid, SheetName, WordTarget, gridMatchesAddress } from './context.js';
4
+ import { DocumentId, OperationId } from './ids.js';
5
+ import { LIMITS } from './limits.js';
6
+ /**
7
+ * Allowlisted, schema-validated document operations. These are data, never code: the
8
+ * Office bridge interprets each `kind` itself. Nothing here is ever evaluated.
9
+ */
10
+ const operationBase = {
11
+ operationId: OperationId,
12
+ documentId: DocumentId,
13
+ /** Short human-readable description shown in the review preview. */
14
+ summary: z.string().min(1).max(500),
15
+ };
16
+ /**
17
+ * Literal values. Strings are written as literal text even when they begin with `=`;
18
+ * the bridge must not let Excel reinterpret them as formulas.
19
+ */
20
+ const ValuesWrite = z.object({ type: z.literal('values'), values: Grid });
21
+ /** Formulas are only written when the reviewed operation explicitly asks for them. */
22
+ const FormulasWrite = z.object({
23
+ type: z.literal('formulas'),
24
+ formulas: z.array(z.array(z.string().max(LIMITS.excelCellChars).regex(/^=/, 'Formulas must start with ='))),
25
+ });
26
+ export const ExcelWriteRange = z
27
+ .object({
28
+ kind: z.literal('excel.writeRange'),
29
+ ...operationBase,
30
+ target: z.object({ sheet: SheetName, address: A1Address }),
31
+ write: z.discriminatedUnion('type', [ValuesWrite, FormulasWrite]),
32
+ /** Snapshot of the target when proposed; apply is refused if the target changed. */
33
+ precondition: z.object({
34
+ formulas: Grid,
35
+ /**
36
+ * Optional value snapshot. In `formulas`, literal text `=x` and a formula `=x` look
37
+ * identical; when present, values are compared too.
38
+ */
39
+ values: Grid.optional(),
40
+ }),
41
+ })
42
+ .superRefine((op, ctx) => {
43
+ const range = parseA1Range(op.target.address);
44
+ if (range && range.rowCount * range.columnCount > LIMITS.excelCells) {
45
+ ctx.addIssue({ code: 'custom', message: `Write exceeds ${LIMITS.excelCells} cells` });
46
+ return;
47
+ }
48
+ const grid = op.write.type === 'values' ? op.write.values : op.write.formulas;
49
+ if (!gridMatchesAddress(grid, op.target.address)) {
50
+ ctx.addIssue({
51
+ code: 'custom',
52
+ path: ['write'],
53
+ message: 'write grid does not match target address',
54
+ });
55
+ }
56
+ if (op.precondition.values && !gridMatchesAddress(op.precondition.values, op.target.address)) {
57
+ ctx.addIssue({
58
+ code: 'custom',
59
+ path: ['precondition', 'values'],
60
+ message: 'precondition values do not match target address',
61
+ });
62
+ }
63
+ if (!gridMatchesAddress(op.precondition.formulas, op.target.address)) {
64
+ ctx.addIssue({
65
+ code: 'custom',
66
+ path: ['precondition'],
67
+ message: 'precondition does not match target address',
68
+ });
69
+ }
70
+ });
71
+ export const WordInsertText = z.object({
72
+ kind: z.literal('word.insertText'),
73
+ ...operationBase,
74
+ target: WordTarget,
75
+ /** Insert relative to the captured target. */
76
+ location: z.enum(['before', 'after']),
77
+ text: z.string().min(1).max(LIMITS.wordChars),
78
+ });
79
+ export const WordReplaceSelection = z.object({
80
+ kind: z.literal('word.replaceSelection'),
81
+ ...operationBase,
82
+ target: WordTarget,
83
+ text: z.string().max(LIMITS.wordChars),
84
+ });
85
+ export const ProposedOperation = z.union([ExcelWriteRange, WordInsertText, WordReplaceSelection]);
86
+ export const OperationStatus = z.enum(['pending', 'applied', 'failed', 'rejected']);
87
+ export const OperationFailureCode = z.enum([
88
+ 'stale_target',
89
+ 'already_applied',
90
+ 'host_mismatch',
91
+ 'unsupported_api',
92
+ 'invalid_operation',
93
+ 'host_error',
94
+ 'user_rejected',
95
+ ]);
96
+ /** Outcome of a proposal as confirmed by the host (or the user's rejection). */
97
+ export const OperationResult = z.object({
98
+ operationId: OperationId,
99
+ status: OperationStatus,
100
+ code: OperationFailureCode.optional(),
101
+ message: z.string().max(1_000).optional(),
102
+ });
103
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sourceR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AIlG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAGpF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC;IACzC,cAAc;IACd,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,mBAAmB;IACnB,YAAY;IACZ,eAAe;CAChB,CAAC,CAAC;AAGH,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,WAAW,EAAE,WAAW;IACxB,MAAM,EAAE,eAAe;IACvB,IAAI,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC"}
package/dist/sse.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { ChatEvent, type DecodedChatEvent } from './events.js';
2
+ /** Encode one chat event as a Server-Sent Events frame. */
3
+ export declare function encodeSseEvent(event: ChatEvent): string;
4
+ /**
5
+ * Incremental SSE decoder for chat streams. Feed it text chunks; it returns validated events.
6
+ * A frame whose type this build knows must match its schema or the decoder throws. A frame of
7
+ * an unknown type must still carry a valid envelope (`requestId`, `seq`) and is returned as
8
+ * `{ type: 'unknown' }` so callers keep their ordering checks and can ignore it.
9
+ */
10
+ export declare class SseDecoder {
11
+ private buffer;
12
+ push(chunk: string): DecodedChatEvent[];
13
+ /** True when a partial frame is still buffered (e.g. the stream ended mid-event). */
14
+ get pending(): boolean;
15
+ }
16
+ /** Validate one decoded JSON event; see {@link SseDecoder}. */
17
+ export declare function decodeEvent(raw: unknown): DecodedChatEvent;
18
+ /** Narrow a decoded event to one this build knows. */
19
+ export declare function isKnownEvent(event: DecodedChatEvent): event is ChatEvent;
20
+ //# sourceMappingURL=sse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../src/sse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAiB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE9E,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEvD;AAID;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAM;IAEpB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAkBvC,qFAAqF;IACrF,IAAI,OAAO,IAAI,OAAO,CAErB;CACF;AAED,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAS1D;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,SAAS,CAExE"}
package/dist/sse.js ADDED
@@ -0,0 +1,54 @@
1
+ import { ChatEvent, EventEnvelope } from './events.js';
2
+ /** Encode one chat event as a Server-Sent Events frame. */
3
+ export function encodeSseEvent(event) {
4
+ return `event: ${event.type}\nid: ${event.seq}\ndata: ${JSON.stringify(event)}\n\n`;
5
+ }
6
+ const KNOWN_TYPES = new Set(ChatEvent.options.map((o) => o.shape.type.value));
7
+ /**
8
+ * Incremental SSE decoder for chat streams. Feed it text chunks; it returns validated events.
9
+ * A frame whose type this build knows must match its schema or the decoder throws. A frame of
10
+ * an unknown type must still carry a valid envelope (`requestId`, `seq`) and is returned as
11
+ * `{ type: 'unknown' }` so callers keep their ordering checks and can ignore it.
12
+ */
13
+ export class SseDecoder {
14
+ buffer = '';
15
+ push(chunk) {
16
+ this.buffer += chunk.replace(/\r\n/g, '\n');
17
+ const events = [];
18
+ let boundary = this.buffer.indexOf('\n\n');
19
+ while (boundary !== -1) {
20
+ const frame = this.buffer.slice(0, boundary);
21
+ this.buffer = this.buffer.slice(boundary + 2);
22
+ const data = frame
23
+ .split('\n')
24
+ .filter((line) => line.startsWith('data:'))
25
+ .map((line) => line.slice(5).replace(/^ /, ''))
26
+ .join('\n');
27
+ if (data)
28
+ events.push(decodeEvent(JSON.parse(data)));
29
+ boundary = this.buffer.indexOf('\n\n');
30
+ }
31
+ return events;
32
+ }
33
+ /** True when a partial frame is still buffered (e.g. the stream ended mid-event). */
34
+ get pending() {
35
+ return this.buffer.trim().length > 0;
36
+ }
37
+ }
38
+ /** Validate one decoded JSON event; see {@link SseDecoder}. */
39
+ export function decodeEvent(raw) {
40
+ const envelope = EventEnvelope.parse(raw);
41
+ if (KNOWN_TYPES.has(envelope.type))
42
+ return ChatEvent.parse(raw);
43
+ return {
44
+ type: 'unknown',
45
+ requestId: envelope.requestId,
46
+ seq: envelope.seq,
47
+ rawType: envelope.type,
48
+ };
49
+ }
50
+ /** Narrow a decoded event to one this build knows. */
51
+ export function isKnownEvent(event) {
52
+ return event.type !== 'unknown';
53
+ }
54
+ //# sourceMappingURL=sse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse.js","sourceRoot":"","sources":["../src/sse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAyB,MAAM,aAAa,CAAC;AAE9E,2DAA2D;AAC3D,MAAM,UAAU,cAAc,CAAC,KAAgB;IAC7C,OAAO,UAAU,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC,GAAG,WAAW,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;AACtF,CAAC;AAED,MAAM,WAAW,GAAG,IAAI,GAAG,CAAS,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,GAAG,EAAE,CAAC;IAEpB,IAAI,CAAC,KAAa;QAChB,IAAI,CAAC,MAA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AAI,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChE,OAAO;QACL,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,OAAO,EAAE,QAAQ,CAAC,IAAI;KACvB,CAAC;AACJ,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,YAAY,CAAC,KAAuB;IAClD,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC;AAClC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "@classic-homes/agent-contracts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Runtime schemas shared by the gateway and task pane. No host, UI or server dependencies.",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.ts",
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "dependencies": {
18
+ "zod": "4.6.7"
19
+ },
20
+ "license": "UNLICENSED",
21
+ "publishConfig": {
22
+ "access": "public",
23
+ "provenance": true
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/Classic-Homes/classic-agent.git",
28
+ "directory": "packages/contracts"
29
+ },
30
+ "scripts": {
31
+ "build": "tsc -p tsconfig.build.json",
32
+ "typecheck": "tsc -p tsconfig.json --noEmit"
33
+ }
6
34
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.