@funnycode/myclaude 0.1.158 → 0.1.159

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/myclaude.js CHANGED
@@ -4,8 +4,8 @@
4
4
  // MACRO - build-time constants (injected by build.ts)
5
5
  // MACRO injected by build script
6
6
  globalThis.MACRO = {
7
- VERSION: "0.1.158",
8
- BUILD_TIME: "2026-07-29T16:07:05.507Z",
7
+ VERSION: "0.1.159",
8
+ BUILD_TIME: "2026-07-29T23:20:13.620Z",
9
9
  PACKAGE_URL: "@funnycode/myclaude",
10
10
  NATIVE_PACKAGE_URL: "@funnycode/myclaude",
11
11
  VERSION_CHANGELOG: '',
@@ -100201,55 +100201,6 @@ var require_protocols2 = __commonJS((exports) => {
100201
100201
  }, output), dataObject);
100202
100202
  }
100203
100203
  }
100204
- var _toStr = (val) => {
100205
- if (val == null) {
100206
- return val;
100207
- }
100208
- if (typeof val === "number" || typeof val === "bigint") {
100209
- const warning = new Error(`Received number ${val} where a string was expected.`);
100210
- warning.name = "Warning";
100211
- console.warn(warning);
100212
- return String(val);
100213
- }
100214
- if (typeof val === "boolean") {
100215
- const warning = new Error(`Received boolean ${val} where a string was expected.`);
100216
- warning.name = "Warning";
100217
- console.warn(warning);
100218
- return String(val);
100219
- }
100220
- return val;
100221
- };
100222
- var _toBool = (val) => {
100223
- if (val == null) {
100224
- return val;
100225
- }
100226
- if (typeof val === "string") {
100227
- const lowercase2 = val.toLowerCase();
100228
- if (val !== "" && lowercase2 !== "false" && lowercase2 !== "true") {
100229
- const warning = new Error(`Received string "${val}" where a boolean was expected.`);
100230
- warning.name = "Warning";
100231
- console.warn(warning);
100232
- }
100233
- return val !== "" && lowercase2 !== "false";
100234
- }
100235
- return val;
100236
- };
100237
- var _toNum = (val) => {
100238
- if (val == null) {
100239
- return val;
100240
- }
100241
- if (typeof val === "string") {
100242
- const num = Number(val);
100243
- if (num.toString() !== val) {
100244
- const warning = new Error(`Received string "${val}" where a number was expected.`);
100245
- warning.name = "Warning";
100246
- console.warn(warning);
100247
- return val;
100248
- }
100249
- return num;
100250
- }
100251
- return val;
100252
- };
100253
100204
 
