@rzx/ohs 1.1.12 → 1.1.15

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)) {
@@ -721,13 +743,23 @@ function parseServerCapabilities(value) {
721
743
  features[name] = positiveInteger2(version, `features.${name}`);
722
744
  }
723
745
  const attachments = parseAttachmentTransferCapabilities(value.attachments);
746
+ const agentEnvironments = parseAgentEnvironmentCapabilities(value.agentEnvironments);
724
747
  return {
725
748
  serverVersion: value.serverVersion,
726
749
  protocol: { version },
727
750
  features,
728
- ...attachments ? { attachments } : {}
751
+ ...attachments ? { attachments } : {},
752
+ ...agentEnvironments ? { agentEnvironments } : {}
729
753
  };
730
754
  }
755
+ function parseAgentEnvironmentCapabilities(value) {
756
+ if (value === undefined)
757
+ return;
758
+ if (!isRecord2(value) || value.native !== true || typeof value.wsl !== "boolean") {
759
+ throw new Error("agentEnvironments must contain native=true and a boolean wsl value");
760
+ }
761
+ return { native: true, wsl: value.wsl };
762
+ }
731
763
  function checkProtocolCompatibility(server, client) {
732
764
  if (client.version !== server.protocol.version) {
733
765
  return {
@@ -768,10 +800,12 @@ var init_capabilities = __esm(() => {
768
800
 
769
801
  // ../../packages/protocol/src/index.ts
770
802
  var init_src = __esm(() => {
803
+ init_session();
771
804
  init_requests();
772
805
  init_serialization();
773
806
  init_capabilities();
774
807
  init_attachment();
808
+ init_session_input_items();
775
809
  });
776
810
 
777
811
  // ../../packages/client/src/transport/http-client.ts
@@ -1090,6 +1124,20 @@ class OpenHarnessClient {
1090
1124
  async installLocalPlugin(input) {
1091
1125
  return await this.request(input.link ? "/plugins/link-local" : "/plugins/install-local", { method: "POST", body: input });
1092
1126
  }
1127
+ async previewPluginArchive(input, options = {}) {
1128
+ return await this.request("/plugins/archive/preview", {
1129
+ method: "POST",
1130
+ body: input,
1131
+ signal: options.signal
1132
+ });
1133
+ }
1134
+ async installPluginArchive(input, options = {}) {
1135
+ return await this.request("/plugins/archive/install", {
1136
+ method: "POST",
1137
+ body: input,
1138
+ signal: options.signal
1139
+ });
1140
+ }
1093
1141
  async uninstallPlugin(id, input) {
1094
1142
  return await this.request(`/plugins/${encodeURIComponent(id)}`, { method: "DELETE", body: input });
1095
1143
  }
@@ -1642,7 +1690,7 @@ function applySessionSnapshot(state, snapshot) {
1642
1690
  };
1643
1691
  }
1644
1692
  function applyEvent(state, event) {
1645
- if (event.schemaVersion !== SESSION_EVENT_SCHEMA_VERSION) {
1693
+ if (event.schemaVersion !== sessionEventSchemaVersion(event.type)) {
1646
1694
  throw new UnsupportedSessionEventSchemaVersionError(event);
1647
1695
  }
1648
1696
  const transient = event.type === "session.message.part.delta";
@@ -1919,7 +1967,8 @@ var init_reducer = __esm(() => {
1919
1967
  UnsupportedSessionEventSchemaVersionError = class UnsupportedSessionEventSchemaVersionError extends Error {
1920
1968
  event;
1921
1969
  constructor(event) {
1922
- super(`Unsupported session event schema version ${event.schemaVersion} for ${event.type} at sequence ${event.seq}; expected ${SESSION_EVENT_SCHEMA_VERSION}`);
1970
+ const expected = sessionEventSchemaVersion(event.type);
1971
+ super(`Unsupported session event schema version ${event.schemaVersion} for ${event.type} at sequence ${event.seq}; expected ${expected}`);
1923
1972
  this.name = "UnsupportedSessionEventSchemaVersionError";
1924
1973
  this.event = {
1925
1974
  seq: event.seq,
@@ -2068,6 +2117,29 @@ var init_state = __esm(() => {
2068
2117
  init_sync();
2069
2118
  });
2070
2119
 
2120
+ // ../../packages/client/src/commands/plugin-presentation.ts
2121
+ function formatPluginReload(result) {
2122
+ const lines = [result.message];
2123
+ if (!result.plugins.length)
2124
+ lines.push("No plugins discovered.");
2125
+ else {
2126
+ lines.push("Plugin validation after reload (runtimes load on next use):");
2127
+ for (const plugin of result.plugins) {
2128
+ lines.push(`- ${plugin.identity.id} [${plugin.enabled ? "enabled" : "disabled"}/${plugin.installation}/${plugin.activation}]`);
2129
+ for (const diagnostic of plugin.diagnostics)
2130
+ lines.push(` ${diagnostic.severity}: ${diagnostic.code}: ${diagnostic.message}`);
2131
+ if (plugin.permissions.missing.length)
2132
+ lines.push(` Missing permissions: ${plugin.permissions.missing.join(", ")}`);
2133
+ if (plugin.installation !== "installed" || plugin.permissions.missing.length || plugin.diagnostics.some((item) => item.code.includes("permission"))) {
2134
+ 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.");
2135
+ }
2136
+ }
2137
+ }
2138
+ lines.push(...result.warnings.map((warning) => `! ${warning}`));
2139
+ return lines.join(`
2140
+ `);
2141
+ }
2142
+
2071
2143
  // ../../packages/client/src/commands/session-commands.ts
2072
2144
  function parseSlashLine(line) {
2073
2145
  const trimmed = line.trim();
@@ -2840,18 +2912,7 @@ No entries found.`;
2840
2912
  }
2841
2913
  if (slash?.name === "/reload-plugins") {
2842
2914
  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
- `));
2915
+ emit(formatPluginReload(result));
2855
2916
  return "handled";
2856
2917
  }
2857
2918
  if (slash?.name === "/hooks") {
@@ -3902,7 +3963,7 @@ Refresh failed: ${message}` : `Failed to load ${request.title}: ${message}`;
3902
3963
  }
3903
3964
  const response = await client.admitPrompt(session.id, {
3904
3965
  id: createPromptRequestId(),
3905
- content: config.initial_prompt
3966
+ items: [{ type: "text", text: config.initial_prompt }]
3906
3967
  });
3907
3968
  setLocalBusy(false);
3908
3969
  setSubmittedRun(response.run ? { sessionId: session.id, runId: response.run.id } : null);
@@ -4046,19 +4107,18 @@ Refresh failed: ${message}` : `Failed to load ${request.title}: ${message}`;
4046
4107
  if (!sessionId)
4047
4108
  return;
4048
4109
  setLocalBusy(true);
4049
- const commandName = slash.name.replace(/^\//, "");
4050
4110
  const response = await client.admitPrompt(sessionId, {
4051
4111
  id: createPromptRequestId(),
4052
- content: slash.args,
4053
- metadata: {
4054
- skillInvocation: {
4055
- name: commandName,
4056
- commandName,
4112
+ items: [
4113
+ {
4114
+ type: "skill",
4115
+ name: catalogEntry.skillName,
4116
+ path: catalogEntry.path,
4057
4117
  ...catalogEntry.displayName ? { displayName: catalogEntry.displayName } : {},
4058
- source: catalogEntry.source,
4059
- invocationSource: "slash"
4060
- }
4061
- }
4118
+ ...catalogEntry.source && catalogEntry.source !== "builtin" ? { source: catalogEntry.source } : {}
4119
+ },
4120
+ ...slash.args ? [{ type: "text", text: ` ${slash.args}` }] : []
4121
+ ]
4062
4122
  });
4063
4123
  setLocalBusy(false);
4064
4124
  setSubmittedRun(response.run ? { sessionId, runId: response.run.id } : null);
@@ -4076,7 +4136,7 @@ Refresh failed: ${message}` : `Failed to load ${request.title}: ${message}`;
4076
4136
  setLocalBusy(true);
4077
4137
  const response = await client.admitPrompt(sessionId, {
4078
4138
  id: createPromptRequestId(),
4079
- content: line
4139
+ items: [{ type: "text", text: line }]
4080
4140
  });
4081
4141
  setLocalBusy(false);
4082
4142
  setSubmittedRun(response.run ? { sessionId, runId: response.run.id } : null);
@@ -8084,4 +8144,4 @@ try {
8084
8144
  process.exit(1);
8085
8145
  }
8086
8146
 
8087
- //# debugId=336ABBB32A8FF01B64756E2164756E21
8147
+ //# debugId=F04BF25428D7317964756E2164756E21