@codeworksh/plugin 0.0.1-dev.20260922103030

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.
Files changed (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/error-ClDISWlT.d.mts +11 -0
  4. package/event-rIZpnOTo.d.mts +895 -0
  5. package/event.d.mts +2 -0
  6. package/event.mjs +125 -0
  7. package/event.mjs.map +1 -0
  8. package/filesystem-Cp-KapCE.d.mts +142 -0
  9. package/ids-CHjmAdTc.d.mts +43 -0
  10. package/ids.d.mts +2 -0
  11. package/ids.mjs +48 -0
  12. package/ids.mjs.map +1 -0
  13. package/index.d.mts +3 -0
  14. package/index.mjs +3 -0
  15. package/io-BYs7hbiY.d.mts +497 -0
  16. package/location-D4hAfuXF.d.mts +61 -0
  17. package/location.d.mts +2 -0
  18. package/location.mjs +48 -0
  19. package/location.mjs.map +1 -0
  20. package/package.json +200 -0
  21. package/plugin/prompt.d.mts +2 -0
  22. package/plugin/prompt.mjs +7 -0
  23. package/plugin/prompt.mjs.map +1 -0
  24. package/plugin/tool.d.mts +2 -0
  25. package/plugin/tool.mjs +29 -0
  26. package/plugin/tool.mjs.map +1 -0
  27. package/plugin-DbJEpY3M.d.mts +140 -0
  28. package/plugin-lorpq7Oi.mjs +41 -0
  29. package/plugin-lorpq7Oi.mjs.map +1 -0
  30. package/plugin.d.mts +4 -0
  31. package/plugin.mjs +4 -0
  32. package/posix.d.mts +6 -0
  33. package/posix.mjs +8 -0
  34. package/posix.mjs.map +1 -0
  35. package/project-CLGsIFD-.d.mts +21 -0
  36. package/project.d.mts +2 -0
  37. package/project.mjs +22 -0
  38. package/project.mjs.map +1 -0
  39. package/prompt-BcpagjGh.d.mts +10 -0
  40. package/repo.d.mts +42 -0
  41. package/repo.mjs +46 -0
  42. package/repo.mjs.map +1 -0
  43. package/rolldown-runtime-D7D4PA-g.mjs +13 -0
  44. package/sandbox/driver.d.mts +2 -0
  45. package/sandbox/driver.mjs +63 -0
  46. package/sandbox/driver.mjs.map +1 -0
  47. package/sandbox/error.d.mts +7 -0
  48. package/sandbox/error.mjs +15 -0
  49. package/sandbox/error.mjs.map +1 -0
  50. package/sandbox/errors.d.mts +2 -0
  51. package/sandbox/errors.mjs +160 -0
  52. package/sandbox/errors.mjs.map +1 -0
  53. package/sandbox/filesystem.d.mts +2 -0
  54. package/sandbox/filesystem.mjs +142 -0
  55. package/sandbox/filesystem.mjs.map +1 -0
  56. package/sandbox/instance.d.mts +2 -0
  57. package/sandbox/instance.mjs +144 -0
  58. package/sandbox/instance.mjs.map +1 -0
  59. package/sandbox/io.d.mts +2 -0
  60. package/sandbox/io.mjs +127 -0
  61. package/sandbox/io.mjs.map +1 -0
  62. package/sandbox/resource.d.mts +28 -0
  63. package/sandbox/resource.mjs +29 -0
  64. package/sandbox/resource.mjs.map +1 -0
  65. package/sandbox/shell.d.mts +2 -0
  66. package/sandbox/shell.mjs +93 -0
  67. package/sandbox/shell.mjs.map +1 -0
  68. package/sandbox.d.mts +17 -0
  69. package/sandbox.mjs +39 -0
  70. package/sandbox.mjs.map +1 -0
  71. package/schema.d.mts +91 -0
  72. package/schema.mjs +105 -0
  73. package/schema.mjs.map +1 -0
  74. package/settings-CYL6yyDD.d.mts +193 -0
  75. package/settings.d.mts +2 -0
  76. package/settings.mjs +102 -0
  77. package/settings.mjs.map +1 -0
  78. package/shell-CZ6Y4lNU.d.mts +109 -0
  79. package/space-CR-9UxdT.d.mts +25 -0
  80. package/space.d.mts +2 -0
  81. package/space.mjs +33 -0
  82. package/space.mjs.map +1 -0
  83. package/tool/error.d.mts +2 -0
  84. package/tool/error.mjs +11 -0
  85. package/tool/error.mjs.map +1 -0
  86. package/tool/progress.d.mts +2 -0
  87. package/tool/progress.mjs +11 -0
  88. package/tool/progress.mjs.map +1 -0
  89. package/tool-BoVqkYvL.d.mts +287 -0
  90. package/tool-DuYBgiJf.d.mts +142 -0
  91. package/tool.d.mts +2 -0
  92. package/tool.mjs +71 -0
  93. package/tool.mjs.map +1 -0
package/package.json ADDED
@@ -0,0 +1,200 @@
1
+ {
2
+ "name": "@codeworksh/plugin",
3
+ "version": "0.0.1-dev.20260922103030",
4
+ "description": "SDK for building CodeWork plugins — the plugin, tool, and sandbox contracts shared with @codeworksh/harness.",
5
+ "keywords": [
6
+ "agent",
7
+ "ai",
8
+ "codework",
9
+ "harness",
10
+ "llm",
11
+ "plugin",
12
+ "sdk",
13
+ "tool"
14
+ ],
15
+ "homepage": "https://www.codework.sh",
16
+ "bugs": {
17
+ "url": "https://github.com/codeworksh/codework/issues"
18
+ },
19
+ "license": "MIT",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/codeworksh/codework.git",
23
+ "directory": "packages/plugin"
24
+ },
25
+ "type": "module",
26
+ "types": "./index.d.mts",
27
+ "exports": {
28
+ ".": {
29
+ "development": "./src/index.ts",
30
+ "types": "./index.d.mts",
31
+ "import": "./index.mjs",
32
+ "default": "./index.mjs"
33
+ },
34
+ "./plugin": {
35
+ "development": "./src/plugin.ts",
36
+ "types": "./plugin.d.mts",
37
+ "import": "./plugin.mjs",
38
+ "default": "./plugin.mjs"
39
+ },
40
+ "./plugin/tool": {
41
+ "development": "./src/plugin/tool.ts",
42
+ "types": "./plugin/tool.d.mts",
43
+ "import": "./plugin/tool.mjs",
44
+ "default": "./plugin/tool.mjs"
45
+ },
46
+ "./plugin/prompt": {
47
+ "development": "./src/plugin/prompt.ts",
48
+ "types": "./plugin/prompt.d.mts",
49
+ "import": "./plugin/prompt.mjs",
50
+ "default": "./plugin/prompt.mjs"
51
+ },
52
+ "./sandbox": {
53
+ "development": "./src/sandbox.ts",
54
+ "types": "./sandbox.d.mts",
55
+ "import": "./sandbox.mjs",
56
+ "default": "./sandbox.mjs"
57
+ },
58
+ "./sandbox/io": {
59
+ "development": "./src/sandbox/io.ts",
60
+ "types": "./sandbox/io.d.mts",
61
+ "import": "./sandbox/io.mjs",
62
+ "default": "./sandbox/io.mjs"
63
+ },
64
+ "./sandbox/driver": {
65
+ "development": "./src/sandbox/driver.ts",
66
+ "types": "./sandbox/driver.d.mts",
67
+ "import": "./sandbox/driver.mjs",
68
+ "default": "./sandbox/driver.mjs"
69
+ },
70
+ "./sandbox/errors": {
71
+ "development": "./src/sandbox/errors.ts",
72
+ "types": "./sandbox/errors.d.mts",
73
+ "import": "./sandbox/errors.mjs",
74
+ "default": "./sandbox/errors.mjs"
75
+ },
76
+ "./sandbox/error": {
77
+ "development": "./src/sandbox/error.ts",
78
+ "types": "./sandbox/error.d.mts",
79
+ "import": "./sandbox/error.mjs",
80
+ "default": "./sandbox/error.mjs"
81
+ },
82
+ "./sandbox/instance": {
83
+ "development": "./src/sandbox/instance.ts",
84
+ "types": "./sandbox/instance.d.mts",
85
+ "import": "./sandbox/instance.mjs",
86
+ "default": "./sandbox/instance.mjs"
87
+ },
88
+ "./sandbox/filesystem": {
89
+ "development": "./src/sandbox/filesystem.ts",
90
+ "types": "./sandbox/filesystem.d.mts",
91
+ "import": "./sandbox/filesystem.mjs",
92
+ "default": "./sandbox/filesystem.mjs"
93
+ },
94
+ "./sandbox/shell": {
95
+ "development": "./src/sandbox/shell.ts",
96
+ "types": "./sandbox/shell.d.mts",
97
+ "import": "./sandbox/shell.mjs",
98
+ "default": "./sandbox/shell.mjs"
99
+ },
100
+ "./sandbox/resource": {
101
+ "development": "./src/sandbox/resource.ts",
102
+ "types": "./sandbox/resource.d.mts",
103
+ "import": "./sandbox/resource.mjs",
104
+ "default": "./sandbox/resource.mjs"
105
+ },
106
+ "./tool": {
107
+ "development": "./src/tool.ts",
108
+ "types": "./tool.d.mts",
109
+ "import": "./tool.mjs",
110
+ "default": "./tool.mjs"
111
+ },
112
+ "./tool/error": {
113
+ "development": "./src/tool/error.ts",
114
+ "types": "./tool/error.d.mts",
115
+ "import": "./tool/error.mjs",
116
+ "default": "./tool/error.mjs"
117
+ },
118
+ "./tool/progress": {
119
+ "development": "./src/tool/progress.ts",
120
+ "types": "./tool/progress.d.mts",
121
+ "import": "./tool/progress.mjs",
122
+ "default": "./tool/progress.mjs"
123
+ },
124
+ "./event": {
125
+ "development": "./src/event.ts",
126
+ "types": "./event.d.mts",
127
+ "import": "./event.mjs",
128
+ "default": "./event.mjs"
129
+ },
130
+ "./ids": {
131
+ "development": "./src/ids.ts",
132
+ "types": "./ids.d.mts",
133
+ "import": "./ids.mjs",
134
+ "default": "./ids.mjs"
135
+ },
136
+ "./location": {
137
+ "development": "./src/location.ts",
138
+ "types": "./location.d.mts",
139
+ "import": "./location.mjs",
140
+ "default": "./location.mjs"
141
+ },
142
+ "./project": {
143
+ "development": "./src/project.ts",
144
+ "types": "./project.d.mts",
145
+ "import": "./project.mjs",
146
+ "default": "./project.mjs"
147
+ },
148
+ "./repo": {
149
+ "development": "./src/repo.ts",
150
+ "types": "./repo.d.mts",
151
+ "import": "./repo.mjs",
152
+ "default": "./repo.mjs"
153
+ },
154
+ "./space": {
155
+ "development": "./src/space.ts",
156
+ "types": "./space.d.mts",
157
+ "import": "./space.mjs",
158
+ "default": "./space.mjs"
159
+ },
160
+ "./settings": {
161
+ "development": "./src/settings.ts",
162
+ "types": "./settings.d.mts",
163
+ "import": "./settings.mjs",
164
+ "default": "./settings.mjs"
165
+ },
166
+ "./schema": {
167
+ "development": "./src/schema.ts",
168
+ "types": "./schema.d.mts",
169
+ "import": "./schema.mjs",
170
+ "default": "./schema.mjs"
171
+ },
172
+ "./posix": {
173
+ "development": "./src/posix.ts",
174
+ "types": "./posix.d.mts",
175
+ "import": "./posix.mjs",
176
+ "default": "./posix.mjs"
177
+ },
178
+ "./package.json": "./package.json"
179
+ },
180
+ "files": [
181
+ "**/*",
182
+ "README.md",
183
+ "LICENSE"
184
+ ],
185
+ "publishConfig": {
186
+ "access": "public"
187
+ },
188
+ "engines": {
189
+ "node": ">=24.14.1"
190
+ },
191
+ "dependencies": {
192
+ "@codeworksh/aikit": "0.8.0",
193
+ "tslib": "^2.8.1",
194
+ "typebox": "^1.3.30",
195
+ "uuidv7": "^1.2.1"
196
+ },
197
+ "peerDependencies": {
198
+ "effect": "4.0.0-rc.115"
199
+ }
200
+ }
@@ -0,0 +1,2 @@
1
+ import { t as PromptRegistry } from "../prompt-BcpagjGh.mjs";
2
+ export { PromptRegistry };
@@ -0,0 +1,7 @@
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
+ //#region src/plugin/prompt.ts
3
+ var prompt_exports = /* @__PURE__ */ __exportAll({});
4
+ //#endregion
5
+ export { prompt_exports as t };
6
+
7
+ //# sourceMappingURL=prompt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.mjs","names":[],"sources":["../../../src/plugin/prompt.ts"],"sourcesContent":["export interface PromptRegistry {\n\treadonly set: (systemPrompt: string) => void;\n\treadonly get: () => string | undefined;\n}\n"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { a as ToolAfterResult, c as ToolBeforeResult, d as ToolRegistry, f as ToolResultContent, i as ToolAfterFn, l as ToolDefPatch, n as ToolAddOptions, o as ToolBefore, r as ToolAfter, s as ToolBeforeFn, t as HookReturn, u as ToolRegistration } from "../tool-BoVqkYvL.mjs";
2
+ export { HookReturn, ToolAddOptions, ToolAfter, ToolAfterFn, ToolAfterResult, ToolBefore, ToolBeforeFn, ToolBeforeResult, ToolDefPatch, ToolRegistration, ToolRegistry, ToolResultContent };
@@ -0,0 +1,29 @@
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.mjs";
2
+ import { AikitToolCallTerminalPart } from "../event.mjs";
3
+ import { MessageID, SessionID } from "../ids.mjs";
4
+ import { ToolCallContext } from "../tool.mjs";
5
+ import { Schema } from "effect";
6
+ //#region src/plugin/tool.ts
7
+ var tool_exports = /* @__PURE__ */ __exportAll({
8
+ ToolAfter: () => ToolAfter,
9
+ ToolBefore: () => ToolBefore,
10
+ ToolBeforeResult: () => ToolBeforeResult
11
+ });
12
+ const ToolBefore = Schema.Struct({
13
+ ...ToolCallContext.fields,
14
+ sessionId: SessionID,
15
+ messageId: MessageID,
16
+ params: Schema.Unknown
17
+ });
18
+ const ToolAfter = Schema.Struct({
19
+ ...ToolBefore.fields,
20
+ terminal: AikitToolCallTerminalPart
21
+ });
22
+ const ToolBeforeResult = Schema.Struct({
23
+ block: Schema.Boolean,
24
+ reason: Schema.optional(Schema.String)
25
+ });
26
+ //#endregion
27
+ export { ToolAfter, ToolBefore, ToolBeforeResult, tool_exports as t };
28
+
29
+ //# sourceMappingURL=tool.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.mjs","names":[],"sources":["../../../src/plugin/tool.ts"],"sourcesContent":["import { type Effect, Schema } from \"effect\";\nimport { AikitToolCallTerminalPart } from \"../event.ts\";\nimport { MessageID, SessionID } from \"../ids.ts\";\nimport { type AnyToolDef, type ModelContent, type RegisteredTool, ToolCallContext } from \"../tool.ts\";\n\nexport const ToolBefore = Schema.Struct({\n\t...ToolCallContext.fields,\n\tsessionId: SessionID,\n\tmessageId: MessageID,\n\tparams: Schema.Unknown,\n});\nexport type ToolBefore = typeof ToolBefore.Type;\nexport const ToolAfter = Schema.Struct({ ...ToolBefore.fields, terminal: AikitToolCallTerminalPart });\nexport type ToolAfter = typeof ToolAfter.Type;\nexport const ToolBeforeResult = Schema.Struct({ block: Schema.Boolean, reason: Schema.optional(Schema.String) });\nexport type ToolBeforeResult = typeof ToolBeforeResult.Type;\nexport type ToolResultContent = ModelContent;\nexport interface ToolAfterResult {\n\treadonly content?: ToolResultContent;\n\treadonly details?: unknown;\n\treadonly isError?: boolean;\n}\nexport type HookReturn<A> = A | void | Promise<A | void> | Effect.Effect<A | void, unknown>;\nexport type ToolBeforeFn = (call: ToolBefore) => HookReturn<ToolBeforeResult>;\nexport type ToolAfterFn = (call: ToolAfter) => HookReturn<ToolAfterResult>;\nexport interface ToolAddOptions {\n\treadonly beforeToolCall?: ToolBeforeFn;\n\treadonly afterToolCall?: ToolAfterFn;\n}\nexport interface ToolDefPatch {\n\treadonly description?: string;\n\treadonly label?: string;\n\treadonly promptSnippet?: string;\n\treadonly promptGuidelines?: ReadonlyArray<string>;\n}\n/**\n * One frozen bucket entry: the winning tool for a name together with the hooks that\n * `add` declared alongside it. Kept here rather than in the bucket implementation so\n * the executor shares the contract without importing plugin assembly.\n */\nexport interface ToolRegistration {\n\treadonly tool: RegisteredTool;\n\treadonly hooks: ToolAddOptions;\n}\nexport interface ToolRegistry {\n\treadonly add: (tool: RegisteredTool, options?: ToolAddOptions) => void;\n\treadonly update: (name: string, patch: ToolDefPatch) => void;\n\treadonly list: () => ReadonlyArray<AnyToolDef>;\n\treadonly get: (name: string) => AnyToolDef | undefined;\n\treadonly has: (name: string) => boolean;\n}\n"],"mappings":";;;;;;;;;;;AAKA,MAAa,aAAa,OAAO,OAAO;CACvC,GAAG,gBAAgB;CACnB,WAAW;CACX,WAAW;CACX,QAAQ,OAAO;AAChB,CAAC;AAED,MAAa,YAAY,OAAO,OAAO;CAAE,GAAG,WAAW;CAAQ,UAAU;AAA0B,CAAC;AAEpG,MAAa,mBAAmB,OAAO,OAAO;CAAE,OAAO,OAAO;CAAS,QAAQ,OAAO,SAAS,OAAO,MAAM;AAAE,CAAC"}
@@ -0,0 +1,140 @@
1
+ import { i as Definition, o as Payload, r as Data, s as PublishOptions } from "./event-rIZpnOTo.mjs";
2
+ import { n as SessionID } from "./ids-CHjmAdTc.mjs";
3
+ import { r as Info, s as Service } from "./location-D4hAfuXF.mjs";
4
+ import { a as Provides, r as Identity, u as io_d_exports } from "./io-BYs7hbiY.mjs";
5
+ import { r as Info$1 } from "./settings-CYL6yyDD.mjs";
6
+ import { n as prompt_d_exports, t as PromptRegistry } from "./prompt-BcpagjGh.mjs";
7
+ import { d as ToolRegistry, p as tool_d_exports } from "./tool-BoVqkYvL.mjs";
8
+ import { Model } from "@codeworksh/aikit";
9
+ import { Effect } from "effect";
10
+ //#region src/plugin/registry.d.ts
11
+ /**
12
+ * What a plugin writes into during `setup`: one registry per domain.
13
+ *
14
+ * The buckets are open for the duration of the setup pass and frozen after it, so a plugin holds
15
+ * the object only as long as writing to it means anything. Assembling the frozen snapshot — the
16
+ * effective tool catalog and the final system prompt — is the harness's job, not the contract's.
17
+ */
18
+ interface PluginRegistry {
19
+ readonly tools: ToolRegistry;
20
+ readonly prompt: PromptRegistry;
21
+ }
22
+ //#endregion
23
+ //#region src/plugin/context.d.ts
24
+ type PromptResolver = (ctx: SharedPluginContext) => string | Promise<string>;
25
+ interface Config {
26
+ readonly promptCustom?: PromptResolver;
27
+ readonly promptSystemAppend?: PromptResolver;
28
+ }
29
+ /**
30
+ * The publish half of the harness event bus.
31
+ *
32
+ * Narrowed to `publish` on purpose: a plugin announces what it did, it does not read the journal.
33
+ * Kernel event types are reserved — the harness rejects a plugin publishing one — so a plugin's
34
+ * own definitions must be namespaced `plugin.<id>.*`.
35
+ */
36
+ interface Events {
37
+ readonly publish: <D extends Definition>(definition: D, data: Data<D>, options?: PublishOptions) => Effect.Effect<Payload<D>>;
38
+ }
39
+ /** One object, shared by every plugin in one exchange. */
40
+ interface SharedPluginContext {
41
+ readonly sessionId: SessionID;
42
+ readonly sandbox: Identity;
43
+ readonly location: Info;
44
+ readonly settings: Info$1;
45
+ readonly model: Model.Info;
46
+ readonly config: Config;
47
+ readonly events: Events;
48
+ readonly plugin: PluginRegistry;
49
+ }
50
+ //#endregion
51
+ //#region src/plugin/ref.d.ts
52
+ /**
53
+ * How a plugin is named in a `plugins` array, and what the harness does with each shape.
54
+ *
55
+ * The array is the whole configuration surface: an entry either *selects* a module or
56
+ * *configures* one something else already selected. Nothing else is required of a plugin author,
57
+ * which is why the shapes live in this package rather than in the loader that consumes them.
58
+ */
59
+ /** Opaque to the harness: a plugin reads and validates its own block. */
60
+ type PluginOptions = {
61
+ readonly [key: string]: unknown;
62
+ };
63
+ /** A module to load: a path, a `file:` URL, or a package spec. Definitions are passed directly. */
64
+ type PluginSpec = Plugin | string;
65
+ interface PluginConfig {
66
+ /** `false` drops the plugin from the selection. */
67
+ readonly enabled?: boolean | undefined;
68
+ readonly options?: PluginOptions | undefined;
69
+ }
70
+ /**
71
+ * Configuration for a plugin something else already selected, naming it by ID (`plugin`) or by
72
+ * the module string it was registered from (`package`) — exactly one of the two. It loads nothing,
73
+ * so a name matching nothing in the selection is ignored rather than fetched.
74
+ */
75
+ type PluginPatch = (PluginConfig & {
76
+ readonly plugin: string;
77
+ readonly package?: never;
78
+ }) | (PluginConfig & {
79
+ readonly package: string;
80
+ readonly plugin?: never;
81
+ });
82
+ type PluginRef = PluginSpec | PluginPatch;
83
+ //#endregion
84
+ //#region src/plugin/plugin.d.ts
85
+ /**
86
+ * The domains a plugin can extend, and the order the harness runs them in.
87
+ *
88
+ * Order is declared, not positional. A plugin's place used to come from where its entry sat in
89
+ * the `plugins` array, which is unknowable when the entry is written: a user's settings file and
90
+ * a project's are edited by different people at different times, and neither can see the other's
91
+ * order. Since a prompt plugin indexes the tools registered before it, that made a tool added
92
+ * from settings invisible in the system prompt, with no way to fix it from a settings file.
93
+ *
94
+ * A plugin instead says which domain it extends, and the harness runs the domains in this order.
95
+ * Entries within one domain keep the order they were written in, because that is where
96
+ * composition actually happens -- a plugin patching another's tool, or appending to the prompt a
97
+ * previous one rendered, is written next to it and deliberately after it.
98
+ *
99
+ * Kept as data so a later release can add a domain, or make the order configurable, without
100
+ * touching the loader: `{ tool: 1, skill: 2, prompt: 3 }` needs no code change here.
101
+ */
102
+ declare const domains: {
103
+ readonly tool: 1;
104
+ readonly prompt: 2;
105
+ };
106
+ type PluginKind = keyof typeof domains;
107
+ /** Sort key for a plugin: its domain first, then where it was written. */
108
+ declare const rank: (kind: PluginKind) => 1 | 2;
109
+ type Mount = Provides | Service;
110
+ interface Plugin {
111
+ readonly id: string;
112
+ /**
113
+ * The domain this plugin extends, which decides when it runs: every `tool` plugin is set up
114
+ * before any `prompt` plugin, whichever settings layer each came from, so a prompt plugin
115
+ * always sees the complete tool set. Plugins within one domain run in the order they were
116
+ * written.
117
+ */
118
+ readonly kind: PluginKind;
119
+ /**
120
+ * Event definitions this plugin publishes. Declared rather than registered at
121
+ * runtime so they are known before the event system builds, and so a bad type
122
+ * fails the boot instead of the first publish. Types must be namespaced
123
+ * `plugin.<id>.*`.
124
+ */
125
+ readonly events?: ReadonlyArray<Definition>;
126
+ /**
127
+ * `options` is this plugin's own configuration block, `{}` when its entry carried none.
128
+ * Unvalidated: the harness never looks inside it, so a plugin checks whatever shape it
129
+ * documents. It is a second argument rather than a context field so `ctx` stays one object
130
+ * shared by every plugin in the exchange.
131
+ */
132
+ readonly setup: (ctx: SharedPluginContext, options: PluginOptions) => void | Promise<void> | Effect.Effect<void, unknown, Mount>;
133
+ }
134
+ declare const define: (plugin: Plugin) => Plugin;
135
+ declare namespace plugin_d_exports {
136
+ export { Config, Events, Mount, Plugin, PluginKind, PluginOptions, PluginPatch, PluginRef, PluginRegistry, PluginSpec, prompt_d_exports as Prompt, PromptResolver, SharedPluginContext, tool_d_exports as Tool, define, domains, rank };
137
+ }
138
+ //#endregion
139
+ export { define as a, PluginOptions as c, PluginSpec as d, Config as f, PluginRegistry as g, SharedPluginContext as h, PluginKind as i, PluginPatch as l, PromptResolver as m, Mount as n, domains as o, Events as p, Plugin as r, rank as s, plugin_d_exports as t, PluginRef as u };
140
+ //# sourceMappingURL=plugin-DbJEpY3M.d.mts.map
@@ -0,0 +1,41 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { t as prompt_exports } from "./plugin/prompt.mjs";
3
+ import { t as tool_exports } from "./plugin/tool.mjs";
4
+ //#region src/plugin/plugin.ts
5
+ /**
6
+ * The domains a plugin can extend, and the order the harness runs them in.
7
+ *
8
+ * Order is declared, not positional. A plugin's place used to come from where its entry sat in
9
+ * the `plugins` array, which is unknowable when the entry is written: a user's settings file and
10
+ * a project's are edited by different people at different times, and neither can see the other's
11
+ * order. Since a prompt plugin indexes the tools registered before it, that made a tool added
12
+ * from settings invisible in the system prompt, with no way to fix it from a settings file.
13
+ *
14
+ * A plugin instead says which domain it extends, and the harness runs the domains in this order.
15
+ * Entries within one domain keep the order they were written in, because that is where
16
+ * composition actually happens -- a plugin patching another's tool, or appending to the prompt a
17
+ * previous one rendered, is written next to it and deliberately after it.
18
+ *
19
+ * Kept as data so a later release can add a domain, or make the order configurable, without
20
+ * touching the loader: `{ tool: 1, skill: 2, prompt: 3 }` needs no code change here.
21
+ */
22
+ const domains = {
23
+ tool: 1,
24
+ prompt: 2
25
+ };
26
+ /** Sort key for a plugin: its domain first, then where it was written. */
27
+ const rank = (kind) => domains[kind];
28
+ const define = (plugin) => plugin;
29
+ //#endregion
30
+ //#region src/plugin.ts
31
+ var plugin_exports = /* @__PURE__ */ __exportAll({
32
+ Prompt: () => prompt_exports,
33
+ Tool: () => tool_exports,
34
+ define: () => define,
35
+ domains: () => domains,
36
+ rank: () => rank
37
+ });
38
+ //#endregion
39
+ export { rank as i, define as n, domains as r, plugin_exports as t };
40
+
41
+ //# sourceMappingURL=plugin-lorpq7Oi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-lorpq7Oi.mjs","names":[],"sources":["../../src/plugin/plugin.ts","../../src/plugin.ts"],"sourcesContent":["import type { Effect } from \"effect\";\nimport type { Definition } from \"../event.ts\";\nimport type { Service as LocationService } from \"../location.ts\";\nimport type { SandboxIO } from \"../sandbox/io.ts\";\nimport type { PluginOptions } from \"./ref.ts\";\nimport type { SharedPluginContext } from \"./context.ts\";\n\n/**\n * The domains a plugin can extend, and the order the harness runs them in.\n *\n * Order is declared, not positional. A plugin's place used to come from where its entry sat in\n * the `plugins` array, which is unknowable when the entry is written: a user's settings file and\n * a project's are edited by different people at different times, and neither can see the other's\n * order. Since a prompt plugin indexes the tools registered before it, that made a tool added\n * from settings invisible in the system prompt, with no way to fix it from a settings file.\n *\n * A plugin instead says which domain it extends, and the harness runs the domains in this order.\n * Entries within one domain keep the order they were written in, because that is where\n * composition actually happens -- a plugin patching another's tool, or appending to the prompt a\n * previous one rendered, is written next to it and deliberately after it.\n *\n * Kept as data so a later release can add a domain, or make the order configurable, without\n * touching the loader: `{ tool: 1, skill: 2, prompt: 3 }` needs no code change here.\n */\nexport const domains = { tool: 1, prompt: 2 } as const;\n\nexport type PluginKind = keyof typeof domains;\n\n/** Sort key for a plugin: its domain first, then where it was written. */\nexport const rank = (kind: PluginKind) => domains[kind];\n\nexport type Mount = SandboxIO.Provides | LocationService;\nexport interface Plugin {\n\treadonly id: string;\n\t/**\n\t * The domain this plugin extends, which decides when it runs: every `tool` plugin is set up\n\t * before any `prompt` plugin, whichever settings layer each came from, so a prompt plugin\n\t * always sees the complete tool set. Plugins within one domain run in the order they were\n\t * written.\n\t */\n\treadonly kind: PluginKind;\n\t/**\n\t * Event definitions this plugin publishes. Declared rather than registered at\n\t * runtime so they are known before the event system builds, and so a bad type\n\t * fails the boot instead of the first publish. Types must be namespaced\n\t * `plugin.<id>.*`.\n\t */\n\treadonly events?: ReadonlyArray<Definition>;\n\t/**\n\t * `options` is this plugin's own configuration block, `{}` when its entry carried none.\n\t * Unvalidated: the harness never looks inside it, so a plugin checks whatever shape it\n\t * documents. It is a second argument rather than a context field so `ctx` stays one object\n\t * shared by every plugin in the exchange.\n\t */\n\treadonly setup: (\n\t\tctx: SharedPluginContext,\n\t\toptions: PluginOptions,\n\t) => void | Promise<void> | Effect.Effect<void, unknown, Mount>;\n}\n\nexport const define = (plugin: Plugin): Plugin => plugin;\n","/**\n * The plugin authoring surface.\n *\n * Everything a third-party plugin needs to describe itself and to write into the harness during\n * `setup`, and nothing about how the harness finds, installs or runs it. Loading, the store and\n * the `.npmrc` anchoring stay in `@codeworksh/harness`, which imports this same module — so a\n * plugin and its host agree on one set of types rather than two that happen to match.\n */\nexport type { Config, Events, PromptResolver, SharedPluginContext } from \"./plugin/context.ts\";\nexport { define, domains, type Mount, type Plugin, type PluginKind, rank } from \"./plugin/plugin.ts\";\nexport * as Prompt from \"./plugin/prompt.ts\";\nexport type { PluginOptions, PluginPatch, PluginRef, PluginSpec } from \"./plugin/ref.ts\";\nexport type { PluginRegistry } from \"./plugin/registry.ts\";\nexport * as Tool from \"./plugin/tool.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,UAAU;CAAE,MAAM;CAAG,QAAQ;AAAE;;AAK5C,MAAa,QAAQ,SAAqB,QAAQ;AA+BlD,MAAa,UAAU,WAA2B"}
package/plugin.d.mts ADDED
@@ -0,0 +1,4 @@
1
+ import { n as prompt_d_exports } from "./prompt-BcpagjGh.mjs";
2
+ import { p as tool_d_exports } from "./tool-BoVqkYvL.mjs";
3
+ import { a as define, c as PluginOptions, d as PluginSpec, f as Config, g as PluginRegistry, h as SharedPluginContext, i as PluginKind, l as PluginPatch, m as PromptResolver, n as Mount, o as domains, p as Events, r as Plugin, s as rank, u as PluginRef } from "./plugin-DbJEpY3M.mjs";
4
+ export { type Config, type Events, type Mount, type Plugin, type PluginKind, type PluginOptions, type PluginPatch, type PluginRef, type PluginRegistry, type PluginSpec, prompt_d_exports as Prompt, type PromptResolver, type SharedPluginContext, tool_d_exports as Tool, define, domains, rank };
package/plugin.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { i as rank, n as define, r as domains } from "./plugin-lorpq7Oi.mjs";
2
+ import { t as prompt_exports } from "./plugin/prompt.mjs";
3
+ import { t as tool_exports } from "./plugin/tool.mjs";
4
+ export { prompt_exports as Prompt, tool_exports as Tool, define, domains, rank };
package/posix.d.mts ADDED
@@ -0,0 +1,6 @@
1
+ import { Path } from "effect";
2
+ //#region src/posix.d.ts
3
+ /** Shared POSIX path implementation for sandbox and remote-runtime paths. */
4
+ export declare const posix: Path.Path;
5
+ //#endregion
6
+ //# sourceMappingURL=posix.d.mts.map
package/posix.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import { Effect, Path } from "effect";
2
+ //#region src/posix.ts
3
+ /** Shared POSIX path implementation for sandbox and remote-runtime paths. */
4
+ const posix = Effect.runSync(Path.Path.pipe(Effect.provide(Path.layer)));
5
+ //#endregion
6
+ export { posix };
7
+
8
+ //# sourceMappingURL=posix.mjs.map
package/posix.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posix.mjs","names":[],"sources":["../../src/posix.ts"],"sourcesContent":["import { Effect, Path } from \"effect\";\n\n/** Shared POSIX path implementation for sandbox and remote-runtime paths. */\nexport const posix = Effect.runSync(Path.Path.pipe(Effect.provide(Path.layer)));\n"],"mappings":";;;AAGA,MAAa,QAAQ,OAAO,QAAQ,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,KAAK,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Schema } from "effect";
2
+ declare namespace project_d_exports {
3
+ export { ID, Info, project_d_exports as ProjectSchema, Status };
4
+ }
5
+ declare const ID: Schema.brand<Schema.String, "Project.ID">;
6
+ type ID = typeof ID.Type;
7
+ declare const Status: Schema.Literals<readonly ["active", "archived"]>;
8
+ type Status = typeof Status.Type;
9
+ declare const Info_base: Schema.Class<Info, Schema.Struct<{
10
+ readonly id: Schema.brand<Schema.String, "Project.ID">;
11
+ readonly name: Schema.String;
12
+ readonly status: Schema.Literals<readonly ["active", "archived"]>;
13
+ readonly vcs: Schema.optional<Schema.Union<readonly [Schema.Struct<{
14
+ readonly type: Schema.Literal<"git">;
15
+ readonly store: Schema.brand<Schema.String, "AbsolutePath">;
16
+ }>]>>;
17
+ }>, {}>;
18
+ declare class Info extends Info_base {}
19
+ //#endregion
20
+ export { project_d_exports as i, Info as n, Status as r, ID as t };
21
+ //# sourceMappingURL=project-CLGsIFD-.d.mts.map
package/project.d.mts ADDED
@@ -0,0 +1,2 @@
1
+ import { i as project_d_exports, n as Info, r as Status, t as ID } from "./project-CLGsIFD-.mjs";
2
+ export { ID, Info, project_d_exports as ProjectSchema, Status };
package/project.mjs ADDED
@@ -0,0 +1,22 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Vcs } from "./repo.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/project.ts
5
+ var project_exports = /* @__PURE__ */ __exportAll({
6
+ ID: () => ID,
7
+ Info: () => Info,
8
+ ProjectSchema: () => project_exports,
9
+ Status: () => Status
10
+ });
11
+ const ID = Schema.String.pipe(Schema.brand("Project.ID"));
12
+ const Status = Schema.Literals(["active", "archived"]);
13
+ var Info = class extends Schema.Class("Project.Info")({
14
+ id: ID,
15
+ name: Schema.String,
16
+ status: Status,
17
+ vcs: Schema.optional(Vcs)
18
+ }) {};
19
+ //#endregion
20
+ export { ID, Info, project_exports as ProjectSchema, Status };
21
+
22
+ //# sourceMappingURL=project.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.mjs","names":["RepoSchema.Vcs"],"sources":["../../src/project.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { RepoSchema } from \"./repo.ts\";\n\n// Env-independent project id: marker ?? remoteHash ?? rootCommit ?? provisional.\nexport const ID = Schema.String.pipe(Schema.brand(\"Project.ID\"));\nexport type ID = typeof ID.Type;\n\n// A project is archived, never deleted, once it has no active space anywhere.\nexport const Status = Schema.Literals([\"active\", \"archived\"]);\nexport type Status = typeof Status.Type;\n\nexport class Info extends Schema.Class<Info>(\"Project.Info\")({\n\tid: ID,\n\tname: Schema.String,\n\tstatus: Status,\n\tvcs: Schema.optional(RepoSchema.Vcs),\n}) {}\n\nexport * as ProjectSchema from \"./project.ts\";\n"],"mappings":";;;;;;;;;;AAIA,MAAa,KAAK,OAAO,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAI/D,MAAa,SAAS,OAAO,SAAS,CAAC,UAAU,UAAU,CAAC;AAG5D,IAAa,OAAb,cAA0B,OAAO,MAAY,cAAc,CAAC,CAAC;CAC5D,IAAI;CACJ,MAAM,OAAO;CACb,QAAQ;CACR,KAAK,OAAO,SAASA,GAAc;AACpC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ declare namespace prompt_d_exports {
2
+ export { PromptRegistry };
3
+ }
4
+ interface PromptRegistry {
5
+ readonly set: (systemPrompt: string) => void;
6
+ readonly get: () => string | undefined;
7
+ }
8
+ //#endregion
9
+ export { prompt_d_exports as n, PromptRegistry as t };
10
+ //# sourceMappingURL=prompt-BcpagjGh.d.mts.map
package/repo.d.mts ADDED
@@ -0,0 +1,42 @@
1
+ import { Schema } from "effect";
2
+ declare namespace repo_d_exports {
3
+ export { Info, repo_d_exports as RepoSchema, Vcs };
4
+ }
5
+ export declare const Vcs: Schema.Union<readonly [Schema.Struct<{
6
+ readonly type: Schema.Literal<"git">;
7
+ readonly store: Schema.brand<Schema.String, "AbsolutePath">;
8
+ }>]>;
9
+ export type Vcs = typeof Vcs.Type;
10
+ export declare const Info: Schema.Struct<{
11
+ /**
12
+ * The root directory of the working tree that contains the input path
13
+ * (`rev-parse --show-toplevel`).
14
+ *
15
+ * For `/home/me/app/src/file.ts` in a normal clone, this is `/home/me/app`.
16
+ * For `/home/me/app-feature/src/file.ts` in a linked worktree, this is
17
+ * `/home/me/app-feature`.
18
+ */
19
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
20
+ /**
21
+ * This checkout's own git directory (`rev-parse --git-dir`).
22
+ *
23
+ * For a normal clone at `/home/me/app`, this is `/home/me/app/.git`. For a
24
+ * linked worktree it lives under the store, e.g.
25
+ * `/home/me/app/.git/worktrees/app-feature`. `gitDir === store` iff this is
26
+ * the main checkout.
27
+ */
28
+ readonly gitDir: Schema.brand<Schema.String, "AbsolutePath">;
29
+ /**
30
+ * The shared Git storage directory used by this repo and any linked
31
+ * worktrees (`rev-parse --git-common-dir`).
32
+ *
33
+ * For a normal clone at `/home/me/app`, this is usually `/home/me/app/.git`.
34
+ * For a linked worktree at `/home/me/app-feature` whose main checkout is
35
+ * `/home/me/app`, this is usually `/home/me/app/.git`.
36
+ */
37
+ readonly store: Schema.brand<Schema.String, "AbsolutePath">;
38
+ }>;
39
+ export type Info = typeof Info.Type;
40
+ //#endregion
41
+ export { repo_d_exports as RepoSchema };
42
+ //# sourceMappingURL=repo.d.mts.map
package/repo.mjs ADDED
@@ -0,0 +1,46 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { AbsolutePath } from "./schema.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/repo.ts
5
+ var repo_exports = /* @__PURE__ */ __exportAll({
6
+ Info: () => Info,
7
+ RepoSchema: () => repo_exports,
8
+ Vcs: () => Vcs
9
+ });
10
+ const Vcs = Schema.Union([Schema.Struct({
11
+ type: Schema.Literal("git"),
12
+ store: AbsolutePath
13
+ })]);
14
+ const Info = Schema.Struct({
15
+ /**
16
+ * The root directory of the working tree that contains the input path
17
+ * (`rev-parse --show-toplevel`).
18
+ *
19
+ * For `/home/me/app/src/file.ts` in a normal clone, this is `/home/me/app`.
20
+ * For `/home/me/app-feature/src/file.ts` in a linked worktree, this is
21
+ * `/home/me/app-feature`.
22
+ */
23
+ directory: AbsolutePath,
24
+ /**
25
+ * This checkout's own git directory (`rev-parse --git-dir`).
26
+ *
27
+ * For a normal clone at `/home/me/app`, this is `/home/me/app/.git`. For a
28
+ * linked worktree it lives under the store, e.g.
29
+ * `/home/me/app/.git/worktrees/app-feature`. `gitDir === store` iff this is
30
+ * the main checkout.
31
+ */
32
+ gitDir: AbsolutePath,
33
+ /**
34
+ * The shared Git storage directory used by this repo and any linked
35
+ * worktrees (`rev-parse --git-common-dir`).
36
+ *
37
+ * For a normal clone at `/home/me/app`, this is usually `/home/me/app/.git`.
38
+ * For a linked worktree at `/home/me/app-feature` whose main checkout is
39
+ * `/home/me/app`, this is usually `/home/me/app/.git`.
40
+ */
41
+ store: AbsolutePath
42
+ });
43
+ //#endregion
44
+ export { Info, repo_exports as RepoSchema, Vcs };
45
+
46
+ //# sourceMappingURL=repo.mjs.map
package/repo.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo.mjs","names":[],"sources":["../../src/repo.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { AbsolutePath } from \"./schema.ts\";\n\n// Identified vcs type and its shared storage path.\n// Example: `{ type: \"git\", store: \"/app/code/.git\" }`\nexport const Vcs = Schema.Union([\n\tSchema.Struct({\n\t\ttype: Schema.Literal(\"git\"),\n\t\tstore: AbsolutePath,\n\t}),\n]);\nexport type Vcs = typeof Vcs.Type;\n\n// A discovered git repository. Every path is realpath'd.\nexport const Info = Schema.Struct({\n\t/**\n\t * The root directory of the working tree that contains the input path\n\t * (`rev-parse --show-toplevel`).\n\t *\n\t * For `/home/me/app/src/file.ts` in a normal clone, this is `/home/me/app`.\n\t * For `/home/me/app-feature/src/file.ts` in a linked worktree, this is\n\t * `/home/me/app-feature`.\n\t */\n\tdirectory: AbsolutePath,\n\t/**\n\t * This checkout's own git directory (`rev-parse --git-dir`).\n\t *\n\t * For a normal clone at `/home/me/app`, this is `/home/me/app/.git`. For a\n\t * linked worktree it lives under the store, e.g.\n\t * `/home/me/app/.git/worktrees/app-feature`. `gitDir === store` iff this is\n\t * the main checkout.\n\t */\n\tgitDir: AbsolutePath,\n\t/**\n\t * The shared Git storage directory used by this repo and any linked\n\t * worktrees (`rev-parse --git-common-dir`).\n\t *\n\t * For a normal clone at `/home/me/app`, this is usually `/home/me/app/.git`.\n\t * For a linked worktree at `/home/me/app-feature` whose main checkout is\n\t * `/home/me/app`, this is usually `/home/me/app/.git`.\n\t */\n\tstore: AbsolutePath,\n});\nexport type Info = typeof Info.Type;\n\nexport * as RepoSchema from \"./repo.ts\";\n"],"mappings":";;;;;;;;;AAKA,MAAa,MAAM,OAAO,MAAM,CAC/B,OAAO,OAAO;CACb,MAAM,OAAO,QAAQ,KAAK;CAC1B,OAAO;AACR,CAAC,CACF,CAAC;AAID,MAAa,OAAO,OAAO,OAAO;;;;;;;;;CASjC,WAAW;;;;;;;;;CASX,QAAQ;;;;;;;;;CASR,OAAO;AACR,CAAC"}