100254
100205
  class SerdeContextConfig {
100255
100206
  serdeContext;
@@ -101048,15 +100999,667 @@ var require_protocols2 = __commonJS((exports) => {
101048
100999
  return "application/json";
101049
101000
  }
101050
101001
  }
101051
- var awsExpectUnion = (value) => {
101052
- if (value == null) {
101053
- return;
101002
+
101003
+ class JsonShapeDeserializer2 extends SerdeContextConfig {
101004
+ settings;
101005
+ constructor(settings) {
101006
+ super();
101007
+ this.settings = settings;
101054
101008
  }
101055
- if (typeof value === "object" && "__type" in value) {
101056
- delete value.__type;
101009
+ async read(schema, data) {
101010
+ const reviver = needsReviver(schema) ? jsonReviver : undefined;
101011
+ let parsed;
101012
+ if (typeof data === "string") {
101013
+ parsed = JSON.parse(data, reviver);
101014
+ } else if (data instanceof Uint8Array && detectBufferParsing()) {
101015
+ const buf = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
101016
+ parsed = JSON.parse(buf, reviver);
101017
+ } else {
101018
+ parsed = await parseJsonBody(data, this.serdeContext);
101019
+ }
101020
+ return this._read(schema, parsed);
101057
101021
  }
101058
- return expectUnion(value);
101059
- };
101022
+ readObject(schema, data) {
101023
+ return this._read(schema, data);
101024
+ }
101025
+ _read(schema, value) {
101026
+ const isObject5 = value !== null && typeof value === "object";
101027
+ const ns = NormalizedSchema.of(schema);
101028
+ if (isObject5) {
101029
+ if (ns.isStructSchema()) {
101030
+ return this._readStruct(ns, value);
101031
+ }
101032
+ if (Array.isArray(value) && ns.isListSchema()) {
101033
+ const listMember = ns.getValueSchema();
101034
+ for (let i2 = 0;i2 < value.length; ++i2) {
101035
+ value[i2] = this._read(listMember, value[i2]);
101036
+ }
101037
+ return value;
101038
+ }
101039
+ if (ns.isMapSchema()) {
101040
+ const mapMember = ns.getValueSchema();
101041
+ const map2 = value;
101042
+ for (const k in map2) {
101043
+ if (k === "__proto__") {
101044
+ writeKey(map2);
101045
+ }
101046
+ map2[k] = this._read(mapMember, map2[k]);
101047
+ }
101048
+ return map2;
101049
+ }
101050
+ }
101051
+ if (ns.isBlobSchema() && typeof value === "string") {
101052
+ return fromBase64(value);
101053
+ }
101054
+ const mediaType = ns.getMergedTraits().mediaType;
101055
+ if (ns.isStringSchema() && typeof value === "string" && mediaType) {
101056
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
101057
+ if (isJson) {
101058
+ return LazyJsonString.from(value);
101059
+ }
101060
+ return value;
101061
+ }
101062
+ if (ns.isTimestampSchema() && value != null) {
101063
+ const format3 = determineTimestampFormat(ns, this.settings);
101064
+ switch (format3) {
101065
+ case 5:
101066
+ return parseRfc3339DateTimeWithOffset(value);
101067
+ case 6:
101068
+ return parseRfc7231DateTime(value);
101069
+ case 7:
101070
+ return parseEpochTimestamp(value);
101071
+ default:
101072
+ console.warn("Missing timestamp format, parsing value with Date constructor:", value);
101073
+ return new Date(value);
101074
+ }
101075
+ }
101076
+ if (ns.isBigIntegerSchema() && (typeof value === "number" || typeof value === "string")) {
101077
+ return BigInt(value);
101078
+ }
101079
+ if (ns.isBigDecimalSchema() && value != null) {
101080
+ if (value instanceof NumericValue) {
101081
+ return value;
101082
+ }
101083
+ const untyped = value;
101084
+ if (untyped.type === "bigDecimal" && "string" in untyped) {
101085
+ return new NumericValue(untyped.string, untyped.type);
101086
+ }
101087
+ return new NumericValue(String(value), "bigDecimal");
101088
+ }
101089
+ if (ns.isNumericSchema() && typeof value === "string") {
101090
+ switch (value) {
101091
+ case "Infinity":
101092
+ return Infinity;
101093
+ case "-Infinity":
101094
+ return -Infinity;
101095
+ case "NaN":
101096
+ return NaN;
101097
+ }
101098
+ return value;
101099
+ }
101100
+ if (ns.isDocumentSchema()) {
101101
+ if (isObject5) {
101102
+ if (Array.isArray(value)) {
101103
+ for (let i2 = 0;i2 < value.length; ++i2) {
101104
+ const v = value[i2];
101105
+ if (!(v instanceof NumericValue)) {
101106
+ value[i2] = this._read(ns, v);
101107
+ }
101108
+ }
101109
+ } else {
101110
+ const doc2 = value;
101111
+ for (const k in doc2) {
101112
+ if (k === "__proto__") {
101113
+ writeKey(doc2);
101114
+ }
101115
+ const v = doc2[k];
101116
+ if (!(v instanceof NumericValue)) {
101117
+ doc2[k] = this._read(ns, v);
101118
+ }
101119
+ }
101120
+ }
101121
+ return value;
101122
+ } else {
101123
+ return value;
101124
+ }
101125
+ }
101126
+ return value;
101127
+ }
101128
+ _readStruct(ns, record2) {
101129
+ const union2 = ns.isUnionSchema();
101130
+ const out = {};
101131
+ let nameMap = undefined;
101132
+ const { jsonName } = this.settings;
101133
+ if (jsonName) {
101134
+ nameMap = {};
101135
+ }
101136
+ let unionSerde;
101137
+ if (union2) {
101138
+ unionSerde = new UnionSerde(record2, out);
101139
+ }
101140
+ for (const [memberName, memberSchema] of ns.structIterator()) {
101141
+ let fromKey = memberName;
101142
+ if (jsonName) {
101143
+ fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
101144
+ nameMap[fromKey] = memberName;
101145
+ }
101146
+ if (union2) {
101147
+ unionSerde.mark(fromKey);
101148
+ }
101149
+ if (record2[fromKey] != null) {
101150
+ out[memberName] = this._read(memberSchema, record2[fromKey]);
101151
+ }
101152
+ }
101153
+ if (union2) {
101154
+ unionSerde.writeUnknown();
101155
+ } else if (typeof record2.__type === "string") {
101156
+ for (const k in record2) {
101157
+ const v = record2[k];
101158
+ const t = jsonName ? nameMap[k] ?? k : k;
101159
+ if (!(t in out)) {
101160
+ out[t] = v;
101161
+ }
101162
+ }
101163
+ }
101164
+ return out;
101165
+ }
101166
+ }
101167
+ var encoder2 = new TextEncoder;
101168
+ var OPEN_BRACE = 123;
101169
+ var CLOSE_BRACE = 125;
101170
+ var OPEN_BRACKET = 91;
101171
+ var CLOSE_BRACKET = 93;
101172
+ var QUOTE = 34;
101173
+ var COLON = 58;
101174
+ var COMMA = 44;
101175
+ var BACKSLASH = 92;
101176
+ var TRUE = new Uint8Array([116, 114, 117, 101]);
101177
+ var FALSE = new Uint8Array([102, 97, 108, 115, 101]);
101178
+ var NULL = new Uint8Array([110, 117, 108, 108]);
101179
+ var ESCAPE_TABLE = new Array(128).fill(null);
101180
+ ESCAPE_TABLE[8] = "b";
101181
+ ESCAPE_TABLE[9] = "t";
101182
+ ESCAPE_TABLE[10] = "n";
101183
+ ESCAPE_TABLE[12] = "f";
101184
+ ESCAPE_TABLE[13] = "r";
101185
+ ESCAPE_TABLE[34] = '"';
101186
+ ESCAPE_TABLE[92] = "\\";
101187
+ for (let i2 = 0;i2 < 32; i2++) {
101188
+ if (ESCAPE_TABLE[i2] === null) {
101189
+ ESCAPE_TABLE[i2] = "u00" + i2.toString(16).padStart(2, "0");
101190
+ }
101191
+ }
101192
+ var INITIAL_BUFFER_SIZE = 2048;
101193
+ function alloc(size) {
101194
+ return typeof Buffer !== "undefined" ? Buffer.allocUnsafe(size) : new Uint8Array(size);
101195
+ }
101196
+
101197
+ class JsonShapeSerializer2 extends SerdeContextConfig {
101198
+ settings;
101199
+ json;
101200
+ i = 0;
101201
+ rootSchema;
101202
+ rawValue;
101203
+ passthrough = false;
101204
+ constructor(settings) {
101205
+ super();
101206
+ this.settings = settings;
101207
+ this.json = alloc(INITIAL_BUFFER_SIZE);
101208
+ }
101209
+ write(schema, value) {
101210
+ this.i = 0;
101211
+ this.rawValue = value;
101212
+ this.rootSchema = NormalizedSchema.of(schema);
101213
+ this.passthrough = !this.rootSchema.isStructSchema() && !this.rootSchema.isDocumentSchema() && (this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema());
101214
+ if (!this.passthrough) {
101215
+ this.writeValue(this.rootSchema, value, undefined);
101216
+ }
101217
+ }
101218
+ writeDiscriminatedDocument(schema, value) {
101219
+ this.i = 0;
101220
+ this.rootSchema = NormalizedSchema.of(schema);
101221
+ const ns = this.rootSchema;
101222
+ if (ns.isStructSchema() && value != null && typeof value === "object") {
101223
+ this.ensure(2);
101224
+ this.json[this.i++] = OPEN_BRACE;
101225
+ this.writeAsciiQuoted("__type");
101226
+ this.json[this.i++] = COLON;
101227
+ this.writeAsciiQuoted(ns.getName(true) ?? "Unknown");
101228
+ let wroteAny = true;
101229
+ const { jsonName } = this.settings;
101230
+ for (const [memberName, memberSchema] of ns.structIterator()) {
101231
+ const item = value[memberName];
101232
+ if (item == null && !memberSchema.isIdempotencyToken()) {
101233
+ continue;
101234
+ }
101235
+ if (wroteAny) {
101236
+ this.ensure(1);
101237
+ this.json[this.i++] = COMMA;
101238
+ }
101239
+ const targetKey = jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
101240
+ this.writeAsciiQuoted(targetKey);
101241
+ this.json[this.i++] = COLON;
101242
+ this.writeValue(memberSchema, item, ns);
101243
+ wroteAny = true;
101244
+ }
101245
+ this.ensure(1);
101246
+ this.json[this.i++] = CLOSE_BRACE;
101247
+ } else {
101248
+ this.writeValue(ns, value, undefined);
101249
+ }
101250
+ }
101251
+ flush() {
101252
+ this.rootSchema = undefined;
101253
+ const finalPosition = this.i;
101254
+ this.i = 0;
101255
+ const raw = this.rawValue;
101256
+ this.rawValue = undefined;
101257
+ if (finalPosition === 0) {
101258
+ return raw;
101259
+ }
101260
+ const result = this.json.subarray(0, finalPosition);
101261
+ this.json = alloc(INITIAL_BUFFER_SIZE);
101262
+ return result;
101263
+ }
101264
+ ensure(byteCount) {
101265
+ const { i: i2, json: json2 } = this;
101266
+ if (i2 + byteCount > json2.length) {
101267
+ let newSize = json2.length * 2;
101268
+ while (newSize < i2 + byteCount) {
101269
+ newSize *= 2;
101270
+ }
101271
+ const next = alloc(newSize);
101272
+ next.set(this.json);
101273
+ this.json = next;
101274
+ }
101275
+ }
101276
+ writeAscii(s) {
101277
+ const z3 = s.length;
101278
+ this.ensure(z3);
101279
+ let { i: i2, json: json2 } = this;
101280
+ for (let j = 0;j < z3; ++j) {
101281
+ json2[i2] = s.charCodeAt(j);
101282
+ i2 += 1;
101283
+ }
101284
+ this.i = i2;
101285
+ }
101286
+ writeAsciiQuoted(s) {
101287
+ const z3 = s.length;
101288
+ this.ensure(z3 + 4);
101289
+ let { json: json2, i: i2 } = this;
101290
+ json2[i2++] = QUOTE;
101291
+ for (let j = 0;j < z3; ++j) {
101292
+ json2[i2++] = s.charCodeAt(j);
101293
+ }
101294
+ json2[i2++] = QUOTE;
101295
+ this.i = i2;
101296
+ }
101297
+ writeJsonString(s) {
101298
+ this.ensure(s.length * 2 + 2);
101299
+ this.json[this.i++] = QUOTE;
101300
+ const z3 = s.length;
101301
+ for (let j = 0;j < z3; ++j) {
101302
+ const c5 = s.charCodeAt(j);
101303
+ if (c5 > 34 && c5 < 92) {
101304
+ this.json[this.i++] = c5;
101305
+ } else if (c5 < 128) {
101306
+ const esc2 = ESCAPE_TABLE[c5];
101307
+ if (esc2 !== null) {
101308
+ this.ensure(esc2.length + 1);
101309
+ this.json[this.i++] = BACKSLASH;
101310
+ for (let k = 0;k < esc2.length; k++) {
101311
+ this.json[this.i++] = esc2.charCodeAt(k);
101312
+ }
101313
+ } else {
101314
+ this.json[this.i++] = c5;
101315
+ }
101316
+ } else if (c5 >= 55296 && c5 <= 56319) {
101317
+ const next = j + 1 < z3 ? s.charCodeAt(j + 1) : 0;
101318
+ if (next >= 56320 && next <= 57343) {
101319
+ this.ensure(4);
101320
+ const { written } = encoder2.encodeInto(s.substring(j, j + 2), this.json.subarray(this.i));
101321
+ this.i += written;
101322
+ j++;
101323
+ } else {
101324
+ this.ensure(6);
101325
+ this.writeUnicodeEscape(c5);
101326
+ }
101327
+ } else if (c5 >= 56320 && c5 <= 57343) {
101328
+ this.ensure(6);
101329
+ this.writeUnicodeEscape(c5);
101330
+ } else {
101331
+ let { i: i2, json: json2 } = this;
101332
+ if (c5 < 2048) {
101333
+ json2[i2++] = 192 | c5 >> 6;
101334
+ json2[i2++] = 128 | c5 & 63;
101335
+ } else {
101336
+ json2[i2++] = 224 | c5 >> 12;
101337
+ json2[i2++] = 128 | c5 >> 6 & 63;
101338
+ json2[i2++] = 128 | c5 & 63;
101339
+ }
101340
+ this.i = i2;
101341
+ }
101342
+ }
101343
+ this.json[this.i++] = QUOTE;
101344
+ }
101345
+ writeUnicodeEscape(code) {
101346
+ let { json: json2, i: i2 } = this;
101347
+ json2[i2++] = BACKSLASH;
101348
+ json2[i2++] = 117;
101349
+ const hex3 = code.toString(16).padStart(4, "0");
101350
+ for (let j = 0;j < 4; ++j) {
101351
+ json2[i2++] = hex3.charCodeAt(j);
101352
+ }
101353
+ this.i = i2;
101354
+ }
101355
+ static B64 = (() => {
101356
+ const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
101357
+ const table = new Uint8Array(64);
101358
+ for (let i2 = 0;i2 < 64; i2++)
101359
+ table[i2] = chars.charCodeAt(i2);
101360
+ return table;
101361
+ })();
101362
+ writeBase64(data) {
101363
+ const b64Len = Math.ceil(data.length / 3) * 4;
101364
+ this.ensure(b64Len + 2);
101365
+ const json2 = this.json;
101366
+ const B64 = JsonShapeSerializer2.B64;
101367
+ let i2 = this.i;
101368
+ json2[i2++] = QUOTE;
101369
+ const len = data.length;
101370
+ const remainder = len % 3;
101371
+ const mainLen = len - remainder;
101372
+ for (let j = 0;j < mainLen; j += 3) {
101373
+ const a2 = data[j];
101374
+ const b = data[j + 1];
101375
+ const c5 = data[j + 2];
101376
+ json2[i2++] = B64[a2 >> 2];
101377
+ json2[i2++] = B64[(a2 & 3) << 4 | b >> 4];
101378
+ json2[i2++] = B64[(b & 15) << 2 | c5 >> 6];
101379
+ json2[i2++] = B64[c5 & 63];
101380
+ }
101381
+ if (remainder === 2) {
101382
+ const a2 = data[mainLen];
101383
+ const b = data[mainLen + 1];
101384
+ json2[i2++] = B64[a2 >> 2];
101385
+ json2[i2++] = B64[(a2 & 3) << 4 | b >> 4];
101386
+ json2[i2++] = B64[(b & 15) << 2];
101387
+ json2[i2++] = 61;
101388
+ } else if (remainder === 1) {
101389
+ const a2 = data[mainLen];
101390
+ json2[i2++] = B64[a2 >> 2];
101391
+ json2[i2++] = B64[(a2 & 3) << 4];
101392
+ json2[i2++] = 61;
101393
+ json2[i2++] = 61;
101394
+ }
101395
+ json2[i2++] = QUOTE;
101396
+ this.i = i2;
101397
+ }
101398
+ writeValue(schema, value, container) {
101399
+ if (value == null) {
101400
+ if (container?.isStructSchema()) {
101401
+ if (value === undefined) {
101402
+ const ns2 = NormalizedSchema.of(schema);
101403
+ if (ns2.isIdempotencyToken()) {
101404
+ this.writeAsciiQuoted(generateIdempotencyToken());
101405
+ return;
101406
+ }
101407
+ }
101408
+ return;
101409
+ }
101410
+ this.ensure(4);
101411
+ this.json.set(NULL, this.i);
101412
+ this.i += 4;
101413
+ return;
101414
+ }
101415
+ const ns = NormalizedSchema.of(schema);
101416
+ const isObject5 = typeof value === "object";
101417
+ if (ns.isStringSchema()) {
101418
+ const mediaType = ns.getMergedTraits().mediaType;
101419
+ if (mediaType) {
101420
+ const isJson = mediaType === "application/json" || mediaType.endsWith("+json");
101421
+ if (isJson) {
101422
+ this.writeJsonString(LazyJsonString.from(value).toString());
101423
+ return;
101424
+ }
101425
+ }
101426
+ }
101427
+ if (isObject5) {
101428
+ if (ns.isStructSchema()) {
101429
+ this.writeStruct(ns, value);
101430
+ return;
101431
+ }
101432
+ if (Array.isArray(value) && (ns.isListSchema() || ns.isDocumentSchema())) {
101433
+ this.writeList(ns, value, ns.isDocumentSchema());
101434
+ return;
101435
+ }
101436
+ if (ns.isMapSchema()) {
101437
+ this.writeMap(ns, value, false);
101438
+ return;
101439
+ }
101440
+ if (value instanceof Uint8Array && (ns.isBlobSchema() || ns.isDocumentSchema())) {
101441
+ this.writeBase64(value);
101442
+ return;
101443
+ }
101444
+ if (value instanceof Date && (ns.isTimestampSchema() || ns.isDocumentSchema())) {
101445
+ this.writeTimestamp(ns, value);
101446
+ return;
101447
+ }
101448
+ if (value instanceof NumericValue) {
101449
+ this.writeAscii(value.string);
101450
+ return;
101451
+ }
101452
+ if (ns.isDocumentSchema()) {
101453
+ if (Array.isArray(value)) {
101454
+ this.writeList(ns, value, true);
101455
+ } else {
101456
+ this.writeMap(ns, value, true);
101457
+ }
101458
+ return;
101459
+ }
101460
+ const json2 = JSON.stringify(value);
101461
+ this.writeAscii(json2);
101462
+ return;
101463
+ }
101464
+ if (typeof value === "string") {
101465
+ if (ns.isBlobSchema()) {
101466
+ const b64 = (this.serdeContext?.base64Encoder ?? toBase64)(value);
101467
+ this.writeAsciiQuoted(b64);
101468
+ return;
101469
+ }
101470
+ this.writeJsonString(value);
101471
+ return;
101472
+ }
101473
+ if (typeof value === "number") {
101474
+ if (ns.isNumericSchema() && (Math.abs(value) === Infinity || isNaN(value))) {
101475
+ this.writeAsciiQuoted(String(value));
101476
+ return;
101477
+ }
101478
+ const numStr = String(value);
101479
+ this.writeAscii(numStr);
101480
+ return;
101481
+ }
101482
+ if (typeof value === "boolean") {
101483
+ this.ensure(5);
101484
+ if (value) {
101485
+ this.json.set(TRUE, this.i);
101486
+ this.i += 4;
101487
+ } else {
101488
+ this.json.set(FALSE, this.i);
101489
+ this.i += 5;
101490
+ }
101491
+ return;
101492
+ }
101493
+ if (typeof value === "bigint") {
101494
+ this.writeAscii(value.toString());
101495
+ return;
101496
+ }
101497
+ this.writeAscii(String(value));
101498
+ }
101499
+ writeStruct(ns, value) {
101500
+ this.ensure(2);
101501
+ this.json[this.i++] = OPEN_BRACE;
101502
+ let first = true;
101503
+ let wroteAny = false;
101504
+ const hasType = typeof value.__type === "string";
101505
+ let writtenKeys;
101506
+ if (hasType) {
101507
+ writtenKeys = new Set;
101508
+ }
101509
+ for (const [memberName, memberSchema] of ns.structIterator()) {
101510
+ const item = value[memberName];
101511
+ if (item == null && !memberSchema.isIdempotencyToken())
101512
+ continue;
101513
+ if (!first) {
101514
+ this.ensure(1);
101515
+ this.json[this.i++] = COMMA;
101516
+ }
101517
+ first = false;
101518
+ wroteAny = true;
101519
+ const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
101520
+ if (writtenKeys) {
101521
+ writtenKeys.add(memberName);
101522
+ writtenKeys.add(targetKey);
101523
+ }
101524
+ this.writeAsciiQuoted(targetKey);
101525
+ this.json[this.i++] = COLON;
101526
+ this.writeValue(memberSchema, item, ns);
101527
+ }
101528
+ if (!wroteAny && ns.isUnionSchema()) {
101529
+ const { $unknown } = value;
101530
+ if (Array.isArray($unknown)) {
101531
+ const [k, v] = $unknown;
101532
+ this.writeAsciiQuoted(k);
101533
+ this.ensure(1);
101534
+ this.json[this.i++] = COLON;
101535
+ this.writeValue(15, v, ns);
101536
+ }
101537
+ } else if (hasType) {
101538
+ for (const k in value) {
101539
+ const targetKey = this.settings.jsonName ? writtenKeys.has(k) ? k : k : k;
101540
+ if (writtenKeys.has(targetKey))
101541
+ continue;
101542
+ writtenKeys.add(targetKey);
101543
+ const v = value[k];
101544
+ if (!first) {
101545
+ this.ensure(1);
101546
+ this.json[this.i++] = COMMA;
101547
+ }
101548
+ first = false;
101549
+ this.writeAsciiQuoted(targetKey);
101550
+ this.ensure(1);
101551
+ this.json[this.i++] = COLON;
101552
+ this.writeValue(15, v, undefined);
101553
+ }
101554
+ }
101555
+ this.ensure(1);
101556
+ this.json[this.i++] = CLOSE_BRACE;
101557
+ }
101558
+ writeList(ns, value, isDocument) {
101559
+ this.ensure(2);
101560
+ this.json[this.i++] = OPEN_BRACKET;
101561
+ const sparse = !!ns.getMergedTraits().sparse;
101562
+ const valueSchema = ns.getValueSchema();
101563
+ for (let i2 = 0;i2 < value.length; ++i2) {
101564
+ const item = value[i2];
101565
+ if (isDocument ? item === undefined : item == null && !sparse) {
101566
+ continue;
101567
+ }
101568
+ if (i2 !== 0) {
101569
+ this.ensure(1);
101570
+ this.json[this.i++] = COMMA;
101571
+ }
101572
+ this.writeValue(valueSchema, item, undefined);
101573
+ }
101574
+ this.ensure(1);
101575
+ this.json[this.i++] = CLOSE_BRACKET;
101576
+ }
101577
+ writeMap(ns, value, isDocument) {
101578
+ const sparse = !!ns.getMergedTraits().sparse;
101579
+ const valueSchema = ns.getValueSchema();
101580
+ if (!isDocument) {
101581
+ if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
101582
+ let input = value;
101583
+ if (sparse) {
101584
+ input = {};
101585
+ for (const k in value) {
101586
+ if (k === "__proto__") {
101587
+ writeKey(input);
101588
+ }
101589
+ input[k] = value[k] ?? null;
101590
+ }
101591
+ }
101592
+ const json2 = JSON.stringify(input);
101593
+ this.ensure(json2.length * 3);
101594
+ const { written } = encoder2.encodeInto(json2, this.json.subarray(this.i));
101595
+ this.i += written;
101596
+ return;
101597
+ }
101598
+ }
101599
+ this.ensure(2);
101600
+ this.json[this.i++] = OPEN_BRACE;
101601
+ let first = true;
101602
+ for (const k in value) {
101603
+ const v = value[k];
101604
+ if (isDocument ? v === undefined : v == null && !sparse) {
101605
+ continue;
101606
+ }
101607
+ if (!first) {
101608
+ this.ensure(1);
101609
+ this.json[this.i++] = COMMA;
101610
+ }
101611
+ first = false;
101612
+ this.writeJsonString(k);
101613
+ this.ensure(1);
101614
+ this.json[this.i++] = COLON;
101615
+ this.writeValue(valueSchema, v, undefined);
101616
+ }
101617
+ this.ensure(1);
101618
+ this.json[this.i++] = CLOSE_BRACE;
101619
+ }
101620
+ writeTimestamp(ns, value) {
101621
+ const format3 = determineTimestampFormat(ns, this.settings);
101622
+ switch (format3) {
101623
+ case 5: {
101624
+ const iso = value.toISOString().replace(".000Z", "Z");
101625
+ this.writeAsciiQuoted(iso);
101626
+ return;
101627
+ }
101628
+ case 6: {
101629
+ this.writeAsciiQuoted(dateToUtcString(value));
101630
+ return;
101631
+ }
101632
+ case 7: {
101633
+ const epochSecs = String(value.getTime() / 1000);
101634
+ this.writeAscii(epochSecs);
101635
+ return;
101636
+ }
101637
+ default: {
101638
+ const epochSecs = String(value.getTime() / 1000);
101639
+ this.writeAscii(epochSecs);
101640
+ return;
101641
+ }
101642
+ }
101643
+ }
101644
+ }
101645
+
101646
+ class JsonCodec2 extends SerdeContextConfig {
101647
+ settings;
101648
+ constructor(settings) {
101649
+ super();
101650
+ this.settings = settings;
101651
+ }
101652
+ createSerializer() {
101653
+ const serializer = new JsonShapeSerializer2(this.settings);
101654
+ serializer.setSerdeContext(this.serdeContext);
101655
+ return serializer;
101656
+ }
101657
+ createDeserializer() {
101658
+ const deserializer = new JsonShapeDeserializer2(this.settings);
101659
+ deserializer.setSerdeContext(this.serdeContext);
101660
+ return deserializer;
101661
+ }
101662
+ }
101060
101663
 
101061
101664
  class XmlShapeDeserializer extends SerdeContextConfig {
101062
101665
  settings;
@@ -101934,6 +102537,64 @@ var require_protocols2 = __commonJS((exports) => {
101934
102537
  return false;
101935
102538
  }
101936
102539
  }
102540
+ var awsExpectUnion = (value) => {
102541
+ if (value == null) {
102542
+ return;
102543
+ }
102544
+ if (typeof value === "object" && "__type" in value) {
102545
+ delete value.__type;
102546
+ }
102547
+ return expectUnion(value);
102548
+ };
102549
+ var _toStr = (val) => {
102550
+ if (val == null) {
102551
+ return val;
102552
+ }
102553
+ if (typeof val === "number" || typeof val === "bigint") {
102554
+ const warning = new Error(`Received number ${val} where a string was expected.`);
102555
+ warning.name = "Warning";
102556
+ console.warn(warning);
102557
+ return String(val);
102558
+ }
102559
+ if (typeof val === "boolean") {
102560
+ const warning = new Error(`Received boolean ${val} where a string was expected.`);
102561
+ warning.name = "Warning";
102562
+ console.warn(warning);
102563
+ return String(val);
102564
+ }
102565
+ return val;
102566
+ };
102567
+ var _toBool = (val) => {
102568
+ if (val == null) {
102569
+ return val;
102570
+ }
102571
+ if (typeof val === "string") {
102572
+ const lowercase2 = val.toLowerCase();
102573
+ if (val !== "" && lowercase2 !== "false" && lowercase2 !== "true") {
102574
+ const warning = new Error(`Received string "${val}" where a boolean was expected.`);
102575
+ warning.name = "Warning";
102576
+ console.warn(warning);
102577
+ }
102578
+ return val !== "" && lowercase2 !== "false";
102579
+ }
102580
+ return val;
102581
+ };
102582
+ var _toNum = (val) => {
102583
+ if (val == null) {
102584
+ return val;
102585
+ }
102586
+ if (typeof val === "string") {
102587
+ const num = Number(val);
102588
+ if (num.toString() !== val) {
102589
+ const warning = new Error(`Received string "${val}" where a number was expected.`);
102590
+ warning.name = "Warning";
102591
+ console.warn(warning);
102592
+ return val;
102593
+ }
102594
+ return num;
102595
+ }
102596
+ return val;
102597
+ };
101937
102598
  exports.AwsEc2QueryProtocol = AwsEc2QueryProtocol;
101938
102599
  exports.AwsJson1_0Protocol = AwsJson1_0Protocol;
101939
102600
  exports.AwsJson1_1Protocol = AwsJson1_1Protocol;
@@ -101943,8 +102604,11 @@ var require_protocols2 = __commonJS((exports) => {
101943
102604
  exports.AwsRestXmlProtocol = AwsRestXmlProtocol;
101944
102605
  exports.AwsSmithyRpcV2CborProtocol = AwsSmithyRpcV2CborProtocol;
101945
102606
  exports.JsonCodec = JsonCodec;
102607
+ exports.JsonCodec2 = JsonCodec2;
101946
102608
  exports.JsonShapeDeserializer = JsonShapeDeserializer;
102609
+ exports.JsonShapeDeserializer2 = JsonShapeDeserializer2;
101947
102610
  exports.JsonShapeSerializer = JsonShapeSerializer;
102611
+ exports.JsonShapeSerializer2 = JsonShapeSerializer2;
101948
102612
  exports.QueryShapeSerializer = QueryShapeSerializer;
101949
102613
  exports.XmlCodec = XmlCodec;
101950
102614
  exports.XmlShapeDeserializer = XmlShapeDeserializer;
@@ -102040,7 +102704,7 @@ var require_sso_oidc = __commonJS((exports) => {
102040
102704
  Region: { type: "builtInParams", name: "region" },
102041
102705
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
102042
102706
  };
102043
- var version2 = "3.997.36";
102707
+ var version2 = "3.997.37";
102044
102708
  var packageInfo = {
102045
102709
  version: version2
102046
102710
  };
@@ -102937,7 +103601,7 @@ var require_sso = __commonJS((exports) => {
102937
103601
  Region: { type: "builtInParams", name: "region" },
102938
103602
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
102939
103603
  };
102940
- var version2 = "3.997.36";
103604
+ var version2 = "3.997.37";
102941
103605
  var packageInfo = {
102942
103606
  version: version2
102943
103607
  };
@@ -104031,7 +104695,7 @@ var require_sts = __commonJS((exports) => {
104031
104695
  Region: { type: "builtInParams", name: "region" },
104032
104696
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
104033
104697
  };
104034
- var version2 = "3.997.36";
104698
+ var version2 = "3.997.37";
104035
104699
  var packageInfo = {
104036
104700
  version: version2
104037
104701
  };
@@ -104800,7 +105464,7 @@ var require_signin = __commonJS((exports) => {
104800
105464
  Region: { type: "builtInParams", name: "region" },
104801
105465
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
104802
105466
  };
104803
- var version2 = "3.997.36";
105467
+ var version2 = "3.997.37";
104804
105468
  var packageInfo = {
104805
105469
  version: version2
104806
105470
  };
@@ -119165,7 +119829,7 @@ var package_default;
119165
119829
  var init_package = __esm(() => {
119166
119830
  package_default = {
119167
119831
  name: "@funnycode/myclaude",
119168
- version: "0.1.158",
119832
+ version: "0.1.159",
119169
119833
  private: false,
119170
119834
  description: "An open-source AI coding assistant in your terminal - powered by Claude",
119171
119835
  license: "MIT",
@@ -565705,9 +566369,9 @@ function migrateEnableAllProjectMcpServersToSettings() {
565705
566369
  const originalProjectConfig = { ...projectConfig };
565706
566370
  const originalSettingsKeys = new Set(Object.keys(originalSettings));
565707
566371
  const fieldsToRemove = [];
566372
+ const updates = {};
565708
566373
  try {
565709
566374
  const existingSettings = originalSettings;
565710
- const updates = {};
565711
566375
  if (hasEnableAll) {
565712
566376
  updates.enableAllProjectMcpServers = projectConfig.enableAllProjectMcpServers;
565713
566377
  fieldsToRemove.push("enableAllProjectMcpServers");
@@ -565755,12 +566419,12 @@ function migrateEnableAllProjectMcpServersToSettings() {
565755
566419
  }
565756
566420
  const existingHadEnabledServers = Array.isArray(existingSettings.enabledMcpjsonServers);
565757
566421
  const existingHadDisabledServers = Array.isArray(existingSettings.disabledMcpjsonServers);
565758
- const hasNonEmptyEnabledServers = hasEnabledServers && Array.isArray(projectConfig.enabledMcpjsonServers) && projectConfig.enabledMcpjsonServers.length > 0;
565759
- const hasNonEmptyDisabledServers = hasDisabledServers && Array.isArray(projectConfig.disabledMcpjsonServers) && projectConfig.disabledMcpjsonServers.length > 0;
565760
- if (existingHadEnabledServers || hasNonEmptyEnabledServers) {
566422
+ const hasEnabledServersArray = hasEnabledServers && Array.isArray(projectConfig.enabledMcpjsonServers);
566423
+ const hasDisabledServersArray = hasDisabledServers && Array.isArray(projectConfig.disabledMcpjsonServers);
566424
+ if (existingHadEnabledServers || hasEnabledServersArray) {
565761
566425
  updates.enabledMcpjsonServers = existingEnabledServers;
565762
566426
  }
565763
- if (existingHadDisabledServers || hasNonEmptyDisabledServers) {
566427
+ if (existingHadDisabledServers || hasDisabledServersArray) {
565764
566428
  updates.disabledMcpjsonServers = existingDisabledServers;
565765
566429
  }
565766
566430
  updateSettingsForSource("localSettings", updates);
@@ -565811,7 +566475,22 @@ function migrateEnableAllProjectMcpServersToSettings() {
565811
566475
  } catch (rollbackError) {
565812
566476
  logError2("Rollback of project config failed", rollbackError);
565813
566477
  rollbackFailed = true;
565814
- logError2("Settings rollback succeeded but project config rollback failed. " + "System is in an inconsistent state. Manual intervention may be required.", rollbackError);
566478
+ if (settingsRollbackSucceeded) {
566479
+ try {
566480
+ const reapplyUpdates = {};
566481
+ for (const field of migratedFields) {
566482
+ if (updates[field] !== undefined) {
566483
+ reapplyUpdates[field] = updates[field];
566484
+ }
566485
+ }
566486
+ updateSettingsForSource("localSettings", reapplyUpdates);
566487
+ logError2("Re-applied migrated state to settings after project config rollback failure. " + "System is now consistent (migration state re-applied).", rollbackError);
566488
+ } catch (reapplyError) {
566489
+ logError2("Failed to re-apply migrated state to settings after project config rollback failure. " + "System is in an inconsistent state. Manual intervention may be required.", reapplyError);
566490
+ }
566491
+ } else {
566492
+ logError2("Settings rollback succeeded but project config rollback failed. " + "System is in an inconsistent state. Manual intervention may be required.", rollbackError);
566493
+ }
565815
566494
  }
565816
566495
  if (rollbackFailed) {
565817
566496
  throw new Error("Migration failed and rollback was incomplete. The system may be in an inconsistent state. " + "Original error: " + (error49 instanceof Error ? error49.message : String(error49)));