@agimon-ai/po-artifact 0.0.0-alpha.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/LICENSE +21 -0
- package/README.md +18 -0
- package/dist/apiContracts.cjs +112 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +107 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/native.mjs +700 -0
- package/dist/extensions/native.mjs.map +1 -0
- package/dist/extensions/server.cjs +561 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +532 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +507 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +0 -0
- package/dist/index.d.mts +22 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +152 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vuong Ngo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Po Artifacts
|
|
2
|
+
|
|
3
|
+
Always-loaded session artifact storage and web/native views.
|
|
4
|
+
|
|
5
|
+
Each session owns a durable folder under the configured Po agent directory:
|
|
6
|
+
`doom-artifacts/<session-id>/`. The agent's system prompt names that folder for
|
|
7
|
+
user-designated artifacts and important deliverable documents. Ordinary source
|
|
8
|
+
edits stay in the project.
|
|
9
|
+
|
|
10
|
+
The Artifacts activity section shows the three most recently modified files.
|
|
11
|
+
Its heading opens every artifact in the current session as a grid. Files open
|
|
12
|
+
read-only, using artifact-scoped authenticated reads. Nested regular files are
|
|
13
|
+
included; symlinks are not followed. Artifacts are not deleted on session disposal.
|
|
14
|
+
|
|
15
|
+
Text previews are limited to 1 MiB, raw downloads to 25 MiB, and native in-memory
|
|
16
|
+
media/downloads to 5 MiB. Secure filesystem reads use macOS no-follow-all semantics
|
|
17
|
+
or Linux descriptor-relative traversal through `/proc/self/fd`. Other server
|
|
18
|
+
platforms fail closed rather than permit ancestor-symlink races.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
|
+
let typebox = require("typebox");
|
|
7
|
+
//#region src/schemas/apiContracts.ts
|
|
8
|
+
const S = typebox.Type.String();
|
|
9
|
+
const N = typebox.Type.Number();
|
|
10
|
+
const ArtifactsPayloadSchema = typebox.Type.Object({
|
|
11
|
+
items: typebox.Type.Array(typebox.Type.Object({
|
|
12
|
+
path: S,
|
|
13
|
+
name: S,
|
|
14
|
+
size: N,
|
|
15
|
+
modifiedAt: N
|
|
16
|
+
})),
|
|
17
|
+
error: typebox.Type.Optional(S)
|
|
18
|
+
});
|
|
19
|
+
const query = [{
|
|
20
|
+
name: "path",
|
|
21
|
+
in: "query",
|
|
22
|
+
required: true,
|
|
23
|
+
schema: typebox.Type.String({ minLength: 1 })
|
|
24
|
+
}];
|
|
25
|
+
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
26
|
+
version: 1,
|
|
27
|
+
dynamic: [],
|
|
28
|
+
http: [
|
|
29
|
+
{
|
|
30
|
+
id: "artifacts.list",
|
|
31
|
+
scope: "session",
|
|
32
|
+
basePath: "artifacts",
|
|
33
|
+
path: "/",
|
|
34
|
+
method: "GET",
|
|
35
|
+
authentication: "owner",
|
|
36
|
+
description: "List regular artifacts in the current session folder by modification time.",
|
|
37
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(ArtifactsPayloadSchema)
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "artifacts.preview",
|
|
41
|
+
scope: "session",
|
|
42
|
+
basePath: "artifacts",
|
|
43
|
+
path: "/preview",
|
|
44
|
+
method: "GET",
|
|
45
|
+
authentication: "owner",
|
|
46
|
+
description: "Read bounded text preview from the current session artifact folder.",
|
|
47
|
+
parameters: query,
|
|
48
|
+
responses: (0, _agimon_ai_po_core_apiContracts.jsonApiResponses)(typebox.Type.Object({
|
|
49
|
+
path: S,
|
|
50
|
+
content: S,
|
|
51
|
+
mimeType: S,
|
|
52
|
+
unavailable: typebox.Type.Optional(typebox.Type.Boolean()),
|
|
53
|
+
reason: typebox.Type.Optional(S)
|
|
54
|
+
}))
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "artifacts.content",
|
|
58
|
+
scope: "session",
|
|
59
|
+
basePath: "artifacts",
|
|
60
|
+
path: "/content",
|
|
61
|
+
method: "GET",
|
|
62
|
+
authentication: "owner",
|
|
63
|
+
description: "Read bounded artifact bytes, with range and version checks.",
|
|
64
|
+
parameters: [
|
|
65
|
+
...query,
|
|
66
|
+
{
|
|
67
|
+
name: "Range",
|
|
68
|
+
in: "header",
|
|
69
|
+
required: false,
|
|
70
|
+
schema: S
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "If-Match",
|
|
74
|
+
in: "header",
|
|
75
|
+
required: false,
|
|
76
|
+
schema: S
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
responses: {
|
|
80
|
+
"200": {
|
|
81
|
+
description: "Artifact bytes.",
|
|
82
|
+
contentType: "application/octet-stream"
|
|
83
|
+
},
|
|
84
|
+
"206": {
|
|
85
|
+
description: "Artifact byte range.",
|
|
86
|
+
contentType: "application/octet-stream"
|
|
87
|
+
},
|
|
88
|
+
"400": { description: "Invalid artifact path." },
|
|
89
|
+
"403": { description: "Artifact access rejected." },
|
|
90
|
+
"404": { description: "Artifact missing." },
|
|
91
|
+
"412": { description: "Artifact changed." },
|
|
92
|
+
"413": { description: "Artifact too large." },
|
|
93
|
+
"416": { description: "Invalid byte range." }
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
sockets: ["global", "workspace"].map((scope) => ({
|
|
98
|
+
id: "artifacts.channel",
|
|
99
|
+
scope,
|
|
100
|
+
service: "po.hub.v1",
|
|
101
|
+
member: "artifacts",
|
|
102
|
+
kind: "channel",
|
|
103
|
+
direction: "server-to-client",
|
|
104
|
+
description: "Current-session artifact metadata in the hub frame payload.",
|
|
105
|
+
input: ArtifactsPayloadSchema
|
|
106
|
+
}))
|
|
107
|
+
});
|
|
108
|
+
//#endregion
|
|
109
|
+
exports.apiContracts = apiContracts;
|
|
110
|
+
exports.default = apiContracts;
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=apiContracts.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["Type","defineApiContract","jsonApiResponses"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nexport const ArtifactsPayloadSchema = Type.Object({\n items: Type.Array(Type.Object({ path: S, name: S, size: N, modifiedAt: N })),\n error: Type.Optional(S),\n});\nconst query = [{ name: 'path', in: 'query' as const, required: true, schema: Type.String({ minLength: 1 }) }];\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: [\n {\n id: 'artifacts.list',\n scope: 'session',\n basePath: 'artifacts',\n path: '/',\n method: 'GET',\n authentication: 'owner',\n description: 'List regular artifacts in the current session folder by modification time.',\n responses: jsonApiResponses(ArtifactsPayloadSchema),\n },\n {\n id: 'artifacts.preview',\n scope: 'session',\n basePath: 'artifacts',\n path: '/preview',\n method: 'GET',\n authentication: 'owner',\n description: 'Read bounded text preview from the current session artifact folder.',\n parameters: query,\n responses: jsonApiResponses(\n Type.Object({\n path: S,\n content: S,\n mimeType: S,\n unavailable: Type.Optional(Type.Boolean()),\n reason: Type.Optional(S),\n }),\n ),\n },\n {\n id: 'artifacts.content',\n scope: 'session',\n basePath: 'artifacts',\n path: '/content',\n method: 'GET',\n authentication: 'owner',\n description: 'Read bounded artifact bytes, with range and version checks.',\n parameters: [\n ...query,\n { name: 'Range', in: 'header', required: false, schema: S },\n { name: 'If-Match', in: 'header', required: false, schema: S },\n ],\n responses: {\n '200': { description: 'Artifact bytes.', contentType: 'application/octet-stream' },\n '206': { description: 'Artifact byte range.', contentType: 'application/octet-stream' },\n '400': { description: 'Invalid artifact path.' },\n '403': { description: 'Artifact access rejected.' },\n '404': { description: 'Artifact missing.' },\n '412': { description: 'Artifact changed.' },\n '413': { description: 'Artifact too large.' },\n '416': { description: 'Invalid byte range.' },\n },\n },\n ],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'artifacts.channel',\n scope,\n service: 'po.hub.v1',\n member: 'artifacts',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Current-session artifact metadata in the hub frame payload.',\n input: ArtifactsPayloadSchema,\n })),\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAa,yBAAyBA,QAAAA,KAAK,OAAO;CAChD,OAAOA,QAAAA,KAAK,MAAMA,QAAAA,KAAK,OAAO;EAAE,MAAM;EAAG,MAAM;EAAG,MAAM;EAAG,YAAY;CAAE,CAAC,CAAC;CAC3E,OAAOA,QAAAA,KAAK,SAAS,CAAC;AACxB,CAAC;AACD,MAAM,QAAQ,CAAC;CAAE,MAAM;CAAQ,IAAI;CAAkB,UAAU;CAAM,QAAQA,QAAAA,KAAK,OAAO,EAAE,WAAW,EAAE,CAAC;AAAE,CAAC;AAC5G,MAAa,gBAAA,GAAeC,gCAAAA,kBAAAA,CAAkB;CAC5C,SAAS;CACT,SAAS,CAAC;CACV,MAAM;EACJ;GACE,IAAI;GACJ,OAAO;GACP,UAAU;GACV,MAAM;GACN,QAAQ;GACR,gBAAgB;GAChB,aAAa;GACb,YAAA,GAAWC,gCAAAA,iBAAAA,CAAiB,sBAAsB;EACpD;EACA;GACE,IAAI;GACJ,OAAO;GACP,UAAU;GACV,MAAM;GACN,QAAQ;GACR,gBAAgB;GAChB,aAAa;GACb,YAAY;GACZ,YAAA,GAAWA,gCAAAA,iBAAAA,CACTF,QAAAA,KAAK,OAAO;IACV,MAAM;IACN,SAAS;IACT,UAAU;IACV,aAAaA,QAAAA,KAAK,SAASA,QAAAA,KAAK,QAAQ,CAAC;IACzC,QAAQA,QAAAA,KAAK,SAAS,CAAC;GACzB,CAAC,CACH;EACF;EACA;GACE,IAAI;GACJ,OAAO;GACP,UAAU;GACV,MAAM;GACN,QAAQ;GACR,gBAAgB;GAChB,aAAa;GACb,YAAY;IACV,GAAG;IACH;KAAE,MAAM;KAAS,IAAI;KAAU,UAAU;KAAO,QAAQ;IAAE;IAC1D;KAAE,MAAM;KAAY,IAAI;KAAU,UAAU;KAAO,QAAQ;IAAE;GAC/D;GACA,WAAW;IACT,OAAO;KAAE,aAAa;KAAmB,aAAa;IAA2B;IACjF,OAAO;KAAE,aAAa;KAAwB,aAAa;IAA2B;IACtF,OAAO,EAAE,aAAa,yBAAyB;IAC/C,OAAO,EAAE,aAAa,4BAA4B;IAClD,OAAO,EAAE,aAAa,oBAAoB;IAC1C,OAAO,EAAE,aAAa,oBAAoB;IAC1C,OAAO,EAAE,aAAa,sBAAsB;IAC5C,OAAO,EAAE,aAAa,sBAAsB;GAC9C;EACF;CACF;CACA,SAAU,CAAC,UAAU,WAAW,CAAC,CAAW,KAAK,WAAW;EAC1D,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO;CACT,EAAE;AACJ,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
//#region src/schemas/apiContracts.d.ts
|
|
3
|
+
export declare const apiContracts: {
|
|
4
|
+
version: 1;
|
|
5
|
+
protocols?: Record<string, string> | undefined;
|
|
6
|
+
schemas?: Record<string, boolean | object> | undefined;
|
|
7
|
+
http: {
|
|
8
|
+
id: string;
|
|
9
|
+
scope: "global" | "session" | "workspace";
|
|
10
|
+
basePath?: string | undefined;
|
|
11
|
+
path: string;
|
|
12
|
+
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
13
|
+
description: string;
|
|
14
|
+
availability?: string | undefined;
|
|
15
|
+
authentication: "device" | "none" | "owner";
|
|
16
|
+
parameters?: {
|
|
17
|
+
name: string;
|
|
18
|
+
in: "header" | "path" | "query";
|
|
19
|
+
required: boolean;
|
|
20
|
+
schema: boolean | object;
|
|
21
|
+
}[] | undefined;
|
|
22
|
+
body?: {
|
|
23
|
+
contentType: string;
|
|
24
|
+
contentTypes?: string[] | undefined;
|
|
25
|
+
required: boolean;
|
|
26
|
+
schema: boolean | object;
|
|
27
|
+
} | undefined;
|
|
28
|
+
responses: Record<string, {
|
|
29
|
+
description: string;
|
|
30
|
+
contentType?: string | undefined;
|
|
31
|
+
schema?: boolean | object | undefined;
|
|
32
|
+
events?: Record<string, boolean | object> | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
}[];
|
|
35
|
+
sockets: {
|
|
36
|
+
id: string;
|
|
37
|
+
scope: "global" | "session" | "workspace";
|
|
38
|
+
description: string;
|
|
39
|
+
availability?: string | undefined;
|
|
40
|
+
service: string;
|
|
41
|
+
member: string;
|
|
42
|
+
direction: "client-to-server" | "server-to-client";
|
|
43
|
+
kind: "channel" | "method" | "state";
|
|
44
|
+
input: boolean | object;
|
|
45
|
+
output?: boolean | object | undefined;
|
|
46
|
+
errors?: boolean | object | undefined;
|
|
47
|
+
}[];
|
|
48
|
+
dynamic: string[];
|
|
49
|
+
gaps?: string[] | undefined;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { apiContracts as default };
|
|
53
|
+
//# sourceMappingURL=apiContracts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAUa"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { defineApiContract, jsonApiResponses } from "@agimon-ai/po-core/apiContracts";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
//#region src/schemas/apiContracts.ts
|
|
4
|
+
const S = Type.String();
|
|
5
|
+
const N = Type.Number();
|
|
6
|
+
const ArtifactsPayloadSchema = Type.Object({
|
|
7
|
+
items: Type.Array(Type.Object({
|
|
8
|
+
path: S,
|
|
9
|
+
name: S,
|
|
10
|
+
size: N,
|
|
11
|
+
modifiedAt: N
|
|
12
|
+
})),
|
|
13
|
+
error: Type.Optional(S)
|
|
14
|
+
});
|
|
15
|
+
const query = [{
|
|
16
|
+
name: "path",
|
|
17
|
+
in: "query",
|
|
18
|
+
required: true,
|
|
19
|
+
schema: Type.String({ minLength: 1 })
|
|
20
|
+
}];
|
|
21
|
+
const apiContracts = defineApiContract({
|
|
22
|
+
version: 1,
|
|
23
|
+
dynamic: [],
|
|
24
|
+
http: [
|
|
25
|
+
{
|
|
26
|
+
id: "artifacts.list",
|
|
27
|
+
scope: "session",
|
|
28
|
+
basePath: "artifacts",
|
|
29
|
+
path: "/",
|
|
30
|
+
method: "GET",
|
|
31
|
+
authentication: "owner",
|
|
32
|
+
description: "List regular artifacts in the current session folder by modification time.",
|
|
33
|
+
responses: jsonApiResponses(ArtifactsPayloadSchema)
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "artifacts.preview",
|
|
37
|
+
scope: "session",
|
|
38
|
+
basePath: "artifacts",
|
|
39
|
+
path: "/preview",
|
|
40
|
+
method: "GET",
|
|
41
|
+
authentication: "owner",
|
|
42
|
+
description: "Read bounded text preview from the current session artifact folder.",
|
|
43
|
+
parameters: query,
|
|
44
|
+
responses: jsonApiResponses(Type.Object({
|
|
45
|
+
path: S,
|
|
46
|
+
content: S,
|
|
47
|
+
mimeType: S,
|
|
48
|
+
unavailable: Type.Optional(Type.Boolean()),
|
|
49
|
+
reason: Type.Optional(S)
|
|
50
|
+
}))
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "artifacts.content",
|
|
54
|
+
scope: "session",
|
|
55
|
+
basePath: "artifacts",
|
|
56
|
+
path: "/content",
|
|
57
|
+
method: "GET",
|
|
58
|
+
authentication: "owner",
|
|
59
|
+
description: "Read bounded artifact bytes, with range and version checks.",
|
|
60
|
+
parameters: [
|
|
61
|
+
...query,
|
|
62
|
+
{
|
|
63
|
+
name: "Range",
|
|
64
|
+
in: "header",
|
|
65
|
+
required: false,
|
|
66
|
+
schema: S
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "If-Match",
|
|
70
|
+
in: "header",
|
|
71
|
+
required: false,
|
|
72
|
+
schema: S
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
responses: {
|
|
76
|
+
"200": {
|
|
77
|
+
description: "Artifact bytes.",
|
|
78
|
+
contentType: "application/octet-stream"
|
|
79
|
+
},
|
|
80
|
+
"206": {
|
|
81
|
+
description: "Artifact byte range.",
|
|
82
|
+
contentType: "application/octet-stream"
|
|
83
|
+
},
|
|
84
|
+
"400": { description: "Invalid artifact path." },
|
|
85
|
+
"403": { description: "Artifact access rejected." },
|
|
86
|
+
"404": { description: "Artifact missing." },
|
|
87
|
+
"412": { description: "Artifact changed." },
|
|
88
|
+
"413": { description: "Artifact too large." },
|
|
89
|
+
"416": { description: "Invalid byte range." }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
sockets: ["global", "workspace"].map((scope) => ({
|
|
94
|
+
id: "artifacts.channel",
|
|
95
|
+
scope,
|
|
96
|
+
service: "po.hub.v1",
|
|
97
|
+
member: "artifacts",
|
|
98
|
+
kind: "channel",
|
|
99
|
+
direction: "server-to-client",
|
|
100
|
+
description: "Current-session artifact metadata in the hub frame payload.",
|
|
101
|
+
input: ArtifactsPayloadSchema
|
|
102
|
+
}))
|
|
103
|
+
});
|
|
104
|
+
//#endregion
|
|
105
|
+
export { apiContracts, apiContracts as default };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=apiContracts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract, jsonApiResponses } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nexport const ArtifactsPayloadSchema = Type.Object({\n items: Type.Array(Type.Object({ path: S, name: S, size: N, modifiedAt: N })),\n error: Type.Optional(S),\n});\nconst query = [{ name: 'path', in: 'query' as const, required: true, schema: Type.String({ minLength: 1 }) }];\nexport const apiContracts = defineApiContract({\n version: 1,\n dynamic: [],\n http: [\n {\n id: 'artifacts.list',\n scope: 'session',\n basePath: 'artifacts',\n path: '/',\n method: 'GET',\n authentication: 'owner',\n description: 'List regular artifacts in the current session folder by modification time.',\n responses: jsonApiResponses(ArtifactsPayloadSchema),\n },\n {\n id: 'artifacts.preview',\n scope: 'session',\n basePath: 'artifacts',\n path: '/preview',\n method: 'GET',\n authentication: 'owner',\n description: 'Read bounded text preview from the current session artifact folder.',\n parameters: query,\n responses: jsonApiResponses(\n Type.Object({\n path: S,\n content: S,\n mimeType: S,\n unavailable: Type.Optional(Type.Boolean()),\n reason: Type.Optional(S),\n }),\n ),\n },\n {\n id: 'artifacts.content',\n scope: 'session',\n basePath: 'artifacts',\n path: '/content',\n method: 'GET',\n authentication: 'owner',\n description: 'Read bounded artifact bytes, with range and version checks.',\n parameters: [\n ...query,\n { name: 'Range', in: 'header', required: false, schema: S },\n { name: 'If-Match', in: 'header', required: false, schema: S },\n ],\n responses: {\n '200': { description: 'Artifact bytes.', contentType: 'application/octet-stream' },\n '206': { description: 'Artifact byte range.', contentType: 'application/octet-stream' },\n '400': { description: 'Invalid artifact path.' },\n '403': { description: 'Artifact access rejected.' },\n '404': { description: 'Artifact missing.' },\n '412': { description: 'Artifact changed.' },\n '413': { description: 'Artifact too large.' },\n '416': { description: 'Invalid byte range.' },\n },\n },\n ],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'artifacts.channel',\n scope,\n service: 'po.hub.v1',\n member: 'artifacts',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Current-session artifact metadata in the hub frame payload.',\n input: ArtifactsPayloadSchema,\n })),\n});\n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