@rzx/ohs 1.1.12 → 1.1.13

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.
@@ -118,7 +118,15 @@ var init_builtinThemes = __esm(() => {
118
118
  });
119
119
 
120
120
  // ../../packages/protocol/src/session.ts
121
- var SESSION_EVENT_SCHEMA_VERSION = 1;
121
+ function sessionEventSchemaVersion(type) {
122
+ return SESSION_EVENT_SCHEMA_VERSIONS[type] ?? SESSION_EVENT_SCHEMA_VERSION;
123
+ }
124
+ var SESSION_EVENT_SCHEMA_VERSION = 1, SESSION_EVENT_SCHEMA_VERSIONS;
125
+ var init_session = __esm(() => {
126
+ SESSION_EVENT_SCHEMA_VERSIONS = {
127
+ "session.input.admitted": 2
128
+ };
129
+ });
122
130
 
123
131
  // ../../packages/protocol/src/runtime-config.ts
124
132
  function isRecord(value) {
@@ -189,8 +197,22 @@ function stripUndefined(input) {
189
197
  return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined));
190
198
  }
191
199
 
200
+ // ../../packages/protocol/src/session-input-items.ts
201
+ var SESSION_INPUT_LIMITS;
202
+ var init_session_input_items = __esm(() => {
203
+ SESSION_INPUT_LIMITS = {
204
+ maxItems: 256,
205
+ maxSkills: 32,
206
+ maxTextBytes: 1024 * 1024,
207
+ maxNameChars: 128,
208
+ maxDisplayNameChars: 256
209
+ };
210
+ });
211
+
192
212
  // ../../packages/protocol/src/requests.ts
193
- var init_requests = () => {};
213
+ var init_requests = __esm(() => {
214
+ init_session_input_items();
215
+ });
194
216
  // ../../packages/protocol/src/serialization.ts
