@pstdio/sdk 0.44.0 → 0.45.0-nightly.20261021030241

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/dist/api/index.js CHANGED
@@ -1,18 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __returnValue = (v) => v;
3
- function __exportSetter(name, newValue) {
4
- this[name] = __returnValue.bind(null, newValue);
5
- }
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true,
11
- configurable: true,
12
- set: __exportSetter.bind(all, name)
13
- });
14
- };
15
-
16
1
  // ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/util.js
17
2
  function getEnumValues(entries) {
18
3
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -56,28 +41,6 @@ function floatSafeRemainder(val, step) {
56
41
  return 0;
57
42
  return ratio - roundedRatio;
58
43
  }
59
- var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
60
- function defineLazy(object, key, getter) {
61
- let value = undefined;
62
- Object.defineProperty(object, key, {
63
- get() {
64
- if (value === EVALUATING) {
65
- return;
66
- }
67
- if (value === undefined) {
68
- value = EVALUATING;
69
- value = getter();
70
- }
71
- return value;
72
- },
73
- set(v) {
74
- Object.defineProperty(object, key, {
75
- value: v
76
- });
77
- },
78
- configurable: true
79
- });
80
- }
81
44
  function assignProp(target, prop, value) {
82
45
  Object.defineProperty(target, prop, {
83
46
  value,
@@ -968,11 +931,9 @@ var string = (params) => {
968
931
  const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
969
932
  return new RegExp(`^${regex}$`);
970
933
  };
971
- var bigint = /^-?\d+n?$/;
972
934
  var integer = /^-?\d+$/;
973
935
  var number = /^-?\d+(?:\.\d+)?$/;
974
936
  var boolean = /^(?:true|false)$/i;
975
- var _null = /^null$/i;
976
937
  var lowercase = /^[^A-Z]*$/;
977
938
  var uppercase = /^[^a-z]*$/;
978
939
 
@@ -1924,42 +1885,6 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
1924
1885
  return payload;
1925
1886
  };
1926
1887
  });
1927
- var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
1928
- $ZodType.init(inst, def);
1929
- inst._zod.pattern = bigint;
1930
- inst._zod.parse = (payload, _ctx) => {
1931
- if (def.coerce)
1932
- try {
1933
- payload.value = BigInt(payload.value);
1934
- } catch (_) {}
1935
- if (typeof payload.value === "bigint")
1936
- return payload;
1937
- payload.issues.push({
1938
- expected: "bigint",
1939
- code: "invalid_type",
1940
- input: payload.value,
1941
- inst
1942
- });
1943
- return payload;
1944
- };
1945
- });
1946
- var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
1947
- $ZodType.init(inst, def);
1948
- inst._zod.pattern = _null;
1949
- inst._zod.values = new Set([null]);
1950
- inst._zod.parse = (payload, _ctx) => {
1951
- const input = payload.value;
1952
- if (input === null)
1953
- return payload;
1954
- payload.issues.push({
1955
- expected: "null",
1956
- code: "invalid_type",
1957
- input,
1958
- inst
1959
- });
1960
- return payload;
1961
- };
1962
- });
1963
1888
  var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
1964
1889
  $ZodType.init(inst, def);
1965
1890
  inst._zod.parse = (payload) => payload;
@@ -1976,29 +1901,6 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1976
1901
  return payload;
1977
1902
  };
1978
1903
  });
1979
- var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
1980
- $ZodType.init(inst, def);
1981
- inst._zod.parse = (payload, _ctx) => {
1982
- if (def.coerce) {
1983
- try {
1984
- payload.value = new Date(payload.value);
1985
- } catch (_err) {}
1986
- }
1987
- const input = payload.value;
1988
- const isDate = input instanceof Date;
1989
- const isValidDate = isDate && !Number.isNaN(input.getTime());
1990
- if (isValidDate)
1991
- return payload;
1992
- payload.issues.push({
1993
- expected: "date",
1994
- code: "invalid_type",
1995
- input,
1996
- ...isDate ? { received: "Invalid Date" } : {},
1997
- inst
1998
- });
1999
- return payload;
2000
- };
2001
- });
2002
1904
  function handleArrayResult(result, final, index) {
2003
1905
  if (result.issues.length) {
2004
1906
  final.issues.push(...prefixIssues(index, result.issues));
@@ -2578,119 +2480,6 @@ function handleIntersectionResults(result, left, right) {
2578
2480
  result.value = merged.data;
2579
2481
  return result;
2580
2482
  }
2581
- var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
2582
- $ZodType.init(inst, def);
2583
- const items = def.items;
2584
- const memo = globalConfig.memoizer;
2585
- memo?.attach(inst);
2586
- inst._zod.parse = (payload, ctx) => {
2587
- const input = payload.value;
2588
- if (!Array.isArray(input)) {
2589
- payload.issues.push({
2590
- input,
2591
- inst,
2592
- expected: "tuple",
2593
- code: "invalid_type"
2594
- });
2595
- return payload;
2596
- }
2597
- payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];
2598
- const proms = [];
2599
- const optinStart = getTupleOptStart(items, "optin");
2600
- const optoutStart = getTupleOptStart(items, "optout");
2601
- if (!def.rest) {
2602
- if (input.length < optinStart) {
2603
- payload.issues.push({
2604
- code: "too_small",
2605
- minimum: optinStart,
2606
- inclusive: true,
2607
- input,
2608
- inst,
2609
- origin: "array"
2610
- });
2611
- return payload;
2612
- }
2613
- if (input.length > items.length) {
2614
- payload.issues.push({
2615
- code: "too_big",
2616
- maximum: items.length,
2617
- inclusive: true,
2618
- input,
2619
- inst,
2620
- origin: "array"
2621
- });
2622
- }
2623
- }
2624
- const itemResults = new Array(items.length);
2625
- for (let i = 0;i < items.length; i++) {
2626
- const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
2627
- if (r instanceof Promise) {
2628
- proms.push(r.then((rr) => {
2629
- itemResults[i] = rr;
2630
- }));
2631
- } else {
2632
- itemResults[i] = r;
2633
- }
2634
- }
2635
- if (def.rest) {
2636
- let i = items.length - 1;
2637
- const rest = input.slice(items.length);
2638
- for (const el of rest) {
2639
- i++;
2640
- const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
2641
- if (result instanceof Promise) {
2642
- proms.push(result.then((r) => handleTupleResult(r, payload, i)));
2643
- } else {
2644
- handleTupleResult(result, payload, i);
2645
- }
2646
- }
2647
- }
2648
- if (proms.length) {
2649
- return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
2650
- }
2651
- return handleTupleResults(itemResults, payload, items, input, optoutStart);
2652
- };
2653
- });
2654
- function getTupleOptStart(items, key) {
2655
- for (let i = items.length - 1;i >= 0; i--) {
2656
- const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
2657
- if (!omittable)
2658
- return i + 1;
2659
- }
2660
- return 0;
2661
- }
2662
- function handleTupleResult(result, final, index) {
2663
- if (result.issues.length) {
2664
- final.issues.push(...prefixIssues(index, result.issues));
2665
- }
2666
- final.value[index] = result.value;
2667
- }
2668
- function handleTupleResults(itemResults, final, items, input, optoutStart) {
2669
- for (let i = 0;i < items.length; i++) {
2670
- const r = itemResults[i];
2671
- const isPresent = i < input.length;
2672
- if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
2673
- final.value.length = i;
2674
- break;
2675
- }
2676
- if (r.issues.length) {
2677
- if (!isPresent && i >= optoutStart) {
2678
- final.value.length = i;
2679
- break;
2680
- }
2681
- final.issues.push(...prefixIssues(i, r.issues));
2682
- }
2683
- final.value[i] = r.value;
2684
- }
2685
- for (let i = final.value.length - 1;i >= input.length; i--) {
2686
- if (items[i]._zod.optout === "optional" && final.value[i] === undefined) {
2687
- final.value.length = i;
2688
- } else {
2689
- break;
2690
- }
2691
- }
2692
- return final;
2693
- }
2694
2483
  var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
2695
2484
  $ZodType.init(inst, def);
2696
2485
  const memo = globalConfig.memoizer;
@@ -3087,9 +2876,6 @@ function handlePipeResult(left, next, ctx) {
3087
2876
  }
3088
2877
  return next._zod.run({ value: left.value, issues: left.issues }, ctx);
3089
2878
  }
3090
- var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => {
3091
- $ZodPipe.init(inst, def);
3092
- });
3093
2879
  var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
3094
2880
  $ZodType.init(inst, def);
3095
2881
  defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
@@ -3112,23 +2898,6 @@ function handleReadonlyResult(payload) {
3112
2898
  payload.value = Object.freeze(payload.value);
3113
2899
  return payload;
3114
2900
  }
3115
- var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
3116
- $ZodType.init(inst, def);
3117
- defineLazy(inst._zod, "innerType", () => {
3118
- const d = def;
3119
- if (!d._cachedInner)
3120
- d._cachedInner = def.getter();
3121
- return d._cachedInner;
3122
- });
3123
- defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
3124
- defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
3125
- defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
3126
- defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
3127
- inst._zod.parse = (payload, ctx) => {
3128
- const inner = inst._zod.innerType;
3129
- return inner._zod.run(payload, ctx);
3130
- };
3131
- });
3132
2901
  var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
3133
2902
  $ZodCheck.init(inst, def);
3134
2903
  $ZodType.init(inst, def);
@@ -3566,13 +3335,6 @@ function _string(Class, params) {
3566
3335
  ...normalizeParams(params)
3567
3336
  });
3568
3337
  }
3569
- function _coercedString(Class, params) {
3570
- return new Class({
3571
- type: "string",
3572
- coerce: true,
3573
- ...normalizeParams(params)
3574
- });
3575
- }
3576
3338
  function _email(Class, params) {
3577
3339
  return new Class({
3578
3340
  type: "string",
@@ -3817,14 +3579,6 @@ function _number(Class, params) {
3817
3579
  ...normalizeParams(params)
3818
3580
  });
3819
3581
  }
3820
- function _coercedNumber(Class, params) {
3821
- return new Class({
3822
- type: "number",
3823
- coerce: true,
3824
- checks: [],
3825
- ...normalizeParams(params)
3826
- });
3827
- }
3828
3582
  function _int(Class, params) {
3829
3583
  return new Class({
3830
3584
  type: "number",
@@ -3840,26 +3594,6 @@ function _boolean(Class, params) {
3840
3594
  ...normalizeParams(params)
3841
3595
  });
3842
3596
  }
3843
- function _coercedBoolean(Class, params) {
3844
- return new Class({
3845
- type: "boolean",
3846
- coerce: true,
3847
- ...normalizeParams(params)
3848
- });
3849
- }
3850
- function _coercedBigint(Class, params) {
3851
- return new Class({
3852
- type: "bigint",
3853
- coerce: true,
3854
- ...normalizeParams(params)
3855
- });
3856
- }
3857
- function _null2(Class, params) {
3858
- return new Class({
3859
- type: "null",
3860
- ...normalizeParams(params)
3861
- });
3862
- }
3863
3597
  function _unknown(Class) {
3864
3598
  return new Class({
3865
3599
  type: "unknown"
@@ -3871,13 +3605,6 @@ function _never(Class, params) {
3871
3605
  ...normalizeParams(params)
3872
3606
  });
3873
3607
  }
3874
- function _coercedDate(Class, params) {
3875
- return new Class({
3876
- type: "date",
3877
- coerce: true,
3878
- ...normalizeParams(params)
3879
- });
3880
- }
3881
3608
  function _lt(value, params) {
3882
3609
  return new $ZodCheckLessThan({
3883
3610
  check: "less_than",
@@ -4666,25 +4393,10 @@ var numberProcessor = (schema, ctx, _json, params) => {
4666
4393
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4667
4394
  json.type = "boolean";
4668
4395
  };
4669
- var bigintProcessor = (schema, ctx, json, params) => {
4670
- handleUnrepresentable(schema, ctx, json, params, "BigInt cannot be represented in JSON Schema");
4671
- };
4672
- var nullProcessor = (_schema, ctx, json, _params) => {
4673
- if (ctx.target === "openapi-3.0") {
4674
- json.type = "string";
4675
- json.nullable = true;
4676
- json.enum = [null];
4677
- } else {
4678
- json.type = "null";
4679
- }
4680
- };
4681
4396
  var neverProcessor = (_schema, _ctx, json, _params) => {
4682
4397
  json.not = {};
4683
4398
  };
4684
4399
  var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4685
- var dateProcessor = (schema, ctx, json, params) => {
4686
- handleUnrepresentable(schema, ctx, json, params, "Date cannot be represented in JSON Schema");
4687
- };
4688
4400
  var enumProcessor = (schema, _ctx, json, _params) => {
4689
4401
  const def = schema._zod.def;
4690
4402
  const values = getEnumValues(def.entries);
@@ -4838,70 +4550,6 @@ var intersectionProcessor = (schema, ctx, json, params) => {
4838
4550
  json.allOf = allOf;
4839
4551
  ctx.intersections.push(allOf);
4840
4552
  };
4841
- var tupleProcessor = (schema, ctx, _json, params) => {
4842
- const json = _json;
4843
- const def = schema._zod.def;
4844
- json.type = "array";
4845
- const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
4846
- const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
4847
- const prefixItems = def.items.map((x, i) => process(x, ctx, {
4848
- ...params,
4849
- path: [...params.path, prefixPath, i]
4850
- }));
4851
- const rest = def.rest ? process(def.rest, ctx, {
4852
- ...params,
4853
- path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
4854
- }) : null;
4855
- let minItems = def.items.length;
4856
- while (minItems > 0) {
4857
- const item = def.items[minItems - 1];
4858
- const optional = ctx.io === "input" ? inputOptin(item) !== undefined : item._zod.optout === "optional";
4859
- if (!optional)
4860
- break;
4861
- minItems--;
4862
- }
4863
- const maxItems = def.items.length;
4864
- const isClosed = !def.rest;
4865
- if (ctx.target === "draft-2020-12") {
4866
- json.prefixItems = prefixItems;
4867
- if (isClosed) {
4868
- json.items = false;
4869
- } else if (rest) {
4870
- json.items = rest;
4871
- }
4872
- if (minItems > 0)
4873
- json.minItems = minItems;
4874
- if (isClosed)
4875
- json.maxItems = maxItems;
4876
- } else if (ctx.target === "openapi-3.0") {
4877
- json.items = {
4878
- anyOf: prefixItems
4879
- };
4880
- if (rest) {
4881
- json.items.anyOf.push(rest);
4882
- }
4883
- if (minItems > 0)
4884
- json.minItems = minItems;
4885
- if (isClosed)
4886
- json.maxItems = maxItems;
4887
- } else {
4888
- json.items = prefixItems;
4889
- if (isClosed) {
4890
- json.additionalItems = false;
4891
- } else if (rest) {
4892
- json.additionalItems = rest;
4893
- }
4894
- if (minItems > 0)
4895
- json.minItems = minItems;
4896
- if (isClosed)
4897
- json.maxItems = maxItems;
4898
- }
4899
- const { minimum, maximum } = schema._zod.bag;
4900
- if (typeof minimum === "number")
4901
- json.minItems = minimum;
4902
- if (typeof maximum === "number")
4903
- json.maxItems = maximum;
4904
- };
4905
4553
  function stringifyKeyNames(bySchema, json, visited) {
4906
4554
  if (json.$ref) {
4907
4555
  if (visited.has(json))
@@ -5095,12 +4743,6 @@ var optionalProcessor = (schema, ctx, _json, params) => {
5095
4743
  const seen = ctx.seen.get(schema);
5096
4744
  seen.ref = def.innerType;
5097
4745
  };
5098
- var lazyProcessor = (schema, ctx, _json, params) => {
5099
- const innerType = schema._zod.innerType;
5100
- process(innerType, ctx, params);
5101
- const seen = ctx.seen.get(schema);
5102
- seen.ref = innerType;
5103
- };
5104
4746
  // ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/classic/errors.js
5105
4747
  var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
5106
4748
  function _lazyMethod(proto, key, make) {
@@ -5511,9 +5153,6 @@ var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
5511
5153
  $ZodURL.init(inst, def);
5512
5154
  ZodStringFormat.init(inst, def);
5513
5155
  });
5514
- function url(params) {
5515
- return _url(ZodURL, params);
5516
- }
5517
5156
  var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
5518
5157
  $ZodEmoji.init(inst, def);
5519
5158
  ZodStringFormat.init(inst, def);
@@ -5562,10 +5201,16 @@ var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
5562
5201
  $ZodBase64.init(inst, def);
5563
5202
  ZodStringFormat.init(inst, def);
5564
5203
  });
5204
+ function base642(params) {
5205
+ return _base64(ZodBase64, params);
5206
+ }
5565
5207
  var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
5566
5208
  $ZodBase64URL.init(inst, def);
5567
5209
  ZodStringFormat.init(inst, def);
5568
5210
  });
5211
+ function base64url2(params) {
5212
+ return _base64url(ZodBase64URL, params);
5213
+ }
5569
5214
  var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
5570
5215
  $ZodE164.init(inst, def);
5571
5216
  ZodStringFormat.init(inst, def);
@@ -5649,57 +5294,6 @@ var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
5649
5294
  function boolean2(params) {
5650
5295
  return _boolean(ZodBoolean, params);
5651
5296
  }
5652
- var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
5653
- $ZodBigInt.init(inst, def);
5654
- ZodType.init(inst, def);
5655
- inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
5656
- const bag = inst._zod.bag;
5657
- inst.minValue = bag.minimum ?? null;
5658
- inst.maxValue = bag.maximum ?? null;
5659
- inst.format = bag.format ?? null;
5660
- }, {
5661
- gte(value, params) {
5662
- return this.check(_gte(value, params));
5663
- },
5664
- min(value, params) {
5665
- return this.check(_gte(value, params));
5666
- },
5667
- gt(value, params) {
5668
- return this.check(_gt(value, params));
5669
- },
5670
- lt(value, params) {
5671
- return this.check(_lt(value, params));
5672
- },
5673
- lte(value, params) {
5674
- return this.check(_lte(value, params));
5675
- },
5676
- max(value, params) {
5677
- return this.check(_lte(value, params));
5678
- },
5679
- positive(params) {
5680
- return this.check(_gt(BigInt(0), params));
5681
- },
5682
- negative(params) {
5683
- return this.check(_lt(BigInt(0), params));
5684
- },
5685
- nonpositive(params) {
5686
- return this.check(_lte(BigInt(0), params));
5687
- },
5688
- nonnegative(params) {
5689
- return this.check(_gte(BigInt(0), params));
5690
- },
5691
- multipleOf(value, params) {
5692
- return this.check(_multipleOf(value, params));
5693
- }
5694
- });
5695
- var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
5696
- $ZodNull.init(inst, def);
5697
- ZodType.init(inst, def);
5698
- inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
5699
- });
5700
- function _null3(params) {
5701
- return _null2(ZodNull, params);
5702
- }
5703
5297
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
5704
5298
  $ZodUnknown.init(inst, def);
5705
5299
  ZodType.init(inst, def);
@@ -5716,16 +5310,6 @@ var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
5716
5310
  function never(params) {
5717
5311
  return _never(ZodNever, params);
5718
5312
  }
5719
- var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
5720
- $ZodDate.init(inst, def);
5721
- ZodType.init(inst, def);
5722
- inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
5723
- inst.min = (value, params) => inst.check(_gte(value, params));
5724
- inst.max = (value, params) => inst.check(_lte(value, params));
5725
- const c = inst._zod.bag;
5726
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
5727
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
5728
- });
5729
5313
  var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
5730
5314
  _ensureDefaultMemoizer();
5731
5315
  $ZodArray.init(inst, def);
@@ -5855,39 +5439,6 @@ function intersection(left, right) {
5855
5439
  right
5856
5440
  });
5857
5441
  }
5858
- var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
5859
- _ensureDefaultMemoizer();
5860
- $ZodTuple.init(inst, def);
5861
- ZodType.init(inst, def);
5862
- inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
5863
- }, {
5864
- rest(rest) {
5865
- return this.clone({
5866
- ...this._zod.def,
5867
- rest
5868
- });
5869
- },
5870
- partial() {
5871
- const def = this._zod.def;
5872
- if (def.checks?.length)
5873
- throw new Error(".partial() cannot be used on tuple schemas containing refinements");
5874
- return this.clone({
5875
- ...def,
5876
- items: def.items.map((item) => new ZodOptional({ type: "optional", innerType: item }))
5877
- });
5878
- }
5879
- });
5880
- function tuple(items, _paramsOrRest, _params) {
5881
- const hasRest = _paramsOrRest instanceof $ZodType;
5882
- const params = hasRest ? _params : _paramsOrRest;
5883
- const rest = hasRest ? _paramsOrRest : null;
5884
- return new ZodTuple({
5885
- type: "tuple",
5886
- items,
5887
- rest,
5888
- ...normalizeParams(params)
5889
- });
5890
- }
5891
5442
  var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
5892
5443
  _ensureDefaultMemoizer();
5893
5444
  $ZodRecord.init(inst, def);
@@ -5912,15 +5463,6 @@ function record(keyType, valueType, params) {
5912
5463
  ...normalizeParams(params)
5913
5464
  });
5914
5465
  }
5915
- function partialRecord(keyType, valueType, params) {
5916
- return new ZodRecord({
5917
- type: "record",
5918
- keyType,
5919
- valueType,
5920
- ...normalizeParams(params),
5921
- partial: true
5922
- });
5923
- }
5924
5466
  var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
5925
5467
  $ZodEnum.init(inst, def);
5926
5468
  ZodType.init(inst, def);
@@ -6136,10 +5678,6 @@ function pipe(in_, out) {
6136
5678
  out
6137
5679
  });
6138
5680
  }
6139
- var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => {
6140
- ZodPipe.init(inst, def);
6141
- $ZodPreprocess.init(inst, def);
6142
- });
6143
5681
  var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
6144
5682
  $ZodReadonly.init(inst, def);
6145
5683
  ZodType.init(inst, def);
@@ -6152,18 +5690,6 @@ function readonly(innerType) {
6152
5690
  innerType
6153
5691
  });
6154
5692
  }
6155
- var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
6156
- $ZodLazy.init(inst, def);
6157
- ZodType.init(inst, def);
6158
- inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
6159
- inst.unwrap = () => inst._zod.def.getter();
6160
- });
6161
- function lazy(getter) {
6162
- return new ZodLazy({
6163
- type: "lazy",
6164
- getter
6165
- });
6166
- }
6167
5693
  var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
6168
5694
  $ZodCustom.init(inst, def);
6169
5695
  ZodType.init(inst, def);
