@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.
package/dist/a1.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Minimal A1 range parsing for bounded, single-area ranges without a sheet prefix,
3
+ * for example `B2` or `B2:D5`. Whole-row/column and multi-area references are rejected
4
+ * on purpose: proposals must name an exact bounded target.
5
+ */
6
+ export interface A1Range {
7
+ /** Zero-based first row. */
8
+ row: number;
9
+ /** Zero-based first column. */
10
+ column: number;
11
+ rowCount: number;
12
+ columnCount: number;
13
+ }
14
+ export declare function parseA1Range(address: string): A1Range | null;
15
+ export declare function columnName(index: number): string;
16
+ export declare function formatA1Range(range: A1Range): string;
17
+ //# sourceMappingURL=a1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a1.d.ts","sourceRoot":"","sources":["../src/a1.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAiBD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAc5D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAShD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKpD"}
package/dist/a1.js ADDED
@@ -0,0 +1,51 @@
1
+ const MAX_ROWS = 1_048_576;
2
+ const MAX_COLUMNS = 16_384;
3
+ const CELL = /^\$?([A-Z]{1,3})\$?([1-9][0-9]{0,6})$/;
4
+ function parseCell(ref) {
5
+ const match = CELL.exec(ref);
6
+ if (!match)
7
+ return null;
8
+ const [, letters = '', digits = ''] = match;
9
+ let column = 0;
10
+ for (const ch of letters)
11
+ column = column * 26 + (ch.charCodeAt(0) - 64);
12
+ const row = Number(digits);
13
+ if (column > MAX_COLUMNS || row > MAX_ROWS)
14
+ return null;
15
+ return { row: row - 1, column: column - 1 };
16
+ }
17
+ export function parseA1Range(address) {
18
+ const parts = address.toUpperCase().split(':');
19
+ if (parts.length < 1 || parts.length > 2)
20
+ return null;
21
+ const start = parseCell(parts[0] ?? '');
22
+ const end = parts.length === 2 ? parseCell(parts[1] ?? '') : start;
23
+ if (!start || !end)
24
+ return null;
25
+ const row = Math.min(start.row, end.row);
26
+ const column = Math.min(start.column, end.column);
27
+ return {
28
+ row,
29
+ column,
30
+ rowCount: Math.abs(end.row - start.row) + 1,
31
+ columnCount: Math.abs(end.column - start.column) + 1,
32
+ };
33
+ }
34
+ export function columnName(index) {
35
+ let n = index + 1;
36
+ let name = '';
37
+ while (n > 0) {
38
+ const rem = (n - 1) % 26;
39
+ name = String.fromCharCode(65 + rem) + name;
40
+ n = Math.floor((n - 1) / 26);
41
+ }
42
+ return name;
43
+ }
44
+ export function formatA1Range(range) {
45
+ const start = `${columnName(range.column)}${range.row + 1}`;
46
+ if (range.rowCount === 1 && range.columnCount === 1)
47
+ return start;
48
+ const end = `${columnName(range.column + range.columnCount - 1)}${range.row + range.rowCount}`;
49
+ return `${start}:${end}`;
50
+ }
51
+ //# sourceMappingURL=a1.js.map
package/dist/a1.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"a1.js","sourceRoot":"","sources":["../src/a1.ts"],"names":[],"mappings":"AAcA,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,IAAI,GAAG,uCAAuC,CAAC;AAErD,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CA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ist/api.d.ts ADDED
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+ /** HTTP paths served by the backend. The task pane is served from the same origin. */
3
+ export declare const API_PATHS: {
4
+ readonly health: "/healthz";
5
+ readonly ready: "/readyz";
6
+ readonly session: "/api/session";
7
+ /** Enrollment and limits for the signed-in user. */
8
+ readonly me: "/api/me";
9
+ /** Agents the signed-in user may address. */
10
+ readonly agents: "/api/agents";
11
+ readonly chat: "/api/chat";
12
+ /** `POST` with `:requestId` substituted. Closing the stream also cancels. */
13
+ readonly cancel: "/api/chat/:requestId/cancel";
14
+ readonly conversations: "/api/conversations";
15
+ /** `GET`, `PATCH` (rename) or `DELETE` with `:conversationId` substituted. */
16
+ readonly conversation: "/api/conversations/:conversationId";
17
+ /** `GET ?since=<seq>` replays a turn still in flight as an event stream. */
18
+ readonly conversationEvents: "/api/conversations/:conversationId/events";
19
+ /** `POST` multipart upload; `GET` with `:fileId` downloads. */
20
+ readonly files: "/api/files";
21
+ readonly file: "/api/files/:fileId";
22
+ };
23
+ export declare function cancelPath(requestId: string): string;
24
+ export declare function conversationPath(conversationId: string): string;
25
+ export declare function conversationEventsPath(conversationId: string, since?: number): string;
26
+ export declare function filePath(fileId: string): string;
27
+ export declare const HealthResponse: z.ZodObject<{
28
+ status: z.ZodLiteral<"ok">;
29
+ }, z.core.$strip>;
30
+ export type HealthResponse = z.infer<typeof HealthResponse>;
31
+ export declare const ReadyResponse: z.ZodObject<{
32
+ status: z.ZodEnum<{
33
+ ready: "ready";
34
+ not_ready: "not_ready";
35
+ }>;
36
+ mode: z.ZodEnum<{
37
+ mock: "mock";
38
+ live: "live";
39
+ }>;
40
+ checks: z.ZodRecord<z.ZodString, z.ZodEnum<{
41
+ ok: "ok";
42
+ fail: "fail";
43
+ skipped: "skipped";
44
+ }>>;
45
+ }, z.core.$strip>;
46
+ export type ReadyResponse = z.infer<typeof ReadyResponse>;
47
+ export declare const SessionResponse: z.ZodObject<{
48
+ mode: z.ZodEnum<{
49
+ mock: "mock";
50
+ live: "live";
51
+ }>;
52
+ authenticated: z.ZodBoolean;
53
+ user: z.ZodNullable<z.ZodObject<{
54
+ subject: z.ZodString;
55
+ name: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>;
58
+ export type SessionResponse = z.infer<typeof SessionResponse>;
59
+ /** `GET /api/me`: whether this user may use the agent yet (pilot gating) and where else to go. */
60
+ export declare const MeResponse: z.ZodObject<{
61
+ mode: z.ZodEnum<{
62
+ mock: "mock";
63
+ live: "live";
64
+ }>;
65
+ enabled: z.ZodBoolean;
66
+ reason: z.ZodOptional<z.ZodEnum<{
67
+ forbidden: "forbidden";
68
+ pilot_closed: "pilot_closed";
69
+ }>>;
70
+ user: z.ZodObject<{
71
+ subject: z.ZodString;
72
+ name: z.ZodOptional<z.ZodString>;
73
+ }, z.core.$strip>;
74
+ }, z.core.$strip>;
75
+ export type MeResponse = z.infer<typeof MeResponse>;
76
+ export declare const AgentSummary: z.ZodObject<{
77
+ key: z.ZodString;
78
+ name: z.ZodString;
79
+ description: z.ZodOptional<z.ZodString>;
80
+ }, z.core.$strip>;
81
+ export type AgentSummary = z.infer<typeof AgentSummary>;
82
+ export declare const AgentsResponse: z.ZodObject<{
83
+ agents: z.ZodArray<z.ZodObject<{
84
+ key: z.ZodString;
85
+ name: z.ZodString;
86
+ description: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strip>>;
88
+ }, z.core.$strip>;
89
+ export type AgentsResponse = z.infer<typeof AgentsResponse>;
90
+ export declare const ConversationSummary: z.ZodObject<{
91
+ conversationId: z.ZodString;
92
+ agent: z.ZodString;
93
+ title: z.ZodString;
94
+ createdAt: z.ZodISODateTime;
95
+ updatedAt: z.ZodISODateTime;
96
+ activeRequestId: z.ZodOptional<z.ZodUUID>;
97
+ }, z.core.$strip>;
98
+ export type ConversationSummary = z.infer<typeof ConversationSummary>;
99
+ export declare const ConversationListResponse: z.ZodObject<{
100
+ conversations: z.ZodArray<z.ZodObject<{
101
+ conversationId: z.ZodString;
102
+ agent: z.ZodString;
103
+ title: z.ZodString;
104
+ createdAt: z.ZodISODateTime;
105
+ updatedAt: z.ZodISODateTime;
106
+ activeRequestId: z.ZodOptional<z.ZodUUID>;
107
+ }, z.core.$strip>>;
108
+ nextCursor: z.ZodOptional<z.ZodString>;
109
+ }, z.core.$strip>;
110
+ export type ConversationListResponse = z.infer<typeof ConversationListResponse>;
111
+ export declare const ConversationRenameRequest: z.ZodObject<{
112
+ title: z.ZodString;
113
+ }, z.core.$strip>;
114
+ export type ConversationRenameRequest = z.infer<typeof ConversationRenameRequest>;
115
+ export declare const FileRef: z.ZodObject<{
116
+ fileId: z.ZodString;
117
+ name: z.ZodString;
118
+ mimeType: z.ZodString;
119
+ bytes: z.ZodNumber;
120
+ status: z.ZodEnum<{
121
+ failed: "failed";
122
+ uploaded: "uploaded";
123
+ indexed: "indexed";
124
+ }>;
125
+ }, z.core.$strip>;
126
+ export type FileRef = z.infer<typeof FileRef>;
127
+ export declare const FileUploadResponse: z.ZodObject<{
128
+ file: z.ZodObject<{
129
+ fileId: z.ZodString;
130
+ name: z.ZodString;
131
+ mimeType: z.ZodString;
132
+ bytes: z.ZodNumber;
133
+ status: z.ZodEnum<{
134
+ failed: "failed";
135
+ uploaded: "uploaded";
136
+ indexed: "indexed";
137
+ }>;
138
+ }, z.core.$strip>;
139
+ }, z.core.$strip>;
140
+ export type FileUploadResponse = z.infer<typeof FileUploadResponse>;
141
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,sFAAsF;AACtF,eAAO,MAAM,SAAS;;;;IAIpB,oDAAoD;;IAEpD,6CAA6C;;;IAG7C,6EAA6E;;;IAG7E,8EAA8E;;IAE9E,4EAA4E;;IAE5E,+DAA+D;;;CAGvD,CAAC;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C,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF,eAAO,MAAM,yBAAyB;;iBAAyD,CAAC;AAChG,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,eAAO,MAAM,OAAO;;;;;;;;;;iBAMlB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC9C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;iBAA8B,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
package/dist/api.js ADDED
@@ -0,0 +1,86 @@
1
+ import { z } from 'zod';
2
+ import { BackendMode } from './events.js';
3
+ import { AgentKey, ConversationId, FileId } from './ids.js';
4
+ /** HTTP paths served by the backend. The task pane is served from the same origin. */
5
+ export const API_PATHS = {
6
+ health: '/healthz',
7
+ ready: '/readyz',
8
+ session: '/api/session',
9
+ /** Enrollment and limits for the signed-in user. */
10
+ me: '/api/me',
11
+ /** Agents the signed-in user may address. */
12
+ agents: '/api/agents',
13
+ chat: '/api/chat',
14
+ /** `POST` with `:requestId` substituted. Closing the stream also cancels. */
15
+ cancel: '/api/chat/:requestId/cancel',
16
+ conversations: '/api/conversations',
17
+ /** `GET`, `PATCH` (rename) or `DELETE` with `:conversationId` substituted. */
18
+ conversation: '/api/conversations/:conversationId',
19
+ /** `GET ?since=<seq>` replays a turn still in flight as an event stream. */
20
+ conversationEvents: '/api/conversations/:conversationId/events',
21
+ /** `POST` multipart upload; `GET` with `:fileId` downloads. */
22
+ files: '/api/files',
23
+ file: '/api/files/:fileId',
24
+ };
25
+ export function cancelPath(requestId) {
26
+ return API_PATHS.cancel.replace(':requestId', encodeURIComponent(requestId));
27
+ }
28
+ export function conversationPath(conversationId) {
29
+ return API_PATHS.conversation.replace(':conversationId', encodeURIComponent(conversationId));
30
+ }
31
+ export function conversationEventsPath(conversationId, since) {
32
+ const base = API_PATHS.conversationEvents.replace(':conversationId', encodeURIComponent(conversationId));
33
+ return since === undefined ? base : `${base}?since=${since}`;
34
+ }
35
+ export function filePath(fileId) {
36
+ return API_PATHS.file.replace(':fileId', encodeURIComponent(fileId));
37
+ }
38
+ export const HealthResponse = z.object({ status: z.literal('ok') });
39
+ export const ReadyResponse = z.object({
40
+ status: z.enum(['ready', 'not_ready']),
41
+ mode: BackendMode,
42
+ checks: z.record(z.string(), z.enum(['ok', 'fail', 'skipped'])),
43
+ });
44
+ export const SessionResponse = z.object({
45
+ mode: BackendMode,
46
+ authenticated: z.boolean(),
47
+ /** Display-only identity; never a token. */
48
+ user: z.object({ subject: z.string(), name: z.string().optional() }).nullable(),
49
+ });
50
+ /** `GET /api/me`: whether this user may use the agent yet (pilot gating) and where else to go. */
51
+ export const MeResponse = z.object({
52
+ mode: BackendMode,
53
+ enabled: z.boolean(),
54
+ reason: z.enum(['pilot_closed', 'forbidden']).optional(),
55
+ /** Display-only identity; never a token. */
56
+ user: z.object({ subject: z.string(), name: z.string().optional() }),
57
+ });
58
+ export const AgentSummary = z.object({
59
+ key: AgentKey,
60
+ name: z.string().min(1).max(100),
61
+ description: z.string().max(1_000).optional(),
62
+ });
63
+ export const AgentsResponse = z.object({ agents: z.array(AgentSummary) });
64
+ export const ConversationSummary = z.object({
65
+ conversationId: ConversationId,
66
+ agent: AgentKey,
67
+ title: z.string().max(200),
68
+ createdAt: z.iso.datetime(),
69
+ updatedAt: z.iso.datetime(),
70
+ /** Set while a turn is still running, so a client can resume its stream. */
71
+ activeRequestId: z.uuid().optional(),
72
+ });
73
+ export const ConversationListResponse = z.object({
74
+ conversations: z.array(ConversationSummary),
75
+ nextCursor: z.string().max(200).optional(),
76
+ });
77
+ export const ConversationRenameRequest = z.object({ title: z.string().trim().min(1).max(200) });
78
+ export const FileRef = z.object({
79
+ fileId: FileId,
80
+ name: z.string().min(1).max(255),
81
+ mimeType: z.string().min(1).max(127),
82
+ bytes: z.number().int().nonnegative(),
83
+ status: z.enum(['uploaded', 'indexed', 'failed']),
84
+ });
85
+ export const FileUploadResponse = z.object({ file: FileRef });
86
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE5D,sFAAsF;AACtF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,cAAc;IACvB,oDAAoD;IACpD,EAAE,EAAE,SAAS;IACb,6CAA6C;IAC7C,MAAM,EAAE,aAAa;IACrB,IAAI,EAAE,WAAW;IACjB,6EAA6E;IAC7E,MAAM,EAAE,6BAA6B;IACrC,aAAa,EAAE,oBAAoB;IACnC,8EAA8E;IAC9E,YAAY,EAAE,oCAAoC;IAClD,4EAA4E;IAC5E,kBAAkB,EAAE,2CAA2C;IAC/D,+DAA+D;IAC/D,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,oBAAoB;CAClB,CAAC;AAEX,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;AAC/E,CAAC;AACD,MAAM,UAAU,gBAAgB,CAAC,cAAsB;IACrD,OAAO,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC;AAC/F,CAAC;AACD,MAAM,UAAU,sBAAsB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AC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAGhG,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACrC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;CAClD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC"}
package/dist/auth.d.ts ADDED
@@ -0,0 +1,101 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Sign-in handoff between the task pane, the Office dialog and the gateway
4
+ * (docs/architecture/auth-design.md). All paths are on the pane's own origin.
5
+ *
6
+ * 1. The pane creates a random `verifier` and opens the Office dialog at
7
+ * `/auth/start?challenge=<base64url(sha256(verifier))>`.
8
+ * 2. After the identity provider redirect, the gateway's `/auth/callback` page sends ONE
9
+ * `AuthDialogMessage` (JSON string) to the pane with `Office.context.ui.messageParent`.
10
+ * 3. The pane checks the message origin and shape, closes the dialog, and redeems the
11
+ * single-use handoff code with `POST /auth/exchange` (`AuthExchangeRequest`).
12
+ * 4. The gateway answers `AuthExchangeResponse` and also sets an HttpOnly session cookie.
13
+ * The pane sends the session token as `Authorization: Bearer`; provider tokens never
14
+ * reach the pane.
15
+ */
16
+ export declare const AUTH_PATHS: {
17
+ /** `GET ?challenge=`: opened in the Office dialog; redirects to the identity provider. */
18
+ readonly start: "/auth/start";
19
+ /** `GET`: identity provider redirect target; renders the handoff page. */
20
+ readonly callback: "/auth/callback";
21
+ /** `POST AuthExchangeRequest` → `AuthExchangeResponse`. */
22
+ readonly exchange: "/auth/exchange";
23
+ /** `POST`: ends the gateway session (not the identity provider session). 204. */
24
+ readonly logout: "/auth/logout";
25
+ };
26
+ export declare const AUTH_MESSAGE_TYPE = "classic-agent-auth";
27
+ /** Pane-only secret: 43-128 RFC 7636 unreserved characters. */
28
+ export declare const PaneVerifier: z.ZodString;
29
+ /** `base64url(sha256(verifier))` without padding. */
30
+ export declare const PaneChallenge: z.ZodString;
31
+ /** Single-use, short-lived handoff code (base64url). */
32
+ export declare const HandoffCode: z.ZodString;
33
+ export declare function authStartPath(challenge: string): string;
34
+ /** The one message the callback page sends to the pane (serialized as JSON). */
35
+ export declare const AuthDialogMessage: z.ZodDiscriminatedUnion<[z.ZodObject<{
36
+ type: z.ZodLiteral<"classic-agent-auth">;
37
+ status: z.ZodLiteral<"ok">;
38
+ handoffCode: z.ZodString;
39
+ }, z.core.$strict>, z.ZodObject<{
40
+ type: z.ZodLiteral<"classic-agent-auth">;
41
+ status: z.ZodLiteral<"error">;
42
+ error: z.ZodString;
43
+ }, z.core.$strict>], "status">;
44
+ export type AuthDialogMessage = z.infer<typeof AuthDialogMessage>;
45
+ export declare const AuthExchangeRequest: z.ZodObject<{
46
+ handoffCode: z.ZodString;
47
+ verifier: z.ZodString;
48
+ }, z.core.$strict>;
49
+ export type AuthExchangeRequest = z.infer<typeof AuthExchangeRequest>;
50
+ export declare const AuthExchangeResponse: z.ZodObject<{
51
+ sessionToken: z.ZodString;
52
+ expiresAt: z.ZodISODateTime;
53
+ user: z.ZodObject<{
54
+ subject: z.ZodString;
55
+ name: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strip>;
57
+ }, z.core.$strip>;
58
+ export type AuthExchangeResponse = z.infer<typeof AuthExchangeResponse>;
59
+ /**
60
+ * Device-flow sign-in (native runtime). The pane starts a login, shows the user code and the
61
+ * verification link, then polls until the identity provider confirms. The redeemed session is
62
+ * the same opaque bearer as above; provider tokens never reach the pane.
63
+ */
64
+ export declare const DEVICE_AUTH_PATHS: {
65
+ /** `POST` → `DeviceStartResponse`. */
66
+ readonly start: "/auth/device/start";
67
+ /** `POST DevicePollRequest` → `DevicePollResponse`. */
68
+ readonly poll: "/auth/device/poll";
69
+ };
70
+ export declare const DeviceStartResponse: z.ZodObject<{
71
+ loginId: z.ZodString;
72
+ userCode: z.ZodString;
73
+ verificationUri: z.ZodURL;
74
+ verificationUriComplete: z.ZodOptional<z.ZodURL>;
75
+ expiresIn: z.ZodNumber;
76
+ interval: z.ZodNumber;
77
+ }, z.core.$strip>;
78
+ export type DeviceStartResponse = z.infer<typeof DeviceStartResponse>;
79
+ export declare const DevicePollRequest: z.ZodObject<{
80
+ loginId: z.ZodString;
81
+ }, z.core.$strip>;
82
+ export type DevicePollRequest = z.infer<typeof DevicePollRequest>;
83
+ export declare const DevicePollResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
84
+ status: z.ZodLiteral<"pending">;
85
+ }, z.core.$strip>, z.ZodObject<{
86
+ status: z.ZodLiteral<"slow_down">;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ status: z.ZodLiteral<"expired">;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ status: z.ZodLiteral<"denied">;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ status: z.ZodLiteral<"authorized">;
93
+ sessionToken: z.ZodString;
94
+ expiresIn: z.ZodNumber;
95
+ user: z.ZodObject<{
96
+ subject: z.ZodString;
97
+ name: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strip>;
99
+ }, z.core.$strip>], "status">;
100
+ export type DevicePollResponse = z.infer<typeof DevicePollResponse>;
101
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,UAAU;IACrB,0FAA0F;;IAE1F,0EAA0E;;IAE1E,2DAA2D;;IAE3D,iFAAiF;;CAEzE,CAAC;AAEX,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,+DAA+D;AAC/D,eAAO,MAAM,YAAY,aAAgD,CAAC;AAC1E,qDAAqD;AACrD,eAAO,MAAM,aAAa,aAA0C,CAAC;AACrE,wDAAwD;AACxD,eAAO,MAAM,WAAW,aAII,CAAC;AAE7B,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,gFAAgF;AAChF,eAAO,MAAM,iBAAiB;;;;;;;;8BAe5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,mBAAmB;;;kBAErB,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,oBAAoB;;;;;;;iBAM/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;IAC5B,sCAAsC;;IAEtC,uDAAuD;;CAE/C,CAAC;AAEX,eAAO,MAAM,mBAAmB;;;;;;;iBAS9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,iBAAiB;;iBAAqD,CAAC;AACpF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;6BAW7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
package/dist/auth.js ADDED
@@ -0,0 +1,101 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Sign-in handoff between the task pane, the Office dialog and the gateway
4
+ * (docs/architecture/auth-design.md). All paths are on the pane's own origin.
5
+ *
6
+ * 1. The pane creates a random `verifier` and opens the Office dialog at
7
+ * `/auth/start?challenge=<base64url(sha256(verifier))>`.
8
+ * 2. After the identity provider redirect, the gateway's `/auth/callback` page sends ONE
9
+ * `AuthDialogMessage` (JSON string) to the pane with `Office.context.ui.messageParent`.
10
+ * 3. The pane checks the message origin and shape, closes the dialog, and redeems the
11
+ * single-use handoff code with `POST /auth/exchange` (`AuthExchangeRequest`).
12
+ * 4. The gateway answers `AuthExchangeResponse` and also sets an HttpOnly session cookie.
13
+ * The pane sends the session token as `Authorization: Bearer`; provider tokens never
14
+ * reach the pane.
15
+ */
16
+ export const AUTH_PATHS = {
17
+ /** `GET ?challenge=`: opened in the Office dialog; redirects to the identity provider. */
18
+ start: '/auth/start',
19
+ /** `GET`: identity provider redirect target; renders the handoff page. */
20
+ callback: '/auth/callback',
21
+ /** `POST AuthExchangeRequest` → `AuthExchangeResponse`. */
22
+ exchange: '/auth/exchange',
23
+ /** `POST`: ends the gateway session (not the identity provider session). 204. */
24
+ logout: '/auth/logout',
25
+ };
26
+ export const AUTH_MESSAGE_TYPE = 'classic-agent-auth';
27
+ /** Pane-only secret: 43-128 RFC 7636 unreserved characters. */
28
+ export const PaneVerifier = z.string().regex(/^[A-Za-z0-9._~-]{43,128}$/);
29
+ /** `base64url(sha256(verifier))` without padding. */
30
+ export const PaneChallenge = z.string().regex(/^[A-Za-z0-9_-]{43}$/);
31
+ /** Single-use, short-lived handoff code (base64url). */
32
+ export const HandoffCode = z
33
+ .string()
34
+ .min(16)
35
+ .max(512)
36
+ .regex(/^[A-Za-z0-9_-]+$/);
37
+ export function authStartPath(challenge) {
38
+ return `${AUTH_PATHS.start}?challenge=${encodeURIComponent(challenge)}`;
39
+ }
40
+ /** The one message the callback page sends to the pane (serialized as JSON). */
41
+ export const AuthDialogMessage = z.discriminatedUnion('status', [
42
+ z
43
+ .object({
44
+ type: z.literal(AUTH_MESSAGE_TYPE),
45
+ status: z.literal('ok'),
46
+ handoffCode: HandoffCode,
47
+ })
48
+ .strict(),
49
+ z
50
+ .object({
51
+ type: z.literal(AUTH_MESSAGE_TYPE),
52
+ status: z.literal('error'),
53
+ error: z.string().min(1).max(500),
54
+ })
55
+ .strict(),
56
+ ]);
57
+ export const AuthExchangeRequest = z
58
+ .object({ handoffCode: HandoffCode, verifier: PaneVerifier })
59
+ .strict();
60
+ export const AuthExchangeResponse = z.object({
61
+ /** Opaque gateway session credential. Keep in memory; never in localStorage. */
62
+ sessionToken: z.string().min(16).max(512),
63
+ expiresAt: z.iso.datetime(),
64
+ /** Display-only identity. */
65
+ user: z.object({ subject: z.string(), name: z.string().optional() }),
66
+ });
67
+ /**
68
+ * Device-flow sign-in (native runtime). The pane starts a login, shows the user code and the
69
+ * verification link, then polls until the identity provider confirms. The redeemed session is
70
+ * the same opaque bearer as above; provider tokens never reach the pane.
71
+ */
72
+ export const DEVICE_AUTH_PATHS = {
73
+ /** `POST` → `DeviceStartResponse`. */
74
+ start: '/auth/device/start',
75
+ /** `POST DevicePollRequest` → `DevicePollResponse`. */
76
+ poll: '/auth/device/poll',
77
+ };
78
+ export const DeviceStartResponse = z.object({
79
+ loginId: z.string().min(16).max(128),
80
+ userCode: z.string().min(1).max(32),
81
+ verificationUri: z.url(),
82
+ verificationUriComplete: z.url().optional(),
83
+ /** Seconds until the login must be completed. */
84
+ expiresIn: z.number().int().positive(),
85
+ /** Minimum seconds between polls. */
86
+ interval: z.number().int().positive(),
87
+ });
88
+ export const DevicePollRequest = z.object({ loginId: z.string().min(16).max(128) });
89
+ export const DevicePollResponse = z.discriminatedUnion('status', [
90
+ z.object({ status: z.literal('pending') }),
91
+ z.object({ status: z.literal('slow_down') }),
92
+ z.object({ status: z.literal('expired') }),
93
+ z.object({ status: z.literal('denied') }),
94
+ z.object({
95
+ status: z.literal('authorized'),
96
+ sessionToken: z.string().min(16),
97
+ expiresIn: z.number().int().positive(),
98
+ user: z.object({ subject: z.string(), name: z.string().optional() }),
99
+ }),
100
+ ]);
101
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,0FAA0F;IAC1F,KAAK,EAAE,aAAa;IACpB,0EAA0E;IAC1E,QAAQ,EAAE,gBAAgB;IAC1B,2DAA2D;IAC3D,QAAQ,EAAE,gBAAgB;IAC1B,iFAAiF;IACjF,MAAM,EAAE,cAAc;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC1E,qDAAqD;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,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,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IAC/D,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;IAC1C,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;IAC5C,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;IAC1C,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IACzC,CAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;QAC/B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;QACtC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;KACrE,CAAC;CACH,CAAC,CAAC"}
package/dist/chat.d.ts ADDED
@@ -0,0 +1,106 @@
1
+ import { z } from 'zod';
2
+ /** Which client sent a request. Lets the backend shape tool availability and rendering hints. */
3
+ export declare const ClientKind: z.ZodEnum<{
4
+ app: "app";
5
+ office: "office";
6
+ }>;
7
+ export type ClientKind = z.infer<typeof ClientKind>;
8
+ /** Body of `POST /api/chat`. */
9
+ export declare const ChatRequest: z.ZodObject<{
10
+ requestId: z.ZodUUID;
11
+ conversationId: z.ZodOptional<z.ZodString>;
12
+ agent: z.ZodDefault<z.ZodString>;
13
+ message: z.ZodString;
14
+ context: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
15
+ selection: z.ZodObject<{
16
+ sheet: z.ZodString;
17
+ address: z.ZodString;
18
+ values: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
19
+ formulas: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
20
+ }, z.core.$strip>;
21
+ documentId: z.ZodString;
22
+ capturedAt: z.ZodISODateTime;
23
+ simulated: z.ZodBoolean;
24
+ host: z.ZodLiteral<"excel">;
25
+ }, z.core.$strip>, z.ZodObject<{
26
+ selection: z.ZodObject<{
27
+ text: z.ZodString;
28
+ isEmpty: z.ZodBoolean;
29
+ target: z.ZodObject<{
30
+ targetId: z.ZodString;
31
+ expectedText: z.ZodString;
32
+ }, z.core.$strip>;
33
+ }, z.core.$strip>;
34
+ documentId: z.ZodString;
35
+ capturedAt: z.ZodISODateTime;
36
+ simulated: z.ZodBoolean;
37
+ host: z.ZodLiteral<"word">;
38
+ }, z.core.$strip>, z.ZodObject<{
39
+ host: z.ZodLiteral<"app">;
40
+ capturedAt: z.ZodISODateTime;
41
+ route: z.ZodString;
42
+ title: z.ZodString;
43
+ tab: z.ZodOptional<z.ZodString>;
44
+ record: z.ZodOptional<z.ZodObject<{
45
+ kind: z.ZodEnum<{
46
+ home: "home";
47
+ lot: "lot";
48
+ community: "community";
49
+ filing: "filing";
50
+ floorplan: "floorplan";
51
+ elevation: "elevation";
52
+ district: "district";
53
+ user: "user";
54
+ vendor: "vendor";
55
+ sign: "sign";
56
+ "slide-deck": "slide-deck";
57
+ survey: "survey";
58
+ workspace: "workspace";
59
+ walk: "walk";
60
+ permit: "permit";
61
+ incentive: "incentive";
62
+ }>;
63
+ id: z.ZodString;
64
+ label: z.ZodString;
65
+ path: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>>;
67
+ target: z.ZodOptional<z.ZodObject<{
68
+ homeRid: z.ZodOptional<z.ZodNumber>;
69
+ lotRid: z.ZodOptional<z.ZodNumber>;
70
+ elevationRid: z.ZodOptional<z.ZodNumber>;
71
+ floorplanRid: z.ZodOptional<z.ZodNumber>;
72
+ filingRid: z.ZodOptional<z.ZodNumber>;
73
+ communityRid: z.ZodOptional<z.ZodNumber>;
74
+ districtId: z.ZodOptional<z.ZodString>;
75
+ }, z.core.$strip>>;
76
+ facts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
77
+ selection: z.ZodOptional<z.ZodString>;
78
+ }, z.core.$strip>], "host">>;
79
+ operationResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
+ operationId: z.ZodUUID;
81
+ status: z.ZodEnum<{
82
+ pending: "pending";
83
+ applied: "applied";
84
+ failed: "failed";
85
+ rejected: "rejected";
86
+ }>;
87
+ code: z.ZodOptional<z.ZodEnum<{
88
+ stale_target: "stale_target";
89
+ already_applied: "already_applied";
90
+ host_mismatch: "host_mismatch";
91
+ unsupported_api: "unsupported_api";
92
+ invalid_operation: "invalid_operation";
93
+ host_error: "host_error";
94
+ user_rejected: "user_rejected";
95
+ }>>;
96
+ message: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>>>;
98
+ fileIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
+ client: z.ZodOptional<z.ZodEnum<{
100
+ app: "app";
101
+ office: "office";
102
+ }>>;
103
+ }, z.core.$strip>;
104
+ export type ChatRequest = z.infer<typeof ChatRequest>;
105
+ export type ChatRequestInput = z.input<typeof ChatRequest>;
106
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,iGAAiG;AACjG,eAAO,MAAM,UAAU;;;EAA4B,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,gCAAgC;AAChC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}