@agentproto/workspace 0.1.0-alpha.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 +23 -0
- package/dist/chunk-O7MX54WR.mjs +29 -0
- package/dist/chunk-O7MX54WR.mjs.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.mjs +14 -0
- package/dist/index.mjs.map +1 -0
- package/dist/manifest/index.d.ts +77 -0
- package/dist/manifest/index.mjs +28 -0
- package/dist/manifest/index.mjs.map +1 -0
- package/dist/types-fudFG_yV.d.ts +412 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 agentproto contributors
|
|
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,23 @@
|
|
|
1
|
+
# @agentproto/workspace
|
|
2
|
+
|
|
3
|
+
AIP-34 `WORKSPACE.md` reference implementation. A markdown + frontmatter format for declaring a workspace's identity — globally addressable id, owner, storage choice, defaults, publish posture. The root manifest of every AIP-organized workspace; pairs with STORAGE.md (AIP-35) for the storage policy block.
|
|
4
|
+
|
|
5
|
+
> **Status: 0.1.0-alpha.** Generated by `scripts/scaffold-aip.mjs` — `build()` and `validate()` bodies are TODOs.
|
|
6
|
+
|
|
7
|
+
Spec: <https://agentproto.sh/docs/aip-34>
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { defineWorkspace } from "@agentproto/workspace"
|
|
13
|
+
|
|
14
|
+
const x = defineWorkspace({
|
|
15
|
+
id: "my-workspace",
|
|
16
|
+
description: "Short purpose.",
|
|
17
|
+
// ...
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createDoctype } from '@agentproto/define-doctype';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @agentproto/workspace v0.1.0-alpha
|
|
6
|
+
* AIP-34 WORKSPACE.md `defineWorkspace` reference implementation.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var workspaceFrontmatterSchema = z.object({ "schema": z.literal("workspace/v1"), "id": z.string().regex(new RegExp("^@[a-z0-9][a-z0-9-]*/[a-z0-9][a-z0-9-]*$")).describe("Globally addressable id `@<owner-slug>/<workspace-slug>`. Lowercase kebab-case, immutable across the workspace's lifetime."), "version": z.string().regex(new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.\\-]+)?$")).describe("Spec version of THIS file. Bump on breaking shape change."), "name": z.string().min(1).max(80).describe("Human-readable display name."), "description": z.string().max(2e3).describe("One-paragraph purpose.").optional(), "owner": z.object({ "type": z.enum(["guild", "user", "org"]), "id": z.string().min(1), "slug": z.string().regex(new RegExp("^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$")).min(1).describe("Owner-side slug. MUST match the slug suffix of the workspace `id`.") }).strict(), "storage": z.any().describe("AIP-35 STORAGE block. Required. Inline / ref / file."), "sandbox": z.any().describe("AIP-36 SANDBOX block. Optional \u2014 when absent, command-execution tools MUST be unavailable.").optional(), "code": z.any().describe("AIP-26 CODE block. Optional \u2014 when present, the workspace IS a code-workspace / repo (codespace pattern).").optional(), "identity": z.any().describe("AIP-23 identity-ref \u2014 default identity for sub-blocks. Sub-blocks (storage, sandbox, code) may override.").optional(), "defaults": z.object({ "read_only": z.boolean().optional() }).catchall(z.any()).optional(), "publish": z.object({ "template": z.boolean().default(false), "registry": z.string().optional(), "visibility": z.enum(["private", "unlisted", "public"]).default("private") }).strict().optional(), "tags": z.array(z.string()).default([]), "created_at": z.string().datetime({ offset: true }).optional(), "metadata": z.record(z.string(), z.any()).optional() }).strict().describe("Validates the YAML frontmatter portion of an AIP-34 WORKSPACE.md manifest. Composes the AIP-35 STORAGE block (required), AIP-36 SANDBOX block (optional), AIP-26 CODE block (optional), AIP-23 identity-ref block (optional).");
|
|
10
|
+
var defineWorkspace = createDoctype({
|
|
11
|
+
aip: 34,
|
|
12
|
+
name: "workspace",
|
|
13
|
+
readDescription: (def) => def.name,
|
|
14
|
+
validate(def) {
|
|
15
|
+
const result = workspaceFrontmatterSchema.safeParse(def);
|
|
16
|
+
if (!result.success) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
`defineWorkspace (AIP-34): ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
build(def) {
|
|
23
|
+
return { ...def };
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { defineWorkspace, workspaceFrontmatterSchema };
|
|
28
|
+
//# sourceMappingURL=chunk-O7MX54WR.mjs.map
|
|
29
|
+
//# sourceMappingURL=chunk-O7MX54WR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts","../src/define-workspace.ts"],"names":[],"mappings":"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","file":"chunk-O7MX54WR.mjs","sourcesContent":["/**\n * AIP-34 WORKSPACE.md frontmatter zod schema.\n *\n * Generated from `resources/aip-34/draft/WORKSPACE.schema.json` via\n * json-schema-to-zod. Imported by both `define-workspace.ts` (TS path\n * validation) and `manifest/index.ts` (.md path validation) so every\n * field-level constraint runs in both authoring paths from a single\n * source of truth — re-run scaffold-aip to refresh after spec changes.\n *\n * Cross-field rules (if/then/allOf in JSON Schema) don't translate\n * cleanly and live in `define-workspace.ts`'s `validate(def)` instead.\n */\n\nimport { z } from \"zod\"\n\nexport const workspaceFrontmatterSchema = z.object({ \"schema\": z.literal(\"workspace/v1\"), \"id\": z.string().regex(new RegExp(\"^@[a-z0-9][a-z0-9-]*/[a-z0-9][a-z0-9-]*$\")).describe(\"Globally addressable id `@<owner-slug>/<workspace-slug>`. Lowercase kebab-case, immutable across the workspace's lifetime.\"), \"version\": z.string().regex(new RegExp(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:[-+][\\\\w.\\\\-]+)?$\")).describe(\"Spec version of THIS file. Bump on breaking shape change.\"), \"name\": z.string().min(1).max(80).describe(\"Human-readable display name.\"), \"description\": z.string().max(2000).describe(\"One-paragraph purpose.\").optional(), \"owner\": z.object({ \"type\": z.enum([\"guild\",\"user\",\"org\"]), \"id\": z.string().min(1), \"slug\": z.string().regex(new RegExp(\"^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$\")).min(1).describe(\"Owner-side slug. MUST match the slug suffix of the workspace `id`.\") }).strict(), \"storage\": z.any().describe(\"AIP-35 STORAGE block. Required. Inline / ref / file.\"), \"sandbox\": z.any().describe(\"AIP-36 SANDBOX block. Optional — when absent, command-execution tools MUST be unavailable.\").optional(), \"code\": z.any().describe(\"AIP-26 CODE block. Optional — when present, the workspace IS a code-workspace / repo (codespace pattern).\").optional(), \"identity\": z.any().describe(\"AIP-23 identity-ref — default identity for sub-blocks. Sub-blocks (storage, sandbox, code) may override.\").optional(), \"defaults\": z.object({ \"read_only\": z.boolean().optional() }).catchall(z.any()).optional(), \"publish\": z.object({ \"template\": z.boolean().default(false), \"registry\": z.string().optional(), \"visibility\": z.enum([\"private\",\"unlisted\",\"public\"]).default(\"private\") }).strict().optional(), \"tags\": z.array(z.string()).default([] as never), \"created_at\": z.string().datetime({ offset: true }).optional(), \"metadata\": z.record(z.string(), z.any()).optional() }).strict().describe(\"Validates the YAML frontmatter portion of an AIP-34 WORKSPACE.md manifest. Composes the AIP-35 STORAGE block (required), AIP-36 SANDBOX block (optional), AIP-26 CODE block (optional), AIP-23 identity-ref block (optional).\")\n\nexport type WorkspaceFrontmatter = z.infer<typeof workspaceFrontmatterSchema>\n","import { createDoctype } from \"@agentproto/define-doctype\"\nimport { workspaceFrontmatterSchema } from \"./schema.js\"\nimport type { WorkspaceDefinition, WorkspaceHandle } from \"./types.js\"\n\n/**\n * AIP-34 reference implementation of `defineWorkspace`.\n *\n * Built on `createDoctype` so the cross-AIP invariants (id pattern,\n * description length, top-level freeze, \"defineWorkspace (AIP-34): …\"\n * error prefix) run uniformly with every other AIP defineX.\n *\n * Field-level validation runs the schema-derived zod from\n * `./schema.ts` against the input. Same source of truth as the .md\n * path uses (`parseWorkspaceManifest`), so a malformed TS-authored\n * definition fails with the same diagnostic as a malformed manifest.\n * Cross-field rules go in `validate(def)` after the zod check.\n *\n * Identity / description extractors detected from the JSON Schema:\n * readIdentity: def.id\n * readDescription: def.name.\n */\nexport const defineWorkspace = createDoctype<WorkspaceDefinition, WorkspaceHandle>({\n aip: 34,\n name: \"workspace\",\n readDescription: (def) => def.name,\n validate(def) {\n const result = workspaceFrontmatterSchema.safeParse(def)\n if (!result.success) {\n throw new Error(\n `defineWorkspace (AIP-34): ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n // TODO: spec-34-specific cross-field rules (if/then/allOf in\n // the JSON Schema) — those don't translate to zod cleanly and\n // belong here. See @agentproto/operator's autonomy=gated rule.\n },\n build(def) {\n // Default build: spread the validated definition into a fresh object.\n // Hand-tune for nested freezing (Object.freeze on arrays/objects) and\n // for fields that need defaults applied — see @agentproto/operator\n // for a reference shape.\n return { ...def } as WorkspaceHandle\n },\n})\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { W as WorkspaceDefinition } from './types-fudFG_yV.js';
|
|
2
|
+
export { a as WorkspaceHandle } from './types-fudFG_yV.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AIP-34 reference implementation of `defineWorkspace`.
|
|
6
|
+
*
|
|
7
|
+
* Built on `createDoctype` so the cross-AIP invariants (id pattern,
|
|
8
|
+
* description length, top-level freeze, "defineWorkspace (AIP-34): …"
|
|
9
|
+
* error prefix) run uniformly with every other AIP defineX.
|
|
10
|
+
*
|
|
11
|
+
* Field-level validation runs the schema-derived zod from
|
|
12
|
+
* `./schema.ts` against the input. Same source of truth as the .md
|
|
13
|
+
* path uses (`parseWorkspaceManifest`), so a malformed TS-authored
|
|
14
|
+
* definition fails with the same diagnostic as a malformed manifest.
|
|
15
|
+
* Cross-field rules go in `validate(def)` after the zod check.
|
|
16
|
+
*
|
|
17
|
+
* Identity / description extractors detected from the JSON Schema:
|
|
18
|
+
* readIdentity: def.id
|
|
19
|
+
* readDescription: def.name.
|
|
20
|
+
*/
|
|
21
|
+
declare const defineWorkspace: (def: WorkspaceDefinition) => Readonly<WorkspaceDefinition>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @agentproto/workspace — AIP-34 WORKSPACE.md `defineWorkspace` reference impl.
|
|
25
|
+
*
|
|
26
|
+
* A markdown + frontmatter format for declaring a workspace's identity — globally addressable id, owner, storage choice, defaults, publish posture. The root manifest of every AIP-organized workspace; pairs with STORAGE.md (AIP-35) for the storage policy block.
|
|
27
|
+
*
|
|
28
|
+
* Spec: https://agentproto.sh/docs/aip-34
|
|
29
|
+
*
|
|
30
|
+
* Authoring paths:
|
|
31
|
+
* - TS: `defineWorkspace({...})` → `WorkspaceHandle`
|
|
32
|
+
* - MD: `parseWorkspaceManifest(src) → workspaceFromManifest({...})` → `WorkspaceHandle`
|
|
33
|
+
*/
|
|
34
|
+
declare const SPEC_NAME: "agentworkspace/v1";
|
|
35
|
+
declare const SPEC_VERSION: "1.0.0-alpha";
|
|
36
|
+
|
|
37
|
+
export { SPEC_NAME, SPEC_VERSION, WorkspaceDefinition, defineWorkspace };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { defineWorkspace } from './chunk-O7MX54WR.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @agentproto/workspace v0.1.0-alpha
|
|
5
|
+
* AIP-34 WORKSPACE.md `defineWorkspace` reference implementation.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
var SPEC_NAME = "agentworkspace/v1";
|
|
10
|
+
var SPEC_VERSION = "1.0.0-alpha";
|
|
11
|
+
|
|
12
|
+
export { SPEC_NAME, SPEC_VERSION };
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
14
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAYO,IAAM,SAAA,GAAY;AAClB,IAAM,YAAA,GAAe","file":"index.mjs","sourcesContent":["/**\n * @agentproto/workspace — AIP-34 WORKSPACE.md `defineWorkspace` reference impl.\n *\n * A markdown + frontmatter format for declaring a workspace's identity — globally addressable id, owner, storage choice, defaults, publish posture. The root manifest of every AIP-organized workspace; pairs with STORAGE.md (AIP-35) for the storage policy block.\n *\n * Spec: https://agentproto.sh/docs/aip-34\n *\n * Authoring paths:\n * - TS: `defineWorkspace({...})` → `WorkspaceHandle`\n * - MD: `parseWorkspaceManifest(src) → workspaceFromManifest({...})` → `WorkspaceHandle`\n */\n\nexport const SPEC_NAME = \"agentworkspace/v1\" as const\nexport const SPEC_VERSION = \"1.0.0-alpha\" as const\n\nexport { defineWorkspace } from \"./define-workspace.js\"\nexport type { WorkspaceDefinition, WorkspaceHandle } from \"./types.js\"\n"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { a as WorkspaceHandle } from '../types-fudFG_yV.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AIP-34 WORKSPACE.md frontmatter zod schema.
|
|
6
|
+
*
|
|
7
|
+
* Generated from `resources/aip-34/draft/WORKSPACE.schema.json` via
|
|
8
|
+
* json-schema-to-zod. Imported by both `define-workspace.ts` (TS path
|
|
9
|
+
* validation) and `manifest/index.ts` (.md path validation) so every
|
|
10
|
+
* field-level constraint runs in both authoring paths from a single
|
|
11
|
+
* source of truth — re-run scaffold-aip to refresh after spec changes.
|
|
12
|
+
*
|
|
13
|
+
* Cross-field rules (if/then/allOf in JSON Schema) don't translate
|
|
14
|
+
* cleanly and live in `define-workspace.ts`'s `validate(def)` instead.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
declare const workspaceFrontmatterSchema: z.ZodObject<{
|
|
18
|
+
schema: z.ZodLiteral<"workspace/v1">;
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
version: z.ZodString;
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
description: z.ZodOptional<z.ZodString>;
|
|
23
|
+
owner: z.ZodObject<{
|
|
24
|
+
type: z.ZodEnum<{
|
|
25
|
+
guild: "guild";
|
|
26
|
+
user: "user";
|
|
27
|
+
org: "org";
|
|
28
|
+
}>;
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
slug: z.ZodString;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
storage: z.ZodAny;
|
|
33
|
+
sandbox: z.ZodOptional<z.ZodAny>;
|
|
34
|
+
code: z.ZodOptional<z.ZodAny>;
|
|
35
|
+
identity: z.ZodOptional<z.ZodAny>;
|
|
36
|
+
defaults: z.ZodOptional<z.ZodObject<{
|
|
37
|
+
read_only: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
}, z.core.$catchall<z.ZodAny>>>;
|
|
39
|
+
publish: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
template: z.ZodDefault<z.ZodBoolean>;
|
|
41
|
+
registry: z.ZodOptional<z.ZodString>;
|
|
42
|
+
visibility: z.ZodDefault<z.ZodEnum<{
|
|
43
|
+
private: "private";
|
|
44
|
+
unlisted: "unlisted";
|
|
45
|
+
public: "public";
|
|
46
|
+
}>>;
|
|
47
|
+
}, z.core.$strict>>;
|
|
48
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
49
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
50
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
type WorkspaceFrontmatter = z.infer<typeof workspaceFrontmatterSchema>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* AIP-34 WORKSPACE.md sidecar parser + manifest-to-handle constructor.
|
|
56
|
+
*
|
|
57
|
+
* Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:
|
|
58
|
+
* the .md provides metadata; the TS module supplies any spec-specific
|
|
59
|
+
* runtime bits (schemas, execute bodies, …) that can't live in
|
|
60
|
+
* frontmatter. Both inputs end up in `defineWorkspace` so the cross-AIP
|
|
61
|
+
* invariants run uniformly.
|
|
62
|
+
*
|
|
63
|
+
*
|
|
64
|
+
* The frontmatter zod schema below was generated from
|
|
65
|
+
* `resources/aip-34/draft/WORKSPACE.schema.json` via json-schema-to-zod.
|
|
66
|
+
* Re-run scaffold-aip to refresh after spec changes (or hand-tune
|
|
67
|
+
* any constraint the converter doesn't capture cleanly).
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
interface WorkspaceManifest {
|
|
71
|
+
frontmatter: WorkspaceFrontmatter;
|
|
72
|
+
body: string;
|
|
73
|
+
}
|
|
74
|
+
declare function parseWorkspaceManifest(source: string): WorkspaceManifest;
|
|
75
|
+
declare function workspaceFromManifest(manifest: WorkspaceManifest): WorkspaceHandle;
|
|
76
|
+
|
|
77
|
+
export { type WorkspaceFrontmatter, type WorkspaceManifest, parseWorkspaceManifest, workspaceFromManifest, workspaceFrontmatterSchema };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { workspaceFrontmatterSchema, defineWorkspace } from '../chunk-O7MX54WR.mjs';
|
|
2
|
+
export { workspaceFrontmatterSchema } from '../chunk-O7MX54WR.mjs';
|
|
3
|
+
import matter from 'gray-matter';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @agentproto/workspace v0.1.0-alpha
|
|
7
|
+
* AIP-34 WORKSPACE.md `defineWorkspace` reference implementation.
|
|
8
|
+
*/
|
|
9
|
+
function parseWorkspaceManifest(source) {
|
|
10
|
+
const parsed = matter(source);
|
|
11
|
+
if (Object.keys(parsed.data).length === 0) {
|
|
12
|
+
throw new Error("parseWorkspaceManifest: missing or empty frontmatter");
|
|
13
|
+
}
|
|
14
|
+
const result = workspaceFrontmatterSchema.safeParse(parsed.data);
|
|
15
|
+
if (!result.success) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`parseWorkspaceManifest: invalid frontmatter \u2014 ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return { frontmatter: result.data, body: parsed.content };
|
|
21
|
+
}
|
|
22
|
+
function workspaceFromManifest(manifest) {
|
|
23
|
+
return defineWorkspace(manifest.frontmatter);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { parseWorkspaceManifest, workspaceFromManifest };
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
28
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/manifest/index.ts"],"names":[],"mappings":";;;;;;;;AA8BO,SAAS,uBAAuB,MAAA,EAAmC;AACxE,EAAA,MAAM,MAAA,GAAS,OAAO,MAAM,CAAA;AAC5B,EAAA,IAAI,OAAO,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA,CAAE,WAAW,CAAA,EAAG;AACzC,IAAA,MAAM,IAAI,MAAM,sDAAsD,CAAA;AAAA,EACxE;AACA,EAAA,MAAM,MAAA,GAAS,0BAAA,CAA2B,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA;AAC/D,EAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,mDAAA,EAAiD,OAAO,KAAA,CAAM,MAAA,CAC3D,IAAI,CAAC,CAAA,KAAM,GAAG,CAAA,CAAE,IAAA,CAAK,KAAK,GAAG,CAAC,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CAC9C,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,KACf;AAAA,EACF;AACA,EAAA,OAAO,EAAE,WAAA,EAAa,MAAA,CAAO,IAAA,EAAM,IAAA,EAAM,OAAO,OAAA,EAAQ;AAC1D;AAEO,SAAS,sBAAsB,QAAA,EAA8C;AAKlF,EAAA,OAAO,eAAA,CAAgB,SAAS,WAA6C,CAAA;AAC/E","file":"index.mjs","sourcesContent":["/**\n * AIP-34 WORKSPACE.md sidecar parser + manifest-to-handle constructor.\n *\n * Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:\n * the .md provides metadata; the TS module supplies any spec-specific\n * runtime bits (schemas, execute bodies, …) that can't live in\n * frontmatter. Both inputs end up in `defineWorkspace` so the cross-AIP\n * invariants run uniformly.\n *\n *\n * The frontmatter zod schema below was generated from\n * `resources/aip-34/draft/WORKSPACE.schema.json` via json-schema-to-zod.\n * Re-run scaffold-aip to refresh after spec changes (or hand-tune\n * any constraint the converter doesn't capture cleanly).\n */\n\nimport matter from \"gray-matter\"\nimport { workspaceFrontmatterSchema, type WorkspaceFrontmatter } from \"../schema.js\"\nimport { defineWorkspace } from \"../define-workspace.js\"\nimport type { WorkspaceDefinition, WorkspaceHandle } from \"../types.js\"\n\n// Re-export so consumers can import the schema + inferred type either\n// from \"@@agentproto/workspace/manifest\" or directly from \"@@agentproto/workspace/schema\".\nexport { workspaceFrontmatterSchema, type WorkspaceFrontmatter }\n\nexport interface WorkspaceManifest {\n frontmatter: WorkspaceFrontmatter\n body: string\n}\n\nexport function parseWorkspaceManifest(source: string): WorkspaceManifest {\n const parsed = matter(source)\n if (Object.keys(parsed.data).length === 0) {\n throw new Error(\"parseWorkspaceManifest: missing or empty frontmatter\")\n }\n const result = workspaceFrontmatterSchema.safeParse(parsed.data)\n if (!result.success) {\n throw new Error(\n `parseWorkspaceManifest: invalid frontmatter — ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n return { frontmatter: result.data, body: parsed.content }\n}\n\nexport function workspaceFromManifest(manifest: WorkspaceManifest): WorkspaceHandle {\n // The zod-validated frontmatter is structurally compatible with\n // WorkspaceDefinition; the cast pins the typing once the manifest\n // schema and the TS interface diverge (e.g. handle has frozen fields\n // a literal config doesn't carry yet).\n return defineWorkspace(manifest.frontmatter as unknown as WorkspaceDefinition)\n}\n"]}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AIP-34 WorkspaceDefinition + WorkspaceHandle.
|
|
3
|
+
*
|
|
4
|
+
* `WorkspaceDefinition` was generated from
|
|
5
|
+
* `resources/aip-34/draft/WORKSPACE.schema.json` via json-schema-to-typescript.
|
|
6
|
+
* `WorkspaceHandle` is the readonly view of the same shape; tighten it
|
|
7
|
+
* by hand for fields that get defaults applied in build().
|
|
8
|
+
*/
|
|
9
|
+
type IdentityRefEntry = {
|
|
10
|
+
name: string;
|
|
11
|
+
email: string;
|
|
12
|
+
avatar?: string;
|
|
13
|
+
gpg_key?: string;
|
|
14
|
+
role?: string;
|
|
15
|
+
metadata?: {};
|
|
16
|
+
[k: string]: unknown;
|
|
17
|
+
} | {
|
|
18
|
+
ref: string;
|
|
19
|
+
role?: string;
|
|
20
|
+
[k: string]: unknown;
|
|
21
|
+
} | {
|
|
22
|
+
file: string;
|
|
23
|
+
role?: string;
|
|
24
|
+
[k: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Validates the YAML frontmatter portion of an AIP-34 WORKSPACE.md manifest. Composes the AIP-35 STORAGE block (required), AIP-36 SANDBOX block (optional), AIP-26 CODE block (optional), AIP-23 identity-ref block (optional).
|
|
28
|
+
*/
|
|
29
|
+
interface WorkspaceDefinition {
|
|
30
|
+
schema: "workspace/v1";
|
|
31
|
+
/**
|
|
32
|
+
* Globally addressable id `@<owner-slug>/<workspace-slug>`. Lowercase kebab-case, immutable across the workspace's lifetime.
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Spec version of THIS file. Bump on breaking shape change.
|
|
37
|
+
*/
|
|
38
|
+
version: string;
|
|
39
|
+
/**
|
|
40
|
+
* Human-readable display name.
|
|
41
|
+
*/
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* One-paragraph purpose.
|
|
45
|
+
*/
|
|
46
|
+
description?: string;
|
|
47
|
+
owner: {
|
|
48
|
+
type: "guild" | "user" | "org";
|
|
49
|
+
id: string;
|
|
50
|
+
/**
|
|
51
|
+
* Owner-side slug. MUST match the slug suffix of the workspace `id`.
|
|
52
|
+
*/
|
|
53
|
+
slug: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* AIP-35 STORAGE block. Required. Inline / ref / file.
|
|
57
|
+
*/
|
|
58
|
+
storage: {
|
|
59
|
+
inline: STORAGEMdFrontmatterAgentstorageV1FilesystemPolicyBlock;
|
|
60
|
+
} | {
|
|
61
|
+
ref: string;
|
|
62
|
+
} | {
|
|
63
|
+
file: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* AIP-36 SANDBOX block. Optional — when absent, command-execution tools MUST be unavailable.
|
|
67
|
+
*/
|
|
68
|
+
sandbox?: {
|
|
69
|
+
inline: SANDBOXMdFrontmatterAgentsandboxV1ComputeEnvironmentPolicy;
|
|
70
|
+
} | {
|
|
71
|
+
ref: string;
|
|
72
|
+
} | {
|
|
73
|
+
file: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* AIP-26 CODE block. Optional — when present, the workspace IS a code-workspace / repo (codespace pattern).
|
|
77
|
+
*/
|
|
78
|
+
code?: {
|
|
79
|
+
inline: {};
|
|
80
|
+
} | {
|
|
81
|
+
ref: string;
|
|
82
|
+
} | {
|
|
83
|
+
file: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* AIP-23 identity-ref — default identity for sub-blocks. Sub-blocks (storage, sandbox, code) may override.
|
|
87
|
+
*/
|
|
88
|
+
identity?: IdentityRefEntry | [IdentityRefEntry, ...IdentityRefEntry[]];
|
|
89
|
+
defaults?: {
|
|
90
|
+
read_only?: boolean;
|
|
91
|
+
[k: string]: unknown;
|
|
92
|
+
};
|
|
93
|
+
publish?: {
|
|
94
|
+
template?: boolean;
|
|
95
|
+
registry?: string;
|
|
96
|
+
visibility?: "private" | "unlisted" | "public";
|
|
97
|
+
};
|
|
98
|
+
tags?: string[];
|
|
99
|
+
created_at?: string;
|
|
100
|
+
metadata?: {
|
|
101
|
+
[k: string]: unknown;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Validates the YAML frontmatter portion of an AIP-35 STORAGE.md manifest, OR the inline form embedded in any other manifest's `storage:` block. Filesystem-only — sandbox-shaped backends (e2b/modal/...) live in AIP-36 SANDBOX.md.
|
|
106
|
+
*/
|
|
107
|
+
interface STORAGEMdFrontmatterAgentstorageV1FilesystemPolicyBlock {
|
|
108
|
+
/**
|
|
109
|
+
* Standalone-only. Identifies the doctype + version. Absent when the block is inlined in another manifest.
|
|
110
|
+
*/
|
|
111
|
+
schema?: "storage/v1";
|
|
112
|
+
/**
|
|
113
|
+
* Standalone-only. Globally addressable id `@<owner-slug>/<storage-slug>`.
|
|
114
|
+
*/
|
|
115
|
+
id?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Standalone-only. Spec version of THIS file. Bump on breaking shape change.
|
|
118
|
+
*/
|
|
119
|
+
version?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Backend kind. Day-1 enumerated set: cloud-bucket | self-bucket | github | local-fs | dev-local | mastra-s3 | mastra-azure. Hosts MAY register additional ids; the schema accepts any non-empty string and host-side validation narrows.
|
|
122
|
+
*/
|
|
123
|
+
provider: string;
|
|
124
|
+
/**
|
|
125
|
+
* Provider-specific connection fields. Shape varies per provider (see AIP-35 §Provider config shapes).
|
|
126
|
+
*/
|
|
127
|
+
config: {};
|
|
128
|
+
sync?: SyncBlock;
|
|
129
|
+
auth?: AuthBlock;
|
|
130
|
+
/**
|
|
131
|
+
* AIP-23 identity-ref block — commit author(s) for syncing providers (github). Supports multi-attribution (primary + co-authors).
|
|
132
|
+
*/
|
|
133
|
+
identity?: ({
|
|
134
|
+
name: string;
|
|
135
|
+
email: string;
|
|
136
|
+
avatar?: string;
|
|
137
|
+
gpg_key?: string;
|
|
138
|
+
role?: string;
|
|
139
|
+
metadata?: {};
|
|
140
|
+
[k: string]: unknown;
|
|
141
|
+
} | {
|
|
142
|
+
ref: string;
|
|
143
|
+
role?: string;
|
|
144
|
+
[k: string]: unknown;
|
|
145
|
+
} | {
|
|
146
|
+
file: string;
|
|
147
|
+
role?: string;
|
|
148
|
+
[k: string]: unknown;
|
|
149
|
+
}) | [
|
|
150
|
+
({
|
|
151
|
+
name: string;
|
|
152
|
+
email: string;
|
|
153
|
+
avatar?: string;
|
|
154
|
+
gpg_key?: string;
|
|
155
|
+
role?: string;
|
|
156
|
+
metadata?: {};
|
|
157
|
+
[k: string]: unknown;
|
|
158
|
+
} | {
|
|
159
|
+
ref: string;
|
|
160
|
+
role?: string;
|
|
161
|
+
[k: string]: unknown;
|
|
162
|
+
} | {
|
|
163
|
+
file: string;
|
|
164
|
+
role?: string;
|
|
165
|
+
[k: string]: unknown;
|
|
166
|
+
}),
|
|
167
|
+
...({
|
|
168
|
+
name: string;
|
|
169
|
+
email: string;
|
|
170
|
+
avatar?: string;
|
|
171
|
+
gpg_key?: string;
|
|
172
|
+
role?: string;
|
|
173
|
+
metadata?: {};
|
|
174
|
+
[k: string]: unknown;
|
|
175
|
+
} | {
|
|
176
|
+
ref: string;
|
|
177
|
+
role?: string;
|
|
178
|
+
[k: string]: unknown;
|
|
179
|
+
} | {
|
|
180
|
+
file: string;
|
|
181
|
+
role?: string;
|
|
182
|
+
[k: string]: unknown;
|
|
183
|
+
})[]
|
|
184
|
+
];
|
|
185
|
+
/**
|
|
186
|
+
* Paths NOT mirrored to the backing store. Glob-ish, prefix-matched.
|
|
187
|
+
*/
|
|
188
|
+
exclude?: string[];
|
|
189
|
+
/**
|
|
190
|
+
* Reject writes at the storage layer.
|
|
191
|
+
*/
|
|
192
|
+
read_only?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Free-form, namespaced. Authors MAY stash adapter-specific hints under namespaced keys.
|
|
195
|
+
*/
|
|
196
|
+
metadata?: {
|
|
197
|
+
[k: string]: unknown;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Sync semantics. Lifecycle triggers reference AIP-37 event names.
|
|
202
|
+
*/
|
|
203
|
+
interface SyncBlock {
|
|
204
|
+
mode?: "canonical" | "pull-push" | "watch";
|
|
205
|
+
pull?: {
|
|
206
|
+
/**
|
|
207
|
+
* AIP-37 lifecycle event name. Standard: workspace-open | turn-start | manual. Aliases (per-turn, each-write) resolve via AIP-37.
|
|
208
|
+
*/
|
|
209
|
+
on?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Cache validity for pull-push providers (e.g. github clone).
|
|
212
|
+
*/
|
|
213
|
+
ttl_seconds?: number;
|
|
214
|
+
};
|
|
215
|
+
commit?: {
|
|
216
|
+
/**
|
|
217
|
+
* AIP-37 event name. Common: each-write | per-turn | per-conversation | manual.
|
|
218
|
+
*/
|
|
219
|
+
on?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Debounce window for each-write commit mode.
|
|
222
|
+
*/
|
|
223
|
+
batch_window_ms?: number;
|
|
224
|
+
/**
|
|
225
|
+
* Template for commit message. Provider-specific tokens (e.g. {{operator}}, {{summary}}).
|
|
226
|
+
*/
|
|
227
|
+
message_template?: string;
|
|
228
|
+
};
|
|
229
|
+
push?: {
|
|
230
|
+
/**
|
|
231
|
+
* AIP-37 event name. Common: per-commit | per-turn | per-conversation | manual.
|
|
232
|
+
*/
|
|
233
|
+
on?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Github only. Where commits land.
|
|
236
|
+
*/
|
|
237
|
+
branch_policy?: "main" | "per-conversation" | "per-turn";
|
|
238
|
+
/**
|
|
239
|
+
* Github only. Whether to open PRs automatically.
|
|
240
|
+
*/
|
|
241
|
+
pr_policy?: "none" | "auto" | "manual";
|
|
242
|
+
};
|
|
243
|
+
conflict?: {
|
|
244
|
+
policy?: "rebase" | "merge" | "abort" | "manual" | "last-writer-wins" | "split-conflicts";
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Reference to AIP-19 SECRETS.md (or future ENV.md) for credentials.
|
|
249
|
+
*/
|
|
250
|
+
interface AuthBlock {
|
|
251
|
+
/**
|
|
252
|
+
* Path or registry slug pointing to a SECRETS.md (or future ENV.md) inventory.
|
|
253
|
+
*/
|
|
254
|
+
ref?: string;
|
|
255
|
+
state?: {
|
|
256
|
+
/**
|
|
257
|
+
* Env-var names this consumer expects to be revealed from the referenced inventory.
|
|
258
|
+
*/
|
|
259
|
+
env?: string[];
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Validates the YAML frontmatter portion of an AIP-36 SANDBOX.md manifest, OR the inline form embedded in any other manifest's `sandbox:` block. Compute-only — durable filesystem backings live in AIP-35 STORAGE.md.
|
|
264
|
+
*/
|
|
265
|
+
interface SANDBOXMdFrontmatterAgentsandboxV1ComputeEnvironmentPolicy {
|
|
266
|
+
/**
|
|
267
|
+
* Standalone-only. Identifies the doctype + version. Absent when the block is inlined.
|
|
268
|
+
*/
|
|
269
|
+
schema?: "sandbox/v1";
|
|
270
|
+
/**
|
|
271
|
+
* Standalone-only. Globally addressable id `@<owner-slug>/<sandbox-slug>`.
|
|
272
|
+
*/
|
|
273
|
+
id?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Standalone-only. Spec version of THIS file.
|
|
276
|
+
*/
|
|
277
|
+
version?: string;
|
|
278
|
+
/**
|
|
279
|
+
* Backend kind. Day-1 enumerated set: local | mastra-e2b | mastra-modal | mastra-daytona | mastra-blaxel | node-permission. Hosts MAY register additional ids.
|
|
280
|
+
*/
|
|
281
|
+
provider: string;
|
|
282
|
+
/**
|
|
283
|
+
* Provider-specific connection fields. Shape varies per provider (see AIP-36 §Provider config shapes).
|
|
284
|
+
*/
|
|
285
|
+
config: {};
|
|
286
|
+
/**
|
|
287
|
+
* Resource caps per command.
|
|
288
|
+
*/
|
|
289
|
+
limits?: {
|
|
290
|
+
timeout_ms?: number;
|
|
291
|
+
memory_mb?: number;
|
|
292
|
+
cpu_ms?: number;
|
|
293
|
+
};
|
|
294
|
+
env?: {
|
|
295
|
+
auth?: AuthBlock1;
|
|
296
|
+
/**
|
|
297
|
+
* Static host env-var names to forward into the sandbox.
|
|
298
|
+
*/
|
|
299
|
+
passthrough?: string[];
|
|
300
|
+
};
|
|
301
|
+
network?: {
|
|
302
|
+
/**
|
|
303
|
+
* Hostnames the sandbox MAY reach. Empty / missing = no egress.
|
|
304
|
+
*/
|
|
305
|
+
egress?: string[];
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Filesystems mounted inside the sandbox at declared paths. Maps to Mastra Workspace.mounts.
|
|
309
|
+
*/
|
|
310
|
+
mounts?: MountEntry[];
|
|
311
|
+
/**
|
|
312
|
+
* AIP-23 identity-ref — owner of the sandbox processes.
|
|
313
|
+
*/
|
|
314
|
+
identity?: ({
|
|
315
|
+
name: string;
|
|
316
|
+
email: string;
|
|
317
|
+
avatar?: string;
|
|
318
|
+
gpg_key?: string;
|
|
319
|
+
role?: string;
|
|
320
|
+
metadata?: {};
|
|
321
|
+
[k: string]: unknown;
|
|
322
|
+
} | {
|
|
323
|
+
ref: string;
|
|
324
|
+
role?: string;
|
|
325
|
+
[k: string]: unknown;
|
|
326
|
+
} | {
|
|
327
|
+
file: string;
|
|
328
|
+
role?: string;
|
|
329
|
+
[k: string]: unknown;
|
|
330
|
+
}) | [
|
|
331
|
+
({
|
|
332
|
+
name: string;
|
|
333
|
+
email: string;
|
|
334
|
+
avatar?: string;
|
|
335
|
+
gpg_key?: string;
|
|
336
|
+
role?: string;
|
|
337
|
+
metadata?: {};
|
|
338
|
+
[k: string]: unknown;
|
|
339
|
+
} | {
|
|
340
|
+
ref: string;
|
|
341
|
+
role?: string;
|
|
342
|
+
[k: string]: unknown;
|
|
343
|
+
} | {
|
|
344
|
+
file: string;
|
|
345
|
+
role?: string;
|
|
346
|
+
[k: string]: unknown;
|
|
347
|
+
}),
|
|
348
|
+
...({
|
|
349
|
+
name: string;
|
|
350
|
+
email: string;
|
|
351
|
+
avatar?: string;
|
|
352
|
+
gpg_key?: string;
|
|
353
|
+
role?: string;
|
|
354
|
+
metadata?: {};
|
|
355
|
+
[k: string]: unknown;
|
|
356
|
+
} | {
|
|
357
|
+
ref: string;
|
|
358
|
+
role?: string;
|
|
359
|
+
[k: string]: unknown;
|
|
360
|
+
} | {
|
|
361
|
+
file: string;
|
|
362
|
+
role?: string;
|
|
363
|
+
[k: string]: unknown;
|
|
364
|
+
})[]
|
|
365
|
+
];
|
|
366
|
+
lifecycle?: {
|
|
367
|
+
/**
|
|
368
|
+
* AIP-37 event name (e.g. `idle-600` for 10 min). Provider-supported only (modal, daytona).
|
|
369
|
+
*/
|
|
370
|
+
pause_after_idle?: string;
|
|
371
|
+
/**
|
|
372
|
+
* AIP-37 event name (e.g. `workspace-close`).
|
|
373
|
+
*/
|
|
374
|
+
destroy_on?: string;
|
|
375
|
+
};
|
|
376
|
+
/**
|
|
377
|
+
* Reject command execution at the sandbox layer. Read-only sandbox calls fail with `sandbox_read_only`.
|
|
378
|
+
*/
|
|
379
|
+
read_only?: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Free-form, namespaced. Adapter hints under `metadata.<adapter>.*`.
|
|
382
|
+
*/
|
|
383
|
+
metadata?: {
|
|
384
|
+
[k: string]: unknown;
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
interface AuthBlock1 {
|
|
388
|
+
ref?: string;
|
|
389
|
+
state?: {
|
|
390
|
+
env?: string[];
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
interface MountEntry {
|
|
394
|
+
/**
|
|
395
|
+
* What to mount. `"workspace"` shortcut for the parent workspace storage.
|
|
396
|
+
*/
|
|
397
|
+
source: "workspace" | {
|
|
398
|
+
ref: string;
|
|
399
|
+
} | {
|
|
400
|
+
inline: STORAGEMdFrontmatterAgentstorageV1FilesystemPolicyBlock;
|
|
401
|
+
} | {
|
|
402
|
+
file: string;
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Absolute path inside the sandbox where the mount appears.
|
|
406
|
+
*/
|
|
407
|
+
at: string;
|
|
408
|
+
mode?: "read-write" | "read-only";
|
|
409
|
+
}
|
|
410
|
+
type WorkspaceHandle = Readonly<WorkspaceDefinition>;
|
|
411
|
+
|
|
412
|
+
export type { WorkspaceDefinition as W, WorkspaceHandle as a };
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentproto/workspace",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "@agentproto/workspace — AIP-34 WORKSPACE.md reference implementation. A markdown + frontmatter format for declaring a workspace's identity — globally addressable id, owner, storage choice, defaults, publish posture. The root manifest of every AIP-organized workspace; pairs with STORAGE.md (AIP-35) for the storage policy block.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agentproto",
|
|
7
|
+
"aip-34",
|
|
8
|
+
"workspace",
|
|
9
|
+
"defineWorkspace",
|
|
10
|
+
"open-standard",
|
|
11
|
+
"agentic"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://agentproto.sh/docs/aip-34",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/agentproto/ts",
|
|
17
|
+
"directory": "packages/workspace"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/agentproto/ts/issues"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "dist/index.mjs",
|
|
25
|
+
"module": "dist/index.mjs",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.mjs",
|
|
31
|
+
"default": "./dist/index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./manifest": {
|
|
34
|
+
"types": "./dist/manifest/index.d.ts",
|
|
35
|
+
"import": "./dist/manifest/index.mjs",
|
|
36
|
+
"default": "./dist/manifest/index.mjs"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"gray-matter": "^4.0.3",
|
|
50
|
+
"zod": "^4.4.3",
|
|
51
|
+
"@agentproto/define-doctype": "0.1.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^25.6.2",
|
|
55
|
+
"tsup": "^8.5.1",
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"vitest": "^3.2.4",
|
|
58
|
+
"@agentproto/tooling": "0.1.0-alpha.0"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"dev": "tsup --watch",
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"clean": "rm -rf dist",
|
|
64
|
+
"check-types": "tsc --noEmit",
|
|
65
|
+
"test": "vitest run --passWithNoTests",
|
|
66
|
+
"test:watch": "vitest"
|
|
67
|
+
}
|
|
68
|
+
}
|