@fnndsc/calypso 0.2.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 +33 -0
- package/dist/daemon/engine.d.ts +44 -0
- package/dist/daemon/engine.js +3 -0
- package/dist/daemon/engine.js.map +1 -0
- package/dist/daemon/server.d.ts +217 -0
- package/dist/daemon/server.js +466 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/token.d.ts +24 -0
- package/dist/daemon/token.js +56 -0
- package/dist/daemon/token.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol/envelope.d.ts +136 -0
- package/dist/protocol/envelope.js +49 -0
- package/dist/protocol/envelope.js.map +1 -0
- package/dist/protocol/messages.d.ts +1032 -0
- package/dist/protocol/messages.js +189 -0
- package/dist/protocol/messages.js.map +1 -0
- package/dist/protocol/validate.d.ts +57 -0
- package/dist/protocol/validate.js +94 -0
- package/dist/protocol/validate.js.map +1 -0
- package/dist/protocol/version.d.ts +25 -0
- package/dist/protocol/version.js +32 -0
- package/dist/protocol/version.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The wire schema for a command envelope.
|
|
3
|
+
*
|
|
4
|
+
* cumin defines the `CommandEnvelope` type (the shape produced in-stack);
|
|
5
|
+
* calypso owns the wire schema that validates that envelope at the boundary
|
|
6
|
+
* — the published promise an external surface programs against. The two are
|
|
7
|
+
* kept in step by a compile-time check below: if cumin's type gains a field
|
|
8
|
+
* the wire schema does not cover, this file stops compiling, so the contract
|
|
9
|
+
* can never silently drift from what the code produces.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
/** Terminal status of a completed command. */
|
|
15
|
+
export declare const envelopeStatusSchema: z.ZodEnum<["ok", "error"]>;
|
|
16
|
+
/** A single structured error/warning drained from the error stack. */
|
|
17
|
+
export declare const stackMessageSchema: z.ZodObject<{
|
|
18
|
+
type: z.ZodEnum<["error", "warning"]>;
|
|
19
|
+
message: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
type: "error" | "warning";
|
|
22
|
+
message: string;
|
|
23
|
+
}, {
|
|
24
|
+
type: "error" | "warning";
|
|
25
|
+
message: string;
|
|
26
|
+
}>;
|
|
27
|
+
/** A command's typed result: a namespaced kind and an opaque payload. */
|
|
28
|
+
export declare const envelopeModelSchema: z.ZodObject<{
|
|
29
|
+
kind: z.ZodString;
|
|
30
|
+
data: z.ZodUnknown;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
kind: string;
|
|
33
|
+
data?: unknown;
|
|
34
|
+
}, {
|
|
35
|
+
kind: string;
|
|
36
|
+
data?: unknown;
|
|
37
|
+
}>;
|
|
38
|
+
/** The record of how a natural-language input resolved into a command. */
|
|
39
|
+
export declare const resolutionTraceSchema: z.ZodObject<{
|
|
40
|
+
input: z.ZodString;
|
|
41
|
+
proposed: z.ZodString;
|
|
42
|
+
validated: z.ZodBoolean;
|
|
43
|
+
executed: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
input: string;
|
|
46
|
+
proposed: string;
|
|
47
|
+
validated: boolean;
|
|
48
|
+
executed?: string | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
input: string;
|
|
51
|
+
proposed: string;
|
|
52
|
+
validated: boolean;
|
|
53
|
+
executed?: string | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* The envelope in which one command's complete outcome crosses the wire.
|
|
57
|
+
*/
|
|
58
|
+
export declare const commandEnvelopeSchema: z.ZodObject<{
|
|
59
|
+
status: z.ZodEnum<["ok", "error"]>;
|
|
60
|
+
rendered: z.ZodString;
|
|
61
|
+
renderedErr: z.ZodOptional<z.ZodString>;
|
|
62
|
+
model: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
kind: z.ZodString;
|
|
64
|
+
data: z.ZodUnknown;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
kind: string;
|
|
67
|
+
data?: unknown;
|
|
68
|
+
}, {
|
|
69
|
+
kind: string;
|
|
70
|
+
data?: unknown;
|
|
71
|
+
}>>;
|
|
72
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
73
|
+
type: z.ZodEnum<["error", "warning"]>;
|
|
74
|
+
message: z.ZodString;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
type: "error" | "warning";
|
|
77
|
+
message: string;
|
|
78
|
+
}, {
|
|
79
|
+
type: "error" | "warning";
|
|
80
|
+
message: string;
|
|
81
|
+
}>, "many">>;
|
|
82
|
+
trace: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
input: z.ZodString;
|
|
84
|
+
proposed: z.ZodString;
|
|
85
|
+
validated: z.ZodBoolean;
|
|
86
|
+
executed: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
input: string;
|
|
89
|
+
proposed: string;
|
|
90
|
+
validated: boolean;
|
|
91
|
+
executed?: string | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
input: string;
|
|
94
|
+
proposed: string;
|
|
95
|
+
validated: boolean;
|
|
96
|
+
executed?: string | undefined;
|
|
97
|
+
}>>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
status: "ok" | "error";
|
|
100
|
+
rendered: string;
|
|
101
|
+
renderedErr?: string | undefined;
|
|
102
|
+
model?: {
|
|
103
|
+
kind: string;
|
|
104
|
+
data?: unknown;
|
|
105
|
+
} | undefined;
|
|
106
|
+
errors?: {
|
|
107
|
+
type: "error" | "warning";
|
|
108
|
+
message: string;
|
|
109
|
+
}[] | undefined;
|
|
110
|
+
trace?: {
|
|
111
|
+
input: string;
|
|
112
|
+
proposed: string;
|
|
113
|
+
validated: boolean;
|
|
114
|
+
executed?: string | undefined;
|
|
115
|
+
} | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
status: "ok" | "error";
|
|
118
|
+
rendered: string;
|
|
119
|
+
renderedErr?: string | undefined;
|
|
120
|
+
model?: {
|
|
121
|
+
kind: string;
|
|
122
|
+
data?: unknown;
|
|
123
|
+
} | undefined;
|
|
124
|
+
errors?: {
|
|
125
|
+
type: "error" | "warning";
|
|
126
|
+
message: string;
|
|
127
|
+
}[] | undefined;
|
|
128
|
+
trace?: {
|
|
129
|
+
input: string;
|
|
130
|
+
proposed: string;
|
|
131
|
+
validated: boolean;
|
|
132
|
+
executed?: string | undefined;
|
|
133
|
+
} | undefined;
|
|
134
|
+
}>;
|
|
135
|
+
/** The envelope type inferred from the wire schema. */
|
|
136
|
+
export type WireEnvelope = z.infer<typeof commandEnvelopeSchema>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commandEnvelopeSchema = exports.resolutionTraceSchema = exports.envelopeModelSchema = exports.stackMessageSchema = exports.envelopeStatusSchema = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @file The wire schema for a command envelope.
|
|
6
|
+
*
|
|
7
|
+
* cumin defines the `CommandEnvelope` type (the shape produced in-stack);
|
|
8
|
+
* calypso owns the wire schema that validates that envelope at the boundary
|
|
9
|
+
* — the published promise an external surface programs against. The two are
|
|
10
|
+
* kept in step by a compile-time check below: if cumin's type gains a field
|
|
11
|
+
* the wire schema does not cover, this file stops compiling, so the contract
|
|
12
|
+
* can never silently drift from what the code produces.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
const zod_1 = require("zod");
|
|
17
|
+
/** Terminal status of a completed command. */
|
|
18
|
+
exports.envelopeStatusSchema = zod_1.z.enum(['ok', 'error']);
|
|
19
|
+
/** A single structured error/warning drained from the error stack. */
|
|
20
|
+
exports.stackMessageSchema = zod_1.z.object({
|
|
21
|
+
type: zod_1.z.enum(['error', 'warning']),
|
|
22
|
+
message: zod_1.z.string(),
|
|
23
|
+
});
|
|
24
|
+
/** A command's typed result: a namespaced kind and an opaque payload. */
|
|
25
|
+
exports.envelopeModelSchema = zod_1.z.object({
|
|
26
|
+
kind: zod_1.z.string(),
|
|
27
|
+
data: zod_1.z.unknown(),
|
|
28
|
+
});
|
|
29
|
+
/** The record of how a natural-language input resolved into a command. */
|
|
30
|
+
exports.resolutionTraceSchema = zod_1.z.object({
|
|
31
|
+
input: zod_1.z.string(),
|
|
32
|
+
proposed: zod_1.z.string(),
|
|
33
|
+
validated: zod_1.z.boolean(),
|
|
34
|
+
executed: zod_1.z.string().optional(),
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* The envelope in which one command's complete outcome crosses the wire.
|
|
38
|
+
*/
|
|
39
|
+
exports.commandEnvelopeSchema = zod_1.z.object({
|
|
40
|
+
status: exports.envelopeStatusSchema,
|
|
41
|
+
rendered: zod_1.z.string(),
|
|
42
|
+
renderedErr: zod_1.z.string().optional(),
|
|
43
|
+
model: exports.envelopeModelSchema.optional(),
|
|
44
|
+
errors: zod_1.z.array(exports.stackMessageSchema).optional(),
|
|
45
|
+
trace: exports.resolutionTraceSchema.optional(),
|
|
46
|
+
});
|
|
47
|
+
const _envelopeCoversCumin = true;
|
|
48
|
+
void _envelopeCoversCumin;
|
|
49
|
+
//# sourceMappingURL=envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/protocol/envelope.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,6BAAwB;AAGxB,8CAA8C;AACjC,QAAA,oBAAoB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AAE5D,sEAAsE;AACzD,QAAA,kBAAkB,GAAG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