@@ -6178,1320 +5704,6 @@ function refine(fn, _params = {}) {
6178
5704
  function superRefine(fn, params) {
6179
5705
  return _superRefine(fn, params);
6180
5706
  }
6181
- function _instanceof(cls, params = {}) {
6182
- const inst = new ZodCustom({
6183
- type: "custom",
6184
- check: "custom",
6185
- fn: (data) => data instanceof cls,
6186
- abort: true,
6187
- ...normalizeParams(params)
6188
- });
6189
- inst._zod.bag.Class = cls;
6190
- inst._zod.check = (payload) => {
6191
- if (!(payload.value instanceof cls)) {
6192
- payload.issues.push({
6193
- code: "invalid_type",
6194
- expected: cls.name,
6195
- input: payload.value,
6196
- inst,
6197
- path: [...inst._zod.def.path ?? []]
6198
- });
6199
- }
6200
- };
6201
- return inst;
6202
- }
6203
- function json(params) {
6204
- const jsonSchema = lazy(() => {
6205
- return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
6206
- });
6207
- return jsonSchema;
6208
- }
6209
- function preprocess(fn, schema) {
6210
- return new ZodPreprocess({
6211
- type: "pipe",
6212
- in: transform(fn),
6213
- out: schema
6214
- });
6215
- }
6216
- // ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/classic/coerce.js
6217
- var exports_coerce = {};
6218
- __export(exports_coerce, {
6219
- bigint: () => bigint2,
6220
- boolean: () => boolean3,
6221
- date: () => date2,
6222
- number: () => number3,
6223
- string: () => string3
6224
- });
6225
- function string3(params) {
6226
- return _coercedString(ZodString, params);
6227
- }
6228
- function number3(params) {
6229
- return _coercedNumber(ZodNumber, params);
6230
- }
6231
- function boolean3(params) {
6232
- return _coercedBoolean(ZodBoolean, params);
6233
- }
6234
- function bigint2(params) {
6235
- return _coercedBigint(ZodBigInt, params);
6236
- }
6237
- function date2(params) {
6238
- return _coercedDate(ZodDate, params);
6239
- }
6240
- // ../pstdio-api-contracts/src/activity.ts
6241
- var activityResourceTypeSchema = string2();
6242
- var activityActorTypeSchema = _enum(["user", "agent", "system"]);
6243
- var activitySourceSchema = _enum(["ui", "api", "hook", "system", "agent"]);
6244
- var activityEventSchema = object({
6245
- id: string2(),
6246
- project_id: string2(),
6247
- resource_type: activityResourceTypeSchema,
6248
- resource_id: string2(),
6249
- source_extension_id: string2().nullable(),
6250
- event_type: string2(),
6251
- actor_type: activityActorTypeSchema,
6252
- actor_id: string2().nullable(),
6253
- source: activitySourceSchema,
6254
- summary: string2(),
6255
- payload_json: record(string2(), unknown()),
6256
- created_at: string2()
6257
- });
6258
- var listActivityInputSchema = object({
6259
- eventType: string2().optional(),
6260
- event_type: string2().optional(),
6261
- from: string2().optional(),
6262
- to: string2().optional(),
6263
- cursor: string2().optional(),
6264
- limit: exports_coerce.number().int().optional()
6265
- });
6266
- var listProjectActivityInputSchema = listActivityInputSchema.extend({
6267
- resource_type: activityResourceTypeSchema.optional()
6268
- });
6269
- var listActivityResponseSchema = object({
6270
- events: array(activityEventSchema),
6271
- next_cursor: string2().nullable()
6272
- });
6273
- var activityEntrySchema = object({
6274
- id: string2(),
6275
- projectId: string2(),
6276
- resourceType: string2(),
6277
- resourceId: string2(),
6278
- sourceExtensionId: string2().nullable(),
6279
- eventType: string2(),
6280
- actorType: activityActorTypeSchema,
6281
- actorId: string2().nullable(),
6282
- source: activitySourceSchema,
6283
- summary: string2(),
6284
- payloadJson: record(string2(), unknown()),
6285
- createdAt: string2()
6286
- });
6287
- var activityPageSchema = object({ items: array(activityEntrySchema), nextCursor: string2().nullable() });
6288
- // ../pstdio-api-contracts/src/harness.ts
6289
- var AGENT_CAPABILITIES = [
6290
- "SessionFork",
6291
- "ContextUsage",
6292
- "Approvals",
6293
- "SessionReattach",
6294
- "Attachments"
6295
- ];
6296
-
6297
- // ../pstdio-api-contracts/src/agents.ts
6298
- var agentAvailabilityTypeSchema = _enum(["INSTALLED", "NOT_FOUND"]);
6299
- var agentSkillsLayoutSchema = object({
6300
- dir: string2(),
6301
- global_dir: string2()
6302
- });
6303
- var localizableSchema = union([string2(), object({ $l10n: string2(), default: string2().optional() })]);
6304
- var harnessParamBaseSchema = object({
6305
- control: literal("command").optional(),
6306
- label: localizableSchema.optional(),
6307
- description: localizableSchema.optional(),
6308
- required: boolean2().optional(),
6309
- metadata: record(string2(), unknown()).optional()
6310
- });
6311
- var harnessParamOptionSchema = object({ label: string2(), value: string2(), icon: string2().optional() });
6312
- var harnessSelectParamSchema = harnessParamBaseSchema.extend({
6313
- type: literal("select"),
6314
- defaultValue: string2().optional(),
6315
- options: array(harnessParamOptionSchema)
6316
- });
6317
- var harnessBooleanParamSchema = harnessParamBaseSchema.extend({
6318
- type: literal("boolean"),
6319
- defaultValue: boolean2().optional()
6320
- });
6321
- var harnessParamDescriptorSchema = union([harnessSelectParamSchema, harnessBooleanParamSchema]);
6322
- var harnessParamsSchema = record(string2(), harnessParamDescriptorSchema);
6323
- var agentInfoSchema = object({
6324
- id: string2(),
6325
- name: string2(),
6326
- availability: object({
6327
- type: agentAvailabilityTypeSchema,
6328
- reason: string2().optional()
6329
- }),
6330
- skills: agentSkillsLayoutSchema.optional(),
6331
- params: harnessParamsSchema.optional(),
6332
- capabilities: array(_enum(AGENT_CAPABILITIES)),
6333
- supportsModels: boolean2()
6334
- });
6335
- var agentModelSchema = object({
6336
- id: string2(),
6337
- label: string2().optional(),
6338
- description: string2().optional(),
6339
- isDefault: boolean2().optional(),
6340
- paramOverrides: record(string2(), harnessParamDescriptorSchema.nullable()).optional()
6341
- });
6342
- var harnessLocalId = (id) => id.slice(id.lastIndexOf(".") + 1);
6343
- var agentDetailsSchema = agentInfoSchema.extend({
6344
- skills: agentSkillsLayoutSchema.extend({ globalDir: string2() }).optional()
6345
- });
6346
- // ../pstdio-sync-contracts/src/compatibility.ts
6347
- var peerSchema = strictObject({
6348
- release: string2().min(1),
6349
- protocolVersions: array(number2().int().positive()).min(1),
6350
- supportedFeatures: array(string2().min(1)),
6351
- requiredFeatures: array(string2().min(1))
6352
- });
6353
- var protocolPeer = {
6354
- release: "contracts-v1",
6355
- protocolVersions: [1],
6356
- supportedFeatures: ["atomic-groups", "retained-recovery", "revisioned-resolution"],
6357
- requiredFeatures: ["atomic-groups", "retained-recovery", "revisioned-resolution"]
6358
- };
6359
- function negotiate(client, relay) {
6360
- const common = client.protocolVersions.includes(1) && relay.protocolVersions.includes(1);
6361
- const features = client.requiredFeatures.every((feature) => relay.supportedFeatures.includes(feature)) && relay.requiredFeatures.every((feature) => client.supportedFeatures.includes(feature));
6362
- if (common && features)
6363
- return { status: "compatible", protocolVersion: 1 };
6364
- return {
6365
- status: "unsupported-protocol",
6366
- recoverable: true,
6367
- action: "Update the local runtime or relay to a common protocol and required feature set. Local work remains saved; retry after updating."
6368
- };
6369
- }
6370
- // ../pstdio-sync-contracts/src/json.ts
6371
- function isJson(value) {
6372
- try {
6373
- JSON.stringify(value);
6374
- } catch {
6375
- return false;
6376
- }
6377
- const queue = [value];
6378
- const visited = new Set;
6379
- while (queue.length) {
6380
- const item = queue.pop();
6381
- if (item === null || typeof item === "string" || typeof item === "boolean")
6382
- continue;
6383
- if (typeof item === "number" && Number.isFinite(item))
6384
- continue;
6385
- if (typeof item !== "object" || item === null)
6386
- return false;
6387
- if (visited.has(item))
6388
- continue;
6389
- visited.add(item);
6390
- if (Array.isArray(item))
6391
- queue.push(...item);
6392
- else {
6393
- const prototype = Object.getPrototypeOf(item);
6394
- if (prototype !== Object.prototype && prototype !== null)
6395
- return false;
6396
- queue.push(...Object.values(item));
6397
- }
6398
- }
6399
- return true;
6400
- }
6401
- var jsonSchema = custom(isJson, "Expected a JSON value without loss of object keys");
6402
- function dictionarySchema(valueSchema) {
6403
- return custom((value) => value !== null && typeof value === "object" && !Array.isArray(value) && Object.values(value).every((entry) => valueSchema.safeParse(entry).success), "Invalid dictionary");
6404
- }
6405
-
6406
- // ../pstdio-sync-contracts/src/wire.ts
6407
- var identitySchema = string2().min(1);
6408
- var revisionSchema = number2().int().nonnegative();
6409
- var fingerprintSchema = string2().regex(/^[a-f0-9]{64}$/);
6410
- var scopeSchema = strictObject({
6411
- accountId: identitySchema,
6412
- workbenchId: identitySchema,
6413
- extensionId: identitySchema
6414
- });
6415
- var assetSchema = strictObject({
6416
- sha256: fingerprintSchema,
6417
- byteLength: revisionSchema,
6418
- mediaType: identitySchema
6419
- });
6420
- var sharedSchema = discriminatedUnion("kind", [
6421
- strictObject({ kind: literal("text"), update: string2().min(1) }),
6422
- strictObject({ kind: literal("list"), update: string2().min(1) }),
6423
- strictObject({
6424
- kind: literal("map"),
6425
- entries: array(strictObject({
6426
- key: string2(),
6427
- expected: fingerprintSchema,
6428
- next: discriminatedUnion("kind", [
6429
- strictObject({ kind: literal("set"), value: jsonSchema }),
6430
- strictObject({ kind: literal("delete") })
6431
- ])
6432
- })).min(1)
6433
- })
6434
- ]);
6435
- var changeSchema = strictObject({
6436
- recordId: identitySchema,
6437
- expectedRevision: revisionSchema,
6438
- baseDeleted: boolean2(),
6439
- shared: sharedSchema.optional(),
6440
- value: strictObject({ expected: fingerprintSchema, next: jsonSchema }).optional(),
6441
- asset: strictObject({ base: assetSchema.nullable(), next: assetSchema.nullable() }).optional(),
6442
- deleted: boolean2().optional()
6443
- });
6444
- var resolutionSchema = strictObject({
6445
- conflictId: identitySchema,
6446
- expectedConflicts: array(strictObject({ conflictId: identitySchema, revision: revisionSchema })).min(1),
6447
- capturedOperationIds: array(identitySchema).min(1),
6448
- expectedInputs: array(strictObject({ recordId: identitySchema, revision: revisionSchema })).min(1),
6449
- handler: strictObject({ publishedRevision: identitySchema, handlerId: identitySchema }).optional()
6450
- });
6451
- var mutationBodySchema = strictObject({
6452
- protocolVersion: literal(1),
6453
- scope: scopeSchema,
6454
- environmentId: identitySchema,
6455
- operationId: identitySchema,
6456
- parents: array(identitySchema),
6457
- changes: array(changeSchema).min(1),
6458
- resolution: resolutionSchema.optional()
6459
- });
6460
- var localOperationSchema = mutationBodySchema.omit({ protocolVersion: true, scope: true }).superRefine(checkGroup);
6461
- var mutationSchema = mutationBodySchema.extend({ fingerprint: fingerprintSchema }).superRefine(checkGroup);
6462
- function checkGroup(value, ctx) {
6463
- const unique = (values) => new Set(values).size === values.length;
6464
- const records = value.changes.map((change) => change.recordId);
6465
- if (!unique(records) || !unique(value.parents) || value.parents.includes(value.operationId)) {
6466
- ctx.addIssue({
6467
- code: "custom",
6468
- message: "Records and parents must be unique; operations cannot depend on themselves"
6469
- });
6470
- }
6471
- for (const change of value.changes) {
6472
- if (!change.shared && !change.value && !change.asset && change.deleted === undefined) {
6473
- ctx.addIssue({ code: "custom", message: "A record change must contain an edit" });
6474
- }
6475
- if (change.shared?.kind === "map" && !unique(change.shared.entries.map((entry) => entry.key))) {
6476
- ctx.addIssue({ code: "custom", message: "Map keys must be unique within a change" });
6477
- }
6478
- }
6479
- const resolution = value.resolution;
6480
- if (!resolution)
6481
- return;
6482
- const inputs = resolution.expectedInputs.map((input) => input.recordId);
6483
- if (!unique(resolution.expectedConflicts.map((input) => input.conflictId)) || !resolution.expectedConflicts.some((input) => input.conflictId === resolution.conflictId) || !unique(inputs) || inputs.length !== records.length || records.some((id) => !inputs.includes(id)) || !unique(resolution.capturedOperationIds) || resolution.capturedOperationIds.some((id) => !value.parents.includes(id))) {
6484
- ctx.addIssue({
6485
- code: "custom",
6486
- message: "Resolution inputs must cover the whole group and captured operations must be parents"
6487
- });
6488
- }
6489
- }
6490
-
6491
- // ../pstdio-sync-contracts/src/fingerprint.ts
6492
- function canonicalJson(value) {
6493
- if (Array.isArray(value))
6494
- return `[${value.map(canonicalJson).join(",")}]`;
6495
- if (value !== null && typeof value === "object") {
6496
- return `{${Object.keys(value).filter((key) => value[key] !== undefined).sort().map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(",")}}`;
6497
- }
6498
- return JSON.stringify(value);
6499
- }
6500
- async function fingerprint(value) {
6501
- const bytes = new TextEncoder().encode(canonicalJson(value));
6502
- const digest = await crypto.subtle.digest("SHA-256", bytes);
6503
- return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
6504
- }
6505
- async function sealMutation(body) {
6506
- const parsed = mutationSchema.parse({ ...body, fingerprint: "0".repeat(64) });
6507
- const { fingerprint: _ignored, ...normalized } = parsed;
6508
- return { ...normalized, fingerprint: await fingerprint(normalized) };
6509
- }
6510
- async function validateMutation(input) {
6511
- const mutation = mutationSchema.parse(input);
6512
- const { fingerprint: supplied, ...body } = mutation;
6513
- if (await fingerprint(body) !== supplied)
6514
- throw new Error("Payload fingerprint does not match");
6515
- return mutation;
6516
- }
6517
- // ../pstdio-sync-contracts/src/identity.ts
6518
- var environmentIdentitySchema = strictObject({ environmentId: identitySchema });
6519
- var environmentTargetSchema = environmentIdentitySchema.extend({
6520
- workbenchId: identitySchema,
6521
- workspaceId: identitySchema
6522
- });
6523
- // ../pstdio-sync-contracts/src/state.ts
6524
- var checkpointSchema = strictObject({ epoch: identitySchema, sequence: revisionSchema });
6525
- var recordSchema = strictObject({
6526
- recordId: identitySchema,
6527
- revision: revisionSchema,
6528
- deleted: boolean2(),
6529
- primitive: _enum(["text", "list", "map"]).nullable(),
6530
- shared: strictObject({ kind: _enum(["text", "list"]), update: string2() }).optional(),
6531
- map: dictionarySchema(jsonSchema),
6532
- value: jsonSchema,
6533
- asset: assetSchema.nullable()
6534
- });
6535
- var conflictSchema = strictObject({
6536
- conflictId: identitySchema,
6537
- revision: revisionSchema,
6538
- recordIds: array(identitySchema).min(1),
6539
- alternativeOperationIds: array(identitySchema).min(1),
6540
- resolvedBy: identitySchema.optional()
6541
- });
6542
- var receiptSchema = strictObject({
6543
- order: revisionSchema,
6544
- operationId: identitySchema,
6545
- fingerprint: fingerprintSchema,
6546
- mutation: mutationSchema,
6547
- status: _enum(["accepted", "conflict", "pending"]),
6548
- reason: string2().optional(),
6549
- checkpoint: checkpointSchema.nullable(),
6550
- conflictId: identitySchema.optional(),
6551
- recoveryProof: fingerprintSchema.optional()
6552
- }).superRefine((receipt, ctx) => {
6553
- const identityMatches = receipt.operationId === receipt.mutation.operationId && receipt.fingerprint === receipt.mutation.fingerprint;
6554
- const accepted = receipt.status === "accepted";
6555
- if (!identityMatches || accepted !== (receipt.checkpoint !== null) || receipt.status === "conflict" && !receipt.conflictId) {
6556
- ctx.addIssue({ code: "custom", message: "Receipt identity, fingerprint, outcome and checkpoint must agree" });
6557
- }
6558
- });
6559
- var snapshotSchema = strictObject({
6560
- protocolVersion: literal(1),
6561
- scope: scopeSchema,
6562
- journalSequence: revisionSchema,
6563
- checkpoint: checkpointSchema,
6564
- records: dictionarySchema(recordSchema),
6565
- receipts: dictionarySchema(receiptSchema),
6566
- conflicts: dictionarySchema(conflictSchema),
6567
- publishedRevision: identitySchema
6568
- });
6569
- var syncOutcomeSchema = discriminatedUnion("status", [
6570
- strictObject({ status: literal("saved-locally"), operationId: identitySchema }),
6571
- strictObject({ status: literal("pending"), operationId: identitySchema, reason: string2() }),
6572
- strictObject({ status: literal("synchronized"), operationId: identitySchema, checkpoint: checkpointSchema }),
6573
- strictObject({
6574
- status: literal("conflict"),
6575
- operationId: identitySchema,
6576
- conflictId: identitySchema,
6577
- conflictRevision: revisionSchema
6578
- })
6579
- ]);
6580
-
6581
- // ../pstdio-sync-contracts/src/replay.ts
6582
- var replaySchema = strictObject({
6583
- protocolVersion: literal(1),
6584
- scope: scopeSchema,
6585
- after: checkpointSchema,
6586
- through: checkpointSchema,
6587
- groups: array(receiptSchema)
6588
- }).superRefine((batch, ctx) => {
6589
- const sameEpoch = batch.after.epoch === batch.through.epoch;
6590
- const complete = batch.through.sequence - batch.after.sequence === batch.groups.length;
6591
- const validGroups = batch.groups.every((group, index) => group.status === "accepted" && group.checkpoint?.epoch === batch.through.epoch && group.checkpoint.sequence === batch.after.sequence + index + 1 && canonicalJson(group.mutation.scope) === canonicalJson(batch.scope));
6592
- const unique = new Set(batch.groups.map((group) => group.operationId)).size === batch.groups.length;
6593
- if (!sameEpoch || !complete || !validGroups || !unique)
6594
- ctx.addIssue({
6595
- code: "custom",
6596
- message: "Replay must contain contiguous complete accepted groups in one scope and epoch"
6597
- });
6598
- });
6599
- // ../pstdio-sync-contracts/src/transport.ts
6600
- var relayOperationSchema = _enum([
6601
- "initialize",
6602
- "snapshot",
6603
- "replay",
6604
- "submit",
6605
- "recover",
6606
- "changes",
6607
- "assets/begin",
6608
- "assets/part",
6609
- "assets/finish",
6610
- "assets/cancel",
6611
- "assets/read"
6612
- ]);
6613
- var relayRecoverySchema = strictObject({ mutation: mutationSchema, proof: fingerprintSchema });
6614
- var targetSchema = strictObject({ workbenchId: identitySchema, extensionId: identitySchema });
6615
- var relayReplayResultSchema = discriminatedUnion("status", [
6616
- strictObject({ status: literal("replay"), batch: replaySchema }),
6617
- strictObject({ status: literal("snapshot-required"), checkpoint: checkpointSchema })
6618
- ]);
6619
- var byteLengthSchema = number2().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
6620
- var relayAssetBeginSchema = strictObject({ uploadId: identitySchema, asset: assetSchema });
6621
- var relayAssetUploadSchema = strictObject({ uploadId: identitySchema });
6622
- var relayAssetPartSchema = strictObject({
6623
- uploadId: identitySchema,
6624
- number: number2().int().min(1).max(1e4),
6625
- sha256: fingerprintSchema,
6626
- byteLength: byteLengthSchema
6627
- });
6628
- var relayAssetReadSchema = strictObject({ asset: assetSchema, offset: byteLengthSchema }).refine(({ asset, offset }) => offset <= asset.byteLength, "Offset exceeds the asset");
6629
- var relayAssetStatusSchema = strictObject({
6630
- asset: assetSchema,
6631
- partSize: number2().int().positive(),
6632
- completed: boolean2(),
6633
- parts: array(strictObject({ number: number2().int().positive(), sha256: fingerprintSchema, byteLength: byteLengthSchema }))
6634
- });
6635
- var relayEventSchema = strictObject({ protocolVersion: literal(1), type: _enum(["ready", "changed"]) });
6636
- var relayInitializeSchema = strictObject({ publishedRevision: identitySchema });
6637
- // ../pstdio-api-contracts/src/assets.ts
6638
- var assetReferenceSchema = assetSchema;
6639
- var assetOwnerSchema = strictObject({ workbenchId: identitySchema, extensionId: identitySchema });
6640
- var assetTransferSchema = discriminatedUnion("status", [
6641
- strictObject({
6642
- status: literal("staging"),
6643
- operationId: identitySchema,
6644
- expected: assetReferenceSchema,
6645
- uploadedByteLength: revisionSchema
6646
- }),
6647
- strictObject({ status: literal("complete"), operationId: identitySchema, asset: assetReferenceSchema }),
6648
- strictObject({ status: literal("cancelled"), operationId: identitySchema, expected: assetReferenceSchema })
6649
- ]);
6650
- // ../pstdio-api-contracts/src/extensions/common.ts
6651
- var jsonObjectSchema = record(string2(), unknown());
6652
- var serializableJsonObjectSchema = record(string2(), json()).meta({
6653
- type: "object",
6654
- additionalProperties: true
6655
- });
6656
- var localizedStringSchema = object({ $l10n: string2(), default: string2().optional() });
6657
- var localizableStringSchema = union([string2(), localizedStringSchema]);
6658
- var extensionSettingScopeSchema = _enum(["global", "project"]);
6659
- var extensionSettingValueTypeSchema = _enum(["boolean", "number", "string", "array", "object"]);
6660
- var extensionSettingSourceSchema = _enum(["stored", "default"]);
6661
- var extensionDiagnosticSeveritySchema = _enum(["info", "warning", "error"]);
6662
- var extensionDiagnosticSchema = object({
6663
- code: string2(),
6664
- severity: extensionDiagnosticSeveritySchema,
6665
- message: string2(),
6666
- extensionId: string2().optional(),
6667
- commandId: string2().optional(),
6668
- sourcePath: string2().optional(),
6669
- metadata: jsonObjectSchema.optional()
6670
- });
6671
- var extensionRecordSchema = object({
6672
- id: string2(),
6673
- name: string2(),
6674
- displayName: string2(),
6675
- extensionInstanceId: string2().optional(),
6676
- installedExtensionId: string2().optional(),
6677
- installName: string2().optional(),
6678
- version: string2().optional(),
6679
- description: string2().optional(),
6680
- sourcePath: string2()
6681
- });
6682
- var packageAssetDescriptorSchema = object({
6683
- kind: literal("package-asset"),
6684
- path: string2(),
6685
- baseUrl: string2()
6686
- });
6687
- var extensionPlacementSchema = _enum(["first", "default", "last"]);
6688
- var extensionSlotKindSchema = _enum([
6689
- "menu",
6690
- "panel",
6691
- "settings",
6692
- "renderer",
6693
- "kanbanRenderer",
6694
- "dataTableRenderer"
6695
- ]);
6696
- var commandSourceSchema = _enum([
6697
- "cli",
6698
- "dashboard",
6699
- "api",
6700
- "schedule",
6701
- "event",
6702
- "automation",
6703
- "command-panel"
6704
- ]);
6705
- var extensionWhenExpressionSchema = object({
6706
- mode: union([string2(), array(string2())]).optional(),
6707
- source: array(commandSourceSchema).optional(),
6708
- viewId: union([string2(), array(string2())]).optional(),
6709
- resourceType: array(string2()).optional(),
6710
- metadata: jsonObjectSchema.optional()
6711
- });
6712
- var extensionWebviewContributionSchema = object({
6713
- entry: packageAssetDescriptorSchema,
6714
- title: localizableStringSchema.optional(),
6715
- capabilities: array(string2()).optional()
6716
- });
6717
- var workbenchExtensionWebviewSchema = extensionWebviewContributionSchema.extend({
6718
- runtimeUrl: string2(),
6719
- moduleUrl: string2(),
6720
- styles: array(string2()).optional()
6721
- });
6722
-
6723
- // ../pstdio-api-contracts/src/extensions/appearance.ts
6724
- var extensionThemeRecordSchema = object({
6725
- id: string2(),
6726
- extensionId: string2(),
6727
- title: localizableStringSchema,
6728
- description: localizableStringSchema.optional(),
6729
- format: literal("vscode-color-theme"),
6730
- mode: _enum(["light", "dark"]),
6731
- source: packageAssetDescriptorSchema,
6732
- tokens: record(string2(), string2()),
6733
- monacoTheme: object({
6734
- base: _enum(["vs", "vs-dark"]),
6735
- inherit: literal(true),
6736
- rules: array(record(string2(), unknown())),
6737
- colors: record(string2(), string2())
6738
- })
6739
- });
6740
- var extensionFileIconThemeRecordSchema = object({
6741
- id: string2(),
6742
- extensionId: string2(),
6743
- title: localizableStringSchema,
6744
- description: localizableStringSchema.optional(),
6745
- format: literal("vscode-file-icon-theme"),
6746
- source: packageAssetDescriptorSchema,
6747
- definitions: jsonObjectSchema,
6748
- fileExtensions: record(string2(), string2()),
6749
- fileNames: record(string2(), string2()),
6750
- defaults: object({ file: string2().optional(), folder: string2().optional() }).default({}),
6751
- fonts: array(object({
6752
- fontFamily: string2(),
6753
- src: array(object({ url: string2(), format: string2().optional() })),
6754
- weight: string2().optional(),
6755
- style: string2().optional()
6756
- })).default([])
6757
- });
6758
- var extensionTranslationRecordSchema = object({
6759
- extensionId: string2(),
6760
- defaultLocale: string2(),
6761
- bundles: record(string2(), record(string2(), string2()))
6762
- });
6763
- // ../pstdio-api-contracts/src/extensions/artifacts.ts
6764
- var extensionArtifactMountSchema = object({
6765
- id: string2(),
6766
- extensionId: string2(),
6767
- relativePath: string2(),
6768
- fullPath: string2(),
6769
- label: localizableStringSchema,
6770
- watch: boolean2()
6771
- });
6772
- // ../pstdio-api-contracts/src/extension-kernel/workbench-targets.ts
6773
- var workbenchMenuTargets = ["workbench.nav.actions", "workbench.nav.overflow"];
6774
- var workbenchTreeTargets = [
6775
- "workbench.left.tree",
6776
- "workbench.main.left.tree",
6777
- "workbench.main.right.tree"
6778
- ];
6779
- var workbenchRegions = [
6780
- "nav",
6781
- "activity",
6782
- "sidenav",
6783
- "main-header",
6784
- "main",
6785
- "secondary-header",
6786
- "secondary",
6787
- "side-header",
6788
- "side",
6789
- "status",
6790
- "overlay"
6791
- ];
6792
- var workbenchViewTargets = [
6793
- "workbench.main",
6794
- "workbench.main.left",
6795
- "workbench.main.right",
6796
- "workbench.secondary"
6797
- ];
6798
- var workbenchSettingsTargets = ["workbench.settings"];
6799
- var workbenchSettingsScopes = ["project", "global"];
6800
- var workbenchModeLayoutTargets = [
6801
- "workbench.left",
6802
- "workbench.main.left",
6803
- "workbench.main",
6804
- "workbench.main.right",
6805
- "workbench.secondary"
6806
- ];
6807
-
6808
- // ../pstdio-api-contracts/src/extensions/targets.ts
6809
- var workbenchMenuTargetSchema = _enum(workbenchMenuTargets);
6810
- var workbenchTreeTargetSchema = _enum(workbenchTreeTargets);
6811
- var workbenchRegionSchema = _enum(workbenchRegions);
6812
- var workbenchViewTargetSchema = _enum(workbenchViewTargets);
6813
- var workbenchSettingsTargetSchema = _enum(workbenchSettingsTargets);
6814
- var workbenchModeLayoutTargetSchema = _enum(workbenchModeLayoutTargets);
6815
- var workbenchAttachmentTargetSchema = union([
6816
- workbenchMenuTargetSchema,
6817
- workbenchTreeTargetSchema,
6818
- workbenchViewTargetSchema,
6819
- workbenchSettingsTargetSchema
6820
- ]);
6821
- var workbenchSettingsScopeSchema = _enum(workbenchSettingsScopes);
6822
-
6823
- // ../pstdio-api-contracts/src/extensions/commands.ts
6824
- var commandParamDescriptorSchema = object({ type: string2(), description: localizableStringSchema.optional() }).catchall(unknown());
6825
- var extensionCommandRecordSchema = object({
6826
- id: string2(),
6827
- extensionId: string2(),
6828
- title: localizableStringSchema,
6829
- description: localizableStringSchema.optional(),
6830
- cliPath: string2().optional(),
6831
- cliAliases: array(string2()).optional(),
6832
- examples: array(string2()).optional(),
6833
- automation: boolean2().optional(),
6834
- mutating: boolean2().optional(),
6835
- resourceMutation: discriminatedUnion("kind", [
6836
- object({ kind: literal("rename"), resourceType: string2(), idParam: string2(), labelParam: string2() }),
6837
- object({ kind: literal("remove"), resourceType: string2(), idParam: string2() })
6838
- ]).optional(),
6839
- params: record(string2(), commandParamDescriptorSchema).optional()
6840
- });
6841
- var extensionParamObjectSchema = record(string2(), commandParamDescriptorSchema);
6842
- var extensionMiddlewareRecordSchema = object({
6843
- id: string2(),
6844
- extensionId: string2(),
6845
- commandId: string2()
6846
- });
6847
- var extensionHookRecordSchema = object({
6848
- id: string2(),
6849
- extensionId: string2(),
6850
- eventId: string2()
6851
- });
6852
- var extensionScheduleRecordSchema = object({
6853
- id: string2(),
6854
- extensionId: string2(),
6855
- cron: string2(),
6856
- commandId: string2()
6857
- });
6858
- var workbenchExtensionAutomationRecordSchema = object({
6859
- id: string2(),
6860
- localId: string2(),
6861
- extensionId: string2(),
6862
- extensionInstanceId: string2().optional(),
6863
- title: localizableStringSchema,
6864
- cron: string2(),
6865
- commandId: string2(),
6866
- enabled: boolean2()
6867
- });
6868
- var extensionMenuContributionSchema = object({
6869
- id: string2(),
6870
- extensionId: string2(),
6871
- commandId: string2(),
6872
- slotId: string2(),
6873
- target: workbenchMenuTargetSchema.optional(),
6874
- label: localizableStringSchema,
6875
- group: string2().optional(),
6876
- placement: extensionPlacementSchema.optional(),
6877
- icon: string2().optional(),
6878
- presentation: _enum(["menu-item", "button", "icon-button"]).optional(),
6879
- params: jsonObjectSchema.optional(),
6880
- when: extensionWhenExpressionSchema.optional(),
6881
- disabledWhen: extensionWhenExpressionSchema.optional(),
6882
- disabledReason: localizableStringSchema.optional()
6883
- });
6884
- var extensionCommandPaletteContributionSchema = object({
6885
- id: string2(),
6886
- extensionId: string2(),
6887
- commandId: string2(),
6888
- label: localizableStringSchema,
6889
- group: string2().optional(),
6890
- placement: extensionPlacementSchema.optional(),
6891
- icon: string2().optional(),
6892
- params: jsonObjectSchema.optional(),
6893
- when: extensionWhenExpressionSchema.optional()
6894
- });
6895
-
6896
- // ../pstdio-api-contracts/src/extensions/host-capabilities.ts
6897
- var extensionHostCapabilitySchema = object({
6898
- version: number2().int().positive(),
6899
- since: string2().optional()
6900
- });
6901
- var extensionHostCapabilitiesSchema = object({
6902
- host: literal("dashboard"),
6903
- hostVersion: string2(),
6904
- capabilities: record(string2(), extensionHostCapabilitySchema)
6905
- });
6906
- var extensionHostCompatibilitySchema = object({
6907
- status: _enum(["verified", "unverified"]),
6908
- host: extensionHostCapabilitiesSchema.optional(),
6909
- diagnostics: array(extensionDiagnosticSchema)
6910
- });
6911
-
6912
- // ../pstdio-api-contracts/src/extension-kernel/types/composition.ts
6913
- var dockedWorkbenchRegions = ["sidenav", "main", "secondary", "side"];
6914
- var extensionPanelRegions = ["main", "secondary", "side"];
6915
-
6916
- // ../pstdio-api-contracts/src/extensions/connections.ts
6917
- var workbenchExtensionConnectionRecordSchema = object({
6918
- id: string2(),
6919
- localId: string2(),
6920
- extensionId: string2(),
6921
- label: localizableStringSchema,
6922
- authType: _enum(["bearer", "header"]),
6923
- supportsCheck: boolean2()
6924
- });
6925
- var extensionConnectionRecordSchema = object({
6926
- id: string2(),
6927
- extensionId: string2(),
6928
- connectionId: string2(),
6929
- baseUrl: string2(),
6930
- authType: _enum(["bearer", "header"]),
6931
- configured: boolean2(),
6932
- lastCheck: object({
6933
- ok: boolean2(),
6934
- status: number2().int().nullable(),
6935
- error: string2().nullable(),
6936
- checkedAt: string2()
6937
- }).nullable(),
6938
- updatedAt: string2()
6939
- });
6940
- var configureExtensionConnectionSchema = object({
6941
- baseUrl: url(),
6942
- secret: string2().optional()
6943
- });
6944
- var listExtensionConnectionsResponseSchema = object({
6945
- connections: array(extensionConnectionRecordSchema)
6946
- });
6947
-
6948
- // ../pstdio-api-contracts/src/extension-kernel/navigation-href.ts
6949
- var isNavigationHref = (href) => {
6950
- if (typeof href !== "string")
6951
- return false;
6952
- try {
6953
- const { protocol } = new URL(href);
6954
- return protocol === "https:" || protocol === "http:";
6955
- } catch {
6956
- return false;
6957
- }
6958
- };
6959
-
6960
- // ../pstdio-api-contracts/src/extension-kernel/source-position.ts
6961
- var isFileSourcePosition = (value) => {
6962
- if (!value || typeof value !== "object" || Array.isArray(value))
6963
- return false;
6964
- const position = value;
6965
- const positive = (number) => typeof number === "number" && Number.isSafeInteger(number) && number > 0;
6966
- if (!positive(position.line))
6967
- return false;
6968
- for (const key of ["column", "endLine", "endColumn"]) {
6969
- if (position[key] !== undefined && !positive(position[key]))
6970
- return false;
6971
- }
6972
- if (position.endColumn !== undefined && position.endLine === undefined)
6973
- return false;
6974
- if (position.endLine !== undefined) {
6975
- if (position.endLine < position.line)
6976
- return false;
6977
- if (position.endLine === position.line && (position.endColumn ?? 1) < (position.column ?? 1))
6978
- return false;
6979
- }
6980
- return true;
6981
- };
6982
-
6983
- // ../pstdio-api-contracts/src/extension-kernel/page-params.ts
6984
- var reserved = new Set(["resource", "section", "document", "line", "column", "endLine", "endColumn"]);
6985
- var invalid = (name) => new Error(`page_param_invalid: ${name}`);
6986
- var equal = (left, right) => JSON.stringify(left) === JSON.stringify(right);
6987
- var isPageParamValue = (definition, value) => {
6988
- if (definition.type === "string[]")
6989
- return Array.isArray(value) && value.every((item) => typeof item === "string");
6990
- if (definition.type === "string")
6991
- return typeof value === "string" && (!definition.values || definition.values.includes(value));
6992
- if (definition.type === "number")
6993
- return typeof value === "number" && Number.isFinite(value);
6994
- return typeof value === "boolean";
6995
- };
6996
- var validatePageParamDefinitions = (definitions = {}) => {
6997
- if (Object.keys(definitions).length > 32)
6998
- throw invalid("at most 32 params");
6999
- for (const [name, definition] of Object.entries(definitions)) {
7000
- if (name.length > 64 || !/^[a-z][a-z0-9-]*$/.test(name) || reserved.has(name))
7001
- throw new Error(`page_param_reserved: ${name}`);
7002
- if (definition.default !== undefined && !isPageParamValue(definition, definition.default))
7003
- throw invalid(name);
7004
- }
7005
- };
7006
- var validateNames = (definitions, values) => {
7007
- for (const name of Object.keys(values))
7008
- if (!Object.hasOwn(definitions, name))
7009
- throw invalid(name);
7010
- };
7011
- var normalizePageParams = (definitions = {}, values = {}, strict = true) => {
7012
- const result = {};
7013
- if (strict)
7014
- validateNames(definitions, values);
7015
- for (const name of Object.keys(definitions)) {
7016
- if (!Object.hasOwn(values, name))
7017
- continue;
7018
- const value = values[name];
7019
- const definition = definitions[name];
7020
- if (!isPageParamValue(definition, value)) {
7021
- if (strict)
7022
- throw invalid(name);
7023
- continue;
7024
- }
7025
- if (equal(value, definition.default) || Array.isArray(value) && !value.length)
7026
- continue;
7027
- result[name] = Array.isArray(value) ? Object.freeze([...value]) : value;
7028
- }
7029
- const params = Object.keys(result).length ? Object.freeze(result) : undefined;
7030
- if (pageParamsQuery(definitions, params).toString().length > 2048) {
7031
- if (strict)
7032
- throw invalid("query exceeds 2048 characters");
7033
- return;
7034
- }
7035
- return params;
7036
- };
7037
- var resolvePageParams = (definitions = {}, params) => {
7038
- const result = {};
7039
- for (const [name, definition] of Object.entries(definitions)) {
7040
- if (definition.default !== undefined)
7041
- result[name] = Array.isArray(definition.default) ? Object.freeze([...definition.default]) : definition.default;
7042
- }
7043
- return Object.freeze({ ...result, ...params });
7044
- };
7045
- var pageParamsQuery = (definitions = {}, params) => {
7046
- const query = new URLSearchParams;
7047
- for (const name of Object.keys(definitions)) {
7048
- const value = params?.[name];
7049
- if (value === undefined)
7050
- continue;
7051
- for (const item of Array.isArray(value) ? value : [value])
7052
- query.append(name, String(item));
7053
- }
7054
- return query;
7055
- };
7056
- var parsePageParams = (definitions = {}, query) => {
7057
- const values = {};
7058
- for (const [name, definition] of Object.entries(definitions)) {
7059
- const items = query.getAll(name);
7060
- if (!items.length || definition.type !== "string[]" && items.length !== 1)
7061
- continue;
7062
- const raw = items[0];
7063
- if (definition.type === "string[]")
7064
- values[name] = items;
7065
- else if (definition.type === "number") {
7066
- if (String(Number(raw)) === raw)
7067
- values[name] = Number(raw);
7068
- } else if (definition.type === "boolean") {
7069
- if (raw === "true" || raw === "false")
7070
- values[name] = raw === "true";
7071
- } else
7072
- values[name] = raw;
7073
- }
7074
- const params = normalizePageParams(definitions, values, false);
7075
- return pageParamsQuery(definitions, params).toString().length <= 2048 ? params : undefined;
7076
- };
7077
-
7078
- // ../pstdio-api-contracts/src/extensions/page-params-schema.ts
7079
- var pageParamValueSchema = union([string2(), number2(), boolean2(), array(string2())]);
7080
- var pageParamDefinitionsSchema = record(string2(), discriminatedUnion("type", [
7081
- object({
7082
- type: literal("string"),
7083
- default: string2().optional(),
7084
- values: array(string2()).readonly().optional()
7085
- }).strict(),
7086
- object({ type: literal("number"), default: number2().optional() }).strict(),
7087
- object({ type: literal("boolean"), default: boolean2().optional() }).strict(),
7088
- object({ type: literal("string[]"), default: array(string2()).readonly().optional() }).strict()
7089
- ])).superRefine((value, ctx) => {
7090
- try {
7091
- validatePageParamDefinitions(value);
7092
- } catch (error) {
7093
- ctx.addIssue({ code: "custom", message: String(error) });
7094
- }
7095
- });
7096
-
7097
- // ../pstdio-api-contracts/src/extensions/resource-ref.ts
7098
- var extensionResourceRefSchema = object({
7099
- shorthand: string2().optional(),
7100
- type: string2(),
7101
- id: string2(),
7102
- projectId: string2().optional(),
7103
- label: string2().optional(),
7104
- icon: string2().optional(),
7105
- extensionId: string2().optional(),
7106
- metadata: serializableJsonObjectSchema.optional()
7107
- });
7108
-
7109
- // ../pstdio-api-contracts/src/extensions/workbench-refs-metadata.ts
7110
- var contributionRefSchema = (kind) => object({ extensionId: string2(), kind: literal(kind), id: string2() });
7111
- var pageRefSchema = contributionRefSchema("page");
7112
- var placementRefSchema = contributionRefSchema("placement");
7113
- var modeRefSchema = contributionRefSchema("mode");
7114
- var viewRefSchema = contributionRefSchema("view");
7115
- var resourceKindRefSchema = contributionRefSchema("resource-kind");
7116
- var pageSlotRefSchema = object({
7117
- kind: literal("page-slot"),
7118
- page: pageRefSchema,
7119
- id: string2()
7120
- });
7121
- var panelRefSchema = union([placementRefSchema, pageSlotRefSchema]);
7122
- var commandTargetSchema = object({
7123
- command: contributionRefSchema("command"),
7124
- params: serializableJsonObjectSchema.optional()
7125
- });
7126
-
7127
- // ../pstdio-api-contracts/src/extensions/navigation-target-metadata.ts
7128
- var sourcePositionSchema = object({
7129
- line: number2().int().positive(),
7130
- column: number2().int().positive().optional(),
7131
- endLine: number2().int().positive().optional(),
7132
- endColumn: number2().int().positive().optional()
7133
- }).refine(isFileSourcePosition, "Expected ordered source coordinates");
7134
- var sectionSchema = object({
7135
- anchors: array(object({ id: string2(), heading: string2(), occurrence: number2().int().nonnegative().optional() }))
7136
- });
7137
- var pageTargetSchema = lazy(() => object({
7138
- kind: literal("page"),
7139
- page: pageRefSchema,
7140
- resource: extensionResourceRefSchema.optional(),
7141
- open: _enum(["preview", "pin"]).optional(),
7142
- section: sectionSchema.optional(),
7143
- position: sourcePositionSchema.optional(),
7144
- params: record(string2(), pageParamValueSchema).optional(),
7145
- parent: pageTargetSchema.optional()
7146
- }).refine((value) => !(value.position && value.section), "Choose a source position or a heading section")).meta({ id: "WorkbenchMetadataPageTarget" });
7147
- var navigationOperationSchema = union([
7148
- pageTargetSchema,
7149
- object({
7150
- kind: literal("panel"),
7151
- panel: panelRefSchema,
7152
- resource: extensionResourceRefSchema.optional(),
7153
- open: _enum(["preview", "pin"]).optional()
7154
- })
7155
- ]);
7156
- var navigationTargetSchema = union([
7157
- navigationOperationSchema,
7158
- object({ kind: literal("command"), target: commandTargetSchema }),
7159
- object({ kind: literal("href"), href: string2().refine(isNavigationHref, "Expected an HTTP or HTTPS URL") }),
7160
- object({ kind: literal("compound"), targets: array(navigationOperationSchema).min(1) })
7161
- ]);
7162
-
7163
- // ../pstdio-api-contracts/src/extensions/command-outcome.ts
7164
- var notice = object({
7165
- type: _enum(["info", "success", "warning", "error"]),
7166
- title: string2().optional(),
7167
- message: string2(),
7168
- metadata: serializableJsonObjectSchema.optional()
7169
- });
7170
- var diagnostic = object({
7171
- code: string2(),
7172
- message: string2(),
7173
- severity: _enum(["info", "warning", "error"]),
7174
- extensionId: string2().optional(),
7175
- commandId: string2().optional(),
7176
- metadata: serializableJsonObjectSchema.optional()
7177
- });
7178
- var createCommandOutcomeSchema = (jsonValue) => {
7179
- const error = object({
7180
- name: string2().optional(),
7181
- message: string2(),
7182
- stack: string2().optional(),
7183
- cause: jsonValue.optional()
7184
- });
7185
- const annotations = {
7186
- notices: array(notice).optional(),
7187
- diagnostics: array(diagnostic).optional()
7188
- };
7189
- const failure = {
7190
- ...annotations,
7191
- ok: literal(false),
7192
- code: string2().optional(),
7193
- reason: string2(),
7194
- data: serializableJsonObjectSchema.optional(),
7195
- cause: jsonValue.optional(),
7196
- error: error.optional()
7197
- };
7198
- const navigation = navigationTargetSchema;
7199
- const outcome = discriminatedUnion("status", [
7200
- object({
7201
- ...annotations,
7202
- ok: literal(true),
7203
- status: literal("success"),
7204
- value: unknown().optional(),
7205
- navigationRequests: array(navigation).optional()
7206
- }).transform((outcome) => ({ ...outcome, value: outcome.value })),
7207
- object({ ...failure, status: literal("rejected") }),
7208
- object({ ...failure, status: literal("error") })
7209
- ]);
7210
- return outcome;
7211
- };
7212
- var validatedCommandOutcomeSchema = createCommandOutcomeSchema(json());
7213
-
7214
- // ../pstdio-api-contracts/src/extensions/execute.ts
7215
- var extensionSlotInvocationSchema = object({
7216
- id: string2(),
7217
- kind: extensionSlotKindSchema,
7218
- context: jsonObjectSchema
7219
- });
7220
- var extensionAttachmentInvocationSchema = object({
7221
- target: workbenchAttachmentTargetSchema,
7222
- mode: string2().optional(),
7223
- projectId: string2().optional(),
7224
- resource: extensionResourceRefSchema.optional()
7225
- });
7226
- var extensionRendererContextSchema = object({
7227
- rendererId: string2(),
7228
- pageParams: record(string2(), pageParamValueSchema).optional(),
7229
- projectId: string2().optional(),
7230
- modeId: string2().optional(),
7231
- resource: extensionResourceRefSchema.optional(),
7232
- invocation: object({ placement: _enum(["visible", "background"]) }).optional()
7233
- });
7234
- var commandExecuteRequestSchema = object({
7235
- projectId: string2().min(1),
7236
- workspaceId: string2().optional(),
7237
- params: jsonObjectSchema.optional(),
7238
- resource: extensionResourceRefSchema.optional(),
7239
- attachment: extensionAttachmentInvocationSchema.optional(),
7240
- slot: extensionSlotInvocationSchema.optional(),
7241
- source: commandSourceSchema.optional(),
7242
- metadata: jsonObjectSchema.optional()
7243
- });
7244
- var commandExecuteBodySchema = object({
7245
- workspaceId: string2().optional(),
7246
- params: jsonObjectSchema.optional(),
7247
- resource: extensionResourceRefSchema.optional(),
7248
- attachment: extensionAttachmentInvocationSchema.optional(),
7249
- slot: extensionSlotInvocationSchema.optional(),
7250
- source: commandSourceSchema.optional(),
7251
- metadata: jsonObjectSchema.optional()
7252
- });
7253
- var dispatchExtensionEventBodySchema = object({
7254
- eventId: string2().min(1),
7255
- payload: jsonObjectSchema
7256
- }).strict();
7257
- var responseNavigationTargetSchema = navigationTargetSchema;
7258
- var commandOutcomeSchema = object({
7259
- ok: boolean2(),
7260
- status: _enum(["success", "rejected", "error"]),
7261
- value: unknown().optional(),
7262
- navigationRequests: array(responseNavigationTargetSchema).optional(),
7263
- code: string2().optional(),
7264
- reason: string2().optional(),
7265
- data: jsonObjectSchema.optional(),
7266
- error: object({ name: string2().optional(), message: string2(), stack: string2().optional() }).optional(),
7267
- notices: array(object({
7268
- type: _enum(["info", "success", "warning", "error"]),
7269
- title: string2().optional(),
7270
- message: string2(),
7271
- metadata: jsonObjectSchema.optional()
7272
- })).optional(),
7273
- diagnostics: array(object({
7274
- code: string2(),
7275
- message: string2(),
7276
- severity: _enum(["info", "warning", "error"]),
7277
- extensionId: string2().optional(),
7278
- commandId: string2().optional(),
7279
- metadata: jsonObjectSchema.optional()
7280
- })).optional()
7281
- });
7282
- var responseFields = {
7283
- commandId: string2(),
7284
- extensionId: string2(),
7285
- eventIds: array(string2()).optional()
7286
- };
7287
- var commandExecuteResponseSchema = object({
7288
- ...responseFields,
7289
- outcome: commandOutcomeSchema
7290
- });
7291
- var createCommandExecutionResultSchema = (jsonValue) => object({ ...responseFields, outcome: createCommandOutcomeSchema(jsonValue) });
7292
- var commandExecutionResultSchema = createCommandExecutionResultSchema(json());
7293
-
7294
- // ../pstdio-api-contracts/src/extensions/control-declarations.ts
7295
- var base = { id: string2(), name: string2(), description: string2().optional(), readOnly: boolean2().optional() };
7296
- var numeric = { min: number2().optional(), max: number2().optional(), step: number2().optional() };
7297
- var vector = strictObject({ x: number2(), y: number2() });
7298
- var range = tuple([number2(), number2()]);
7299
- var harness = strictObject({
7300
- harnessId: string2().min(1),
7301
- model: string2().optional(),
7302
- params: record(string2(), union([string2(), boolean2()])).optional()
7303
- });
7304
- var selectionValue = union([string2(), array(string2())]);
7305
- var selectionOption = strictObject({
7306
- id: string2(),
7307
- name: string2(),
7308
- icon: string2().optional(),
7309
- color: string2().optional(),
7310
- description: string2().optional(),
7311
- disabled: boolean2().optional()
7312
- });
7313
- var selection = {
7314
- placeholder: string2().optional(),
7315
- searchable: boolean2().optional(),
7316
- searchPlaceholder: string2().optional(),
7317
- emptyText: string2().optional(),
7318
- disabled: boolean2().optional()
7319
- };
7320
- var image = strictObject({ src: string2(), alt: string2() });
7321
- var primitive = union([string2(), number2(), boolean2(), _null3()]);
7322
- var readOnlyContent = union([
7323
- primitive,
7324
- array(primitive),
7325
- image.extend({ type: literal("image") }),
7326
- strictObject({ type: literal("image-gallery"), images: array(image) })
7327
- ]);
7328
- var controlValueSchema = union([primitive, array(string2()), range, vector, harness]);
7329
- var controlValuesSchema = record(string2(), controlValueSchema);
7330
- var controlParamSchema = discriminatedUnion("type", [
7331
- strictObject({ ...base, type: literal("harness"), defaultValue: harness }),
7332
- strictObject({ ...base, ...numeric, type: literal("number"), defaultValue: number2() }),
7333
- strictObject({ ...base, type: literal("boolean"), defaultValue: boolean2() }),
7334
- strictObject({ ...base, type: literal("text"), defaultValue: string2(), singleLine: boolean2().optional() }),
7335
- strictObject({
7336
- ...base,
7337
- type: literal("markdown"),
7338
- defaultValue: string2(),
7339
- placeholder: string2().optional()
7340
- }),
7341
- strictObject({
7342
- ...base,
7343
- ...selection,
7344
- type: literal("selection"),
7345
- allowCustomValues: boolean2().optional(),
7346
- defaultValue: selectionValue,
7347
- options: array(selectionOption),
7348
- multiSelect: boolean2().optional(),
7349
- clearable: boolean2().optional(),
7350
- group: strictObject({
7351
- id: string2(),
7352
- name: string2(),
7353
- defaultValue: string2(),
7354
- options: array(selectionOption),
7355
- ...selection
7356
- }).optional()
7357
- }),
7358
- strictObject({
7359
- ...base,
7360
- type: literal("date"),
7361
- defaultValue: string2(),
7362
- min: string2().optional(),
7363
- max: string2().optional()
7364
- }),
7365
- strictObject({ ...base, type: literal("color"), defaultValue: string2() }),
7366
- strictObject({ ...base, type: literal("readOnly"), value: readOnlyContent }),
7367
- strictObject({
7368
- ...base,
7369
- type: literal("resource"),
7370
- defaultValue: selectionValue,
7371
- options: array(strictObject({
7372
- id: string2(),
7373
- name: string2(),
7374
- icon: string2().optional(),
7375
- color: string2().optional(),
7376
- description: string2().optional(),
7377
- href: string2().optional(),
7378
- ref: extensionResourceRefSchema.optional(),
7379
- copyText: string2().optional()
7380
- })),
7381
- multiSelect: boolean2().optional(),
7382
- editable: boolean2().optional(),
7383
- placeholder: string2().optional(),
7384
- emptyText: string2().optional()
7385
- }),
7386
- strictObject({
7387
- ...base,
7388
- ...numeric,
7389
- type: literal("range"),
7390
- defaultValue: range,
7391
- min: number2(),
7392
- max: number2(),
7393
- unit: string2().optional(),
7394
- markerCount: number2().optional()
7395
- }),
7396
- strictObject({
7397
- ...base,
7398
- type: literal("segmented"),
7399
- defaultValue: string2(),
7400
- variant: _enum(["default", "dots"]).optional(),
7401
- options: array(strictObject({
7402
- id: string2(),
7403
- name: string2(),
7404
- icon: string2().optional(),
7405
- indicatorColor: string2().optional()
7406
- }))
7407
- }),
7408
- strictObject({
7409
- ...base,
7410
- type: literal("actions"),
7411
- defaultValue: string2().optional(),
7412
- options: array(strictObject({
7413
- id: string2(),
7414
- name: string2(),
7415
- icon: string2().optional(),
7416
- disabled: boolean2().optional()
7417
- }))
7418
- }),
7419
- strictObject({
7420
- ...base,
7421
- type: literal("anchorGrid"),
7422
- defaultValue: _enum([
7423
- "top-left",
7424
- "top",
7425
- "top-right",
7426
- "left",
7427
- "center",
7428
- "right",
7429
- "bottom-left",
7430
- "bottom",
7431
- "bottom-right"
7432
- ])
7433
- }),
7434
- strictObject({
7435
- ...base,
7436
- ...numeric,
7437
- type: literal("vector"),
7438
- defaultValue: vector,
7439
- coordinateMode: _enum(["cartesian", "screen"]).optional(),
7440
- xLabel: string2().optional(),
7441
- yLabel: string2().optional()
7442
- })
7443
- ]);
7444
- var controlGroupSchema = strictObject({
7445
- id: string2(),
7446
- title: string2(),
7447
- description: string2().optional(),
7448
- params: array(controlParamSchema),
7449
- collapsible: boolean2().optional(),
7450
- defaultCollapsed: boolean2().optional()
7451
- });
7452
- var controlsQueryResultSchema = strictObject({
7453
- params: array(controlParamSchema).optional(),
7454
- groups: array(controlGroupSchema).optional(),
7455
- values: controlValuesSchema.optional(),
7456
- readOnly: boolean2().optional()
7457
- });
7458
-
7459
- // ../pstdio-api-contracts/src/extensions/renderers.ts
7460
- var extensionRendererRecordBaseSchema = object({
7461
- id: string2(),
7462
- extensionId: string2(),
7463
- title: localizableStringSchema,
7464
- icon: string2().optional(),
7465
- resourceKind: string2().optional(),
7466
- refreshEventIds: array(string2().min(1)).optional(),
7467
- emptyTitle: localizableStringSchema.optional(),
7468
- emptyDescription: localizableStringSchema.optional()
7469
- });
7470
- var extensionTreeRendererRecordSchema = extensionRendererRecordBaseSchema.extend({
7471
- searchable: boolean2().optional(),
7472
- searchPlaceholder: localizableStringSchema.optional(),
7473
- headerHandlerId: string2().optional(),
7474
- bodyHandlerId: string2(),
7475
- childrenHandlerId: string2().optional(),
7476
- moveHandlerId: string2().optional(),
7477
- footerHandlerId: string2().optional(),
7478
- defaultExpandedSectionIds: array(string2()).optional(),
7479
- defaultExpandedNodeIds: array(string2()).optional()
7480
- });
7481
- var extensionFileRendererRecordSchema = extensionRendererRecordBaseSchema.extend({
7482
- loadHandlerId: string2(),
7483
- saveHandlerId: string2().optional()
7484
- });
7485
-
7486
- // ../pstdio-api-contracts/src/extensions/controls-renderer.ts
7487
- var extensionControlsRendererRecordSchema = extensionRendererRecordBaseSchema.extend({
7488
- queryHandlerId: string2(),
7489
- valueChangeHandlerId: string2().optional(),
7490
- applyHandlerId: string2().optional(),
7491
- resetHandlerId: string2().optional(),
7492
- defaultValues: controlValuesSchema.optional()
7493
- });
7494
-
7495
5707
  // ../pstdio-api-contracts/src/extension-kernel/types/collection-view.ts
7496
5708
  var optionConditions = ["is-any-of", "is-none-of", "is-empty", "is-not-empty"];
7497
5709
  var VIEW_FILTER_CONDITIONS = {
@@ -7591,2080 +5803,6 @@ var findViewFilterProblem = (filter, fields) => {
7591
5803
  return;
7592
5804
  };
7593
5805
 
7594
- // ../pstdio-api-contracts/src/extensions/view-toolbar-action.ts
7595
- var viewToolbarActionSchema = object({
7596
- id: string2(),
7597
- label: localizableStringSchema,
7598
- icon: string2().optional(),
7599
- presentation: _enum(["primary", "secondary"]).optional(),
7600
- params: jsonObjectSchema.optional(),
7601
- input: extensionParamObjectSchema.optional(),
7602
- submitLabel: string2().optional(),
7603
- when: string2().optional(),
7604
- disabled: boolean2().optional()
7605
- });
7606
- var viewToolbarActionRecordSchema = viewToolbarActionSchema.extend({ commandId: string2() });
7607
-
7608
- // ../pstdio-api-contracts/src/extensions/data-table-renderer.ts
7609
- var themeColorSchema = object({
7610
- light: string2(),
7611
- dark: string2(),
7612
- foreground: object({ light: string2(), dark: string2() }).optional()
7613
- });
7614
- var columnStatSchema = discriminatedUnion("type", [
7615
- object({ type: literal("unique") }),
7616
- object({ type: literal("histogram"), bins: number2().int().positive().optional() }),
7617
- object({ type: literal("top-values"), limit: number2().int().positive().optional() })
7618
- ]);
7619
- var columnRendererSchema = discriminatedUnion("type", [
7620
- object({ type: literal("json") }),
7621
- object({
7622
- type: literal("color-scale"),
7623
- stops: array(object({ value: number2(), color: themeColorSchema }))
7624
- }),
7625
- object({
7626
- type: literal("categorical-color"),
7627
- categories: array(object({ value: union([string2(), number2(), boolean2(), _null3()]), color: themeColorSchema }))
7628
- })
7629
- ]);
7630
- var dataTableRendererColumnSchema = object({
7631
- id: string2(),
7632
- label: localizableStringSchema.optional(),
7633
- type: _enum(["string", "number", "boolean", "date"]).optional(),
7634
- groupable: boolean2().optional(),
7635
- filterable: boolean2().optional(),
7636
- description: localizableStringSchema.optional(),
7637
- icon: string2().optional(),
7638
- hidden: boolean2().optional(),
7639
- stat: columnStatSchema.optional(),
7640
- renderer: columnRendererSchema.optional()
7641
- });
7642
- var dataTableRendererSettingsSchema = object({
7643
- grouping: string2(),
7644
- rowNumbers: boolean2(),
7645
- wrapRows: boolean2(),
7646
- showStats: boolean2(),
7647
- hiddenColumns: array(string2()),
7648
- columnOrder: array(string2())
7649
- });
7650
- var dataTableRendererSavedViewSchema = object({
7651
- id: string2(),
7652
- title: localizableStringSchema,
7653
- settings: dataTableRendererSettingsSchema.partial().optional(),
7654
- filter: viewFilterGroupSchema.optional(),
7655
- sorts: viewSortsSchema.optional()
7656
- });
7657
- var rowActionSchema = object({
7658
- id: string2(),
7659
- label: localizableStringSchema,
7660
- icon: string2().optional(),
7661
- destructive: boolean2().optional(),
7662
- commandId: string2()
7663
- });
7664
- var selectionActionSchema = object({
7665
- id: string2(),
7666
- label: localizableStringSchema,
7667
- icon: string2().optional(),
7668
- destructive: boolean2().optional(),
7669
- commandId: string2()
7670
- });
7671
- var extensionDataTableRendererRecordSchema = extensionRendererRecordBaseSchema.extend({
7672
- toolbarActions: array(viewToolbarActionRecordSchema).optional(),
7673
- columns: array(dataTableRendererColumnSchema).optional(),
7674
- queryHandlerId: string2(),
7675
- selectionMode: _enum(["none", "multiple"]).optional(),
7676
- selectionActions: array(selectionActionSchema).optional(),
7677
- rowActions: array(rowActionSchema).optional(),
7678
- rowActivationHandlerId: string2().optional(),
7679
- initialPageSize: number2().int().positive().optional(),
7680
- pageSizeOptions: array(number2().int().positive()).optional(),
7681
- defaultSettings: dataTableRendererSettingsSchema.partial().optional(),
7682
- defaultFilter: viewFilterGroupSchema.optional(),
7683
- defaultSorts: viewSortsSchema.optional(),
7684
- defaultViews: array(dataTableRendererSavedViewSchema).optional(),
7685
- defaultActiveViewId: string2().optional()
7686
- });
7687
-
7688
- // ../pstdio-api-contracts/src/extensions/kanban-renderer.ts
7689
- var kanbanRendererEnumOptionSchema = object({
7690
- value: string2(),
7691
- label: localizableStringSchema,
7692
- color: string2().optional(),
7693
- icon: string2().nullable().optional()
7694
- });
7695
- var kanbanRendererAttributeTypeSchema = discriminatedUnion("kind", [
7696
- object({ kind: literal("enum"), options: array(kanbanRendererEnumOptionSchema) }),
7697
- object({ kind: literal("enum-multi"), options: array(kanbanRendererEnumOptionSchema) }),
7698
- object({ kind: literal("boolean"), legacyValues: record(string2(), boolean2()).optional() }),
7699
- object({ kind: literal("string") }),
7700
- object({ kind: literal("date") }),
7701
- object({ kind: literal("number") }),
7702
- object({ kind: literal("user") })
7703
- ]);
7704
- var kanbanRendererAttributeDisplaySchema = union([
7705
- object({ kind: literal("badge-list"), itemsAttributeId: string2() }),
7706
- object({ kind: string2() }).passthrough().refine((display) => display.kind !== "badge-list")
7707
- ]);
7708
- var kanbanRendererAttributeSchema = object({
7709
- id: string2(),
7710
- label: localizableStringSchema,
7711
- type: kanbanRendererAttributeTypeSchema,
7712
- filterable: boolean2().optional(),
7713
- groupable: boolean2().optional(),
7714
- sortable: boolean2().optional(),
7715
- displayable: boolean2().optional(),
7716
- editable: boolean2().optional(),
7717
- display: kanbanRendererAttributeDisplaySchema.optional()
7718
- });
7719
- var kanbanViewSettingsSchema = object({
7720
- viewMode: _enum(["board", "list"]),
7721
- columnGrouping: string2(),
7722
- rowGrouping: string2(),
7723
- displayProperties: array(string2())
7724
- });
7725
- var kanbanRendererSavedViewSchema = object({
7726
- id: string2(),
7727
- title: localizableStringSchema,
7728
- settings: kanbanViewSettingsSchema,
7729
- filter: viewFilterGroupSchema,
7730
- sorts: viewSortsSchema
7731
- });
7732
- var extensionKanbanRendererCreateRowSchema = object({
7733
- commandId: string2(),
7734
- title: localizableStringSchema.optional(),
7735
- submitLabel: localizableStringSchema.optional(),
7736
- columnParam: string2().optional(),
7737
- params: extensionParamObjectSchema.optional(),
7738
- attributesParam: string2().optional(),
7739
- attachments: object({
7740
- commandId: string2(),
7741
- resourceParam: string2(),
7742
- fileParam: string2()
7743
- }).optional(),
7744
- labels: object({
7745
- cancel: localizableStringSchema.optional(),
7746
- properties: localizableStringSchema.optional(),
7747
- submitError: localizableStringSchema.optional(),
7748
- removeFile: localizableStringSchema.optional()
7749
- }).optional()
7750
- });
7751
- var extensionKanbanRendererRowActionSchema = object({
7752
- id: string2(),
7753
- label: localizableStringSchema,
7754
- icon: string2().optional(),
7755
- commandId: string2(),
7756
- destructive: boolean2().optional()
7757
- });
7758
- var extensionKanbanRendererRecordSchema = extensionRendererRecordBaseSchema.extend({
7759
- toolbarActions: array(viewToolbarActionRecordSchema).optional(),
7760
- extensionInstanceId: string2().optional(),
7761
- attributes: array(kanbanRendererAttributeSchema).optional(),
7762
- queryHandlerId: string2(),
7763
- attributeChangeHandlerId: string2().optional(),
7764
- moveHandlerId: string2().optional(),
7765
- schemaRefreshEventIds: array(string2()).optional(),
7766
- columnActionHandlerId: string2().optional(),
7767
- createRow: extensionKanbanRendererCreateRowSchema.optional(),
7768
- rowActions: array(extensionKanbanRendererRowActionSchema).optional(),
7769
- rowActivationHandlerId: string2().optional(),
7770
- defaultSettings: kanbanViewSettingsSchema.partial().optional(),
7771
- defaultFilter: viewFilterGroupSchema.optional(),
7772
- defaultSorts: viewSortsSchema.optional(),
7773
- defaultViews: array(kanbanRendererSavedViewSchema).optional(),
7774
- defaultActiveViewId: string2().optional(),
7775
- hideToolbar: boolean2().optional()
7776
- });
7777
- var extensionCommandPaletteResourceRecordSchema = object({
7778
- id: string2(),
7779
- extensionId: string2(),
7780
- title: localizableStringSchema,
7781
- resourceKind: string2().optional(),
7782
- queryHandlerId: string2(),
7783
- refreshEventIds: array(string2().min(1)).optional()
7784
- });
7785
-
7786
- // ../pstdio-api-contracts/src/extensions/keybindings.ts
7787
- var parsedKeybindingChordSchema = object({
7788
- key: string2(),
7789
- ctrl: boolean2(),
7790
- shift: boolean2(),
7791
- alt: boolean2(),
7792
- meta: boolean2(),
7793
- modifiers: array(string2())
7794
- });
7795
- var extensionKeybindingRecordSchema = object({
7796
- id: string2(),
7797
- extensionId: string2(),
7798
- action: navigationTargetSchema,
7799
- key: string2(),
7800
- canonicalChord: string2(),
7801
- parsed: parsedKeybindingChordSchema,
7802
- platformOverrides: object({
7803
- mac: string2().optional(),
7804
- linux: string2().optional(),
7805
- win: string2().optional()
7806
- }).optional(),
7807
- when: extensionWhenExpressionSchema.optional()
7808
- });
7809
-
7810
- // ../pstdio-api-contracts/src/extensions/placement-metadata.ts
7811
- var workbenchPlacementPresentationSchema = object({
7812
- mountStrategy: _enum(["active", "keep-mounted"]).optional(),
7813
- hiddenByDefault: boolean2().optional(),
7814
- headerBorderBottom: boolean2().optional(),
7815
- tab: object({
7816
- queryHandlerId: string2(),
7817
- refreshEventIds: array(string2()).optional()
7818
- }).optional()
7819
- });
7820
- var placementPresenceSchema = _enum(["fixed", "open", "closed"]);
7821
- var regionSizeSchema = object({
7822
- defaultPx: number2().optional(),
7823
- minPx: number2().optional(),
7824
- maxPx: number2().optional()
7825
- });
7826
- var regionSettingsSchema = object({
7827
- showHeader: boolean2().optional(),
7828
- size: regionSizeSchema.optional(),
7829
- collapsible: boolean2().optional(),
7830
- alwaysShowTabs: boolean2().optional()
7831
- });
7832
-
7833
- // ../pstdio-api-contracts/src/extensions/resource-binding-metadata.ts
7834
- var resourceConstraintSchema = object({ kinds: array(resourceKindRefSchema).min(1) }).strict();
7835
- var resourceBindingSchema = resourceConstraintSchema.extend({
7836
- view: viewRefSchema,
7837
- cardinality: _enum(["one", "many"]),
7838
- add: navigationTargetSchema.optional()
7839
- });
7840
- var placementItemSchema = discriminatedUnion("kind", [
7841
- object({ kind: literal("view"), view: viewRefSchema, presence: placementPresenceSchema }).strict(),
7842
- object({ kind: literal("binding"), binding: resourceBindingSchema }).strict()
7843
- ]);
7844
-
7845
- // ../pstdio-api-contracts/src/extensions/page-metadata.ts
7846
- var mainSchema = discriminatedUnion("kind", [
7847
- workbenchPlacementPresentationSchema.extend({
7848
- kind: literal("view"),
7849
- view: viewRefSchema,
7850
- cardinality: _enum(["one", "many"])
7851
- }).strict(),
7852
- object({ kind: literal("panels"), empty: viewRefSchema }).strict()
7853
- ]);
7854
- var slotSchema = workbenchPlacementPresentationSchema.extend({
7855
- id: string2(),
7856
- region: _enum(["main", "secondary", "side"]),
7857
- order: number2().optional(),
7858
- item: placementItemSchema,
7859
- openOn: literal("page-resource").optional()
7860
- }).strict();
7861
- var workbenchExtensionPageRecordSchema = object({
7862
- id: string2(),
7863
- localId: string2(),
7864
- extensionId: string2(),
7865
- title: localizableStringSchema,
7866
- icon: string2().optional(),
7867
- path: string2(),
7868
- params: pageParamDefinitionsSchema.optional(),
7869
- document: object({ metadataKey: string2().refine((key) => key.trim().length > 0) }).optional(),
7870
- mode: modeRefSchema,
7871
- parent: pageRefSchema.optional(),
7872
- resource: resourceConstraintSchema.optional(),
7873
- main: mainSchema,
7874
- slots: array(slotSchema)
7875
- });
7876
-
7877
- // ../pstdio-api-contracts/src/extensions/settings.ts
7878
- var extensionSettingsPanelRecordSchema = object({
7879
- id: string2(),
7880
- extensionId: string2(),
7881
- extensionInstanceId: string2().optional(),
7882
- installedExtensionId: string2().optional(),
7883
- installName: string2().optional(),
7884
- slotId: string2(),
7885
- target: workbenchSettingsTargetSchema.optional(),
7886
- scope: workbenchSettingsScopeSchema.optional(),
7887
- title: localizableStringSchema,
7888
- icon: string2().optional(),
7889
- section: string2().optional(),
7890
- webview: extensionWebviewContributionSchema
7891
- });
7892
- var extensionSettingOptionSourceSchema = object({
7893
- commandId: string2(),
7894
- valueField: string2(),
7895
- labelField: string2(),
7896
- params: record(string2(), unknown()).optional()
7897
- });
7898
- var extensionSettingDefinitionRecordSchema = object({
7899
- key: string2(),
7900
- extensionId: string2(),
7901
- type: extensionSettingValueTypeSchema,
7902
- scope: extensionSettingScopeSchema,
7903
- default: unknown().optional(),
7904
- enum: array(unknown()).optional(),
7905
- options: extensionSettingOptionSourceSchema.optional(),
7906
- title: localizableStringSchema.optional(),
7907
- description: localizableStringSchema.optional()
7908
- });
7909
- var extensionSettingValueRecordSchema = extensionSettingDefinitionRecordSchema.extend({
7910
- value: unknown().optional(),
7911
- source: extensionSettingSourceSchema
7912
- });
7913
- var listExtensionSettingsResponseSchema = object({
7914
- settings: array(extensionSettingValueRecordSchema)
7915
- });
7916
- var updateExtensionSettingRequestSchema = object({
7917
- value: unknown()
7918
- });
7919
- var workbenchExtensionSettingsPanelRecordSchema = extensionSettingsPanelRecordSchema.extend({
7920
- webview: workbenchExtensionWebviewSchema
7921
- });
7922
- var extensionSettingsSectionRecordSchema = object({
7923
- id: string2(),
7924
- extensionId: string2(),
7925
- title: localizableStringSchema,
7926
- scope: workbenchSettingsScopeSchema.optional(),
7927
- order: number2().optional()
7928
- });
7929
-
7930
- // ../pstdio-api-contracts/src/extensions/workbench-metadata.ts
7931
- var contributionRefSchema2 = (kind) => object({ extensionId: string2(), kind: literal(kind), id: string2() });
7932
- var commandRefSchema = contributionRefSchema2("command");
7933
- var modeRefSchema2 = contributionRefSchema2("mode");
7934
- var pageRefSchema2 = contributionRefSchema2("page");
7935
- var resourceKindRefSchema2 = contributionRefSchema2("resource-kind");
7936
- var settingsSectionRefSchema = contributionRefSchema2("settings-section");
7937
- var viewRefSchema2 = contributionRefSchema2("view");
7938
- var normalizedWhenSchema = object({
7939
- mode: union([modeRefSchema2, array(modeRefSchema2)]).optional(),
7940
- source: array(_enum(["cli", "dashboard", "api", "schedule", "event", "automation", "command-panel"])).optional(),
7941
- view: union([viewRefSchema2, array(viewRefSchema2)]).optional(),
7942
- resourceType: array(resourceKindRefSchema2).optional(),
7943
- metadata: jsonObjectSchema.optional()
7944
- });
7945
- var rendererBaseOmissions = {
7946
- id: true,
7947
- extensionId: true,
7948
- title: true,
7949
- icon: true
7950
- };
7951
- var commandActionSchema = object({
7952
- id: string2(),
7953
- label: localizableStringSchema,
7954
- icon: string2().optional(),
7955
- destructive: boolean2().optional(),
7956
- command: commandRefSchema
7957
- });
7958
- var kanbanCreateRowSchema = object({
7959
- command: commandRefSchema,
7960
- title: localizableStringSchema.optional(),
7961
- submitLabel: localizableStringSchema.optional(),
7962
- columnParam: string2().optional(),
7963
- params: record(string2(), unknown()).optional(),
7964
- attributesParam: string2().optional(),
7965
- attachments: object({ command: commandRefSchema, resourceParam: string2(), fileParam: string2() }).optional(),
7966
- labels: object({
7967
- cancel: localizableStringSchema.optional(),
7968
- properties: localizableStringSchema.optional(),
7969
- submitError: localizableStringSchema.optional(),
7970
- removeFile: localizableStringSchema.optional()
7971
- }).optional()
7972
- });
7973
- var webviewBodySchema = object({ kind: literal("webview"), webview: workbenchExtensionWebviewSchema });
7974
- var treeBodySchema = extensionTreeRendererRecordSchema.omit(rendererBaseOmissions).extend({ kind: literal("tree") });
7975
- var fileBodySchema = extensionFileRendererRecordSchema.omit(rendererBaseOmissions).extend({ kind: literal("file") });
7976
- var controlsBodySchema = extensionControlsRendererRecordSchema.omit(rendererBaseOmissions).extend({ kind: literal("controls") });
7977
- var kanbanBodySchema = extensionKanbanRendererRecordSchema.omit({ ...rendererBaseOmissions, createRow: true, rowActions: true, toolbarActions: true }).extend({
7978
- kind: literal("kanban"),
7979
- createRow: kanbanCreateRowSchema.optional(),
7980
- rowActions: array(commandActionSchema).optional(),
7981
- toolbarActions: array(viewToolbarActionSchema.extend({ command: commandRefSchema })).optional()
7982
- });
7983
- var dataTableBodySchema = extensionDataTableRendererRecordSchema.omit({ ...rendererBaseOmissions, selectionActions: true, rowActions: true, toolbarActions: true }).extend({
7984
- kind: literal("dataTable"),
7985
- selectionActions: array(commandActionSchema).optional(),
7986
- rowActions: array(commandActionSchema).optional(),
7987
- toolbarActions: array(viewToolbarActionSchema.extend({ command: commandRefSchema })).optional()
7988
- });
7989
- var workbenchExtensionViewBodySchema = discriminatedUnion("kind", [
7990
- webviewBodySchema,
7991
- treeBodySchema,
7992
- fileBodySchema,
7993
- controlsBodySchema,
7994
- kanbanBodySchema,
7995
- dataTableBodySchema
7996
- ]);
7997
- var workbenchExtensionViewRecordSchema = object({
7998
- id: string2(),
7999
- localId: string2(),
8000
- extensionId: string2(),
8001
- title: localizableStringSchema,
8002
- icon: string2().optional(),
8003
- body: workbenchExtensionViewBodySchema
8004
- });
8005
- var workbenchExtensionModeRecordSchema = object({
8006
- id: string2(),
8007
- localId: string2(),
8008
- extensionId: string2(),
8009
- label: localizableStringSchema,
8010
- icon: string2().optional(),
8011
- regions: array(_enum(extensionPanelRegions)),
8012
- floatingPanels: _enum(["visible", "hidden"]).optional(),
8013
- regionSettings: partialRecord(_enum(dockedWorkbenchRegions), regionSettingsSchema).optional(),
8014
- defaultTheme: contributionRefSchema2("theme").optional(),
8015
- chrome: partialRecord(_enum(["nav", "sidenav", "activity", "status"]), union([viewRefSchema2, literal(false)])).optional()
8016
- });
8017
- var workbenchExtensionPlacementRecordSchema = workbenchPlacementPresentationSchema.extend({
8018
- id: string2(),
8019
- localId: string2(),
8020
- extensionId: string2(),
8021
- mode: modeRefSchema2,
8022
- item: placementItemSchema,
8023
- region: _enum(extensionPanelRegions),
8024
- order: number2().optional(),
8025
- movableTo: array(_enum(extensionPanelRegions)).optional()
8026
- });
8027
- var workbenchExtensionViewMenuRecordSchema = object({
8028
- id: string2(),
8029
- extensionId: string2(),
8030
- owner: viewRefSchema2,
8031
- view: viewRefSchema2,
8032
- side: _enum(["left", "right"]),
8033
- group: string2().optional(),
8034
- placement: _enum(["first", "default", "last"]).optional(),
8035
- hostTreeHeader: _enum(["default", "none"]).optional(),
8036
- hostTreeFooter: _enum(["default", "none"]).optional()
8037
- });
8038
- var workbenchExtensionNavigationItemRecordSchema = object({
8039
- id: string2(),
8040
- extensionId: string2(),
8041
- owner: union([modeRefSchema2, pageRefSchema2]),
8042
- slot: _enum(["header", "content", "footer"]),
8043
- label: localizableStringSchema,
8044
- icon: string2().optional(),
8045
- group: string2().optional(),
8046
- when: normalizedWhenSchema.optional(),
8047
- action: navigationTargetSchema
8048
- });
8049
- var workbenchExtensionNavigationTreeRecordSchema = object({
8050
- id: string2(),
8051
- extensionId: string2(),
8052
- owner: union([modeRefSchema2, pageRefSchema2]),
8053
- slot: _enum(["header", "content", "footer"]),
8054
- view: viewRefSchema2,
8055
- resourceScope: _enum(["project", "selection"]).optional()
8056
- });
8057
- var workbenchExtensionResourceKindRecordSchema = object({
8058
- id: string2(),
8059
- localId: string2(),
8060
- extensionId: string2(),
8061
- label: localizableStringSchema.optional(),
8062
- icon: string2().optional(),
8063
- resolveCommand: string2().optional(),
8064
- resolveManyCommand: string2().optional(),
8065
- relatedOpeningsCommand: string2().optional(),
8066
- paths: array(object({ prefix: string2(), resolveCommand: string2() })).optional(),
8067
- menuSlots: array(object({
8068
- id: string2(),
8069
- placement: _enum(["header-primary", "header-overflow", "context-menu"]),
8070
- label: localizableStringSchema.optional(),
8071
- access: _enum(["owner", "public"]),
8072
- order: number2().optional()
8073
- })).optional()
8074
- });
8075
- var workbenchExtensionSettingsPanelRecordSchema2 = object({
8076
- id: string2(),
8077
- extensionId: string2(),
8078
- view: viewRefSchema2,
8079
- slot: object({ id: string2() }),
8080
- section: settingsSectionRefSchema.optional()
8081
- });
8082
- var workbenchExtensionStatusBarItemRecordSchema = object({
8083
- id: string2(),
8084
- extensionId: string2(),
8085
- view: viewRefSchema2,
8086
- slot: object({ id: string2() }),
8087
- order: number2().optional(),
8088
- when: normalizedWhenSchema.optional()
8089
- });
8090
- var workbenchExtensionMetadataSchema = object({
8091
- extensions: array(extensionRecordSchema),
8092
- commands: array(extensionCommandRecordSchema),
8093
- menuContributions: array(extensionMenuContributionSchema),
8094
- commandPaletteContributions: array(extensionCommandPaletteContributionSchema).optional(),
8095
- modes: array(workbenchExtensionModeRecordSchema),
8096
- pages: array(workbenchExtensionPageRecordSchema),
8097
- views: array(workbenchExtensionViewRecordSchema),
8098
- viewMenus: array(workbenchExtensionViewMenuRecordSchema),
8099
- placements: array(workbenchExtensionPlacementRecordSchema),
8100
- resourceKinds: array(workbenchExtensionResourceKindRecordSchema),
8101
- resourceHierarchyProviders: array(object({ id: string2(), extensionId: string2(), resourceKind: resourceKindRefSchema2 })).optional(),
8102
- navigationItems: array(workbenchExtensionNavigationItemRecordSchema),
8103
- navigationTrees: array(workbenchExtensionNavigationTreeRecordSchema),
8104
- statusBarItems: array(workbenchExtensionStatusBarItemRecordSchema),
8105
- activityItems: array(object({
8106
- id: string2(),
8107
- extensionId: string2(),
8108
- title: localizableStringSchema,
8109
- icon: string2(),
8110
- modes: array(modeRefSchema2),
8111
- placement: _enum(["first", "default", "last"]).optional(),
8112
- command: commandRefSchema,
8113
- params: jsonObjectSchema.optional()
8114
- })).optional(),
8115
- settingsSections: array(extensionSettingsSectionRecordSchema).optional(),
8116
- settingsPanels: array(workbenchExtensionSettingsPanelRecordSchema2),
8117
- commandPaletteResources: array(extensionCommandPaletteResourceRecordSchema).optional(),
8118
- keybindings: array(extensionKeybindingRecordSchema).optional(),
8119
- settingsDefinitions: array(extensionSettingDefinitionRecordSchema).optional(),
8120
- automations: array(workbenchExtensionAutomationRecordSchema).optional(),
8121
- connections: array(workbenchExtensionConnectionRecordSchema).optional(),
8122
- harnesses: array(object({
8123
- id: string2(),
8124
- localId: string2(),
8125
- extensionId: string2(),
8126
- label: localizableStringSchema.optional()
8127
- })).optional(),
8128
- skills: array(object({
8129
- id: string2(),
8130
- localId: string2(),
8131
- extensionId: string2(),
8132
- title: localizableStringSchema.optional()
8133
- })).optional(),
8134
- templates: array(object({
8135
- id: string2(),
8136
- localId: string2(),
8137
- extensionId: string2(),
8138
- title: localizableStringSchema.optional()
8139
- })).optional(),
8140
- templateTypes: array(object({
8141
- id: string2(),
8142
- localId: string2(),
8143
- extensionId: string2(),
8144
- label: localizableStringSchema,
8145
- description: localizableStringSchema.optional(),
8146
- order: number2().optional(),
8147
- commands: object({ list: string2(), read: string2(), save: string2(), delete: string2() }).optional()
8148
- })).optional(),
8149
- themes: array(object({
8150
- id: string2(),
8151
- localId: string2(),
8152
- extensionId: string2(),
8153
- title: localizableStringSchema.optional()
8154
- })).optional(),
8155
- diagnostics: array(extensionDiagnosticSchema)
8156
- });
8157
-
8158
- // ../pstdio-api-contracts/src/extensions/check.ts
8159
- var extensionViewLikeSchema = object({
8160
- id: string2(),
8161
- extensionId: string2()
8162
- });
8163
- var checkWorkbenchMetadataSchema = workbenchExtensionMetadataSchema.pick({
8164
- extensions: true,
8165
- commands: true,
8166
- menuContributions: true,
8167
- commandPaletteContributions: true,
8168
- modes: true,
8169
- pages: true,
8170
- views: true,
8171
- viewMenus: true,
8172
- placements: true,
8173
- resourceKinds: true,
8174
- resourceHierarchyProviders: true,
8175
- navigationItems: true,
8176
- navigationTrees: true,
8177
- statusBarItems: true,
8178
- activityItems: true,
8179
- settingsSections: true,
8180
- settingsPanels: true,
8181
- commandPaletteResources: true,
8182
- keybindings: true,
8183
- settingsDefinitions: true,
8184
- diagnostics: true
8185
- });
8186
- var extensionsCheckResponseSchema = checkWorkbenchMetadataSchema.extend({
8187
- extensionsRoot: string2(),
8188
- extensionsRootExists: boolean2(),
8189
- errorCount: number2().int().nonnegative(),
8190
- warningCount: number2().int().nonnegative(),
8191
- middlewares: array(extensionMiddlewareRecordSchema),
8192
- hooks: array(extensionHookRecordSchema),
8193
- schedules: array(extensionScheduleRecordSchema),
8194
- artifactMounts: array(extensionArtifactMountSchema),
8195
- themes: array(extensionThemeRecordSchema),
8196
- fileIconThemes: array(extensionFileIconThemeRecordSchema),
8197
- templates: array(extensionViewLikeSchema),
8198
- skills: array(extensionViewLikeSchema),
8199
- hostCompatibility: extensionHostCompatibilitySchema
8200
- });
8201
- var listExtensionCommandsResponseSchema = object({
8202
- commands: workbenchExtensionMetadataSchema.shape.commands,
8203
- translations: array(extensionTranslationRecordSchema).optional(),
8204
- diagnostics: workbenchExtensionMetadataSchema.shape.diagnostics
8205
- });
8206
- var listExtensionAppearanceResponseSchema = object({
8207
- themes: array(extensionThemeRecordSchema),
8208
- fileIconThemes: array(extensionFileIconThemeRecordSchema),
8209
- translations: array(extensionTranslationRecordSchema),
8210
- diagnostics: workbenchExtensionMetadataSchema.shape.diagnostics
8211
- });
8212
- // ../pstdio-api-contracts/src/extension-kernel/types/data-table-renderer.ts
8213
- var DEFAULT_DATA_TABLE_SETTINGS = {
8214
- grouping: "none",
8215
- rowNumbers: true,
8216
- wrapRows: false,
8217
- showStats: true,
8218
- hiddenColumns: [],
8219
- columnOrder: []
8220
- };
8221
- // ../pstdio-api-contracts/src/extensions/install.ts
8222
- var enableInstalledExtensionRequestSchema = object({
8223
- displayName: string2(),
8224
- extensionId: string2(),
8225
- manifest: jsonObjectSchema,
8226
- name: string2(),
8227
- sourceHash: string2().nullable().optional(),
8228
- sourceKind: _enum(["local_path", "git", "registry"]),
8229
- sourcePath: string2(),
8230
- sourceRef: string2().nullable().optional(),
8231
- version: string2().nullable().optional()
8232
- });
8233
- var enableInstalledExtensionResponseSchema = object({
8234
- enabled: literal(true),
8235
- installName: string2(),
8236
- installedExtensionId: string2(),
8237
- instanceId: string2(),
8238
- name: string2(),
8239
- projectId: string2()
8240
- });
8241
- var projectExtensionInstanceSchema = object({
8242
- id: string2(),
8243
- projectId: string2(),
8244
- extensionId: string2(),
8245
- installedExtensionId: string2(),
8246
- installName: string2(),
8247
- name: string2(),
8248
- displayName: string2(),
8249
- version: string2().nullable().optional(),
8250
- description: string2().optional(),
8251
- sourcePath: string2(),
8252
- scope: _enum(["repo", "global"]),
8253
- status: _enum(["pending", "loaded", "error", "missing", "disabled"]),
8254
- lastLoadedAt: string2().nullable().optional(),
8255
- lastError: jsonObjectSchema.nullable().optional(),
8256
- enabled: boolean2(),
8257
- config: record(string2(), unknown()),
8258
- canUpgrade: boolean2(),
8259
- updateAvailable: boolean2()
8260
- });
8261
- var marketplaceExtensionSchema = object({
8262
- installName: string2(),
8263
- displayName: string2(),
8264
- description: string2(),
8265
- installed: boolean2(),
8266
- origin: object({
8267
- kind: literal("git"),
8268
- url: string2(),
8269
- path: string2(),
8270
- ref: string2()
8271
- }),
8272
- publisher: string2().optional()
8273
- });
8274
- var listProjectExtensionsResponseSchema = object({
8275
- extensions: array(projectExtensionInstanceSchema),
8276
- marketplace: array(marketplaceExtensionSchema)
8277
- });
8278
- var setProjectExtensionEnabledRequestSchema = object({
8279
- enabled: boolean2()
8280
- });
8281
- var setExtensionAutomationEnabledRequestSchema = object({
8282
- enabled: boolean2()
8283
- });
8284
- var upgradeProjectExtensionResponseSchema = object({
8285
- changed: boolean2(),
8286
- extension: projectExtensionInstanceSchema
8287
- });
8288
- var installMarketplaceExtensionResponseSchema = object({
8289
- extension: projectExtensionInstanceSchema
8290
- });
8291
- var addLocalExtensionFolderRequestSchema = object({
8292
- name: string2().min(1),
8293
- files: preprocess((value) => Array.isArray(value) ? value : [value], array(_instanceof(File).meta({ type: "string", format: "binary" })).min(1))
8294
- });
8295
- var addLocalExtensionFolderResponseSchema = object({
8296
- extension: projectExtensionInstanceSchema
8297
- });
8298
- var setupProjectExtensionResponseSchema = object({
8299
- extensionId: string2(),
8300
- name: string2(),
8301
- installName: string2(),
8302
- installedSkills: array(object({
8303
- id: string2(),
8304
- extensionId: string2(),
8305
- skillKey: string2(),
8306
- installedAgents: array(string2())
8307
- }))
8308
- });
8309
- // ../pstdio-api-contracts/src/extensions/installation.ts
8310
- var installNameSchema = string2().min(1).refine((name) => name !== "." && name !== ".." && !/[\\/:]/.test(name) && name.trim().length > 0, "Install name must be one folder name.");
8311
- var installExtensionRequestSchema = object({
8312
- source: discriminatedUnion("kind", [
8313
- object({ kind: literal("catalog"), name: string2().min(1), ref: string2().min(1).optional() }).strict(),
8314
- object({ kind: literal("project-folder"), path: string2().min(1), development: boolean2().optional() }).strict()
8315
- ]),
8316
- installName: installNameSchema.optional(),
8317
- force: boolean2().optional(),
8318
- skipInstall: boolean2().optional()
8319
- }).strict();
8320
- var formBoolean = _enum(["true", "false"]).optional().transform((value) => value === "true");
8321
- var uploadExtensionRequestSchema = object({
8322
- kind: literal("upload"),
8323
- installName: installNameSchema.optional(),
8324
- folderName: installNameSchema,
8325
- files: preprocess((value) => Array.isArray(value) ? value : [value], array(_instanceof(File).meta({ type: "string", format: "binary" })).min(1)),
8326
- force: formBoolean,
8327
- skipInstall: formBoolean,
8328
- development: formBoolean
8329
- }).strict();
8330
- var installedExtensionSourceSchema = object({
8331
- check: extensionsCheckResponseSchema,
8332
- installName: string2(),
8333
- manifest: record(string2(), unknown()),
8334
- metadata: object({
8335
- id: string2(),
8336
- name: string2(),
8337
- displayName: string2(),
8338
- version: string2(),
8339
- description: string2().optional(),
8340
- enginesPstdio: string2()
8341
- }),
8342
- source: discriminatedUnion("kind", [
8343
- object({ kind: literal("local"), path: string2(), ref: string2().optional() }),
8344
- object({ kind: literal("named"), name: string2(), ref: string2() })
8345
- ]),
8346
- sourceHash: string2(),
8347
- targetPath: string2()
8348
- });
8349
- var installExtensionResponseSchema = object({
8350
- source: installedExtensionSourceSchema,
8351
- extension: projectExtensionInstanceSchema
8352
- });
8353
- var extensionDiagnosticsResponseSchema = object({
8354
- roots: array(object({
8355
- scope: _enum(["repo", "user"]),
8356
- path: string2(),
8357
- check: extensionsCheckResponseSchema
8358
- }))
8359
- });
8360
- // ../pstdio-api-contracts/src/extensions/related-resource-opening.ts
8361
- var relatedResourceOpeningSchema = object({
8362
- resource: extensionResourceRefSchema,
8363
- autoOpen: boolean2().optional(),
8364
- region: _enum(extensionPanelRegions),
8365
- open: _enum(["preview", "pin"]).optional()
8366
- });
8367
- // ../pstdio-api-contracts/src/automation.ts
8368
- var automationRunStatusSchema = _enum(["queued", "running", "succeeded", "failed", "cancelled", "rejected"]);
8369
- var issueAutomationTokenInputSchema = object({
8370
- name: string2().trim().min(1).max(120),
8371
- projectId: string2().min(1),
8372
- principalId: string2().uuid().optional(),
8373
- commandScopes: array(string2().min(1)).min(1),
8374
- expiresInSeconds: number2().int().positive().max(365 * 24 * 60 * 60)
8375
- }).strict();
8376
- var automationTokenRecordSchema = object({
8377
- id: string2(),
8378
- principalId: string2(),
8379
- name: string2(),
8380
- tokenPrefix: string2(),
8381
- projectId: string2(),
8382
- commandScopes: array(string2()),
8383
- expiresAt: string2(),
8384
- lastUsedAt: string2().nullable(),
8385
- revokedAt: string2().nullable(),
8386
- createdAt: string2()
8387
- });
8388
- var issueAutomationTokenResponseSchema = automationTokenRecordSchema.extend({ token: string2() });
8389
- var listAutomationTokensResponseSchema = object({ tokens: array(automationTokenRecordSchema) });
8390
- var createAutomationRunInputSchema = object({
8391
- commandId: string2().min(1),
8392
- input: object({
8393
- workspaceId: string2().optional(),
8394
- params: jsonObjectSchema.optional(),
8395
- resource: extensionResourceRefSchema.optional(),
8396
- metadata: jsonObjectSchema.optional()
8397
- }).strict()
8398
- }).strict();
8399
- var automationRunErrorSchema = object({
8400
- code: string2(),
8401
- message: string2(),
8402
- retryable: boolean2()
8403
- });
8404
- var automationRunSchema = object({
8405
- id: string2(),
8406
- projectId: string2(),
8407
- commandId: string2(),
8408
- status: automationRunStatusSchema,
8409
- createdAt: string2(),
8410
- startedAt: string2().nullable(),
8411
- finishedAt: string2().nullable(),
8412
- result: unknown().nullable(),
8413
- error: automationRunErrorSchema.nullable()
8414
- });
8415
- var automationRunEventSchema = object({
8416
- cursor: number2().int().nonnegative(),
8417
- runId: string2(),
8418
- type: string2(),
8419
- payload: jsonObjectSchema,
8420
- createdAt: string2()
8421
- });
8422
- var listAutomationRunEventsResponseSchema = object({ events: array(automationRunEventSchema) });
8423
- // ../pstdio-api-contracts/src/board-views.ts
8424
- var boardFieldSchema = object({
8425
- id: string2(),
8426
- label: string2(),
8427
- kind: _enum(["enum", "enum-multi", "status", "string", "date", "number", "boolean", "user"]),
8428
- conditions: array(viewFilterConditionSchema),
8429
- filterable: boolean2(),
8430
- groupable: boolean2(),
8431
- sortable: boolean2(),
8432
- displayable: boolean2(),
8433
- legacyValues: record(string2(), boolean2()).optional(),
8434
- options: array(object({ value: string2(), label: string2() })).optional()
8435
- });
8436
- var boardSummarySchema = object({
8437
- id: string2(),
8438
- title: string2(),
8439
- kind: _enum(["kanban", "dataTable"]),
8440
- extensionId: string2().nullable(),
8441
- fields: array(boardFieldSchema)
8442
- });
8443
- var boardViewSettingsSchema = union([kanbanViewSettingsSchema, dataTableRendererSettingsSchema]);
8444
- var boardViewSchema = object({
8445
- id: string2(),
8446
- boardId: string2(),
8447
- title: string2(),
8448
- settings: boardViewSettingsSchema,
8449
- filter: viewFilterGroupSchema,
8450
- sorts: viewSortsSchema,
8451
- builtIn: boolean2()
8452
- });
8453
- var boardViewsSchema = object({ views: array(boardViewSchema), defaultViewId: string2() });
8454
- var boardViewUpdateSchema = object({
8455
- title: string2().trim().min(1).optional(),
8456
- settings: union([kanbanViewSettingsSchema.partial().strict(), dataTableRendererSettingsSchema.partial().strict()]).optional(),
8457
- filter: viewFilterGroupSchema.optional(),
8458
- sorts: viewSortsSchema.optional()
8459
- }).strict();
8460
- var boardViewCreateSchema = boardViewUpdateSchema.extend({
8461
- title: string2().trim().min(1),
8462
- copyFrom: string2().optional()
8463
- });
8464
- // ../pstdio-api-contracts/src/data-migration.ts
8465
- var createDataMigrationRunner = (store) => {
8466
- let pending = Promise.resolve();
8467
- return (version, run) => {
8468
- const result = pending.then(async () => {
8469
- if (!Number.isSafeInteger(version) || version < 1)
8470
- throw new Error("Migration version must be a positive safe integer.");
8471
- const previous = await store.readVersion();
8472
- if (!Number.isSafeInteger(previous) || previous < 0)
8473
- throw new Error("Stored migration version is invalid.");
8474
- if (previous > version)
8475
- throw new Error("Stored data has a newer migration version.");
8476
- if (previous === version)
8477
- return;
8478
- await run(previous);
8479
- await store.writeVersion(version);
8480
- });
8481
- pending = result.catch(() => {});
8482
- return result;
8483
- };
8484
- };
8485
- // ../pstdio-api-contracts/src/projects.ts
8486
- var initialWorkspaceSchema = object({
8487
- provider_id: string2().min(1),
8488
- params: serializableJsonObjectSchema.default({})
8489
- });
8490
- var extensionSetupWarningSchema = object({
8491
- code: literal("extension_setup_failed"),
8492
- extension: string2(),
8493
- message: string2()
8494
- });
8495
- var projectSchema = object({
8496
- id: string2(),
8497
- name: string2(),
8498
- shorthand: string2(),
8499
- default_agent_id: string2().nullable(),
8500
- default_agent_model: string2().nullable(),
8501
- startup_script: string2().nullable(),
8502
- created_at: string2(),
8503
- updated_at: string2(),
8504
- deleted_at: string2().nullable(),
8505
- extension_warnings: array(extensionSetupWarningSchema).optional()
8506
- });
8507
- var createProjectInputSchema = object({
8508
- name: string2().trim().min(1).optional(),
8509
- initial_workspace: initialWorkspaceSchema,
8510
- agents: array(string2().min(1)).min(1).optional()
8511
- });
8512
- var updateProjectInputSchema = object({
8513
- name: string2().trim().min(1).optional(),
8514
- default_agent_id: string2().min(1).nullable().optional(),
8515
- default_agent_model: string2().min(1).nullable().optional()
8516
- }).refine((value) => Object.keys(value).length > 0, {
8517
- message: "At least one field must be provided"
8518
- });
8519
- var projectDetailsSchema = object({
8520
- id: string2(),
8521
- name: string2(),
8522
- shorthand: string2(),
8523
- defaultAgentId: string2().nullable(),
8524
- defaultAgentModel: string2().nullable(),
8525
- startupScript: string2().nullable(),
8526
- createdAt: string2(),
8527
- updatedAt: string2(),
8528
- deletedAt: string2().nullable(),
8529
- extensionWarnings: array(extensionSetupWarningSchema).optional()
8530
- });
8531
- var initialWorkspaceRequestSchema = object({
8532
- providerId: string2().min(1),
8533
- params: serializableJsonObjectSchema.default({})
8534
- });
8535
- var projectCreateRequestSchema = createProjectInputSchema.omit({ initial_workspace: true }).extend({ initialWorkspace: initialWorkspaceRequestSchema });
8536
- var projectUpdateRequestSchema = object({
8537
- name: string2().trim().min(1).optional(),
8538
- defaultAgentId: string2().min(1).nullable().optional(),
8539
- defaultAgentModel: string2().min(1).nullable().optional()
8540
- }).strict().refine((value) => Object.keys(value).length > 0, { message: "At least one field must be provided" });
8541
-
8542
- // ../pstdio-api-contracts/src/workspaces.ts
8543
- var workspaceProviderRefShape = {
8544
- version: number2().int().positive(),
8545
- data: jsonObjectSchema
8546
- };
8547
- var workspaceProviderRefSchema = object(workspaceProviderRefShape);
8548
- var workspaceProviderStates = [
8549
- "provisioning",
8550
- "ready",
8551
- "failed",
8552
- "cancelled",
8553
- "archiving",
8554
- "archived",
8555
- "deleting",
8556
- "provider_missing"
8557
- ];
8558
- var workspaceProviderStateSchema = _enum(workspaceProviderStates);
8559
- var workspaceExecutionKindSchema = _enum(["local", "remote"]);
8560
- var workspaceCapabilitiesSchema = object({
8561
- files: _enum(["none", "read", "write"]),
8562
- diff: boolean2(),
8563
- merge: boolean2(),
8564
- rebase: boolean2(),
8565
- delete: boolean2()
8566
- });
8567
- var workspaceProviderErrorSchema = object({
8568
- code: string2(),
8569
- message: string2(),
8570
- retryable: boolean2(),
8571
- occurred_at: string2()
8572
- });
8573
- var extensionWorkspaceFields = {
8574
- projectId: string2(),
8575
- isDefault: boolean2(),
8576
- shorthand: string2(),
8577
- rootPath: string2().nullable(),
8578
- providerId: string2(),
8579
- providerState: workspaceProviderStateSchema,
8580
- executionKind: workspaceExecutionKindSchema,
8581
- displayPath: string2().nullable(),
8582
- capabilities: workspaceCapabilitiesSchema,
8583
- setupError: string2().nullable(),
8584
- createdAt: string2(),
8585
- updatedAt: string2()
8586
- };
8587
- var workspaceAnchorSchema = extensionResourceRefSchema.extend({
8588
- role: _enum(["primary", "context", "source", "result"]).optional()
8589
- });
8590
- var workspaceSchema = object({
8591
- id: string2(),
8592
- project_id: string2(),
8593
- name: string2(),
8594
- branch: string2().nullable(),
8595
- root_path: string2().nullable(),
8596
- provider_id: string2(),
8597
- provider_params_json: jsonObjectSchema,
8598
- provider_ref_json: workspaceProviderRefSchema.nullable(),
8599
- provider_state: workspaceProviderStateSchema,
8600
- execution_kind: workspaceExecutionKindSchema,
8601
- provider_operation_id: string2().nullable(),
8602
- provider_operation_kind: _enum(["create", "cancel", "archive", "delete"]).describe('The "archive" value is deprecated; use "delete". Historical archive operations remain readable until 0.45.').nullable(),
8603
- provider_error_json: workspaceProviderErrorSchema.nullable(),
8604
- provider_capabilities_json: workspaceCapabilitiesSchema,
8605
- display_path: string2().nullable(),
8606
- is_default: boolean2(),
8607
- archived: boolean2(),
8608
- initializing: boolean2(),
8609
- setup_error: string2().nullable(),
8610
- workspace_shorthand: string2(),
8611
- startup_log_file_id: string2().nullable(),
8612
- anchors_json: array(workspaceAnchorSchema),
8613
- created_at: string2(),
8614
- updated_at: string2(),
8615
- deleted_at: string2().nullable()
8616
- });
8617
- var createWorkspaceInputSchema = object({
8618
- project_id: string2().min(1),
8619
- provider_id: string2().min(1),
8620
- params: jsonObjectSchema.optional(),
8621
- anchors: array(workspaceAnchorSchema).optional(),
8622
- shorthand_base: string2().trim().min(1).optional()
8623
- });
8624
- var extensionWorkspaceCreateInputSchema = object({
8625
- projectId: string2().min(1),
8626
- providerId: string2().min(1),
8627
- shorthandBase: string2().trim().min(1).optional(),
8628
- params: jsonObjectSchema.optional(),
8629
- anchors: array(workspaceAnchorSchema).optional()
8630
- });
8631
- var renameWorkspaceInputSchema = object({
8632
- name: string2().trim().min(1, "Workspace name is required").max(120, "Workspace name must be 120 characters or less")
8633
- });
8634
- var removeWorktreeResponseSchema = object({
8635
- removed: boolean2()
8636
- });
8637
- var workspaceFileEntrySchema = object({
8638
- path: string2(),
8639
- name: string2(),
8640
- type: _enum(["file", "directory"]),
8641
- size: number2().int().nonnegative().optional(),
8642
- modified_at: string2().optional()
8643
- });
8644
- var workspaceFilesResponseSchema = object({
8645
- workspace_id: string2(),
8646
- path: string2(),
8647
- entries: array(workspaceFileEntrySchema),
8648
- truncated: boolean2()
8649
- });
8650
- var workspaceFileContentSchema = object({
8651
- workspace_id: string2(),
8652
- path: string2(),
8653
- file_name: string2(),
8654
- mime_type: string2().optional(),
8655
- size: number2().int().nonnegative(),
8656
- encoding: _enum(["utf8", "base64"]),
8657
- content: string2().optional(),
8658
- data_url: string2().optional(),
8659
- editable: boolean2()
8660
- });
8661
- var writeWorkspaceFileInputSchema = object({
8662
- content: string2()
8663
- });
8664
- var moveWorkspaceEntryInputSchema = object({
8665
- destination_path: string2().min(1)
8666
- });
8667
- var listWorkspaceFilesInputSchema = object({
8668
- path: string2().optional(),
8669
- query: string2().optional(),
8670
- limit: number2().int().positive().max(500).optional()
8671
- });
8672
- var workspaceProviderDescriptorSchema = object({
8673
- id: string2(),
8674
- label: localizableStringSchema,
8675
- icon: string2().optional(),
8676
- description: localizableStringSchema.optional(),
8677
- params: extensionParamObjectSchema
8678
- });
8679
- var workspaceEntryMoveInputSchema = object({ destinationPath: string2().min(1) });
8680
-
8681
- // ../pstdio-api-contracts/src/environment.ts
8682
- var bindEnvironmentInputSchema = environmentIdentitySchema.extend({
8683
- name: string2().trim().min(1),
8684
- initial_workspace: initialWorkspaceSchema
8685
- });
8686
- var environmentBindingSchema = environmentIdentitySchema.extend({
8687
- workbenchId: string2().min(1),
8688
- workspace: workspaceSchema
8689
- });
8690
- // ../pstdio-api-contracts/src/extension-kernel/api-versions.ts
8691
- var numericIdentifier = "(?:0|[1-9]\\d*)";
8692
- var caretTerm = new RegExp(`^\\^(${numericIdentifier}\\.${numericIdentifier}\\.${numericIdentifier})$`);
8693
- // ../pstdio-api-contracts/src/extension-kernel/boolean-view-filter.ts
8694
- var normalizeBooleanViewRule = (rule, type) => {
8695
- const mapping = type.kind === "boolean" ? type.legacyValues : undefined;
8696
- if (!mapping || !Array.isArray(rule.value) || rule.value.length === 0)
8697
- return rule;
8698
- if (rule.condition !== "is-any-of" && rule.condition !== "is-none-of")
8699
- return rule;
8700
- if (rule.value.some((value) => !Object.hasOwn(mapping, value)))
8701
- return rule;
8702
- const values = new Set(rule.value.map((value) => mapping[value]));
8703
- if (values.size === 2)
8704
- return { attributeId: rule.attributeId, condition: rule.condition === "is-any-of" ? "is-not-empty" : "is-empty" };
8705
- return {
8706
- attributeId: rule.attributeId,
8707
- condition: rule.condition === "is-any-of" ? "is" : "is-not",
8708
- value: [...values][0]
8709
- };
8710
- };
8711
- // ../pstdio-api-contracts/src/extension-kernel/builtin-refs.ts
8712
- var hostRef = (kind, id) => ({ extensionId: "pstdio", kind, id });
8713
- var workbenchModes = {
8714
- project: hostRef("mode", "project"),
8715
- sessions: hostRef("mode", "sessions"),
8716
- settings: hostRef("mode", "settings")
8717
- };
8718
- var workbenchModeDefinitions = {
8719
- project: { ref: workbenchModes.project, regions: dockedWorkbenchRegions },
8720
- sessions: { ref: workbenchModes.sessions, regions: dockedWorkbenchRegions },
8721
- settings: { ref: workbenchModes.settings, regions: dockedWorkbenchRegions }
8722
- };
8723
- var hostResourceKind = (id, label, menuSlots) => ({
8724
- id,
8725
- ref: hostRef("resource-kind", id),
8726
- label,
8727
- menuSlots
8728
- });
8729
- var headerMenuSlots = [
8730
- { id: "headerPrimary", placement: "header-primary", access: "public" },
8731
- { id: "headerOverflow", placement: "header-overflow", access: "public" }
8732
- ];
8733
- var workbenchResourceKindDefinitions = {
8734
- project: hostResourceKind("project", "Extension", headerMenuSlots),
8735
- session: hostResourceKind("session", "Session", headerMenuSlots),
8736
- workspace: hostResourceKind("workspace", "Workspace", headerMenuSlots)
8737
- };
8738
- var workbenchResourceKinds = {
8739
- project: workbenchResourceKindDefinitions.project.ref,
8740
- session: workbenchResourceKindDefinitions.session.ref,
8741
- workspace: workbenchResourceKindDefinitions.workspace.ref
8742
- };
8743
- var workbenchPages = {
8744
- start: hostRef("page", "start"),
8745
- sessions: hostRef("page", "sessions"),
8746
- session: hostRef("page", "session"),
8747
- workspaces: hostRef("page", "workspaces"),
8748
- workspace: hostRef("page", "workspace")
8749
- };
8750
- var workbenchPageDefinitions = {
8751
- start: {
8752
- ref: workbenchPages.start,
8753
- mode: workbenchModes.project,
8754
- path: "",
8755
- primary: { cardinality: "one", resourceKinds: [] }
8756
- },
8757
- sessions: {
8758
- ref: workbenchPages.sessions,
8759
- mode: workbenchModes.sessions,
8760
- path: "sessions",
8761
- primary: { cardinality: "one", resourceKinds: [] }
8762
- },
8763
- session: {
8764
- ref: workbenchPages.session,
8765
- mode: workbenchModes.sessions,
8766
- path: "session",
8767
- primary: { cardinality: "one", resourceKinds: ["session", "session-draft"] }
8768
- },
8769
- workspaces: {
8770
- ref: workbenchPages.workspaces,
8771
- mode: workbenchModes.project,
8772
- path: "workspaces",
8773
- primary: { cardinality: "one", resourceKinds: [] }
8774
- },
8775
- workspace: {
8776
- ref: workbenchPages.workspace,
8777
- mode: workbenchModes.project,
8778
- path: "workspace",
8779
- primary: { cardinality: "many", resourceKinds: ["workspace"] }
8780
- }
8781
- };
8782
- var workbenchPanels = {
8783
- projectSession: hostRef("placement", "project-session")
8784
- };
8785
- var workbenchPanelDefinitions = {
8786
- projectSession: {
8787
- ref: workbenchPanels.projectSession,
8788
- mode: workbenchModes.project,
8789
- cardinality: "many",
8790
- resourceKinds: ["session", "session-draft"]
8791
- }
8792
- };
8793
- var workbenchSlots = {
8794
- projectSettings: hostRef("settings-panel", "project.settings"),
8795
- extensionSettings: hostRef("settings-panel", "extension.settings"),
8796
- statusBarLeading: hostRef("status-bar-item", "status-bar.leading"),
8797
- statusBarTrailing: hostRef("status-bar-item", "status-bar.trailing")
8798
- };
8799
- // ../pstdio-api-contracts/src/extension-kernel/contribution-id.ts
8800
- var localContributionIdPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)*$/;
8801
- var isValidLocalContributionId = (id) => localContributionIdPattern.test(id);
8802
- var localContributionIdGrammar = 'lowercase kebab-case segments separated by dots, such as "ticket-status.create"';
8803
- // ../pstdio-api-contracts/src/extension-kernel/data-table-values.ts
8804
- var resolveDataTableComparableValue = (value, renderer) => {
8805
- if (typeof value !== "object" || value === null)
8806
- return value;
8807
- if ("display" in value)
8808
- return "sortValue" in value ? value.sortValue : undefined;
8809
- if (renderer?.type === "diff" && "additions" in value && "deletions" in value && typeof value.additions === "number" && typeof value.deletions === "number")
8810
- return value.additions + value.deletions;
8811
- return value;
8812
- };
8813
- var resolveDataTableFieldKind = (values, column = {}) => {
8814
- if (column.type)
8815
- return column.type;
8816
- if (column.renderer?.type === "date")
8817
- return "date";
8818
- const comparable = values.map((value) => resolveDataTableComparableValue(value, column.renderer)).filter((value) => value !== null && value !== undefined);
8819
- return comparable.length > 0 && comparable.every((value) => typeof value === "number") ? "number" : "string";
8820
- };
8821
- // ../pstdio-api-contracts/src/extension-kernel/event-reference.ts
8822
- var resolveEventReferenceId = (ref, ownerExtensionId) => {
8823
- if (typeof ref === "string")
8824
- return ref;
8825
- const extensionId = ref.extensionId ?? ownerExtensionId;
8826
- if (!extensionId || extensionId === "pstdio")
8827
- return ref.id;
8828
- const lifecycle = /^(command\.(?:requested|started|completed|rejected|failed):)(.+)$/.exec(ref.id);
8829
- if (lifecycle)
8830
- return `${lifecycle[1]}${extensionId}.command.${lifecycle[2]}`;
8831
- const artifact = /^artifact\.changed:(.+)$/.exec(ref.id);
8832
- if (artifact)
8833
- return `artifact.changed:${extensionId}.artifact.${artifact[1]}`;
8834
- return `${extensionId}.event.${ref.id}`;
8835
- };
8836
- // ../pstdio-api-contracts/src/extension-kernel/refs.ts
8837
- var createCommandRef = (input) => ({ ...input, kind: "command" });
8838
- var commandRef = Object.assign(createCommandRef, {
8839
- forExtension: (owner) => (id) => createCommandRef({ extensionId: `${owner.publisher}.${owner.name}`, id })
8840
- });
8841
- var eventRef = (input) => ({
8842
- ...input,
8843
- kind: "event"
8844
- });
8845
-
8846
- // ../pstdio-api-contracts/src/extension-kernel/slots.ts
8847
- var defineSlot = (id, options) => ({
8848
- id,
8849
- kind: options.kind,
8850
- label: options.label,
8851
- description: options.description,
8852
- metadata: options.metadata
8853
- });
8854
-
8855
- // ../pstdio-api-contracts/src/extension-kernel/kernel-slots.ts
8856
- var hostEventRef = (id) => eventRef({ extensionId: "pstdio", id });
8857
- var resourceMenuSlotRef = (resourceKind, id) => defineSlot(`${resourceKind.id}.${id}`, { kind: "menu" });
8858
- var projectSlots = {
8859
- sidenav: defineSlot("project.sidenav", { kind: "panel" }),
8860
- headerPrimary: resourceMenuSlotRef(workbenchResourceKinds.project, "headerPrimary"),
8861
- headerOverflow: resourceMenuSlotRef(workbenchResourceKinds.project, "headerOverflow"),
8862
- settingsPanels: defineSlot("project.settings", { kind: "settings" })
8863
- };
8864
- var sessionSlots = {
8865
- headerPrimary: resourceMenuSlotRef(workbenchResourceKinds.session, "headerPrimary"),
8866
- headerOverflow: resourceMenuSlotRef(workbenchResourceKinds.session, "headerOverflow")
8867
- };
8868
- var workspaceSlots = {
8869
- headerPrimary: resourceMenuSlotRef(workbenchResourceKinds.workspace, "headerPrimary"),
8870
- headerOverflow: resourceMenuSlotRef(workbenchResourceKinds.workspace, "headerOverflow"),
8871
- sidenav: defineSlot("workspace.sidenav", { kind: "panel" })
8872
- };
8873
- var projectEvents = {
8874
- opened: hostEventRef("project.opened")
8875
- };
8876
- var viewDataEvents = {
8877
- boardViewsChanged: hostEventRef("view.board-views.changed"),
8878
- resourceAnchorsChanged: hostEventRef("view.resource-anchors.changed"),
8879
- sessionsChanged: hostEventRef("view.sessions.changed"),
8880
- workspacesChanged: hostEventRef("view.workspaces.changed"),
8881
- repositoriesChanged: hostEventRef("view.repositories.changed")
8882
- };
8883
- var sessionEvents = {
8884
- started: hostEventRef("session.started"),
8885
- resumed: hostEventRef("session.resumed"),
8886
- awaitingInput: hostEventRef("session.awaitingInput"),
8887
- succeeded: hostEventRef("session.succeeded"),
8888
- failed: hostEventRef("session.failed"),
8889
- completed: hostEventRef("session.completed")
8890
- };
8891
- var workspaceEvents = {
8892
- created: hostEventRef("workspace.created"),
8893
- provision: hostEventRef("workspace.provision"),
8894
- ready: hostEventRef("workspace.ready"),
8895
- deleted: hostEventRef("workspace.deleted")
8896
- };
8897
- var worktreeEvents = {
8898
- removed: hostEventRef("worktree.removed")
8899
- };
8900
- var gitEvents = {
8901
- committed: hostEventRef("git.committed"),
8902
- rebased: hostEventRef("git.rebased"),
8903
- merged: hostEventRef("git.merged"),
8904
- conflicted: hostEventRef("git.conflicted")
8905
- };
8906
- // ../pstdio-api-contracts/src/extension-kernel/l10n.ts
8907
- var l10n = (key, defaultValue) => ({
8908
- $l10n: key,
8909
- ...defaultValue === undefined ? {} : { default: defaultValue }
8910
- });
8911
- var isLocalizedString = (value) => typeof value === "object" && value !== null && ("$l10n" in value) && typeof value.$l10n === "string";
8912
- // ../pstdio-api-contracts/src/extension-kernel/navigation.ts
8913
- var isRecord = (value) => Boolean(value && typeof value === "object" && !Array.isArray(value));
8914
- var isContributionRef = (value, kind) => isRecord(value) && value.kind === kind && typeof value.id === "string";
8915
- var isResource = (value) => isRecord(value) && typeof value.type === "string" && typeof value.id === "string";
8916
- var isOpenIntent = (value) => value === undefined || value === "preview" || value === "pin";
8917
- var isPageTarget = (value, ancestors = new Set) => {
8918
- if (!isRecord(value) || value.kind !== "page" || !isContributionRef(value.page, "page"))
8919
- return false;
8920
- if (ancestors.has(value))
8921
- return false;
8922
- if (value.resource !== undefined && !isResource(value.resource))
8923
- return false;
8924
- if (value.section !== undefined && !isRecord(value.section))
8925
- return false;
8926
- if (value.position !== undefined && (!isFileSourcePosition(value.position) || value.section !== undefined))
8927
- return false;
8928
- if (!isOpenIntent(value.open))
8929
- return false;
8930
- if (value.parent === undefined)
8931
- return true;
8932
- const next = new Set(ancestors);
8933
- next.add(value);
8934
- return isPageTarget(value.parent, next);
8935
- };
8936
- var isPanelTarget = (value) => {
8937
- if (!isRecord(value) || value.kind !== "panel" || !isRecord(value.panel))
8938
- return false;
8939
- const panel = value.panel;
8940
- const validPanel = isContributionRef(panel, "placement") || panel.kind === "page-slot" && isContributionRef(panel.page, "page") && typeof panel.id === "string";
8941
- return validPanel && (value.resource === undefined || isResource(value.resource)) && isOpenIntent(value.open);
8942
- };
8943
- var isItemTarget = (value) => {
8944
- if (!isRecord(value))
8945
- return false;
8946
- if (value.kind === "page")
8947
- return isPageTarget(value);
8948
- if (value.kind === "panel")
8949
- return isPanelTarget(value);
8950
- if (value.kind === "href")
8951
- return isNavigationHref(value.href);
8952
- return value.kind === "command" && isRecord(value.target) && isContributionRef(value.target.command, "command") && (value.target.params === undefined || isRecord(value.target.params));
8953
- };
8954
- var isNavigationTarget = (value) => {
8955
- if (isItemTarget(value))
8956
- return true;
8957
- if (!isRecord(value) || value.kind !== "compound" || !Array.isArray(value.targets) || value.targets.length === 0) {
8958
- return false;
8959
- }
8960
- return value.targets.every((target) => isPageTarget(target) || isPanelTarget(target));
8961
- };
8962
- var withExtensionOwner = (ref, extensionId) => ref.extensionId !== undefined || extensionId === undefined ? ref : { ...ref, extensionId };
8963
- var toPageTarget = (target, extensionId, projectId) => ({
8964
- ...target,
8965
- page: withExtensionOwner(target.page, extensionId),
8966
- ...target.resource ? { resource: qualifyResource(target.resource, extensionId, projectId) } : {},
8967
- ...target.parent ? { parent: toPageTarget(target.parent, extensionId, projectId) } : {}
8968
- });
8969
- var qualifyResource = (resource, extensionId, projectId) => ({
8970
- ...resource,
8971
- extensionId: resource.extensionId ?? extensionId,
8972
- projectId: resource.projectId ?? projectId
8973
- });
8974
- var qualifyNavigationTarget = (target, extensionId, projectId) => {
8975
- if (!isNavigationTarget(target))
8976
- throw new Error("Invalid navigation target.");
8977
- if (target.kind === "page")
8978
- return toPageTarget(target, extensionId, projectId);
8979
- if (target.kind === "panel")
8980
- return {
8981
- ...target,
8982
- panel: target.panel.kind === "page-slot" ? { ...target.panel, page: withExtensionOwner(target.panel.page, extensionId) } : withExtensionOwner(target.panel, extensionId),
8983
- ...target.resource ? { resource: qualifyResource(target.resource, extensionId, projectId) } : {}
8984
- };
8985
- if (target.kind === "command")
8986
- return { ...target, target: { ...target.target, command: withExtensionOwner(target.target.command, extensionId) } };
8987
- if (target.kind === "href")
8988
- return target;
8989
- return {
8990
- ...target,
8991
- targets: target.targets.map((item) => qualifyNavigationTarget(item, extensionId, projectId))
8992
- };
8993
- };
8994
- // ../pstdio-api-contracts/src/extension-kernel/package-asset.ts
8995
- var packageAsset = (path, baseUrl) => ({
8996
- kind: "package-asset",
8997
- path,
8998
- baseUrl
8999
- });
9000
- // ../pstdio-api-contracts/src/extension-kernel/page-resource-codec.ts
9001
- var fromUri = (uri) => {
9002
- try {
9003
- const parsed = new URL(uri);
9004
- if (parsed.protocol !== "pstdio:" || parsed.hostname !== "extension-resource")
9005
- return;
9006
- const [type, id, ...rest] = parsed.pathname.slice(1).split("/");
9007
- if (!type || !id || rest.length > 0)
9008
- return;
9009
- const extensionId = parsed.searchParams.get("extensionId");
9010
- const projectId = parsed.searchParams.get("projectId");
9011
- return {
9012
- type: decodeURIComponent(type),
9013
- id: decodeURIComponent(id),
9014
- ...extensionId ? { extensionId } : {},
9015
- ...projectId ? { projectId } : {}
9016
- };
9017
- } catch {
9018
- return;
9019
- }
9020
- };
9021
- var defaultPageResourceCodec = {
9022
- normalize: (resource) => ({ ...resource }),
9023
- toUri: (resource) => {
9024
- const uri = `pstdio://extension-resource/${encodeURIComponent(resource.type)}/${encodeURIComponent(resource.id)}`;
9025
- const query = new URLSearchParams;
9026
- if (resource.extensionId)
9027
- query.set("extensionId", resource.extensionId);
9028
- if (resource.projectId)
9029
- query.set("projectId", resource.projectId);
9030
- return query.size ? `${uri}?${query}` : uri;
9031
- },
9032
- fromUri
9033
- };
9034
- // ../pstdio-api-contracts/src/extension-kernel/page-url.ts
9035
- var hostExtensionId = "pstdio";
9036
- var pageRefKey = (ref) => `${ref.extensionId ?? ""}:page:${ref.id}`;
9037
- var pageForRef = (pages, ref) => pages.find((page) => pageRefKey(page.ref) === pageRefKey(ref));
9038
- var encodePath = (path) => path.split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/");
9039
- var routePath = (projectId, page) => {
9040
- const project = `/projects/${encodeURIComponent(projectId)}`;
9041
- const path = encodePath(page.path);
9042
- if (page.ref.extensionId === hostExtensionId)
9043
- return path ? `${project}/${path}` : project;
9044
- if (!page.ref.extensionId)
9045
- throw new Error(`Page "${page.id}" has no extension id`);
9046
- return `${project}/extensions/${encodeURIComponent(page.ref.extensionId)}/${path}`;
9047
- };
9048
- var normalizedSection = (value) => {
9049
- if (!value || typeof value !== "object" || !Array.isArray(value.anchors))
9050
- return;
9051
- const anchors = value.anchors;
9052
- if (anchors.some((anchor) => !anchor || typeof anchor !== "object" || typeof anchor.id !== "string" || typeof anchor.heading !== "string" || anchor.occurrence !== undefined && (!Number.isInteger(anchor.occurrence) || Number(anchor.occurrence) < 0))) {
9053
- return;
9054
- }
9055
- return {
9056
- anchors: anchors.map((anchor) => {
9057
- const value = anchor;
9058
- return {
9059
- id: value.id,
9060
- heading: value.heading,
9061
- ...value.occurrence !== undefined ? { occurrence: value.occurrence } : {}
9062
- };
9063
- })
9064
- };
9065
- };
9066
- var serializeSection = (section) => {
9067
- const normalized = normalizedSection(section);
9068
- if (!normalized)
9069
- throw new Error("Page location has an invalid section");
9070
- return JSON.stringify(normalized);
9071
- };
9072
- var parseSection = (value) => {
9073
- try {
9074
- return normalizedSection(JSON.parse(value));
9075
- } catch {
9076
- return;
9077
- }
9078
- };
9079
- var serializeWorkbenchPageUrl = (input) => {
9080
- const page = pageForRef(input.pages, input.location.page);
9081
- if (!page)
9082
- throw new Error(`Unknown page ref: ${pageRefKey(input.location.page)}`);
9083
- const query = new URLSearchParams;
9084
- if (input.location.resource) {
9085
- query.set("resource", input.resources.toUri(input.resources.normalize(input.location.resource)));
9086
- }
9087
- const document = page.document && input.location.resource?.metadata?.[page.document.metadataKey];
9088
- if (document !== undefined) {
9089
- if (typeof document !== "string" || !document)
9090
- throw new Error("Page location has an invalid document");
9091
- query.set("document", document);
9092
- }
9093
- if (input.location.position) {
9094
- if (!page.document || typeof document !== "string" || !document || input.location.section || !isFileSourcePosition(input.location.position))
9095
- throw new Error("Page location has an invalid source position");
9096
- for (const key of ["line", "column", "endLine", "endColumn"]) {
9097
- const value = input.location.position[key];
9098
- if (value !== undefined)
9099
- query.set(key, String(value));
9100
- }
9101
- }
9102
- if (input.location.section)
9103
- query.set("section", serializeSection(input.location.section));
9104
- const params = normalizePageParams(page.params, input.location.params);
9105
- for (const [name, value] of pageParamsQuery(page.params, params))
9106
- query.append(name, value);
9107
- const encoded = query.toString();
9108
- const path = routePath(input.projectId, page);
9109
- return encoded ? `${path}?${encoded}` : path;
9110
- };
9111
- var decodedSegments = (pathname) => {
9112
- try {
9113
- return pathname.split("/").filter(Boolean).map((segment) => decodeURIComponent(segment));
9114
- } catch {
9115
- return;
9116
- }
9117
- };
9118
- var isWorkbenchProjectUrl = (urlValue, projectId) => {
9119
- try {
9120
- const url = new URL(urlValue, "http://workbench.local");
9121
- const segments = decodedSegments(url.pathname);
9122
- return Boolean(segments && segments[0] === "projects" && segments[1] === projectId);
9123
- } catch {
9124
- return false;
9125
- }
9126
- };
9127
- var pageForRoute = (pages, extensionId, path) => pages.find((page) => page.ref.extensionId === extensionId && page.path === path);
9128
- var parseResource = (uri, resources) => {
9129
- try {
9130
- const resource = resources.fromUri(uri);
9131
- return resource ? resources.normalize(resource) : undefined;
9132
- } catch {
9133
- return;
9134
- }
9135
- };
9136
- var parseSourcePosition = (url, page, document, section) => {
9137
- const coordinates = Object.fromEntries(["line", "column", "endLine", "endColumn"].filter((key) => url.searchParams.has(key)).map((key) => {
9138
- const raw = url.searchParams.get(key);
9139
- return [key, /^[1-9]\d*$/.test(raw) ? Number(raw) : NaN];
9140
- }));
9141
- let position;
9142
- if (Object.keys(coordinates).length) {
9143
- if (!page.document || document === null || section || !isFileSourcePosition(coordinates))
9144
- return false;
9145
- position = coordinates;
9146
- }
9147
- return position;
9148
- };
9149
- var pageForUrl = (url, projectId, pages) => {
9150
- const segments = decodedSegments(url.pathname);
9151
- if (!segments || segments[0] !== "projects" || segments[1] !== projectId)
9152
- return;
9153
- const route = segments.slice(2);
9154
- const extensionRoute = route[0] === "extensions";
9155
- const extensionId = extensionRoute ? route[1] : hostExtensionId;
9156
- const path = (extensionRoute ? route.slice(2) : route).join("/");
9157
- if (!extensionId || extensionRoute && !path)
9158
- return;
9159
- const page = pageForRoute(pages, extensionId, path);
9160
- return page;
9161
- };
9162
- var parseWorkbenchPageUrl = (input) => {
9163
- let url;
9164
- try {
9165
- url = new URL(input.url, "http://workbench.local");
9166
- } catch {
9167
- return;
9168
- }
9169
- const page = pageForUrl(url, input.projectId, input.pages);
9170
- if (!page)
9171
- return;
9172
- for (const key of ["resource", "document", "section", "line", "column", "endLine", "endColumn"]) {
9173
- if (url.searchParams.getAll(key).length > 1)
9174
- return;
9175
- }
9176
- const resourceValue = url.searchParams.get("resource");
9177
- let resource = resourceValue ? parseResource(resourceValue, input.resources) : undefined;
9178
- if (resourceValue !== null && !resource)
9179
- return;
9180
- const document = url.searchParams.get("document");
9181
- if (document !== null) {
9182
- if (!document || !page.document || !resource)
9183
- return;
9184
- resource = { ...resource, metadata: { [page.document.metadataKey]: document } };
9185
- }
9186
- const sectionValue = url.searchParams.get("section");
9187
- const section = sectionValue ? parseSection(sectionValue) : undefined;
9188
- if (sectionValue !== null && !section)
9189
- return;
9190
- const position = parseSourcePosition(url, page, document, section);
9191
- if (position === false)
9192
- return;
9193
- const params = parsePageParams(page.params, url.searchParams);
9194
- return {
9195
- pageId: page.id,
9196
- ...params ? { params } : {},
9197
- ...resource ? { resource } : {},
9198
- ...section ? { section } : {},
9199
- ...position ? { position } : {}
9200
- };
9201
- };
9202
- var serializePageUrl = (input) => serializeWorkbenchPageUrl({
9203
- projectId: input.projectId,
9204
- location: { page: input.page.ref, resource: input.resource, position: input.position, params: input.params },
9205
- pages: [input.page],
9206
- resources: defaultPageResourceCodec
9207
- });
9208
- var parsePageUrl = (input) => {
9209
- if (!input.url.startsWith("/") || input.url.startsWith("//"))
9210
- return;
9211
- return parseWorkbenchPageUrl({ ...input, resources: defaultPageResourceCodec });
9212
- };
9213
- // ../pstdio-api-contracts/src/extension-kernel/serialize-error.ts
9214
- var serializeCommandError = (error) => {
9215
- const ancestors = [];
9216
- const shape = (value) => ({
9217
- ...value,
9218
- name: value.name,
9219
- message: value.message,
9220
- ...value.stack ? { stack: value.stack } : {},
9221
- ...value.cause !== undefined ? { cause: value.cause } : {}
9222
- });
9223
- const shapes = new WeakMap;
9224
- const errorShape = (value) => {
9225
- const existing = shapes.get(value);
9226
- if (existing)
9227
- return existing;
9228
- const result = shape(value);
9229
- shapes.set(value, result);
9230
- return result;
9231
- };
9232
- const source = error instanceof Error ? errorShape(error) : { message: String(error) };
9233
- const result = JSON.parse(JSON.stringify(source, function(_key, value) {
9234
- const normalized = value instanceof Error ? errorShape(value) : value;
9235
- if (typeof normalized === "bigint")
9236
- return String(normalized);
9237
- if (normalized && typeof normalized === "object") {
9238
- while (ancestors.length && ancestors.at(-1) !== this)
9239
- ancestors.pop();
9240
- if (ancestors.includes(normalized))
9241
- return "[Circular]";
9242
- ancestors.push(normalized);
9243
- }
9244
- return normalized;
9245
- }));
9246
- return result;
9247
- };
9248
- // ../pstdio-api-contracts/src/extension-kernel/types/extension.ts
9249
- var EXTENSION_API_VERSION = "0.2.0";
9250
- // ../pstdio-api-contracts/src/extension-kernel/types/webview-capabilities.ts
9251
- var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
9252
- var WEBVIEW_DECLARABLE_CAPABILITIES = [
9253
- "clipboard.write",
9254
- "commands.execute",
9255
- "commands.stream",
9256
- "navigation.open",
9257
- "page.params.update",
9258
- "placement.close",
9259
- "notification.show",
9260
- "notification.action",
9261
- "notification.resolve",
9262
- "notification.dismiss",
9263
- "preferences.get",
9264
- "preferences.set",
9265
- "extension.settings.all",
9266
- "extension.settings.get",
9267
- "extension.settings.set",
9268
- "extension.settings.delete",
9269
- "terminal.session",
9270
- "files.upload",
9271
- "files.list",
9272
- "files.delete"
9273
- ];
9274
- var WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES = ["artifacts.read"];
9275
- var ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES = ["host.dispatchKeyboardEvent"];
9276
- var WEBVIEW_HOST_CAPABILITIES = [
9277
- ...WEBVIEW_DECLARABLE_CAPABILITIES.filter((capability) => capability !== "clipboard.write"),
9278
- ...WEBVIEW_SCOPED_DECLARABLE_CAPABILITIES
9279
- ];
9280
- // ../pstdio-api-contracts/src/extension-kernel/webview-protocol.ts
9281
- var EXTENSION_EVENTS_SCOPE = "extension.events";
9282
- var artifactMountId = (mount) => typeof mount === "string" ? mount : mount.id;
9283
- // ../pstdio-api-contracts/src/files.ts
9284
- var fileRecordSchema = object({
9285
- id: string2(),
9286
- project_id: string2(),
9287
- file_name: string2(),
9288
- file_kind: string2(),
9289
- storage_path: string2(),
9290
- mime_type: string2().nullable(),
9291
- size_bytes: number2(),
9292
- hash: string2().nullable(),
9293
- created_at: string2(),
9294
- updated_at: string2()
9295
- });
9296
- // ../pstdio-api-contracts/src/harness-commands.ts
9297
- var harnessCommandSchema = object({
9298
- name: string2(),
9299
- description: string2(),
9300
- argumentHelp: string2().optional(),
9301
- composer: object({
9302
- label: string2(),
9303
- modeId: string2().optional(),
9304
- reservedArguments: array(string2()).optional()
9305
- }).optional(),
9306
- disabledReason: string2().optional()
9307
- });
9308
- var harnessModeActionSchema = object({
9309
- id: string2(),
9310
- label: string2(),
9311
- icon: string2().optional(),
9312
- argument: object({ label: string2(), value: string2().optional() }).optional()
9313
- });
9314
- var harnessModeSchema = object({
9315
- id: string2(),
9316
- label: string2(),
9317
- description: string2(),
9318
- state: string2(),
9319
- indicator: object({ label: string2(), tone: _enum(["neutral", "info", "success", "warning", "error"]) }).optional(),
9320
- tagText: string2().optional(),
9321
- closeActionId: string2().optional(),
9322
- confirmation: object({
9323
- id: string2(),
9324
- title: string2(),
9325
- actionId: string2(),
9326
- cancelLabel: string2().optional(),
9327
- model: string2().optional()
9328
- }).optional(),
9329
- actions: array(harnessModeActionSchema)
9330
- });
9331
- var harnessCommandStateSchema = object({
9332
- commands: array(harnessCommandSchema),
9333
- modes: array(harnessModeSchema),
9334
- slashCommands: boolean2()
9335
- });
9336
- var harnessOperationSchema = discriminatedUnion("kind", [
9337
- object({ kind: literal("command"), text: string2().min(1) }).strict(),
9338
- object({
9339
- kind: literal("mode-action"),
9340
- modeId: string2(),
9341
- actionId: string2(),
9342
- argument: string2().optional()
9343
- }).strict()
9344
- ]);
9345
- var draftHarnessCommandInputSchema = object({
9346
- project_id: string2().min(1),
9347
- agent: string2().min(1),
9348
- workspace_id: string2().optional(),
9349
- model: string2().optional(),
9350
- params: record(string2(), union([string2(), boolean2()])).optional()
9351
- }).strict();
9352
- var harnessOperationResponseSchema = object({
9353
- status: _enum(["completed", "started"]),
9354
- message: string2().optional()
9355
- });
9356
- // ../pstdio-api-contracts/src/history-turn-evidence.ts
9357
- var historyTurnEvidence = (known, native, prompt, body) => {
9358
- const signatures = (turn) => JSON.stringify([prompt(turn), body(turn)]);
9359
- if (known.length === native.length && known.every((turn, index) => signatures(turn) === signatures(native[index]))) {
9360
- return signatures;
9361
- }
9362
- const tokens = (turns) => {
9363
- const positions = new Map;
9364
- turns.forEach((turn, index) => {
9365
- for (const value of new Set(body(turn))) {
9366
- const token = JSON.stringify([prompt(turn), value]);
9367
- positions.set(token, positions.has(token) ? -1 : index);
9368
- }
9369
- });
9370
- return positions;
9371
- };
9372
- const left = tokens(known);
9373
- const right = tokens(native);
9374
- const matches = new Map;
9375
- const reverse = new Map;
9376
- for (const [token, index] of left) {
9377
- const other = right.get(token);
9378
- if (index < 0 || other === undefined || other < 0)
9379
- continue;
9380
- const targets = matches.get(index) ?? new Set;
9381
- targets.add(other);
9382
- matches.set(index, targets);
9383
- const sources = reverse.get(other) ?? new Set;
9384
- sources.add(index);
9385
- reverse.set(other, sources);
9386
- }
9387
- const keys = new Map;
9388
- known.forEach((turn, index) => {
9389
- keys.set(turn, `known:${index}`);
9390
- });
9391
- native.forEach((turn, index) => {
9392
- keys.set(turn, `native:${index}`);
9393
- });
9394
- for (const [index, targets] of matches) {
9395
- if (targets.size !== 1)
9396
- continue;
9397
- const other = [...targets][0];
9398
- if (reverse.get(other)?.size !== 1)
9399
- continue;
9400
- const key = `pair:${index}:${other}`;
9401
- keys.set(known[index], key);
9402
- keys.set(native[other], key);
9403
- }
9404
- return (turn) => keys.get(turn);
9405
- };
9406
-
9407
- // ../pstdio-api-contracts/src/ordered-history-merge.ts
9408
- var positions = (items, key) => {
9409
- const result = new Map;
9410
- items.forEach((item, index) => {
9411
- const value = key(item);
9412
- const indices = result.get(value) ?? [];
9413
- indices.push(index);
9414
- result.set(value, indices);
9415
- });
9416
- return result;
9417
- };
9418
- var orderedAnchors = (anchors) => {
9419
- const tails = [];
9420
- const previous = [];
9421
- anchors.forEach(([, native], index) => {
9422
- let low = 0;
9423
- let high = tails.length;
9424
- while (low < high) {
9425
- const middle = low + high >> 1;
9426
- if (anchors[tails[middle]][1] < native)
9427
- low = middle + 1;
9428
- else
9429
- high = middle;
9430
- }
9431
- previous[index] = low > 0 ? tails[low - 1] : -1;
9432
- tails[low] = index;
9433
- });
9434
- const kept = [];
9435
- for (let index = tails.at(-1) ?? -1;index >= 0; index = previous[index])
9436
- kept.unshift(anchors[index]);
9437
- return kept;
9438
- };
9439
- var newerThanSaved = (known, native, options) => {
9440
- const times = options.time ? known.map(options.time).filter((value) => value !== undefined) : [];
9441
- if (!times.length)
9442
- return [];
9443
- const savedUntil = Math.max(...times);
9444
- return native.filter((item) => (options.time?.(item) ?? savedUntil) > savedUntil);
9445
- };
9446
- var mergeOrderedHistory = (known, native, options, trailing = true) => {
9447
- const { key, merge, refineKey, covered } = options;
9448
- const missing = native.filter((item) => !covered?.(item));
9449
- if (!known.length)
9450
- return missing;
9451
- if (!native.length)
9452
- return known;
9453
- const knownPositions = positions(known, key);
9454
- const nativePositions = positions(native, key);
9455
- const found = [];
9456
- for (const [value, indices] of knownPositions) {
9457
- const other = nativePositions.get(value);
9458
- if (indices.length === 1 && other?.length === 1)
9459
- found.push([indices[0], other[0]]);
9460
- }
9461
- const anchors = orderedAnchors(found.sort((a, b) => a[0] - b[0]));
9462
- if (!anchors.length) {
9463
- if (refineKey)
9464
- return mergeOrderedHistory(known, native, { ...options, key: refineKey(known, native), refineKey: undefined }, trailing);
9465
- const paired = Math.min(known.length, native.length);
9466
- if (known.slice(0, paired).every((item, index) => key(item) === key(native[index]))) {
9467
- return [
9468
- ...known.slice(0, paired).map((item, index) => merge(item, native[index])),
9469
- ...known.slice(paired),
9470
- ...native.slice(paired)
9471
- ];
9472
- }
9473
- return trailing ? [...known, ...newerThanSaved(known, missing, options)] : known;
9474
- }
9475
- const kept = new Set(anchors.map(([, index]) => index));
9476
- const reordered = new Set(found.filter(([, index]) => !kept.has(index)).map(([, index]) => native[index]));
9477
- const nativeSpan = (start, end) => native.slice(start, end).filter((item) => !reordered.has(item));
9478
- let left = 0;
9479
- let right = 0;
9480
- const result = [];
9481
- for (const [a, b] of anchors) {
9482
- result.push(...mergeOrderedHistory(known.slice(left, a), nativeSpan(right, b), options, false));
9483
- result.push(merge(known[a], native[b]));
9484
- left = a + 1;
9485
- right = b + 1;
9486
- }
9487
- result.push(...mergeOrderedHistory(known.slice(left), nativeSpan(right), options, trailing));
9488
- return result;
9489
- };
9490
-
9491
- // ../pstdio-api-contracts/src/history-reconciliation.ts
9492
- class HistoryConflict extends Error {
9493
- }
9494
- var submittedPrompt = (message) => message.parts.filter((part) => part.type === "text").map((part) => part.text).join(`
9495
- `).replace(/\n\n<session-attachments>[\s\S]*<\/session-attachments>\s*$/, "").trim();
9496
- var historyValueKey = (value) => JSON.stringify(value, (_key, item) => {
9497
- if (!item || typeof item !== "object" || Array.isArray(item))
9498
- return item;
9499
- return Object.fromEntries(Object.entries(item).sort(([a], [b]) => a.localeCompare(b)));
9500
- });
9501
- var historyMessageKey = (message) => historyValueKey([message.role, message.parts]);
9502
- var splitHistoryTurns = (messages) => {
9503
- const turns = [];
9504
- for (const message of messages) {
9505
- if (message.role === "user" || !turns.length)
9506
- turns.push([]);
9507
- turns[turns.length - 1].push(message);
9508
- }
9509
- return turns;
9510
- };
9511
- var mergeHistoryMetadata = (known, native) => {
9512
- const files = native.parts.filter((part) => part.type === "file");
9513
- const fileKeys = new Set(files.map((part) => part.fileId ?? part.url));
9514
- const missing = known.parts.filter((part) => part.type === "file" && !fileKeys.has(part.fileId ?? part.url));
9515
- const parts = native.role === "user" ? [...known.parts.filter((part) => part.type === "text"), ...native.parts.filter((part) => part.type !== "text")] : native.parts;
9516
- return { ...known, ...native, parts: [...parts, ...missing] };
9517
- };
9518
- var isUsage = (message) => message.role === "system" && message.parts.length > 0 && message.parts.every((part) => part.type === "token_usage");
9519
- var combineTextRuns = (messages) => {
9520
- const runs = [];
9521
- for (const message of messages) {
9522
- const previous = runs.at(-1);
9523
- const part = message.parts[0];
9524
- const previousPart = previous?.parts[0];
9525
- if (previous && message.role === previous.role && message.parts.length === 1 && previous.parts.length === 1 && (part.type === "text" || part.type === "reasoning") && previousPart?.type === part.type) {
9526
- runs[runs.length - 1] = { ...previous, parts: [{ ...part, text: previousPart.text + part.text }] };
9527
- } else
9528
- runs.push(message);
9529
- }
9530
- return runs;
9531
- };
9532
- var reconcileMessageHistory = (input, projection = {}) => {
9533
- const key = projection.key ?? historyMessageKey;
9534
- const merge = projection.merge ?? mergeHistoryMetadata;
9535
- const generated = projection.isGenerated ?? isUsage;
9536
- const mergeTurn = (known, native) => {
9537
- const startsWithUser = known[0]?.role === "user" && native[0]?.role === "user";
9538
- const body = (turn) => combineTextRuns(turn.slice(startsWithUser ? 1 : 0).filter((message) => !generated(message)));
9539
- const shown = known.flatMap((message) => message.parts.flatMap((part) => part.type === "text" ? [part.text] : []));
9540
- const saved = shown.join("");
9541
- const messages = mergeOrderedHistory(body(known), body(native), {
9542
- key,
9543
- merge,
9544
- time: (message) => message.createdAt,
9545
- covered: (message) => message.parts.length > 0 && message.parts.every((part) => part.type === "text" && saved.includes(part.text))
9546
- });
9547
- const metadata = [...native.filter(generated)];
9548
- const counts = new Map;
9549
- metadata.forEach((message) => {
9550
- counts.set(historyMessageKey(message), (counts.get(historyMessageKey(message)) ?? 0) + 1);
9551
- });
9552
- for (const message of known.filter(generated)) {
9553
- const value = historyMessageKey(message);
9554
- const remaining = counts.get(value) ?? 0;
9555
- if (remaining)
9556
- counts.set(value, remaining - 1);
9557
- else
9558
- metadata.push(message);
9559
- }
9560
- return [...startsWithUser ? [mergeHistoryMetadata(known[0], native[0])] : [], ...messages, ...metadata];
9561
- };
9562
- try {
9563
- const prompt = (turn) => turn[0]?.role === "user" ? `user:${submittedPrompt(turn[0])}` : "prefix";
9564
- const turns = mergeOrderedHistory(splitHistoryTurns(input.knownMessages), splitHistoryTurns(input.nativeMessages), {
9565
- key: prompt,
9566
- merge: mergeTurn,
9567
- refineKey: (known, native) => historyTurnEvidence(known, native, prompt, (turn) => combineTextRuns(turn.slice(1).filter((message) => !generated(message))).map(key)),
9568
- time: (turn) => turn[0]?.createdAt
9569
- });
9570
- const messages = turns.flat().map((message, index) => message.index === undefined ? message : { ...message, index });
9571
- return { kind: "recovered", messages };
9572
- } catch (error) {
9573
- if (error instanceof HistoryConflict)
9574
- return { kind: "conflict", category: error.message };
9575
- throw error;
9576
- }
9577
- };
9578
- // ../pstdio-api-contracts/src/pagination.ts
9579
- var pageQuerySchema = object({ cursor: string2().optional(), limit: exports_coerce.number().optional() });
9580
- // ../pstdio-api-contracts/src/session-request-values.ts
9581
- var harnessParamValueSchema = union([string2(), boolean2()]);
9582
- var harnessParamsInputSchema = record(string2(), harnessParamValueSchema);
9583
- var sessionAttachmentRefSchema = object({ file_id: string2().min(1) });
9584
-
9585
- // ../pstdio-api-contracts/src/queued-follow-ups.ts
9586
- var queuedFollowUpSchema = object({
9587
- queuePosition: number2().int().positive(),
9588
- revision: string2().min(1),
9589
- prompt: string2(),
9590
- steeringUnavailableReason: string2().nullable().optional(),
9591
- steeringDelivery: object({ id: string2(), runStartedAt: string2() }).nullable(),
9592
- model: string2().nullable(),
9593
- params: harnessParamsInputSchema,
9594
- attachments: array(sessionAttachmentRefSchema)
9595
- });
9596
- var updateQueuedFollowUpInputSchema = object({
9597
- prompt: string2().trim().min(1),
9598
- expectedRevision: string2().min(1).optional(),
9599
- model: string2().min(1).nullable().optional(),
9600
- params: harnessParamsInputSchema.nullable().optional(),
9601
- attachments: array(sessionAttachmentRefSchema).optional()
9602
- });
9603
- var combineQueuedFollowUpsInputSchema = object({
9604
- sourcePosition: number2().int().positive(),
9605
- sourceRevision: string2().min(1),
9606
- targetRevision: string2().min(1)
9607
- });
9608
- var queuedFollowUpUpdateResponseSchema = object({ ok: literal(true), request: queuedFollowUpSchema });
9609
- var pendingQueuedFollowUpsResponseSchema = object({
9610
- requests: array(queuedFollowUpSchema),
9611
- activeRunStartedAt: string2().nullable(),
9612
- steeringAvailable: boolean2(),
9613
- steeringUnavailableReason: string2().nullable()
9614
- });
9615
- var steerQueuedFollowUpInputSchema = object({
9616
- expectedRevision: string2().min(1),
9617
- expectedRunStartedAt: string2().min(1)
9618
- });
9619
- var queuedSteeringResultSchema = discriminatedUnion("status", [
9620
- object({ status: literal("accepted"), deliveryId: string2() }),
9621
- object({
9622
- status: literal("rejected"),
9623
- reason: _enum([
9624
- "unsupported",
9625
- "inactive",
9626
- "stale_run",
9627
- "blocking_input",
9628
- "missing",
9629
- "stale_revision",
9630
- "different_settings",
9631
- "delivery_failed",
9632
- "invalid_attachments"
9633
- ]),
9634
- message: string2()
9635
- }),
9636
- object({ status: literal("uncertain"), deliveryId: string2(), message: string2() })
9637
- ]);
9638
- // ../pstdio-api-contracts/src/resource-anchors.ts
9639
- var resourceLinkRefSchema = extensionResourceRefSchema.extend({
9640
- type: string2().min(1),
9641
- id: string2().min(1),
9642
- projectId: string2().min(1).optional(),
9643
- extensionId: string2().min(1).optional()
9644
- });
9645
- var resourceAnchorSchema = resourceLinkRefSchema.extend({
9646
- role: _enum(["primary", "context", "source", "result"]).optional()
9647
- });
9648
- var addResourceAnchorsSchema = object({
9649
- resource: resourceLinkRefSchema,
9650
- anchors: array(resourceAnchorSchema).max(100)
9651
- });
9652
- var removeResourceAnchorsSchema = object({
9653
- resource: resourceLinkRefSchema,
9654
- refs: array(resourceLinkRefSchema).max(100)
9655
- });
9656
- var resourceAnchorQuerySchema = object({
9657
- resource: resourceLinkRefSchema,
9658
- direction: _enum(["outgoing", "incoming", "both"]).optional(),
9659
- role: _enum(["primary", "context", "source", "result"]).optional(),
9660
- cursor: string2().optional(),
9661
- limit: number2().int().min(1).max(100).optional()
9662
- });
9663
- var resourceAnchorPageSchema = object({
9664
- items: array(object({ source: resourceLinkRefSchema, target: resourceAnchorSchema })),
9665
- nextCursor: string2().optional()
9666
- });
9667
- var resourceAnchorQueryPageSchema = resourceAnchorPageSchema.extend({ nextCursor: string2().nullable() });
9668
5806
  // ../pstdio-api-contracts/src/session-attachment-types.ts
9669
5807
  var sessionAttachmentMimeTypesByExtension = {
9670
5808
  c: "text/plain",
@@ -9711,402 +5849,6 @@ var sessionAttachmentMimeTypesByExtension = {
9711
5849
  };
9712
5850
  var supportedSessionAttachmentExtensions = Object.keys(sessionAttachmentMimeTypesByExtension);
9713
5851
  var supportedSessionAttachmentAccept = supportedSessionAttachmentExtensions.map((extension) => `.${extension}`).join(",");
9714
- // ../pstdio-api-contracts/src/session-messages.ts
9715
- var textPartSchema = object({
9716
- type: literal("text"),
9717
- text: string2()
9718
- });
9719
- var reasoningPartSchema = object({
9720
- type: literal("reasoning"),
9721
- text: string2()
9722
- });
9723
- var toolPartActionTypeSchema = _enum(["read", "write", "execute", "network", "other"]);
9724
- var toolPartStatusSchema = _enum(["pending", "running", "completed", "failed", "denied"]);
9725
- var toolPartSchema = object({
9726
- type: literal("tool"),
9727
- tool: string2(),
9728
- callId: string2().optional(),
9729
- actionType: toolPartActionTypeSchema.optional(),
9730
- status: toolPartStatusSchema.optional(),
9731
- state: object({
9732
- status: string2().optional(),
9733
- input: unknown().optional(),
9734
- output: unknown().optional(),
9735
- errorText: string2().optional(),
9736
- metadata: unknown().optional()
9737
- }).optional()
9738
- });
9739
- var stepStartPartSchema = object({
9740
- type: literal("step-start"),
9741
- snapshot: string2().optional()
9742
- });
9743
- var stepFinishPartSchema = object({
9744
- type: literal("step-finish"),
9745
- reason: string2().optional(),
9746
- snapshot: string2().optional(),
9747
- cost: number2().optional(),
9748
- tokens: unknown().optional()
9749
- });
9750
- var patchPartSchema = object({
9751
- type: literal("patch"),
9752
- hash: string2().optional(),
9753
- files: unknown().optional()
9754
- });
9755
- var filePartSchema = object({
9756
- type: literal("file"),
9757
- fileId: string2().optional(),
9758
- mediaType: string2().optional(),
9759
- filename: string2().optional(),
9760
- size: number2().optional(),
9761
- url: string2()
9762
- });
9763
- var loadingPartSchema = object({
9764
- type: literal("loading")
9765
- });
9766
- var errorPartSchema = object({
9767
- type: literal("error"),
9768
- errorType: _enum(["timeout", "crash", "permission", "other"]),
9769
- message: string2().optional()
9770
- });
9771
- var tokenUsagePartSchema = object({
9772
- type: literal("token_usage"),
9773
- inputTokens: number2(),
9774
- outputTokens: number2(),
9775
- cacheReadTokens: number2().optional(),
9776
- cacheWriteTokens: number2().optional()
9777
- });
9778
- var sessionMessagePartSchema = union([
9779
- textPartSchema,
9780
- reasoningPartSchema,
9781
- toolPartSchema,
9782
- stepStartPartSchema,
9783
- stepFinishPartSchema,
9784
- patchPartSchema,
9785
- filePartSchema,
9786
- loadingPartSchema,
9787
- errorPartSchema,
9788
- tokenUsagePartSchema
9789
- ]);
9790
- var sessionMessageRoleSchema = _enum(["user", "assistant", "tool", "system", "developer"]);
9791
- var sessionMessageSchema = object({
9792
- id: string2(),
9793
- role: sessionMessageRoleSchema,
9794
- parts: array(sessionMessagePartSchema),
9795
- index: number2().optional(),
9796
- createdAt: number2().optional(),
9797
- modelId: string2().optional(),
9798
- providerId: string2().optional(),
9799
- tokens: object({
9800
- input: number2().optional(),
9801
- output: number2().optional(),
9802
- reasoning: number2().optional(),
9803
- cache: object({
9804
- read: number2().optional(),
9805
- write: number2().optional()
9806
- }).optional()
9807
- }).optional()
9808
- });
9809
- // ../pstdio-api-contracts/src/sessions.ts
9810
- var sessionStatusSchema = _enum([
9811
- "in_progress",
9812
- "awaiting_input",
9813
- "queued",
9814
- "completed",
9815
- "failed",
9816
- "cancelled",
9817
- "disconnected"
9818
- ]);
9819
- var sessionUsageSchema = object({
9820
- input_tokens: number2(),
9821
- output_tokens: number2(),
9822
- cache_read_tokens: number2(),
9823
- cache_write_tokens: number2()
9824
- });
9825
- var sessionExitSchema = object({
9826
- cause: _enum([
9827
- "completed",
9828
- "user_stop",
9829
- "request_aborted",
9830
- "worker_lost",
9831
- "host_shutdown",
9832
- "timeout",
9833
- "failed",
9834
- "unknown"
9835
- ]),
9836
- startedAt: string2().nullable(),
9837
- endedAt: string2()
9838
- });
9839
- var extensionSessionSchema = object({
9840
- id: string2(),
9841
- title: string2(),
9842
- status: sessionStatusSchema,
9843
- archived: boolean2(),
9844
- agent: string2().nullable(),
9845
- cwd: string2().nullable(),
9846
- lastSelectedModel: string2().nullable(),
9847
- workspaceId: string2().nullable(),
9848
- originalSessionId: string2().nullable(),
9849
- createdAt: string2(),
9850
- updatedAt: string2(),
9851
- lastRequestStarted: string2().nullable(),
9852
- lastRequestEnded: string2().nullable(),
9853
- lastExit: sessionExitSchema.nullable().optional(),
9854
- usage: object({
9855
- inputTokens: number2(),
9856
- outputTokens: number2(),
9857
- cacheReadTokens: number2(),
9858
- cacheWriteTokens: number2()
9859
- }).nullable()
9860
- });
9861
- var sessionSchema = object({
9862
- id: string2(),
9863
- project_id: string2().nullable(),
9864
- title: string2(),
9865
- status: sessionStatusSchema,
9866
- archived: boolean2(),
9867
- last_request_started: string2().nullable(),
9868
- last_request_ended: string2().nullable(),
9869
- agent: string2().nullable(),
9870
- last_selected_model: string2().nullable(),
9871
- agent_session_id: string2().nullable(),
9872
- session_file_id: string2().nullable(),
9873
- original_session_id: string2().nullable(),
9874
- cwd: string2().nullable(),
9875
- params_json: harnessParamsInputSchema.nullable(),
9876
- usage_json: sessionUsageSchema.nullable().optional(),
9877
- workspace_id: string2().nullable().optional(),
9878
- anchors_json: array(extensionResourceRefSchema),
9879
- created_at: string2(),
9880
- updated_at: string2()
9881
- });
9882
- var sessionDetailsSchema = extensionSessionSchema.extend({
9883
- projectId: string2().nullable(),
9884
- agentSessionId: string2().nullable(),
9885
- sessionFileId: string2().nullable(),
9886
- params: harnessParamsInputSchema.nullable()
9887
- });
9888
- var createSessionResponseSchema = sessionSchema.extend(extensionSessionSchema.shape).extend({
9889
- operation_result: harnessOperationResponseSchema.optional()
9890
- });
9891
- var sessionCreateResponseSchema = createSessionResponseSchema.extend(sessionDetailsSchema.shape).extend({
9892
- operationResult: harnessOperationResponseSchema.optional()
9893
- });
9894
- var sessionAttachmentSchema = object({
9895
- file_id: string2(),
9896
- name: string2(),
9897
- mime_type: string2().nullable(),
9898
- size_bytes: number2(),
9899
- hash: string2().nullable(),
9900
- url: string2(),
9901
- created_at: string2(),
9902
- updated_at: string2()
9903
- });
9904
- var createSessionInputSchema = object({
9905
- project_id: string2().min(1),
9906
- title: string2().min(1),
9907
- prompt: string2().optional(),
9908
- operation: harnessOperationSchema.optional(),
9909
- agent: string2().min(1).optional(),
9910
- workspace_id: string2().optional(),
9911
- anchors: array(extensionResourceRefSchema).optional(),
9912
- attachments: array(sessionAttachmentRefSchema).optional(),
9913
- model: string2().optional(),
9914
- params: harnessParamsInputSchema.optional(),
9915
- original_session_id: string2().optional()
9916
- });
9917
- var questionResponseSchema = object({
9918
- answers: array(array(string2())),
9919
- callId: string2().min(1).optional()
9920
- });
9921
- var followUpInputSchema = object({
9922
- prompt: string2().min(1).optional(),
9923
- agent: string2().optional(),
9924
- model: string2().optional(),
9925
- question_response: questionResponseSchema.optional(),
9926
- params: harnessParamsInputSchema.optional(),
9927
- summary_from_session_id: string2().optional(),
9928
- summary_format: _enum(["brief", "detailed"]).default("brief").optional(),
9929
- summary_role: _enum(["assistant", "all"]).default("assistant").optional(),
9930
- attachments: array(sessionAttachmentRefSchema).optional()
9931
- });
9932
- var approvalInputSchema = object({
9933
- id: string2().min(1),
9934
- decision: _enum(["approve", "deny"])
9935
- });
9936
- var followUpDecisionSchema = union([
9937
- object({ status: literal("dispatched") }),
9938
- object({ status: literal("queued"), queue_position: number2().int() })
9939
- ]);
9940
- var followUpResponseSchema = sessionSchema.extend({
9941
- follow_up: followUpDecisionSchema
9942
- });
9943
- var sessionQueuedMessagesResponseSchema = object({
9944
- messages: array(sessionMessageSchema),
9945
- queue: pendingQueuedFollowUpsResponseSchema.optional()
9946
- });
9947
- var sessionConversationSourcesSchema = object({
9948
- checkpoint: array(sessionMessageSchema).nullable(),
9949
- native: array(sessionMessageSchema).nullable(),
9950
- checkpointError: string2().nullable(),
9951
- nativeError: string2().nullable()
9952
- });
9953
- var sessionConversationResponseSchema = object({
9954
- session: sessionSchema,
9955
- messages: array(sessionMessageSchema)
9956
- });
9957
- var resolveSessionIdInputSchema = object({
9958
- agent: string2(),
9959
- agent_session_id: string2(),
9960
- cwd: string2().optional()
9961
- });
9962
- var resolveSessionIdResponseSchema = object({
9963
- session_id: string2().nullable()
9964
- });
9965
- var sessionCreateRequestSchema = createSessionInputSchema.omit({ project_id: true, workspace_id: true, original_session_id: true, attachments: true }).extend({
9966
- attachments: array(object({ fileId: string2().min(1) })).optional(),
9967
- projectId: string2().min(1),
9968
- workspaceId: string2().optional(),
9969
- originalSessionId: string2().optional()
9970
- });
9971
- var sessionAttachmentDetailsSchema = sessionAttachmentSchema.omit({ file_id: true, mime_type: true, size_bytes: true, created_at: true, updated_at: true }).extend({
9972
- fileId: string2(),
9973
- mimeType: string2().nullable(),
9974
- sizeBytes: number2(),
9975
- createdAt: string2(),
9976
- updatedAt: string2()
9977
- });
9978
- var sessionFollowUpRequestSchema = followUpInputSchema.omit({
9979
- question_response: true,
9980
- summary_from_session_id: true,
9981
- summary_format: true,
9982
- summary_role: true,
9983
- attachments: true
9984
- }).extend({
9985
- questionResponse: questionResponseSchema.optional(),
9986
- summaryFromSessionId: string2().optional(),
9987
- summaryFormat: _enum(["brief", "detailed"]).optional(),
9988
- summaryRole: _enum(["assistant", "all"]).optional(),
9989
- attachments: array(object({ fileId: string2().min(1) })).optional()
9990
- });
9991
- var sessionFollowUpDecisionSchema = union([
9992
- object({ status: literal("dispatched") }),
9993
- object({ status: literal("queued"), queuePosition: number2().int() })
9994
- ]);
9995
- var sessionFollowUpResponseSchema = followUpResponseSchema.extend(sessionDetailsSchema.shape).extend({ followUp: sessionFollowUpDecisionSchema });
9996
- // ../pstdio-api-contracts/src/settings.ts
9997
- var settingsSchema = object({
9998
- notifications_enabled: boolean2(),
9999
- machine_tokens_enabled: boolean2(),
10000
- max_concurrent_sessions: number2().int().min(1).nullable()
10001
- });
10002
- var updateSettingsInputSchema = object({
10003
- notifications_enabled: boolean2().optional(),
10004
- machine_tokens_enabled: boolean2().optional(),
10005
- max_concurrent_sessions: number2().int().min(1).nullable().optional()
10006
- }).strict().refine((value) => Object.keys(value).length > 0, { message: "Expected at least one setting" });
10007
- // ../pstdio-api-contracts/src/skills.ts
10008
- var skillFileSchema = object({
10009
- path: string2(),
10010
- content: string2(),
10011
- encoding: literal("utf8")
10012
- });
10013
- var skillSourceKindSchema = _enum(["project", "extension"]);
10014
- var skillAgentInstallationSchema = object({
10015
- agent_id: string2(),
10016
- agent_name: string2(),
10017
- installed_version: string2().nullable()
10018
- });
10019
- var skillSchema = object({
10020
- id: string2(),
10021
- project_id: string2(),
10022
- name: string2(),
10023
- title: string2(),
10024
- description: string2(),
10025
- source_kind: skillSourceKindSchema,
10026
- files: array(skillFileSchema),
10027
- editable: boolean2(),
10028
- extension_instance_id: string2().optional(),
10029
- extension_id: string2().optional(),
10030
- installed_extension_id: string2().optional(),
10031
- install_name: string2().optional(),
10032
- key: string2().optional(),
10033
- source: packageAssetDescriptorSchema.optional(),
10034
- enabled: boolean2().optional(),
10035
- created_at: string2(),
10036
- updated_at: string2(),
10037
- deleted_at: string2().nullable()
10038
- });
10039
- var skillWithContentSchema = skillSchema.extend({
10040
- installed_agents: array(string2()),
10041
- agent_installations: array(skillAgentInstallationSchema)
10042
- });
10043
- var updateSkillInputSchema = object({
10044
- enabled: boolean2().optional(),
10045
- title: string2().min(1).optional(),
10046
- description: string2().optional()
10047
- });
10048
- var skillDetailsSchema = skillSchema.omit({
10049
- project_id: true,
10050
- source_kind: true,
10051
- extension_instance_id: true,
10052
- extension_id: true,
10053
- installed_extension_id: true,
10054
- install_name: true,
10055
- created_at: true,
10056
- updated_at: true,
10057
- deleted_at: true
10058
- }).extend({
10059
- projectId: string2(),
10060
- sourceKind: skillSourceKindSchema,
10061
- extensionInstanceId: string2().optional(),
10062
- extensionId: string2().optional(),
10063
- installedExtensionId: string2().optional(),
10064
- installName: string2().optional(),
10065
- createdAt: string2(),
10066
- updatedAt: string2(),
10067
- deletedAt: string2().nullable()
10068
- });
10069
- var skillAgentInstallationDetailsSchema = object({
10070
- agentId: string2(),
10071
- agentName: string2(),
10072
- installedVersion: string2().nullable()
10073
- });
10074
- var skillWithContentDetailsSchema = skillDetailsSchema.extend({
10075
- installedAgents: array(string2()),
10076
- agentInstallations: array(skillAgentInstallationDetailsSchema)
10077
- });
10078
- // ../pstdio-api-contracts/src/workspace-diffs.ts
10079
- var fileDiffSchema = object({
10080
- filePath: string2(),
10081
- change: _enum(["added", "deleted", "modified", "renamed", "copied", "permissionChange"]),
10082
- additions: number2(),
10083
- deletions: number2(),
10084
- oldContent: string2(),
10085
- newContent: string2(),
10086
- oldPath: string2().optional(),
10087
- newPath: string2().optional()
10088
- });
10089
- var fileDiffSummarySchema = fileDiffSchema.omit({ oldContent: true, newContent: true });
10090
- var workspaceDiffResponseSchema = object({
10091
- workspace_id: string2(),
10092
- base_ref: string2(),
10093
- head_ref: string2(),
10094
- files: array(fileDiffSchema),
10095
- totals: object({
10096
- additions: number2(),
10097
- deletions: number2(),
10098
- file_count: number2()
10099
- })
10100
- });
10101
- var workspaceDiffFilesResponseSchema = workspaceDiffResponseSchema.extend({
10102
- files: array(fileDiffSummarySchema)
10103
- });
10104
- var workspaceDiffSummarySchema = object({
10105
- workspace_id: string2(),
10106
- additions: number2(),
10107
- deletions: number2(),
10108
- file_count: number2()
10109
- });
10110
5852
  export {
10111
5853
  findViewFilterProblem,
10112
5854
  sessionAttachmentMimeTypesByExtension,