@layernorm/overlay-agent-bridge-protocol 0.3.10 → 0.4.2

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 CHANGED
@@ -12,4 +12,4 @@ npm install @layernorm/overlay-agent-bridge-protocol@0.3.4 @layernorm/overlay-ag
12
12
 
13
13
  Protocol version 1 fails closed on unknown versions, invalid event sequences, oversized payloads,
14
14
  and malformed filesystem grants. See the repository's
15
- `docs/develop/bring-your-own-agents.md` for the complete trust and compatibility policy.
15
+ `internal/develop/bring-your-own-agents.md` for the complete trust and compatibility policy.
@@ -0,0 +1,4 @@
1
+ /** Portable wire paths. Reject aliases rather than silently normalizing file identity. */
2
+ export declare function drivePathSegments(path: string): string[];
3
+ export declare function portableDrivePathKey(path: string): string;
4
+ //# sourceMappingURL=drive-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drive-path.d.ts","sourceRoot":"","sources":["../src/drive-path.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAOxD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGzD"}
@@ -0,0 +1,16 @@
1
+ /** Portable wire paths. Reject aliases rather than silently normalizing file identity. */
2
+ export function drivePathSegments(path) {
3
+ if (!path || path.length > 4096 || path.includes('\\') || path.includes('\0') || path.startsWith('/'))
4
+ throw Error('DRIVE_UNSAFE_PATH');
5
+ const segments = path.split('/');
6
+ if (segments.some(segment => !segment || segment === '.' || segment === '..' || segment.length > 255
7
+ || /[\u0000-\u001f\u007f<>:"|?*]/u.test(segment) || /[. ]$/.test(segment)
8
+ || /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(segment)))
9
+ throw Error('DRIVE_UNSAFE_PATH');
10
+ return segments;
11
+ }
12
+ export function portableDrivePathKey(path) {
13
+ drivePathSegments(path);
14
+ return path.normalize('NFC').toLowerCase();
15
+ }
16
+ //# sourceMappingURL=drive-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drive-path.js","sourceRoot":"","sources":["../src/drive-path.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,MAAM,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACvI,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAChC,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,GAAG;WAC/F,+BAA+B,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;WACtE,+CAA+C,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAAE,MAAM,KAAK,CAAC,mBAAmB,CAAC,CAAA;IACrG,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,iBAAiB,CAAC,IAAI,CAAC,CAAA;IACvB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;AAC5C,CAAC"}
@@ -0,0 +1,189 @@
1
+ import { z } from 'zod';
2
+ /** Receipt lookup only: this request never grants authority to repeat an old write. */
3
+ export declare const driveRecoveryRequestSchema: z.ZodObject<{
4
+ kind: z.ZodEnum<["content", "metadata"]>;
5
+ fingerprint: z.ZodString;
6
+ requestId: z.ZodString;
7
+ previousExecution: z.ZodObject<{
8
+ attemptId: z.ZodString;
9
+ generation: z.ZodNumber;
10
+ }, "strict", z.ZodTypeAny, {
11
+ attemptId: string;
12
+ generation: number;
13
+ }, {
14
+ attemptId: string;
15
+ generation: number;
16
+ }>;
17
+ action: z.ZodLiteral<"recover">;
18
+ }, "strict", z.ZodTypeAny, {
19
+ kind: "metadata" | "content";
20
+ action: "recover";
21
+ requestId: string;
22
+ fingerprint: string;
23
+ previousExecution: {
24
+ attemptId: string;
25
+ generation: number;
26
+ };
27
+ }, {
28
+ kind: "metadata" | "content";
29
+ action: "recover";
30
+ requestId: string;
31
+ fingerprint: string;
32
+ previousExecution: {
33
+ attemptId: string;
34
+ generation: number;
35
+ };
36
+ }>;
37
+ export declare const driveRecoveryResultSchema: z.ZodObject<{
38
+ resolution: z.ZodDiscriminatedUnion<"state", [z.ZodObject<{
39
+ state: z.ZodLiteral<"uncommitted">;
40
+ }, "strict", z.ZodTypeAny, {
41
+ state: "uncommitted";
42
+ }, {
43
+ state: "uncommitted";
44
+ }>, z.ZodObject<{
45
+ state: z.ZodLiteral<"content_committed">;
46
+ uploadId: z.ZodString;
47
+ result: z.ZodObject<{
48
+ fileId: z.ZodString;
49
+ updatedAt: z.ZodNumber;
50
+ name: z.ZodString;
51
+ conflict: z.ZodBoolean;
52
+ objectStored: z.ZodBoolean;
53
+ sha256: z.ZodString;
54
+ sizeBytes: z.ZodNumber;
55
+ }, "strict", z.ZodTypeAny, {
56
+ fileId: string;
57
+ updatedAt: number;
58
+ name: string;
59
+ sha256: string;
60
+ sizeBytes: number;
61
+ conflict: boolean;
62
+ objectStored: boolean;
63
+ }, {
64
+ fileId: string;
65
+ updatedAt: number;
66
+ name: string;
67
+ sha256: string;
68
+ sizeBytes: number;
69
+ conflict: boolean;
70
+ objectStored: boolean;
71
+ }>;
72
+ }, "strict", z.ZodTypeAny, {
73
+ state: "content_committed";
74
+ uploadId: string;
75
+ result: {
76
+ fileId: string;
77
+ updatedAt: number;
78
+ name: string;
79
+ sha256: string;
80
+ sizeBytes: number;
81
+ conflict: boolean;
82
+ objectStored: boolean;
83
+ };
84
+ }, {
85
+ state: "content_committed";
86
+ uploadId: string;
87
+ result: {
88
+ fileId: string;
89
+ updatedAt: number;
90
+ name: string;
91
+ sha256: string;
92
+ sizeBytes: number;
93
+ conflict: boolean;
94
+ objectStored: boolean;
95
+ };
96
+ }>, z.ZodObject<{
97
+ state: z.ZodLiteral<"metadata_committed">;
98
+ result: z.ZodObject<{
99
+ fileId: z.ZodString;
100
+ updatedAt: z.ZodNumber;
101
+ }, "strict", z.ZodTypeAny, {
102
+ fileId: string;
103
+ updatedAt: number;
104
+ }, {
105
+ fileId: string;
106
+ updatedAt: number;
107
+ }>;
108
+ }, "strict", z.ZodTypeAny, {
109
+ state: "metadata_committed";
110
+ result: {
111
+ fileId: string;
112
+ updatedAt: number;
113
+ };
114
+ }, {
115
+ state: "metadata_committed";
116
+ result: {
117
+ fileId: string;
118
+ updatedAt: number;
119
+ };
120
+ }>]>;
121
+ requestId: z.ZodString;
122
+ previousExecution: z.ZodObject<{
123
+ attemptId: z.ZodString;
124
+ generation: z.ZodNumber;
125
+ }, "strict", z.ZodTypeAny, {
126
+ attemptId: string;
127
+ generation: number;
128
+ }, {
129
+ attemptId: string;
130
+ generation: number;
131
+ }>;
132
+ }, "strict", z.ZodTypeAny, {
133
+ requestId: string;
134
+ previousExecution: {
135
+ attemptId: string;
136
+ generation: number;
137
+ };
138
+ resolution: {
139
+ state: "uncommitted";
140
+ } | {
141
+ state: "content_committed";
142
+ uploadId: string;
143
+ result: {
144
+ fileId: string;
145
+ updatedAt: number;
146
+ name: string;
147
+ sha256: string;
148
+ sizeBytes: number;
149
+ conflict: boolean;
150
+ objectStored: boolean;
151
+ };
152
+ } | {
153
+ state: "metadata_committed";
154
+ result: {
155
+ fileId: string;
156
+ updatedAt: number;
157
+ };
158
+ };
159
+ }, {
160
+ requestId: string;
161
+ previousExecution: {
162
+ attemptId: string;
163
+ generation: number;
164
+ };
165
+ resolution: {
166
+ state: "uncommitted";
167
+ } | {
168
+ state: "content_committed";
169
+ uploadId: string;
170
+ result: {
171
+ fileId: string;
172
+ updatedAt: number;
173
+ name: string;
174
+ sha256: string;
175
+ sizeBytes: number;
176
+ conflict: boolean;
177
+ objectStored: boolean;
178
+ };
179
+ } | {
180
+ state: "metadata_committed";
181
+ result: {
182
+ fileId: string;
183
+ updatedAt: number;
184
+ };
185
+ };
186
+ }>;
187
+ export type DriveRecoveryRequest = z.infer<typeof driveRecoveryRequestSchema>;
188
+ export type DriveRecoveryResult = z.infer<typeof driveRecoveryResultSchema>;
189
+ //# sourceMappingURL=drive-recovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drive-recovery.d.ts","sourceRoot":"","sources":["../src/drive-recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAMrB,uFAAuF;AACvF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE5B,CAAA;AACX,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzB,CAAA;AACb,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAC7E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { driveContentResultSchema, driveMetadataResultSchema } from './drive.js';
3
+ const previousExecution = z.object({ attemptId: z.string().min(1).max(200), generation: z.number().int().positive() }).strict();
4
+ const identity = { requestId: z.string().regex(/^[A-Za-z0-9_-]{16,128}$/), previousExecution };
5
+ /** Receipt lookup only: this request never grants authority to repeat an old write. */
6
+ export const driveRecoveryRequestSchema = z.object({ action: z.literal('recover'), ...identity,
7
+ kind: z.enum(['content', 'metadata']), fingerprint: z.string().min(1).max(16384),
8
+ }).strict();
9
+ export const driveRecoveryResultSchema = z.object({ ...identity, resolution: z.discriminatedUnion('state', [
10
+ z.object({ state: z.literal('uncommitted') }).strict(),
11
+ z.object({ state: z.literal('content_committed'), uploadId: z.string().uuid(), result: driveContentResultSchema }).strict(),
12
+ z.object({ state: z.literal('metadata_committed'), result: driveMetadataResultSchema }).strict(),
13
+ ]) }).strict();
14
+ //# sourceMappingURL=drive-recovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drive-recovery.js","sourceRoot":"","sources":["../src/drive-recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AACrB,OAAO,EAAC,wBAAwB,EAAE,yBAAyB,EAAC,MAAM,YAAY,CAAA;AAE9E,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAC,CAAC,CAAC,MAAM,EAAE,CAAA;AAC7H,MAAM,QAAQ,GAAG,EAAC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,yBAAyB,CAAC,EAAE,iBAAiB,EAAC,CAAA;AAE5F,uFAAuF;AACvF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,GAAG,QAAQ;IAC3F,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;CACjF,CAAC,CAAC,MAAM,EAAE,CAAA;AACX,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAC,GAAG,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE;QACxG,CAAC,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,EAAC,CAAC,CAAC,MAAM,EAAE;QACpD,CAAC,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,wBAAwB,EAAC,CAAC,CAAC,MAAM,EAAE;QACzH,CAAC,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAC,CAAC,CAAC,MAAM,EAAE;KAC/F,CAAC,EAAC,CAAC,CAAC,MAAM,EAAE,CAAA"}