195
217
  function object(value, path) {
196
218
  if (!value || typeof value !== "object" || Array.isArray(value)) {
@@ -768,10 +790,12 @@ var init_capabilities = __esm(() => {
768
790
 
769
791
  // ../../packages/protocol/src/index.ts
770
792
  var init_src = __esm(() => {
793
+ init_session();
771
794
  init_requests();
772
795
  init_serialization();
773
796
  init_capabilities();
774
797
  init_attachment();
798
+ init_session_input_items();
775
799
  });
776
800
 
777
801
  // ../../packages/client/src/transport/http-client.ts
@@ -1090,6 +1114,20 @@ class OpenHarnessClient {
1090
1114
  async installLocalPlugin(input) {
1091
1115
  return await this.request(input.link ? "/plugins/link-local" : "/plugins/install-local", { method: "POST", body: input });
1092
1116
  }
1117
+ async previewPluginArchive(input, options = {}) {
1118
+ return await this.request("/plugins/archive/preview", {
1119
+ method: "POST",
1120
+ body: input,
1121
+ signal: options.signal
1122
+ });
1123
+ }
1124
+ async installPluginArchive(input, options = {}) {
1125
+ return await this.request("/plugins/archive/install", {
1126
+ method: "POST",
1127
+ body: input,
1128
+ signal: options.signal
1129
+ });
1130
+ }
1093
1131
  async uninstallPlugin(id, input) {
1094
1132
  return await this.request(`/plugins/${encodeURIComponent(id)}`, { method: "DELETE", body: input });
1095
1133
  }
@@ -1642,7 +1680,7 @@ function applySessionSnapshot(state, snapshot) {
1642
1680
  };
1643
1681
  }
1644
1682
  function applyEvent(state, event) {
1645
- if (event.schemaVersion !== SESSION_EVENT_SCHEMA_VERSION) {
1683
+ if (event.schemaVersion !== sessionEventSchemaVersion(event.type)) {
1646
1684
  throw new UnsupportedSessionEventSchemaVersionError(event);
1647
1685
  }
1648
1686
  const transient = event.type === "session.message.part.delta";
@@ -1919,7 +1957,8 @@ var init_reducer = __esm(() => {
1919
1957
  UnsupportedSessionEventSchemaVersionError = class UnsupportedSessionEventSchemaVersionError extends Error {
1920
1958
  event;
1921
1959
  constructor(event) {
1922
- super(`Unsupported session event schema version ${event.schemaVersion} for ${event.type} at sequence ${event.seq}; expected ${SESSION_EVENT_SCHEMA_VERSION}`);
1960
+ const expected = sessionEventSchemaVersion(event.type);
1961
+ super(`Unsupported session event schema version ${event.schemaVersion} for ${event.type} at sequence ${event.seq}; expected ${expected}`);
1923
1962
  this.name = "UnsupportedSessionEventSchemaVersionError";
1924
1963
  this.event = {
1925
1964
  seq: event.seq,
@@ -2068,6 +2107,29 @@ var init_state = __esm(() => {
2068
2107
  init_sync();
2069
2108
  });
2070
2109
 
2110
+ // ../../packages/client/src/commands/plugin-presentation.ts
2111
+ function formatPluginReload(result) {
2112
+ const lines = [result.message];
2113
+ if (!result.plugins.length)
2114
+ lines.push("No plugins discovered.");
2115
+ else {
2116
+ lines.push("Plugin validation after reload (runtimes load on next use):");
2117
+ for (const plugin of result.plugins) {
2118
+ lines.push(`- ${plugin.identity.id} [${plugin.enabled ? "enabled" : "disabled"}/${plugin.installation}/${plugin.activation}]`);
2119
+ for (const diagnostic of plugin.diagnostics)
2120
+ lines.push(` ${diagnostic.severity}: ${diagnostic.code}: ${diagnostic.message}`);
2121
+ if (plugin.permissions.missing.length)
2122
+ lines.push(` Missing permissions: ${plugin.permissions.missing.join(", ")}`);
2123
+ if (plugin.installation !== "installed" || plugin.permissions.missing.length || plugin.diagnostics.some((item) => item.code.includes("permission"))) {
2124
+ lines.push(plugin.scope === "managed" ? " Ask your administrator to repair this managed plugin." : " Review the source and permissions, then run ohs plugin install-local <source> or ohs plugin link <source>, supplying --approve <permission> for each requested permission.");
2125
+ }
2126
+ }
2127
+ }
2128
+ lines.push(...result.warnings.map((warning) => `! ${warning}`));
2129
+ return lines.join(`
2130
+ `);
2131
+ }
2132
+
2071
2133
  // ../../packages/client/src/commands/session-commands.ts
2072
2134
  function parseSlashLine(line) {
2073
2135
  const trimmed = line.trim();
@@ -2840,18 +2902,7 @@ No entries found.`;
2840
2902
  }
2841
2903
  if (slash?.name === "/reload-plugins") {
2842
2904
  const result = await client.reloadPlugins({ cwd });
2843
- if (result.plugins.length === 0) {
2844
- emit(`${result.message}
2845
- No plugins discovered.`);
2846
- return "handled";
2847
- }
2848
- emit([
2849
- result.message,
2850
- "Reloaded plugins:",
2851
- ...result.plugins.map((plugin) => `- ${plugin.identity.id} [${plugin.enabled ? "enabled" : "disabled"}]`),
2852
- ...result.warnings.map((warning) => `! ${warning}`)
2853
- ].join(`
2854
- `));
2905
+ emit(formatPluginReload(result));
2855
2906
  return "handled";
2856
2907
  }
2857
2908
  if (slash?.name === "/hooks") {
@@ -3902,7 +3953,7 @@ Refresh failed: ${message}` : `Failed to load ${request.title}: ${message}`;
3902
3953
  }
3903
3954
  const response = await client.admitPrompt(session.id, {
3904
3955
  id: createPromptRequestId(),
3905
- content: config.initial_prompt
3956
+ items: [{ type: "text", text: config.initial_prompt }]
3906
3957
  });
3907
3958
  setLocalBusy(false);
3908
3959
  setSubmittedRun(response.run ? { sessionId: session.id, runId: response.run.id } : null);
@@ -4046,19 +4097,18 @@ Refresh failed: ${message}` : `Failed to load ${request.title}: ${message}`;
4046
4097
  if (!sessionId)
4047
4098
  return;
4048
4099
  setLocalBusy(true);
4049
- const commandName = slash.name.replace(/^\//, "");
4050
4100
  const response = await client.admitPrompt(sessionId, {
4051
4101
  id: createPromptRequestId(),
4052
- content: slash.args,
4053
- metadata: {
4054
- skillInvocation: {
4055
- name: commandName,
4056
- commandName,
4102
+ items: [
4103
+ {
4104
+ type: "skill",
4105
+ name: catalogEntry.skillName,
4106
+ path: catalogEntry.path,
4057
4107
  ...catalogEntry.displayName ? { displayName: catalogEntry.displayName } : {},
4058
- source: catalogEntry.source,
4059
- invocationSource: "slash"
4060
- }
4061
- }
4108
+ ...catalogEntry.source && catalogEntry.source !== "builtin" ? { source: catalogEntry.source } : {}
4109
+ },
4110
+ ...slash.args ? [{ type: "text", text: ` ${slash.args}` }] : []
4111
+ ]
4062
4112
  });
4063
4113
  setLocalBusy(false);
4064
4114
  setSubmittedRun(response.run ? { sessionId, runId: response.run.id } : null);
@@ -4076,7 +4126,7 @@ Refresh failed: ${message}` : `Failed to load ${request.title}: ${message}`;
4076
4126
  setLocalBusy(true);
4077
4127
  const response = await client.admitPrompt(sessionId, {
4078
4128
  id: createPromptRequestId(),
4079
- content: line
4129
+ items: [{ type: "text", text: line }]
4080
4130
  });
4081
4131
  setLocalBusy(false);
4082
4132
  setSubmittedRun(response.run ? { sessionId, runId: response.run.id } : null);
@@ -8084,4 +8134,4 @@ try {
8084
8134
  process.exit(1);
8085
8135
  }
8086
8136
 
8087
- //# debugId=336ABBB32A8FF01B64756E2164756E21
8137
+ //# debugId=DB9708E7A715BB8364756E2164756E21