@codespar/types 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @codespar/types
2
+
3
+ Zero-dependency TypeScript package defining the shared session interface hierarchy for CodeSpar runtimes.
4
+
5
+ Any runtime that implements `SessionBase` — the managed CodeSpar backend, Anthropic Managed Agents, a self-hosted server, or a test double — is a first-class citizen in the SDK ecosystem. The contract is the only coupling between runtimes and the tools that run on top of them.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @codespar/types
11
+ ```
12
+
13
+ ## Interfaces
14
+
15
+ ### `SessionBase`
16
+
17
+ The minimal interface any runtime must implement.
18
+
19
+ ```typescript
20
+ import type { SessionBase } from "@codespar/types";
21
+
22
+ interface SessionBase {
23
+ readonly id: string;
24
+ readonly status: "active" | "closed" | "error";
25
+
26
+ execute(toolName: string, params: Record<string, unknown>): Promise<ToolResult>;
27
+ send(message: string): Promise<SendResult>;
28
+ sendStream(message: string): AsyncIterable<StreamEvent>;
29
+ connections(): Promise<BaseConnection[]>;
30
+ close(): Promise<void>;
31
+ }
32
+ ```
33
+
34
+ ### `Session`
35
+
36
+ The codespar-specific extension of `SessionBase`, used when a session was created through the managed CodeSpar API.
37
+
38
+ ```typescript
39
+ import type { Session } from "@codespar/types";
40
+
41
+ interface Session extends SessionBase {
42
+ proxyExecute(request: ProxyRequest): Promise<ProxyResult>;
43
+ authorize(serverId: string, config: AuthConfig): Promise<AuthResult>;
44
+ mcp?: {
45
+ url: string;
46
+ headers: Record<string, string>;
47
+ };
48
+ }
49
+ ```
50
+
51
+ ### `isCodesparSession`
52
+
53
+ Type guard to narrow a `SessionBase` to `Session` when you need codespar-specific methods.
54
+
55
+ ```typescript
56
+ import { isCodesparSession } from "@codespar/types";
57
+
58
+ function useSession(session: SessionBase) {
59
+ if (isCodesparSession(session)) {
60
+ // session is Session here — proxyExecute, authorize, mcp available
61
+ const config = session.mcp;
62
+ }
63
+ }
64
+ ```
65
+
66
+ ## Wire types
67
+
68
+ | Type | Description |
69
+ |------|-------------|
70
+ | `ToolResult` | Return value of `execute()` — `success`, `data`, `error`, `duration`, `server`, `tool` |
71
+ | `SendResult` | Return value of `send()` — `message`, `tool_calls`, `iterations` |
72
+ | `StreamEvent` | Union of events yielded by `sendStream()` — `user_message`, `assistant_text`, `tool_use`, `tool_result`, `done`, `error` |
73
+ | `BaseConnection` | Entry from `connections()` — `id`, `connected` |
74
+ | `ServerConnection` | Extended connection with name and provider metadata |
75
+ | `ProxyRequest` | Input to `proxyExecute()` — `server`, `endpoint`, `method`, `body`, `headers` |
76
+ | `ProxyResult` | Return value of `proxyExecute()` — `status`, `data`, `headers`, `duration`, `proxy_call_id` |
77
+ | `AuthConfig` | Input to `authorize()` — `redirectUri`, `scopes?` |
78
+ | `AuthResult` | Return value of `authorize()` — `linkToken`, `authorizeUrl`, `expiresAt` |
79
+
80
+ ## Conformance testing
81
+
82
+ `@codespar/types` ships a `runContractSuite` helper under a `/testing` subpath export. It registers a Vitest test suite that exercises the five `SessionBase` methods against a live HTTP endpoint.
83
+
84
+ ```typescript
85
+ // my-runtime.test.ts
86
+ import { runContractSuite } from "@codespar/types/testing";
87
+
88
+ // Skip unless the env vars are present
89
+ const apiKey = process.env["MY_RUNTIME_API_KEY"];
90
+ const baseUrl = process.env["MY_RUNTIME_BASE_URL"] ?? "http://localhost:3000";
91
+
92
+ if (apiKey) {
93
+ runContractSuite(baseUrl, apiKey);
94
+ }
95
+ ```
96
+
97
+ The suite opens a session via `POST /v1/sessions` with `Authorization: Bearer <apiKey>` and body `{ servers: [], user_id: "contract-suite" }`, then validates:
98
+ - `execute()` calls a registered tool and returns a `ToolResult`
99
+ - `send()` returns a `SendResult` with a `message` field
100
+ - `sendStream()` yields well-typed `StreamEvent`s including a `done` event
101
+ - `connections()` returns entries with `id` and `connected` fields
102
+ - `close()` transitions `session.status` to `"closed"`
103
+
104
+ See [docs/custom-session-runtime.md](../../docs/custom-session-runtime.md) for a full implementation guide.
105
+
106
+ ## License
107
+
108
+ MIT — [codespar.dev](https://codespar.dev)
@@ -0,0 +1,3 @@
1
+ import type { SessionBase, Session } from "./types.js";
2
+ export declare function isCodesparSession(s: SessionBase): s is Session;
3
+ //# sourceMappingURL=guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEvD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,GAAG,CAAC,IAAI,OAAO,CAE9D"}
package/dist/guards.js ADDED
@@ -0,0 +1,4 @@
1
+ export function isCodesparSession(s) {
2
+ return "proxyExecute" in s && "authorize" in s;
3
+ }
4
+ //# sourceMappingURL=guards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,CAAc;IAC9C,OAAO,cAAc,IAAI,CAAC,IAAI,WAAW,IAAI,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./types.js";
2
+ export * from "./guards.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./types.js";
2
+ export * from "./guards.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare class InvalidBaseUrlError extends Error {
2
+ constructor(url: string);
3
+ }
4
+ /**
5
+ * Register the full session contract test suite against a live backend.
6
+ *
7
+ * Validates the baseUrl before issuing any request: only https:// URLs and
8
+ * localhost are accepted. Throws InvalidBaseUrlError synchronously for
9
+ * invalid URLs so misconfigured CI environments fail early rather than
10
+ * leaking the apiKey to an arbitrary host.
11
+ *
12
+ * @param baseUrl - API base URL (e.g. "https://your-runtime.example" or "http://localhost:3000")
13
+ * @param apiKey - Bearer token for session creation
14
+ */
15
+ export declare function runContractSuite(baseUrl: string, apiKey: string): void;
16
+ //# sourceMappingURL=contract-suite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-suite.d.ts","sourceRoot":"","sources":["../../src/testing/contract-suite.ts"],"names":[],"mappings":"AAGA,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,GAAG,EAAE,MAAM;CAMxB;AAmKD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CA8EtE"}
@@ -0,0 +1,257 @@
1
+ import { describe, it, expect, afterEach } from "vitest";
2
+ export class InvalidBaseUrlError extends Error {
3
+ constructor(url) {
4
+ super(`Invalid base URL "${url}" — must use https:// protocol unless the host is localhost`);
5
+ this.name = "InvalidBaseUrlError";
6
+ }
7
+ }
8
+ function validateBaseUrl(rawUrl) {
9
+ let parsed;
10
+ try {
11
+ parsed = new URL(rawUrl);
12
+ }
13
+ catch {
14
+ throw new InvalidBaseUrlError(rawUrl);
15
+ }
16
+ if (parsed.hostname !== "localhost" && parsed.protocol !== "https:") {
17
+ throw new InvalidBaseUrlError(rawUrl);
18
+ }
19
+ }
20
+ // Minimal SSE parser used only within the contract test suite.
21
+ async function* parseSse(body) {
22
+ const reader = body.getReader();
23
+ const decoder = new TextDecoder();
24
+ let buffer = "";
25
+ try {
26
+ while (true) {
27
+ const { done, value } = await reader.read();
28
+ if (done)
29
+ break;
30
+ buffer += decoder.decode(value, { stream: true });
31
+ let sep;
32
+ while ((sep = buffer.indexOf("\n\n")) !== -1) {
33
+ const chunk = buffer.slice(0, sep);
34
+ buffer = buffer.slice(sep + 2);
35
+ let eventName = "message";
36
+ let dataLine = "";
37
+ for (const line of chunk.split("\n")) {
38
+ if (line.startsWith("event:"))
39
+ eventName = line.slice(6).trim();
40
+ else if (line.startsWith("data:"))
41
+ dataLine += line.slice(5).trim();
42
+ }
43
+ if (!dataLine)
44
+ continue;
45
+ let payload;
46
+ try {
47
+ payload = JSON.parse(dataLine);
48
+ }
49
+ catch {
50
+ continue;
51
+ }
52
+ // Yield discriminated StreamEvent from the known event names.
53
+ // Unrecognised events are silently skipped — the variant list is
54
+ // defined by the StreamEvent union in types.ts.
55
+ if (eventName === "user_message")
56
+ yield { type: "user_message", content: payload.content };
57
+ else if (eventName === "assistant_text")
58
+ yield {
59
+ type: "assistant_text",
60
+ content: payload.content,
61
+ iteration: payload.iteration,
62
+ };
63
+ else if (eventName === "tool_use")
64
+ yield {
65
+ type: "tool_use",
66
+ id: payload.id,
67
+ name: payload.name,
68
+ input: payload.input,
69
+ };
70
+ else if (eventName === "tool_result")
71
+ yield { type: "tool_result", toolCall: payload };
72
+ else if (eventName === "done")
73
+ yield { type: "done", result: payload };
74
+ else if (eventName === "error")
75
+ yield {
76
+ type: "error",
77
+ error: payload.error,
78
+ message: payload.message,
79
+ };
80
+ }
81
+ }
82
+ }
83
+ finally {
84
+ reader.releaseLock();
85
+ }
86
+ }
87
+ // Builds a minimal SessionBase from raw fetch calls so the contract suite
88
+ // can run against any backend that implements the codespar session API.
89
+ async function openSession(baseUrl, apiKey) {
90
+ const headers = {
91
+ "Content-Type": "application/json",
92
+ Authorization: `Bearer ${apiKey}`,
93
+ };
94
+ const res = await fetch(`${baseUrl}/v1/sessions`, {
95
+ method: "POST",
96
+ headers,
97
+ body: JSON.stringify({ servers: [], user_id: "contract-suite" }),
98
+ });
99
+ if (!res.ok) {
100
+ const text = await res.text();
101
+ throw new Error(`session create failed: ${res.status} ${text}`);
102
+ }
103
+ const raw = (await res.json());
104
+ const state = { id: raw.id, status: raw.status };
105
+ return {
106
+ get id() {
107
+ return state.id;
108
+ },
109
+ get status() {
110
+ return state.status;
111
+ },
112
+ async execute(toolName, params) {
113
+ const r = await fetch(`${baseUrl}/v1/sessions/${state.id}/execute`, {
114
+ method: "POST",
115
+ headers,
116
+ body: JSON.stringify({ tool: toolName, input: params }),
117
+ });
118
+ if (!r.ok) {
119
+ const body = await r.text();
120
+ return {
121
+ success: false,
122
+ data: null,
123
+ error: `${r.status}: ${body}`,
124
+ duration: 0,
125
+ server: "",
126
+ tool: toolName,
127
+ };
128
+ }
129
+ return (await r.json());
130
+ },
131
+ async send(message) {
132
+ const r = await fetch(`${baseUrl}/v1/sessions/${state.id}/send`, {
133
+ method: "POST",
134
+ headers: { ...headers, Accept: "application/json" },
135
+ body: JSON.stringify({ message }),
136
+ });
137
+ if (!r.ok) {
138
+ const body = await r.text();
139
+ throw new Error(`send failed: ${r.status} ${body}`);
140
+ }
141
+ return (await r.json());
142
+ },
143
+ async *sendStream(message) {
144
+ const r = await fetch(`${baseUrl}/v1/sessions/${state.id}/send`, {
145
+ method: "POST",
146
+ headers: { ...headers, Accept: "text/event-stream" },
147
+ body: JSON.stringify({ message }),
148
+ });
149
+ if (!r.ok || !r.body) {
150
+ const body = await r.text();
151
+ throw new Error(`sendStream failed: ${r.status} ${body}`);
152
+ }
153
+ yield* parseSse(r.body);
154
+ },
155
+ async connections() {
156
+ const r = await fetch(`${baseUrl}/v1/sessions/${state.id}/connections`, { headers });
157
+ if (!r.ok)
158
+ return [];
159
+ const payload = (await r.json());
160
+ return payload.servers;
161
+ },
162
+ async close() {
163
+ await fetch(`${baseUrl}/v1/sessions/${state.id}`, {
164
+ method: "DELETE",
165
+ headers,
166
+ });
167
+ state.status = "closed";
168
+ },
169
+ };
170
+ }
171
+ /**
172
+ * Register the full session contract test suite against a live backend.
173
+ *
174
+ * Validates the baseUrl before issuing any request: only https:// URLs and
175
+ * localhost are accepted. Throws InvalidBaseUrlError synchronously for
176
+ * invalid URLs so misconfigured CI environments fail early rather than
177
+ * leaking the apiKey to an arbitrary host.
178
+ *
179
+ * @param baseUrl - API base URL (e.g. "https://your-runtime.example" or "http://localhost:3000")
180
+ * @param apiKey - Bearer token for session creation
181
+ */
182
+ export function runContractSuite(baseUrl, apiKey) {
183
+ validateBaseUrl(baseUrl);
184
+ describe("session contract suite", () => {
185
+ let session = null;
186
+ afterEach(async () => {
187
+ try {
188
+ if (session)
189
+ await session.close();
190
+ }
191
+ finally {
192
+ session = null;
193
+ }
194
+ });
195
+ it("execute() calls a registered tool and returns a ToolResult", async () => {
196
+ session = await openSession(baseUrl, apiKey);
197
+ const result = await session.execute("codespar_list_tools", {});
198
+ expect(result).toMatchObject({
199
+ success: expect.any(Boolean),
200
+ data: expect.anything(),
201
+ error: expect.anything(),
202
+ duration: expect.any(Number),
203
+ server: expect.any(String),
204
+ tool: expect.any(String),
205
+ });
206
+ });
207
+ it("send() returns a SendResult with a message field", async () => {
208
+ session = await openSession(baseUrl, apiKey);
209
+ const result = await session.send("hello");
210
+ expect(result).toMatchObject({
211
+ message: expect.any(String),
212
+ tool_calls: expect.any(Array),
213
+ iterations: expect.any(Number),
214
+ });
215
+ });
216
+ it("sendStream() yields well-typed StreamEvents including done", async () => {
217
+ session = await openSession(baseUrl, apiKey);
218
+ const events = [];
219
+ for await (const ev of session.sendStream("hello")) {
220
+ events.push(ev);
221
+ if (ev.type === "done" || ev.type === "error")
222
+ break;
223
+ }
224
+ expect(events.length).toBeGreaterThan(0);
225
+ const types = new Set(events.map((e) => e.type));
226
+ // Every event type must be one of the six discriminated variants.
227
+ const valid = new Set([
228
+ "user_message",
229
+ "assistant_text",
230
+ "tool_use",
231
+ "tool_result",
232
+ "done",
233
+ "error",
234
+ ]);
235
+ for (const t of types) {
236
+ expect(valid.has(t)).toBe(true);
237
+ }
238
+ });
239
+ it("connections() returns entries with id and connected fields", async () => {
240
+ session = await openSession(baseUrl, apiKey);
241
+ const conns = await session.connections();
242
+ expect(Array.isArray(conns)).toBe(true);
243
+ for (const c of conns) {
244
+ expect(typeof c.id).toBe("string");
245
+ expect(typeof c.connected).toBe("boolean");
246
+ }
247
+ });
248
+ it("close() transitions session.status to closed", async () => {
249
+ session = await openSession(baseUrl, apiKey);
250
+ expect(session.status).toBe("active");
251
+ await session.close();
252
+ expect(session.status).toBe("closed");
253
+ session = null; // afterEach guard — already closed
254
+ });
255
+ });
256
+ }
257
+ //# sourceMappingURL=contract-suite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-suite.js","sourceRoot":"","sources":["../../src/testing/contract-suite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGzD,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,YAAY,GAAW;QACrB,KAAK,CACH,qBAAqB,GAAG,6DAA6D,CACtF,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,SAAS,eAAe,CAAC,MAAc;IACrC,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACpE,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;AACH,CAAC;AAED,+DAA+D;AAC/D,KAAK,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAgC;IACvD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,MAAM,OAAO,GA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AE,KAAK,IAAI,EAAE;YAC5D,OAAO,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC7C,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YACtB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,OAAO,GAAG,IAAI,CAAC,CAAC,mCAAmC;QACrD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,108 @@
1
+ export interface SessionBase {
2
+ readonly id: string;
3
+ readonly status: "active" | "closed" | "error";
4
+ execute(toolName: string, params: Record<string, unknown>): Promise<ToolResult>;
5
+ send(message: string): Promise<SendResult>;
6
+ sendStream(message: string): AsyncIterable<StreamEvent>;
7
+ connections(): Promise<BaseConnection[]>;
8
+ close(): Promise<void>;
9
+ }
10
+ export interface Session extends SessionBase {
11
+ proxyExecute(request: ProxyRequest): Promise<ProxyResult>;
12
+ authorize(serverId: string, config: AuthConfig): Promise<AuthResult>;
13
+ mcp?: {
14
+ url: string;
15
+ headers: Record<string, string>;
16
+ };
17
+ }
18
+ export type BaseConnection = {
19
+ id: string;
20
+ connected: boolean;
21
+ };
22
+ export interface ServerConnection {
23
+ id: string;
24
+ name: string;
25
+ category: string;
26
+ country: string;
27
+ auth_type: "oauth" | "api_key" | "cert" | "none";
28
+ connected: boolean;
29
+ }
30
+ export interface CreateSessionRequest {
31
+ servers: string[];
32
+ metadata?: Record<string, string>;
33
+ projectId?: string;
34
+ }
35
+ export interface ToolResult {
36
+ success: boolean;
37
+ data: unknown;
38
+ error: string | null;
39
+ duration: number;
40
+ server: string;
41
+ tool: string;
42
+ tool_call_id?: string;
43
+ called_at?: string;
44
+ }
45
+ export interface SendResult {
46
+ message: string;
47
+ tool_calls: ToolCallRecord[];
48
+ iterations: number;
49
+ }
50
+ export interface ToolCallRecord {
51
+ id: string;
52
+ tool_name: string;
53
+ server_id: string;
54
+ status: "success" | "error";
55
+ duration_ms: number;
56
+ input: unknown;
57
+ output: unknown;
58
+ error_code: string | null;
59
+ }
60
+ export type StreamEvent = {
61
+ type: "user_message";
62
+ content: string;
63
+ } | {
64
+ type: "assistant_text";
65
+ content: string;
66
+ iteration: number;
67
+ } | {
68
+ type: "tool_use";
69
+ id: string;
70
+ name: string;
71
+ input: Record<string, unknown>;
72
+ } | {
73
+ type: "tool_result";
74
+ toolCall: ToolCallRecord;
75
+ } | {
76
+ type: "done";
77
+ result: SendResult;
78
+ } | {
79
+ type: "error";
80
+ error: string;
81
+ message?: string;
82
+ };
83
+ export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
84
+ export interface ProxyRequest {
85
+ server: string;
86
+ endpoint: string;
87
+ method: HttpMethod;
88
+ body?: unknown;
89
+ params?: Record<string, string | number | boolean>;
90
+ headers?: Record<string, string>;
91
+ }
92
+ export interface ProxyResult {
93
+ status: number;
94
+ data: unknown;
95
+ headers: Record<string, string>;
96
+ duration: number;
97
+ proxy_call_id?: string;
98
+ }
99
+ export interface AuthConfig {
100
+ redirectUri: string;
101
+ scopes?: string;
102
+ }
103
+ export interface AuthResult {
104
+ linkToken: string;
105
+ authorizeUrl: string;
106
+ expiresAt: string;
107
+ }
108
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC/C,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,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vD,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ /* ── Runtime-agnostic session base ─────────────────────────────── */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,sEAAsE"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@codespar/types",
3
+ "version": "0.1.0",
4
+ "description": "Shared session interface contract for codespar runtimes",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./testing": {
14
+ "development": {
15
+ "import": "./dist/testing/contract-suite.js",
16
+ "types": "./dist/testing/contract-suite.d.ts"
17
+ }
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "test": "vitest run",
28
+ "typecheck": "tsc --noEmit",
29
+ "clean": "rm -rf dist",
30
+ "prepublishOnly": "npm run build"
31
+ },
32
+ "keywords": [
33
+ "codespar",
34
+ "session",
35
+ "contract",
36
+ "sdk"
37
+ ],
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/codespar/codespar-core",
42
+ "directory": "packages/session-contract"
43
+ },
44
+ "homepage": "https://codespar.dev",
45
+ "bugs": {
46
+ "url": "https://github.com/codespar/codespar-core/issues"
47
+ },
48
+ "engines": {
49
+ "node": ">=20"
50
+ },
51
+ "dependencies": {},
52
+ "devDependencies": {
53
+ "@types/node": "^25.6.0",
54
+ "typescript": "^5.8.0",
55
+ "vitest": "^3.1.0"
56
+ }
57
+ }