@volter-ai-dev/supercode-ui 0.1.66 → 0.1.67

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.
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  var ROLES = /* @__PURE__ */ new Set(["system", "user", "assistant", "tool", "reasoning", "request", "notice"]);
75
80
  var MODES = /* @__PURE__ */ new Set(["none", "control", "mirror"]);
@@ -82,6 +87,10 @@ var AUTHENTICATION_PHASES = /* @__PURE__ */ new Set(["idle", "checking", "requir
82
87
  var MAX_TOOL_FIELDS = 8;
83
88
  var MAX_TOOL_FIELD_CHARS = 800;
84
89
  var MAX_TOOL_PREVIEW_CHARS = 4e3;
90
+ var MAX_CONTRIBUTIONS = 64;
91
+ var MAX_CONTRIBUTION_JSON_DEPTH = 12;
92
+ var MAX_CONTRIBUTION_COLLECTION = 100;
93
+ var MAX_CONTRIBUTION_STRING_CHARS = 16e3;
85
94
  function record(value) {
86
95
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
87
96
  }
@@ -114,6 +123,126 @@ function number(value, fallback = 0) {
114
123
  function nullableNumber(value) {
115
124
  return typeof value === "number" && Number.isFinite(value) ? value : null;
116
125
  }
126
+ function relativeContributionPath(value) {
127
+ if (typeof value !== "string" || value.startsWith("/") || /^[a-z]:[\\/]/i.test(value)) return null;
128
+ return value.replaceAll("\\", "/").split("/").some((segment) => segment === "..") ? null : boundedString(value, 1e3);
129
+ }
130
+ function contributionJson(value, depth = 0, seen = /* @__PURE__ */ new WeakSet()) {
131
+ if (value === null || typeof value === "boolean" || typeof value === "string") {
132
+ return typeof value === "string" ? boundedString(value, MAX_CONTRIBUTION_STRING_CHARS) : value;
133
+ }
134
+ if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
135
+ if (depth >= MAX_CONTRIBUTION_JSON_DEPTH || !value || typeof value !== "object" || seen.has(value)) {
136
+ return void 0;
137
+ }
138
+ seen.add(value);
139
+ if (Array.isArray(value)) {
140
+ const result2 = [];
141
+ for (const item of value.slice(0, MAX_CONTRIBUTION_COLLECTION)) {
142
+ const normalized = contributionJson(item, depth + 1, seen);
143
+ if (normalized !== void 0) result2.push(normalized);
144
+ }
145
+ seen.delete(value);
146
+ return result2;
147
+ }
148
+ const source = record(value);
149
+ if (!source) return void 0;
150
+ const result = {};
151
+ for (const [key, item] of Object.entries(source).slice(0, MAX_CONTRIBUTION_COLLECTION)) {
152
+ const normalized = contributionJson(item, depth + 1, seen);
153
+ if (normalized !== void 0) result[boundedString(key, 200)] = normalized;
154
+ }
155
+ seen.delete(value);
156
+ return result;
157
+ }
158
+ function normalizeContributions(value) {
159
+ if (!Array.isArray(value)) return [];
160
+ return value.slice(0, MAX_CONTRIBUTIONS).flatMap((candidate) => {
161
+ const item = record(candidate);
162
+ const placement = record(item?.placement);
163
+ const source = relativeContributionPath(item?.source);
164
+ if (item?.schema !== "supercode/contribution-v1" || typeof item.id !== "string" || !item.id.trim() || typeof item.kind !== "string" || !item.kind.trim() || source === null) return [];
165
+ const data = contributionJson(item.data);
166
+ if (data === void 0) return [];
167
+ return [{
168
+ schema: "supercode/contribution-v1",
169
+ id: boundedString(item.id, 200),
170
+ kind: boundedString(item.kind, 100),
171
+ ...typeof item.title === "string" ? { title: boundedString(item.title, 500) } : {},
172
+ ...placement ? { placement: {
173
+ ...typeof placement.surface === "string" ? { surface: boundedString(placement.surface, 100) } : {},
174
+ ...typeof placement.region === "string" ? { region: boundedString(placement.region, 100) } : {}
175
+ } } : {},
176
+ data,
177
+ source
178
+ }];
179
+ });
180
+ }
181
+ function readAgentPackage(value) {
182
+ const agentPackage = record(value);
183
+ const capabilities = record(agentPackage?.capabilities);
184
+ const storage = record(agentPackage?.storage);
185
+ const relativePath = relativeContributionPath(storage?.relativePath);
186
+ if (agentPackage?.schemaVersion !== 1 || typeof agentPackage.id !== "string" || typeof agentPackage.name !== "string" || typeof agentPackage.version !== "string" || !capabilities || !Array.isArray(capabilities.required) || !Array.isArray(capabilities.optional) || !storage || relativePath === null) return null;
187
+ const resources = record(agentPackage.resources);
188
+ return {
189
+ id: boundedString(agentPackage.id, 200),
190
+ name: boundedString(agentPackage.name, 500),
191
+ version: boundedString(agentPackage.version, 100),
192
+ description: typeof agentPackage.description === "string" ? boundedString(agentPackage.description, 2e3) : null,
193
+ capabilities: {
194
+ required: capabilities.required.filter((item) => typeof item === "string").slice(0, 100).map((item) => boundedString(item, 200)),
195
+ optional: capabilities.optional.filter((item) => typeof item === "string").slice(0, 100).map((item) => boundedString(item, 200))
196
+ },
197
+ storage: { relativePath },
198
+ resources: resources ? Object.fromEntries(Object.entries(resources).flatMap(([id, candidate]) => {
199
+ const state = record(candidate);
200
+ if (state?.schema !== "supercode/package-resource-state-v1") return [];
201
+ if (state.status === "absent" && typeof state.contributionId === "string") {
202
+ return [[boundedString(id, 200), {
203
+ schema: "supercode/package-resource-state-v1",
204
+ status: "absent",
205
+ contributionId: boundedString(state.contributionId, 200)
206
+ }]];
207
+ }
208
+ if (state.status === "error" && typeof state.contributionId === "string" && typeof state.message === "string") {
209
+ return [[boundedString(id, 200), {
210
+ schema: "supercode/package-resource-state-v1",
211
+ status: "error",
212
+ contributionId: boundedString(state.contributionId, 200),
213
+ message: boundedString(state.message)
214
+ }]];
215
+ }
216
+ const resource = record(state?.resource);
217
+ const data = contributionJson(resource?.data);
218
+ if (state?.status !== "ready" || resource?.schema !== "supercode/package-resource-v1" || typeof resource.contributionId !== "string" || !["json", "text"].includes(resource.format) || typeof resource.mediaType !== "string" || data === void 0) return [];
219
+ return [[boundedString(id, 200), {
220
+ schema: "supercode/package-resource-state-v1",
221
+ status: "ready",
222
+ resource: {
223
+ schema: "supercode/package-resource-v1",
224
+ contributionId: boundedString(resource.contributionId, 200),
225
+ format: resource.format,
226
+ mediaType: boundedString(resource.mediaType, 200),
227
+ data
228
+ }
229
+ }]];
230
+ })) : {}
231
+ };
232
+ }
233
+ function readAgentPackageCapabilityState(value) {
234
+ const state = record(value);
235
+ if (!state) return null;
236
+ const fields = ["availableRequired", "missingRequired", "enabledOptional", "unavailableOptional"];
237
+ if (!fields.every((field) => Array.isArray(state[field]))) return null;
238
+ return {
239
+ ready: state.ready === true,
240
+ ...Object.fromEntries(fields.map((field) => [
241
+ field,
242
+ state[field].filter((item) => typeof item === "string").slice(0, 100).map((item) => boundedString(item, 200))
243
+ ]))
244
+ };
245
+ }
117
246
  function relativeAge(updatedAt, now = Date.now()) {
118
247
  if (typeof updatedAt !== "number" || !Number.isFinite(updatedAt) || updatedAt <= 0) return "";
119
248
  const delta = Math.max(0, now - updatedAt);
@@ -831,7 +960,12 @@ function normalizeUiState(value) {
831
960
  subagentInspector: readSubagentInspector(raw.subagentInspector),
832
961
  attached: readAttached(raw.attached),
833
962
  owned: readAttached(raw.owned),
834
- attachError: attachError && typeof attachError.key === "string" && typeof attachError.message === "string" ? { key: attachError.key, message: attachError.message } : null
963
+ attachError: attachError && typeof attachError.key === "string" && typeof attachError.message === "string" ? { key: attachError.key, message: attachError.message } : null,
964
+ agentPackage: readAgentPackage(raw.agentPackage),
965
+ contributions: normalizeContributions(raw.contributions),
966
+ agentPackageError: typeof raw.agentPackageError === "string" ? boundedString(raw.agentPackageError) : null,
967
+ agentPackageCapabilityState: readAgentPackageCapabilityState(raw.agentPackageCapabilityState),
968
+ agentPackageCapabilityError: typeof raw.agentPackageCapabilityError === "string" ? boundedString(raw.agentPackageCapabilityError) : null
835
969
  };
836
970
  }
837
971
  function harnessDisplayName(id) {
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  function harnessDisplayName(id) {
75
80
  return HARNESS_NAMES[id] ?? id;
@@ -70,7 +70,12 @@ var EMPTY_UI_STATE = Object.freeze({
70
70
  subagentInspector: null,
71
71
  attached: null,
72
72
  owned: null,
73
- attachError: null
73
+ attachError: null,
74
+ agentPackage: null,
75
+ contributions: Object.freeze([]),
76
+ agentPackageError: null,
77
+ agentPackageCapabilityState: null,
78
+ agentPackageCapabilityError: null
74
79
  });
75
80
  var TOOL_CATEGORIES = /* @__PURE__ */ new Set(["read", "search", "edit", "command", "test", "web", "agent", "plan", "other"]);
76
81
  var MAX_TOOL_FIELDS = 8;
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  var ROLES = /* @__PURE__ */ new Set(["system", "user", "assistant", "tool", "reasoning", "request", "notice"]);
75
80
  var MODES = /* @__PURE__ */ new Set(["none", "control", "mirror"]);
@@ -82,6 +87,10 @@ var AUTHENTICATION_PHASES = /* @__PURE__ */ new Set(["idle", "checking", "requir
82
87
  var MAX_TOOL_FIELDS = 8;
83
88
  var MAX_TOOL_FIELD_CHARS = 800;
84
89
  var MAX_TOOL_PREVIEW_CHARS = 4e3;
90
+ var MAX_CONTRIBUTIONS = 64;
91
+ var MAX_CONTRIBUTION_JSON_DEPTH = 12;
92
+ var MAX_CONTRIBUTION_COLLECTION = 100;
93
+ var MAX_CONTRIBUTION_STRING_CHARS = 16e3;
85
94
  function record(value) {
86
95
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
87
96
  }
@@ -114,6 +123,126 @@ function number(value, fallback = 0) {
114
123
  function nullableNumber(value) {
115
124
  return typeof value === "number" && Number.isFinite(value) ? value : null;
116
125
  }
126
+ function relativeContributionPath(value) {
127
+ if (typeof value !== "string" || value.startsWith("/") || /^[a-z]:[\\/]/i.test(value)) return null;
128
+ return value.replaceAll("\\", "/").split("/").some((segment) => segment === "..") ? null : boundedString(value, 1e3);
129
+ }
130
+ function contributionJson(value, depth = 0, seen = /* @__PURE__ */ new WeakSet()) {
131
+ if (value === null || typeof value === "boolean" || typeof value === "string") {
132
+ return typeof value === "string" ? boundedString(value, MAX_CONTRIBUTION_STRING_CHARS) : value;
133
+ }
134
+ if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
135
+ if (depth >= MAX_CONTRIBUTION_JSON_DEPTH || !value || typeof value !== "object" || seen.has(value)) {
136
+ return void 0;
137
+ }
138
+ seen.add(value);
139
+ if (Array.isArray(value)) {
140
+ const result2 = [];
141
+ for (const item of value.slice(0, MAX_CONTRIBUTION_COLLECTION)) {
142
+ const normalized = contributionJson(item, depth + 1, seen);
143
+ if (normalized !== void 0) result2.push(normalized);
144
+ }
145
+ seen.delete(value);
146
+ return result2;
147
+ }
148
+ const source = record(value);
149
+ if (!source) return void 0;
150
+ const result = {};
151
+ for (const [key, item] of Object.entries(source).slice(0, MAX_CONTRIBUTION_COLLECTION)) {
152
+ const normalized = contributionJson(item, depth + 1, seen);
153
+ if (normalized !== void 0) result[boundedString(key, 200)] = normalized;
154
+ }
155
+ seen.delete(value);
156
+ return result;
157
+ }
158
+ function normalizeContributions(value) {
159
+ if (!Array.isArray(value)) return [];
160
+ return value.slice(0, MAX_CONTRIBUTIONS).flatMap((candidate) => {
161
+ const item = record(candidate);
162
+ const placement = record(item?.placement);
163
+ const source = relativeContributionPath(item?.source);
164
+ if (item?.schema !== "supercode/contribution-v1" || typeof item.id !== "string" || !item.id.trim() || typeof item.kind !== "string" || !item.kind.trim() || source === null) return [];
165
+ const data = contributionJson(item.data);
166
+ if (data === void 0) return [];
167
+ return [{
168
+ schema: "supercode/contribution-v1",
169
+ id: boundedString(item.id, 200),
170
+ kind: boundedString(item.kind, 100),
171
+ ...typeof item.title === "string" ? { title: boundedString(item.title, 500) } : {},
172
+ ...placement ? { placement: {
173
+ ...typeof placement.surface === "string" ? { surface: boundedString(placement.surface, 100) } : {},
174
+ ...typeof placement.region === "string" ? { region: boundedString(placement.region, 100) } : {}
175
+ } } : {},
176
+ data,
177
+ source
178
+ }];
179
+ });
180
+ }
181
+ function readAgentPackage(value) {
182
+ const agentPackage = record(value);
183
+ const capabilities = record(agentPackage?.capabilities);
184
+ const storage = record(agentPackage?.storage);
185
+ const relativePath = relativeContributionPath(storage?.relativePath);
186
+ if (agentPackage?.schemaVersion !== 1 || typeof agentPackage.id !== "string" || typeof agentPackage.name !== "string" || typeof agentPackage.version !== "string" || !capabilities || !Array.isArray(capabilities.required) || !Array.isArray(capabilities.optional) || !storage || relativePath === null) return null;
187
+ const resources = record(agentPackage.resources);
188
+ return {
189
+ id: boundedString(agentPackage.id, 200),
190
+ name: boundedString(agentPackage.name, 500),
191
+ version: boundedString(agentPackage.version, 100),
192
+ description: typeof agentPackage.description === "string" ? boundedString(agentPackage.description, 2e3) : null,
193
+ capabilities: {
194
+ required: capabilities.required.filter((item) => typeof item === "string").slice(0, 100).map((item) => boundedString(item, 200)),
195
+ optional: capabilities.optional.filter((item) => typeof item === "string").slice(0, 100).map((item) => boundedString(item, 200))
196
+ },
197
+ storage: { relativePath },
198
+ resources: resources ? Object.fromEntries(Object.entries(resources).flatMap(([id, candidate]) => {
199
+ const state = record(candidate);
200
+ if (state?.schema !== "supercode/package-resource-state-v1") return [];
201
+ if (state.status === "absent" && typeof state.contributionId === "string") {
202
+ return [[boundedString(id, 200), {
203
+ schema: "supercode/package-resource-state-v1",
204
+ status: "absent",
205
+ contributionId: boundedString(state.contributionId, 200)
206
+ }]];
207
+ }
208
+ if (state.status === "error" && typeof state.contributionId === "string" && typeof state.message === "string") {
209
+ return [[boundedString(id, 200), {
210
+ schema: "supercode/package-resource-state-v1",
211
+ status: "error",
212
+ contributionId: boundedString(state.contributionId, 200),
213
+ message: boundedString(state.message)
214
+ }]];
215
+ }
216
+ const resource = record(state?.resource);
217
+ const data = contributionJson(resource?.data);
218
+ if (state?.status !== "ready" || resource?.schema !== "supercode/package-resource-v1" || typeof resource.contributionId !== "string" || !["json", "text"].includes(resource.format) || typeof resource.mediaType !== "string" || data === void 0) return [];
219
+ return [[boundedString(id, 200), {
220
+ schema: "supercode/package-resource-state-v1",
221
+ status: "ready",
222
+ resource: {
223
+ schema: "supercode/package-resource-v1",
224
+ contributionId: boundedString(resource.contributionId, 200),
225
+ format: resource.format,
226
+ mediaType: boundedString(resource.mediaType, 200),
227
+ data
228
+ }
229
+ }]];
230
+ })) : {}
231
+ };
232
+ }
233
+ function readAgentPackageCapabilityState(value) {
234
+ const state = record(value);
235
+ if (!state) return null;
236
+ const fields = ["availableRequired", "missingRequired", "enabledOptional", "unavailableOptional"];
237
+ if (!fields.every((field) => Array.isArray(state[field]))) return null;
238
+ return {
239
+ ready: state.ready === true,
240
+ ...Object.fromEntries(fields.map((field) => [
241
+ field,
242
+ state[field].filter((item) => typeof item === "string").slice(0, 100).map((item) => boundedString(item, 200))
243
+ ]))
244
+ };
245
+ }
117
246
  function relativeAge(updatedAt, now = Date.now()) {
118
247
  if (typeof updatedAt !== "number" || !Number.isFinite(updatedAt) || updatedAt <= 0) return "";
119
248
  const delta = Math.max(0, now - updatedAt);
@@ -831,7 +960,12 @@ function normalizeUiState(value) {
831
960
  subagentInspector: readSubagentInspector(raw.subagentInspector),
832
961
  attached: readAttached(raw.attached),
833
962
  owned: readAttached(raw.owned),
834
- attachError: attachError && typeof attachError.key === "string" && typeof attachError.message === "string" ? { key: attachError.key, message: attachError.message } : null
963
+ attachError: attachError && typeof attachError.key === "string" && typeof attachError.message === "string" ? { key: attachError.key, message: attachError.message } : null,
964
+ agentPackage: readAgentPackage(raw.agentPackage),
965
+ contributions: normalizeContributions(raw.contributions),
966
+ agentPackageError: typeof raw.agentPackageError === "string" ? boundedString(raw.agentPackageError) : null,
967
+ agentPackageCapabilityState: readAgentPackageCapabilityState(raw.agentPackageCapabilityState),
968
+ agentPackageCapabilityError: typeof raw.agentPackageCapabilityError === "string" ? boundedString(raw.agentPackageCapabilityError) : null
835
969
  };
836
970
  }
837
971
  function harnessDisplayName(id) {
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  function relativeAge(updatedAt, now = Date.now()) {
75
80
  if (typeof updatedAt !== "number" || !Number.isFinite(updatedAt) || updatedAt <= 0) return "";
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  function harnessDisplayName(id) {
75
80
  return HARNESS_NAMES[id] ?? id;
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  var TOOL_CATEGORIES = /* @__PURE__ */ new Set(["read", "search", "edit", "command", "test", "web", "agent", "plan", "other"]);
75
80
  var MAX_TOOL_FIELDS = 8;
package/sessions.mjs CHANGED
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  function relativeAge(updatedAt, now = Date.now()) {
75
80
  if (typeof updatedAt !== "number" || !Number.isFinite(updatedAt) || updatedAt <= 0) return "";
package/settings.mjs CHANGED
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  function harnessDisplayName(id) {
75
80
  return HARNESS_NAMES[id] ?? id;
package/subagents.mjs CHANGED
@@ -69,7 +69,12 @@ var EMPTY_UI_STATE = Object.freeze({
69
69
  subagentInspector: null,
70
70
  attached: null,
71
71
  owned: null,
72
- attachError: null
72
+ attachError: null,
73
+ agentPackage: null,
74
+ contributions: Object.freeze([]),
75
+ agentPackageError: null,
76
+ agentPackageCapabilityState: null,
77
+ agentPackageCapabilityError: null
73
78
  });
74
79
  var TOOL_CATEGORIES = /* @__PURE__ */ new Set(["read", "search", "edit", "command", "test", "web", "agent", "plan", "other"]);
75
80
  var MAX_TOOL_FIELDS = 8;