@zyro-sec/schema 1.0.1 → 1.0.3
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/AGENTS.md +95 -95
- package/package.json +5 -1
- package/script/build.ts +9 -9
- package/script/config-schema.ts +86 -86
- package/script/config-v1.json +1311 -1311
- package/script/pack.ts +5 -5
- package/src/agent.ts +68 -68
- package/src/artifact.ts +81 -81
- package/src/automation.ts +224 -224
- package/src/blob-store.ts +25 -25
- package/src/command.ts +18 -18
- package/src/config/agent.ts +26 -26
- package/src/config/command.ts +14 -14
- package/src/config/compaction.ts +27 -27
- package/src/config/experimental.ts +72 -72
- package/src/config/flag.ts +39 -39
- package/src/config/formatter.ts +13 -13
- package/src/config/lsp.ts +19 -19
- package/src/config/mcp.ts +22 -22
- package/src/config/media.ts +15 -15
- package/src/config/model.ts +37 -37
- package/src/config/plugin.ts +14 -14
- package/src/config/policy.ts +57 -57
- package/src/config/provider.ts +122 -122
- package/src/config/reference.ts +23 -23
- package/src/config/shell.ts +10 -10
- package/src/config/tool-output.ts +9 -9
- package/src/config/warming.ts +21 -21
- package/src/config/watcher.ts +8 -8
- package/src/config/websearch.ts +17 -17
- package/src/config/worktree.ts +10 -10
- package/src/config.ts +149 -149
- package/src/connection.ts +38 -38
- package/src/credential-legacy.ts +29 -29
- package/src/credential.ts +78 -78
- package/src/durable-event-manifest.ts +7 -7
- package/src/event-log.ts +21 -21
- package/src/event-manifest.ts +108 -108
- package/src/event.ts +205 -205
- package/src/file-diff.ts +25 -25
- package/src/filesystem-v1.ts +1 -1
- package/src/filesystem.ts +48 -48
- package/src/form.ts +177 -177
- package/src/generate.ts +292 -292
- package/src/goal.ts +46 -46
- package/src/identifier.ts +32 -32
- package/src/index.ts +51 -51
- package/src/installation-event.ts +20 -20
- package/src/instruction-entry.ts +40 -40
- package/src/instruction.ts +25 -25
- package/src/integration-id.ts +13 -13
- package/src/integration.ts +129 -129
- package/src/job.ts +79 -79
- package/src/legacy-event.ts +1 -1
- package/src/llm.ts +6 -6
- package/src/location-event.ts +8 -8
- package/src/location.ts +36 -36
- package/src/lsp-event.ts +7 -7
- package/src/mcp-event.ts +63 -63
- package/src/mcp.ts +171 -171
- package/src/model-compatibility.ts +55 -55
- package/src/model.ts +176 -176
- package/src/models-dev.ts +9 -9
- package/src/money.ts +18 -18
- package/src/permission-saved.ts +25 -25
- package/src/permission-v1.ts +1 -1
- package/src/permission.ts +67 -67
- package/src/persistent-pty.ts +73 -73
- package/src/plugin.ts +62 -62
- package/src/project-id.ts +9 -9
- package/src/project.ts +62 -62
- package/src/prompt-input.ts +33 -33
- package/src/prompt.ts +117 -117
- package/src/provider.ts +136 -136
- package/src/pty-ticket.ts +10 -10
- package/src/pty.ts +61 -61
- package/src/push.ts +86 -86
- package/src/question.ts +22 -22
- package/src/reference.ts +40 -40
- package/src/rpc.ts +167 -167
- package/src/schema.ts +41 -41
- package/src/server-event.ts +8 -8
- package/src/session-error.ts +14 -14
- package/src/session-event.ts +739 -739
- package/src/session-fork.ts +10 -10
- package/src/session-id.ts +12 -12
- package/src/session-inbox.ts +102 -102
- package/src/session-legacy.ts +117 -117
- package/src/session-message.ts +352 -352
- package/src/session-metadata.ts +11 -11
- package/src/session-revert.ts +86 -86
- package/src/session-stats.ts +68 -68
- package/src/session-status-event.ts +53 -53
- package/src/session-transfer.ts +11 -11
- package/src/session-v1.ts +1 -1
- package/src/session.ts +147 -147
- package/src/shell.ts +90 -90
- package/src/skill.ts +68 -68
- package/src/snapshot.ts +6 -6
- package/src/token-usage.ts +18 -18
- package/src/tool.ts +143 -143
- package/src/tui-event.ts +59 -59
- package/src/usage-limits.ts +76 -76
- package/src/v1/filesystem.ts +11 -11
- package/src/v1/legacy-event.ts +18 -18
- package/src/v1/permission.ts +66 -66
- package/src/v1/session.ts +667 -667
- package/src/vcs-event.ts +14 -14
- package/src/vcs.ts +41 -41
- package/src/websearch.ts +44 -44
- package/src/workspace-event.ts +32 -32
- package/src/workspace-id.ts +19 -19
- package/src/workspace.ts +20 -20
- package/src/worktree-event.ts +22 -22
- package/src/worktree.ts +109 -109
- package/tsconfig.build.json +11 -11
- package/tsconfig.json +14 -14
- package/test/agent.test.ts +0 -10
- package/test/automation.test.ts +0 -48
- package/test/compatibility.test.ts +0 -10
- package/test/config.test.ts +0 -194
- package/test/contract-hygiene.test.ts +0 -352
- package/test/credential-legacy.test.ts +0 -55
- package/test/event-manifest.test.ts +0 -228
- package/test/event.test.ts +0 -52
- package/test/legacy-event.test.ts +0 -46
- package/test/mcp.test.ts +0 -37
- package/test/model.test.ts +0 -104
- package/test/session-cursor.test.ts +0 -16
- package/test/session-error.test.ts +0 -51
- package/test/session-legacy.test.ts +0 -178
- package/test/session-terminal.test.ts +0 -50
- package/test/token-usage.test.ts +0 -18
- package/test/v1-isolation.test.ts +0 -26
- package/test/vcs.test.ts +0 -23
- package/test/worktree.test.ts +0 -45
package/script/pack.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
import path from "node:path"
|
|
3
|
-
import { pack } from "@zyro-sec/script/pack"
|
|
4
|
-
|
|
5
|
-
await pack(path.resolve(import.meta.dir, ".."))
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import path from "node:path"
|
|
3
|
+
import { pack } from "@zyro-sec/script/pack"
|
|
4
|
+
|
|
5
|
+
await pack(path.resolve(import.meta.dir, ".."))
|
package/src/agent.ts
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
export * as Agent from "./agent.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { ephemeral, inventory } from "./event.js"
|
|
5
|
-
import { optional } from "./schema.js"
|
|
6
|
-
import { Model } from "./model.js"
|
|
7
|
-
import { Permission } from "./permission.js"
|
|
8
|
-
import { Provider } from "./provider.js"
|
|
9
|
-
import { PositiveInt, statics } from "./schema.js"
|
|
10
|
-
|
|
11
|
-
const Updated = ephemeral({ type: "agent.updated", schema: {} })
|
|
12
|
-
|
|
13
|
-
export const ID = Schema.String.pipe(Schema.brand("Agent.ID"), Schema.annotate({ identifier: "Agent.ID" }))
|
|
14
|
-
export type ID = typeof ID.Type
|
|
15
|
-
|
|
16
|
-
export const Name = Schema.String.pipe(Schema.brand("Agent.Name"))
|
|
17
|
-
export type Name = typeof Name.Type
|
|
18
|
-
|
|
19
|
-
export const Color = Schema.String.annotate({ identifier: "Agent.Color" })
|
|
20
|
-
export type Color = typeof Color.Type
|
|
21
|
-
|
|
22
|
-
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
|
23
|
-
export const Info = Schema.Struct({
|
|
24
|
-
id: ID,
|
|
25
|
-
name: Name,
|
|
26
|
-
model: Model.Ref.pipe(optional),
|
|
27
|
-
request: Provider.Request,
|
|
28
|
-
system: Schema.String.pipe(optional),
|
|
29
|
-
/**
|
|
30
|
-
* Added to the default prompt while the agent is selected, without replacing it like `system`. A string is
|
|
31
|
-
* introduced as this agent's instructions, and core tells the model when they stop applying. `{ selected, unselected }`
|
|
32
|
-
* sends both texts exactly as written: `selected` while the agent is selected, `unselected` once when the session
|
|
33
|
-
* switches away.
|
|
34
|
-
*/
|
|
35
|
-
instructions: Schema.Union([Schema.String, Schema.Struct({ selected: Schema.String, unselected: Schema.String })]).pipe(
|
|
36
|
-
optional,
|
|
37
|
-
),
|
|
38
|
-
description: Schema.String.pipe(optional),
|
|
39
|
-
mode: Schema.Literals(["subagent", "primary", "all"]),
|
|
40
|
-
hidden: Schema.Boolean,
|
|
41
|
-
color: Color.pipe(optional),
|
|
42
|
-
steps: PositiveInt.pipe(optional),
|
|
43
|
-
permissions: Permission.Ruleset,
|
|
44
|
-
})
|
|
45
|
-
.annotate({ identifier: "Agent.Info" })
|
|
46
|
-
.pipe(
|
|
47
|
-
statics(() => ({
|
|
48
|
-
default: (id: ID) =>
|
|
49
|
-
({
|
|
50
|
-
id,
|
|
51
|
-
name: Name.make(id),
|
|
52
|
-
request: { settings: {}, headers: {}, body: {} },
|
|
53
|
-
mode: "primary",
|
|
54
|
-
hidden: false,
|
|
55
|
-
permissions: [
|
|
56
|
-
{ action: "*", resource: "*", effect: "allow" },
|
|
57
|
-
{ action: "read", resource: "*.env", effect: "ask" },
|
|
58
|
-
{ action: "read", resource: "*.env.*", effect: "ask" },
|
|
59
|
-
{ action: "read", resource: "*.env.example", effect: "allow" },
|
|
60
|
-
],
|
|
61
|
-
}) satisfies Info,
|
|
62
|
-
})),
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
export const Event = {
|
|
66
|
-
Updated,
|
|
67
|
-
Definitions: inventory(Updated),
|
|
68
|
-
}
|
|
1
|
+
export * as Agent from "./agent.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { ephemeral, inventory } from "./event.js"
|
|
5
|
+
import { optional } from "./schema.js"
|
|
6
|
+
import { Model } from "./model.js"
|
|
7
|
+
import { Permission } from "./permission.js"
|
|
8
|
+
import { Provider } from "./provider.js"
|
|
9
|
+
import { PositiveInt, statics } from "./schema.js"
|
|
10
|
+
|
|
11
|
+
const Updated = ephemeral({ type: "agent.updated", schema: {} })
|
|
12
|
+
|
|
13
|
+
export const ID = Schema.String.pipe(Schema.brand("Agent.ID"), Schema.annotate({ identifier: "Agent.ID" }))
|
|
14
|
+
export type ID = typeof ID.Type
|
|
15
|
+
|
|
16
|
+
export const Name = Schema.String.pipe(Schema.brand("Agent.Name"))
|
|
17
|
+
export type Name = typeof Name.Type
|
|
18
|
+
|
|
19
|
+
export const Color = Schema.String.annotate({ identifier: "Agent.Color" })
|
|
20
|
+
export type Color = typeof Color.Type
|
|
21
|
+
|
|
22
|
+
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
|
23
|
+
export const Info = Schema.Struct({
|
|
24
|
+
id: ID,
|
|
25
|
+
name: Name,
|
|
26
|
+
model: Model.Ref.pipe(optional),
|
|
27
|
+
request: Provider.Request,
|
|
28
|
+
system: Schema.String.pipe(optional),
|
|
29
|
+
/**
|
|
30
|
+
* Added to the default prompt while the agent is selected, without replacing it like `system`. A string is
|
|
31
|
+
* introduced as this agent's instructions, and core tells the model when they stop applying. `{ selected, unselected }`
|
|
32
|
+
* sends both texts exactly as written: `selected` while the agent is selected, `unselected` once when the session
|
|
33
|
+
* switches away.
|
|
34
|
+
*/
|
|
35
|
+
instructions: Schema.Union([Schema.String, Schema.Struct({ selected: Schema.String, unselected: Schema.String })]).pipe(
|
|
36
|
+
optional,
|
|
37
|
+
),
|
|
38
|
+
description: Schema.String.pipe(optional),
|
|
39
|
+
mode: Schema.Literals(["subagent", "primary", "all"]),
|
|
40
|
+
hidden: Schema.Boolean,
|
|
41
|
+
color: Color.pipe(optional),
|
|
42
|
+
steps: PositiveInt.pipe(optional),
|
|
43
|
+
permissions: Permission.Ruleset,
|
|
44
|
+
})
|
|
45
|
+
.annotate({ identifier: "Agent.Info" })
|
|
46
|
+
.pipe(
|
|
47
|
+
statics(() => ({
|
|
48
|
+
default: (id: ID) =>
|
|
49
|
+
({
|
|
50
|
+
id,
|
|
51
|
+
name: Name.make(id),
|
|
52
|
+
request: { settings: {}, headers: {}, body: {} },
|
|
53
|
+
mode: "primary",
|
|
54
|
+
hidden: false,
|
|
55
|
+
permissions: [
|
|
56
|
+
{ action: "*", resource: "*", effect: "allow" },
|
|
57
|
+
{ action: "read", resource: "*.env", effect: "ask" },
|
|
58
|
+
{ action: "read", resource: "*.env.*", effect: "ask" },
|
|
59
|
+
{ action: "read", resource: "*.env.example", effect: "allow" },
|
|
60
|
+
],
|
|
61
|
+
}) satisfies Info,
|
|
62
|
+
})),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
export const Event = {
|
|
66
|
+
Updated,
|
|
67
|
+
Definitions: inventory(Updated),
|
|
68
|
+
}
|
package/src/artifact.ts
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
export * as Artifact from "./artifact.js"
|
|
2
|
-
|
|
3
|
-
import { Schema } from "effect"
|
|
4
|
-
import { ephemeral, inventory } from "./event.js"
|
|
5
|
-
import { ascending } from "./identifier.js"
|
|
6
|
-
import { optional, statics } from "./schema.js"
|
|
7
|
-
import { SessionID } from "./session-id.js"
|
|
8
|
-
|
|
9
|
-
export const ID = Schema.String.check(Schema.isStartingWith("art_")).pipe(
|
|
10
|
-
Schema.brand("Artifact.ID"),
|
|
11
|
-
Schema.annotate({ identifier: "Artifact.ID" }),
|
|
12
|
-
statics((schema) => ({
|
|
13
|
-
create: () => schema.make("art_" + ascending()),
|
|
14
|
-
})),
|
|
15
|
-
)
|
|
16
|
-
export type ID = typeof ID.Type
|
|
17
|
-
|
|
18
|
-
export const ProviderID = Schema.Trim.check(Schema.isNonEmpty()).pipe(
|
|
19
|
-
Schema.brand("Artifact.ProviderID"),
|
|
20
|
-
Schema.annotate({ identifier: "Artifact.ProviderID" }),
|
|
21
|
-
)
|
|
22
|
-
export type ProviderID = typeof ProviderID.Type
|
|
23
|
-
|
|
24
|
-
export const Capability = Schema.Literals(["static", "server-code", "sqlite", "durable-objects"]).annotate({
|
|
25
|
-
identifier: "Artifact.Capability",
|
|
26
|
-
})
|
|
27
|
-
export type Capability = typeof Capability.Type
|
|
28
|
-
|
|
29
|
-
export interface Provider extends Schema.Schema.Type<typeof Provider> {}
|
|
30
|
-
export const Provider = Schema.Struct({
|
|
31
|
-
id: ProviderID,
|
|
32
|
-
name: Schema.String,
|
|
33
|
-
capabilities: Schema.Array(Capability),
|
|
34
|
-
default: Schema.Boolean,
|
|
35
|
-
}).annotate({ identifier: "Artifact.Provider" })
|
|
36
|
-
|
|
37
|
-
export interface Time extends Schema.Schema.Type<typeof Time> {}
|
|
38
|
-
export const Time = Schema.Struct({
|
|
39
|
-
created: Schema.Finite,
|
|
40
|
-
updated: Schema.Finite,
|
|
41
|
-
}).annotate({ identifier: "Artifact.Time" })
|
|
42
|
-
|
|
43
|
-
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
|
44
|
-
export const Info = Schema.Struct({
|
|
45
|
-
id: ID,
|
|
46
|
-
provider: ProviderID,
|
|
47
|
-
sessionID: SessionID.pipe(optional),
|
|
48
|
-
title: Schema.String,
|
|
49
|
-
entry: Schema.String,
|
|
50
|
-
url: Schema.String,
|
|
51
|
-
time: Time,
|
|
52
|
-
}).annotate({ identifier: "Artifact.Info" })
|
|
53
|
-
|
|
54
|
-
export interface Content extends Schema.Schema.Type<typeof Content> {}
|
|
55
|
-
export const Content = Schema.Struct({
|
|
56
|
-
info: Info,
|
|
57
|
-
files: Schema.Record(Schema.String, Schema.String),
|
|
58
|
-
}).annotate({ identifier: "Artifact.Content" })
|
|
59
|
-
|
|
60
|
-
export interface CreateInput extends Schema.Schema.Type<typeof CreateInput> {}
|
|
61
|
-
export const CreateInput = Schema.Struct({
|
|
62
|
-
title: Schema.String,
|
|
63
|
-
files: Schema.Record(Schema.String, Schema.String),
|
|
64
|
-
entry: Schema.String.pipe(optional),
|
|
65
|
-
provider: ProviderID.pipe(optional),
|
|
66
|
-
sessionID: SessionID.pipe(optional),
|
|
67
|
-
}).annotate({ identifier: "Artifact.CreateInput" })
|
|
68
|
-
|
|
69
|
-
export interface UpdateInput extends Schema.Schema.Type<typeof UpdateInput> {}
|
|
70
|
-
export const UpdateInput = Schema.Struct({
|
|
71
|
-
title: Schema.String.pipe(optional),
|
|
72
|
-
files: Schema.Record(Schema.String, Schema.String),
|
|
73
|
-
entry: Schema.String.pipe(optional),
|
|
74
|
-
sessionID: SessionID.pipe(optional),
|
|
75
|
-
}).annotate({ identifier: "Artifact.UpdateInput" })
|
|
76
|
-
|
|
77
|
-
const Updated = ephemeral({
|
|
78
|
-
type: "artifact.updated",
|
|
79
|
-
schema: {},
|
|
80
|
-
})
|
|
81
|
-
export const Event = { Updated, Definitions: inventory(Updated) }
|
|
1
|
+
export * as Artifact from "./artifact.js"
|
|
2
|
+
|
|
3
|
+
import { Schema } from "effect"
|
|
4
|
+
import { ephemeral, inventory } from "./event.js"
|
|
5
|
+
import { ascending } from "./identifier.js"
|
|
6
|
+
import { optional, statics } from "./schema.js"
|
|
7
|
+
import { SessionID } from "./session-id.js"
|
|
8
|
+
|
|
9
|
+
export const ID = Schema.String.check(Schema.isStartingWith("art_")).pipe(
|
|
10
|
+
Schema.brand("Artifact.ID"),
|
|
11
|
+
Schema.annotate({ identifier: "Artifact.ID" }),
|
|
12
|
+
statics((schema) => ({
|
|
13
|
+
create: () => schema.make("art_" + ascending()),
|
|
14
|
+
})),
|
|
15
|
+
)
|
|
16
|
+
export type ID = typeof ID.Type
|
|
17
|
+
|
|
18
|
+
export const ProviderID = Schema.Trim.check(Schema.isNonEmpty()).pipe(
|
|
19
|
+
Schema.brand("Artifact.ProviderID"),
|
|
20
|
+
Schema.annotate({ identifier: "Artifact.ProviderID" }),
|
|
21
|
+
)
|
|
22
|
+
export type ProviderID = typeof ProviderID.Type
|
|
23
|
+
|
|
24
|
+
export const Capability = Schema.Literals(["static", "server-code", "sqlite", "durable-objects"]).annotate({
|
|
25
|
+
identifier: "Artifact.Capability",
|
|
26
|
+
})
|
|
27
|
+
export type Capability = typeof Capability.Type
|
|
28
|
+
|
|
29
|
+
export interface Provider extends Schema.Schema.Type<typeof Provider> {}
|
|
30
|
+
export const Provider = Schema.Struct({
|
|
31
|
+
id: ProviderID,
|
|
32
|
+
name: Schema.String,
|
|
33
|
+
capabilities: Schema.Array(Capability),
|
|
34
|
+
default: Schema.Boolean,
|
|
35
|
+
}).annotate({ identifier: "Artifact.Provider" })
|
|
36
|
+
|
|
37
|
+
export interface Time extends Schema.Schema.Type<typeof Time> {}
|
|
38
|
+
export const Time = Schema.Struct({
|
|
39
|
+
created: Schema.Finite,
|
|
40
|
+
updated: Schema.Finite,
|
|
41
|
+
}).annotate({ identifier: "Artifact.Time" })
|
|
42
|
+
|
|
43
|
+
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
|
44
|
+
export const Info = Schema.Struct({
|
|
45
|
+
id: ID,
|
|
46
|
+
provider: ProviderID,
|
|
47
|
+
sessionID: SessionID.pipe(optional),
|
|
48
|
+
title: Schema.String,
|
|
49
|
+
entry: Schema.String,
|
|
50
|
+
url: Schema.String,
|
|
51
|
+
time: Time,
|
|
52
|
+
}).annotate({ identifier: "Artifact.Info" })
|
|
53
|
+
|
|
54
|
+
export interface Content extends Schema.Schema.Type<typeof Content> {}
|
|
55
|
+
export const Content = Schema.Struct({
|
|
56
|
+
info: Info,
|
|
57
|
+
files: Schema.Record(Schema.String, Schema.String),
|
|
58
|
+
}).annotate({ identifier: "Artifact.Content" })
|
|
59
|
+
|
|
60
|
+
export interface CreateInput extends Schema.Schema.Type<typeof CreateInput> {}
|
|
61
|
+
export const CreateInput = Schema.Struct({
|
|
62
|
+
title: Schema.String,
|
|
63
|
+
files: Schema.Record(Schema.String, Schema.String),
|
|
64
|
+
entry: Schema.String.pipe(optional),
|
|
65
|
+
provider: ProviderID.pipe(optional),
|
|
66
|
+
sessionID: SessionID.pipe(optional),
|
|
67
|
+
}).annotate({ identifier: "Artifact.CreateInput" })
|
|
68
|
+
|
|
69
|
+
export interface UpdateInput extends Schema.Schema.Type<typeof UpdateInput> {}
|
|
70
|
+
export const UpdateInput = Schema.Struct({
|
|
71
|
+
title: Schema.String.pipe(optional),
|
|
72
|
+
files: Schema.Record(Schema.String, Schema.String),
|
|
73
|
+
entry: Schema.String.pipe(optional),
|
|
74
|
+
sessionID: SessionID.pipe(optional),
|
|
75
|
+
}).annotate({ identifier: "Artifact.UpdateInput" })
|
|
76
|
+
|
|
77
|
+
const Updated = ephemeral({
|
|
78
|
+
type: "artifact.updated",
|
|
79
|
+
schema: {},
|
|
80
|
+
})
|
|
81
|
+
export const Event = { Updated, Definitions: inventory(Updated) }
|