@hasna/skills 0.5.2 → 0.5.3
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/README.md +169 -1
- package/bin/index.js +1182 -623
- package/bin/mcp.js +28155 -26920
- package/bin/migrate.js +172 -1
- package/bin/server.js +187 -1
- package/bin/worker.js +225 -40
- package/dist/cli/commands/invitation-recovery.d.ts +2 -0
- package/dist/cli/commands/invitation-verification.d.ts +8 -0
- package/dist/cli/commands/workspace-invitations.d.ts +2 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +987 -165
- package/dist/lib/invitation-customer-action.d.ts +14 -0
- package/dist/lib/invitation-recovery-target.d.ts +5 -0
- package/dist/lib/remote-auth.d.ts +12 -0
- package/dist/lib/remote-client.d.ts +12 -0
- package/dist/lib/remote-invitation-recovery.d.ts +62 -0
- package/dist/lib/remote-invitations.d.ts +128 -0
- package/dist/lib/skill-bundle.d.ts +54 -1
- package/dist/lib/skill-entry-path.d.ts +6 -0
- package/dist/lib/skill-hash.d.ts +33 -0
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/invitation-recovery.d.ts +2 -0
- package/dist/mcp/remote-invitation-tools.d.ts +2 -0
- package/dist/sdk/index.d.ts +3 -0
- package/dist/sdk/index.js +932 -105
- package/dist/sdk/registry.d.ts +6 -0
- package/package.json +1 -1
package/bin/worker.js
CHANGED
|
@@ -5456,7 +5456,7 @@ var require_checksum = __commonJS((exports) => {
|
|
|
5456
5456
|
}
|
|
5457
5457
|
};
|
|
5458
5458
|
}
|
|
5459
|
-
var
|
|
5459
|
+
var BLOCK2 = 64;
|
|
5460
5460
|
var DIGEST_LENGTH = 32;
|
|
5461
5461
|
var MAX_HASHABLE_LENGTH = 2 ** 53 - 1;
|
|
5462
5462
|
|
|
@@ -5476,13 +5476,13 @@ var require_checksum = __commonJS((exports) => {
|
|
|
5476
5476
|
this.inner = new Sha256Js;
|
|
5477
5477
|
this.outer = new Sha256Js;
|
|
5478
5478
|
const { inner, outer } = this;
|
|
5479
|
-
const pad = new Uint8Array(
|
|
5480
|
-
for (let i = 0;i <
|
|
5479
|
+
const pad = new Uint8Array(BLOCK2 * 2);
|
|
5480
|
+
for (let i = 0;i < BLOCK2; ++i) {
|
|
5481
5481
|
pad[i] = 54 ^ key[i];
|
|
5482
|
-
pad[i +
|
|
5482
|
+
pad[i + BLOCK2] = 92 ^ key[i];
|
|
5483
5483
|
}
|
|
5484
|
-
inner.update(pad.subarray(0,
|
|
5485
|
-
outer.update(pad.subarray(
|
|
5484
|
+
inner.update(pad.subarray(0, BLOCK2));
|
|
5485
|
+
outer.update(pad.subarray(BLOCK2));
|
|
5486
5486
|
}
|
|
5487
5487
|
}
|
|
5488
5488
|
update(data) {
|
|
@@ -5503,7 +5503,7 @@ var require_checksum = __commonJS((exports) => {
|
|
|
5503
5503
|
while (byteLength > 0) {
|
|
5504
5504
|
this.buffer[this.bufferLength++] = chunk[position++];
|
|
5505
5505
|
byteLength--;
|
|
5506
|
-
if (this.bufferLength ===
|
|
5506
|
+
if (this.bufferLength === BLOCK2) {
|
|
5507
5507
|
this.hashBuffer();
|
|
5508
5508
|
this.bufferLength = 0;
|
|
5509
5509
|
}
|
|
@@ -5535,18 +5535,18 @@ var require_checksum = __commonJS((exports) => {
|
|
|
5535
5535
|
const bitsHashed = this.bytesHashed * 8;
|
|
5536
5536
|
const bufferView = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
5537
5537
|
bufferView.setUint8(bufferLength++, 128);
|
|
5538
|
-
if ((bufferLength - 1) %
|
|
5539
|
-
for (let i = bufferLength;i <
|
|
5538
|
+
if ((bufferLength - 1) % BLOCK2 >= BLOCK2 - 8) {
|
|
5539
|
+
for (let i = bufferLength;i < BLOCK2; ++i) {
|
|
5540
5540
|
bufferView.setUint8(i, 0);
|
|
5541
5541
|
}
|
|
5542
5542
|
this.hashBufferWith(state, buffer);
|
|
5543
5543
|
bufferLength = 0;
|
|
5544
5544
|
}
|
|
5545
|
-
for (let i = bufferLength;i <
|
|
5545
|
+
for (let i = bufferLength;i < BLOCK2 - 8; ++i) {
|
|
5546
5546
|
bufferView.setUint8(i, 0);
|
|
5547
5547
|
}
|
|
5548
|
-
bufferView.setUint32(
|
|
5549
|
-
bufferView.setUint32(
|
|
5548
|
+
bufferView.setUint32(BLOCK2 - 8, Math.floor(bitsHashed / 4294967296), false);
|
|
5549
|
+
bufferView.setUint32(BLOCK2 - 4, bitsHashed, false);
|
|
5550
5550
|
this.hashBufferWith(state, buffer);
|
|
5551
5551
|
const out = new Uint8Array(DIGEST_LENGTH);
|
|
5552
5552
|
for (let i = 0;i < 8; ++i) {
|
|
@@ -5559,16 +5559,16 @@ var require_checksum = __commonJS((exports) => {
|
|
|
5559
5559
|
}
|
|
5560
5560
|
static normalizeKey(secret) {
|
|
5561
5561
|
const key = toUint8Array(secret);
|
|
5562
|
-
if (key.byteLength >
|
|
5562
|
+
if (key.byteLength > BLOCK2) {
|
|
5563
5563
|
const h = new Sha256Js;
|
|
5564
5564
|
h.update(key);
|
|
5565
5565
|
const out = h.digestSync();
|
|
5566
|
-
const padded = new Uint8Array(
|
|
5566
|
+
const padded = new Uint8Array(BLOCK2);
|
|
5567
5567
|
padded.set(out);
|
|
5568
5568
|
return padded;
|
|
5569
5569
|
}
|
|
5570
|
-
if (key.byteLength <
|
|
5571
|
-
const padded = new Uint8Array(
|
|
5570
|
+
if (key.byteLength < BLOCK2) {
|
|
5571
|
+
const padded = new Uint8Array(BLOCK2);
|
|
5572
5572
|
padded.set(key);
|
|
5573
5573
|
return padded;
|
|
5574
5574
|
}
|
|
@@ -5580,7 +5580,7 @@ var require_checksum = __commonJS((exports) => {
|
|
|
5580
5580
|
hashBufferWith(state, buffer) {
|
|
5581
5581
|
const w = this.w ??= new Int32Array(64);
|
|
5582
5582
|
let s0 = state[0], s1 = state[1], s2 = state[2], s3 = state[3], s4 = state[4], s5 = state[5], s6 = state[6], s7 = state[7];
|
|
5583
|
-
for (let i = 0;i <
|
|
5583
|
+
for (let i = 0;i < BLOCK2; ++i) {
|
|
5584
5584
|
if (i < 16) {
|
|
5585
5585
|
w[i] = (buffer[i * 4] & 255) << 24 | (buffer[i * 4 + 1] & 255) << 16 | (buffer[i * 4 + 2] & 255) << 8 | buffer[i * 4 + 3] & 255;
|
|
5586
5586
|
} else {
|
|
@@ -23103,7 +23103,7 @@ import { randomUUID as randomUUID4 } from "crypto";
|
|
|
23103
23103
|
// package.json
|
|
23104
23104
|
var package_default = {
|
|
23105
23105
|
name: "@hasna/skills",
|
|
23106
|
-
version: "0.5.
|
|
23106
|
+
version: "0.5.3",
|
|
23107
23107
|
description: "Skills library for AI coding agents",
|
|
23108
23108
|
type: "module",
|
|
23109
23109
|
bin: {
|
|
@@ -23225,7 +23225,40 @@ var package_default = {
|
|
|
23225
23225
|
}
|
|
23226
23226
|
};
|
|
23227
23227
|
|
|
23228
|
+
// src/lib/skill-entry-path.ts
|
|
23229
|
+
class SkillEntryPaths {
|
|
23230
|
+
files = new Set;
|
|
23231
|
+
directories = new Set;
|
|
23232
|
+
add(path, maxBytes, invalid, limit) {
|
|
23233
|
+
if (path.length > maxBytes)
|
|
23234
|
+
limit();
|
|
23235
|
+
const encoded = new TextEncoder().encode(path);
|
|
23236
|
+
if (encoded.byteLength > maxBytes)
|
|
23237
|
+
limit();
|
|
23238
|
+
if (new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(encoded) !== path)
|
|
23239
|
+
invalid("Invalid UTF-8 entry path");
|
|
23240
|
+
if (!path || /[\\:\x00-\x1f\x7f]/u.test(path))
|
|
23241
|
+
invalid("Unsafe entry path");
|
|
23242
|
+
if (path.split("/").some((segment) => !segment || segment === "." || segment === ".."))
|
|
23243
|
+
invalid("Unsafe entry path segment");
|
|
23244
|
+
const key = path.normalize("NFC").toLowerCase().normalize("NFC");
|
|
23245
|
+
if (this.files.has(key) || this.directories.has(key))
|
|
23246
|
+
invalid("Duplicate or conflicting entry path");
|
|
23247
|
+
const parents = key.split("/");
|
|
23248
|
+
parents.pop();
|
|
23249
|
+
while (parents.length) {
|
|
23250
|
+
const parent = parents.join("/");
|
|
23251
|
+
if (this.files.has(parent))
|
|
23252
|
+
invalid("Conflicting entry file ancestor");
|
|
23253
|
+
this.directories.add(parent);
|
|
23254
|
+
parents.pop();
|
|
23255
|
+
}
|
|
23256
|
+
this.files.add(key);
|
|
23257
|
+
}
|
|
23258
|
+
}
|
|
23259
|
+
|
|
23228
23260
|
// src/lib/skill-bundle.ts
|
|
23261
|
+
var BLOCK = 512;
|
|
23229
23262
|
var ANY_SEGMENT_EXCLUDES = new Set([
|
|
23230
23263
|
".git",
|
|
23231
23264
|
".ds_store",
|
|
@@ -23353,6 +23386,144 @@ function ownBytes(view) {
|
|
|
23353
23386
|
out.set(source);
|
|
23354
23387
|
return out;
|
|
23355
23388
|
}
|
|
23389
|
+
var SKILL_BUNDLE_INSPECTION_LIMITS = Object.freeze({
|
|
23390
|
+
compressedBytes: 16 * 1024 * 1024,
|
|
23391
|
+
decompressedBytes: 64 * 1024 * 1024,
|
|
23392
|
+
entries: 1024,
|
|
23393
|
+
fileBytes: 16 * 1024 * 1024,
|
|
23394
|
+
pathBytes: 100,
|
|
23395
|
+
timeoutMs: 5000
|
|
23396
|
+
});
|
|
23397
|
+
|
|
23398
|
+
class SkillBundleInspectionError extends Error {
|
|
23399
|
+
code;
|
|
23400
|
+
constructor(code, message) {
|
|
23401
|
+
super(message);
|
|
23402
|
+
this.code = code;
|
|
23403
|
+
this.name = "SkillBundleInspectionError";
|
|
23404
|
+
}
|
|
23405
|
+
}
|
|
23406
|
+
function invalidBundle(message) {
|
|
23407
|
+
throw new SkillBundleInspectionError("BUNDLE_INVALID", message);
|
|
23408
|
+
}
|
|
23409
|
+
class BoundedTarReader {
|
|
23410
|
+
limits;
|
|
23411
|
+
check;
|
|
23412
|
+
header = new Uint8Array(BLOCK);
|
|
23413
|
+
headerOffset = 0;
|
|
23414
|
+
pending;
|
|
23415
|
+
bodyOffset = 0;
|
|
23416
|
+
padding = 0;
|
|
23417
|
+
zeroBlocks = 0;
|
|
23418
|
+
entries = [];
|
|
23419
|
+
paths = new SkillEntryPaths;
|
|
23420
|
+
fileBytes = 0;
|
|
23421
|
+
constructor(limits, check) {
|
|
23422
|
+
this.limits = limits;
|
|
23423
|
+
this.check = check;
|
|
23424
|
+
}
|
|
23425
|
+
push(chunk) {
|
|
23426
|
+
let offset = 0;
|
|
23427
|
+
while (offset < chunk.byteLength) {
|
|
23428
|
+
this.check();
|
|
23429
|
+
if (this.pending) {
|
|
23430
|
+
const count = Math.min(this.pending.bytes.byteLength - this.bodyOffset, chunk.byteLength - offset);
|
|
23431
|
+
this.pending.bytes.set(chunk.subarray(offset, offset + count), this.bodyOffset);
|
|
23432
|
+
offset += count;
|
|
23433
|
+
this.bodyOffset += count;
|
|
23434
|
+
if (this.bodyOffset === this.pending.bytes.byteLength) {
|
|
23435
|
+
this.entries.push(this.pending);
|
|
23436
|
+
this.pending = undefined;
|
|
23437
|
+
}
|
|
23438
|
+
} else if (this.padding) {
|
|
23439
|
+
const count = Math.min(this.padding, chunk.byteLength - offset);
|
|
23440
|
+
if (chunk.subarray(offset, offset + count).some((byte) => byte !== 0))
|
|
23441
|
+
invalidBundle("Nonzero tar body padding");
|
|
23442
|
+
offset += count;
|
|
23443
|
+
this.padding -= count;
|
|
23444
|
+
} else {
|
|
23445
|
+
const count = Math.min(BLOCK - this.headerOffset, chunk.byteLength - offset);
|
|
23446
|
+
this.header.set(chunk.subarray(offset, offset + count), this.headerOffset);
|
|
23447
|
+
offset += count;
|
|
23448
|
+
this.headerOffset += count;
|
|
23449
|
+
if (this.headerOffset === BLOCK) {
|
|
23450
|
+
this.readHeader();
|
|
23451
|
+
this.headerOffset = 0;
|
|
23452
|
+
}
|
|
23453
|
+
}
|
|
23454
|
+
}
|
|
23455
|
+
}
|
|
23456
|
+
finish() {
|
|
23457
|
+
this.check();
|
|
23458
|
+
if (this.pending || this.padding || this.headerOffset || this.zeroBlocks < 2)
|
|
23459
|
+
invalidBundle("Truncated tar bundle");
|
|
23460
|
+
return this.entries;
|
|
23461
|
+
}
|
|
23462
|
+
readHeader() {
|
|
23463
|
+
this.check();
|
|
23464
|
+
const h = this.header;
|
|
23465
|
+
if (h.every((byte) => byte === 0)) {
|
|
23466
|
+
this.zeroBlocks++;
|
|
23467
|
+
return;
|
|
23468
|
+
}
|
|
23469
|
+
if (this.zeroBlocks)
|
|
23470
|
+
invalidBundle("Nonzero tar data after terminator");
|
|
23471
|
+
if (this.entries.length >= this.limits.entries)
|
|
23472
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle entry limit exceeded");
|
|
23473
|
+
let checksum = 0;
|
|
23474
|
+
for (let i = 0;i < BLOCK; i++)
|
|
23475
|
+
checksum += i >= 148 && i < 156 ? 32 : h[i];
|
|
23476
|
+
if (tarOctal(h.subarray(148, 156)) !== checksum)
|
|
23477
|
+
invalidBundle("Invalid tar header checksum");
|
|
23478
|
+
if (new TextDecoder().decode(h.subarray(257, 265)) !== "ustar\x00" + "00")
|
|
23479
|
+
invalidBundle("Unsupported tar format");
|
|
23480
|
+
if (h[156] !== 48 && h[156] !== 0 || h.subarray(157, 257).some((b) => b !== 0) || h.subarray(345).some((b) => b !== 0))
|
|
23481
|
+
invalidBundle("Unsupported tar entry or path prefix");
|
|
23482
|
+
const mode = tarOctal(h.subarray(100, 108));
|
|
23483
|
+
if (mode > 511)
|
|
23484
|
+
invalidBundle("Unsupported tar permission bits");
|
|
23485
|
+
tarOctal(h.subarray(108, 116));
|
|
23486
|
+
tarOctal(h.subarray(116, 124));
|
|
23487
|
+
tarOctal(h.subarray(136, 148));
|
|
23488
|
+
const size = tarOctal(h.subarray(124, 136));
|
|
23489
|
+
if (size > this.limits.fileBytes || this.fileBytes + size > this.limits.decompressedBytes) {
|
|
23490
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle file byte limit exceeded");
|
|
23491
|
+
}
|
|
23492
|
+
const name = h.subarray(0, 100);
|
|
23493
|
+
const end = name.indexOf(0);
|
|
23494
|
+
if (end !== -1 && name.subarray(end).some((b) => b !== 0))
|
|
23495
|
+
invalidBundle("Invalid tar path padding");
|
|
23496
|
+
const raw = end === -1 ? name : name.subarray(0, end);
|
|
23497
|
+
if (raw.byteLength > this.limits.pathBytes)
|
|
23498
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
|
|
23499
|
+
let path;
|
|
23500
|
+
try {
|
|
23501
|
+
path = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(raw);
|
|
23502
|
+
} catch {
|
|
23503
|
+
return invalidBundle("Invalid UTF-8 bundle path");
|
|
23504
|
+
}
|
|
23505
|
+
this.paths.add(path, this.limits.pathBytes, invalidBundle, () => {
|
|
23506
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
|
|
23507
|
+
});
|
|
23508
|
+
this.fileBytes += size;
|
|
23509
|
+
this.pending = { path, mode, bytes: new Uint8Array(new ArrayBuffer(size)) };
|
|
23510
|
+
this.bodyOffset = 0;
|
|
23511
|
+
this.padding = (BLOCK - size % BLOCK) % BLOCK;
|
|
23512
|
+
if (!size) {
|
|
23513
|
+
this.entries.push(this.pending);
|
|
23514
|
+
this.pending = undefined;
|
|
23515
|
+
}
|
|
23516
|
+
}
|
|
23517
|
+
}
|
|
23518
|
+
function tarOctal(field) {
|
|
23519
|
+
const text = new TextDecoder().decode(field);
|
|
23520
|
+
if (!/^[0-7]+[\0 ]*$/.test(text))
|
|
23521
|
+
invalidBundle("Invalid tar octal field");
|
|
23522
|
+
const value = Number.parseInt(text, 8);
|
|
23523
|
+
if (!Number.isSafeInteger(value))
|
|
23524
|
+
invalidBundle("Tar integer is out of range");
|
|
23525
|
+
return value;
|
|
23526
|
+
}
|
|
23356
23527
|
|
|
23357
23528
|
// ../../node_modules/.bun/@aws-sdk+checksums@3.1000.29/node_modules/@aws-sdk/checksums/dist-cjs/submodules/flexible-checksums/index.js
|
|
23358
23529
|
var { setFeature } = require_client2();
|
|
@@ -32525,7 +32696,7 @@ var import_node_http_handler2 = __toESM(require_dist_cjs6(), 1);
|
|
|
32525
32696
|
var { toUint8Array: toUint8Array2, concatBytes } = require_serde();
|
|
32526
32697
|
var { createHmac, createHash: createHash2 } = __require("crypto");
|
|
32527
32698
|
var { Sha256: Sha2562, Sha256Js, Sha256Node } = require_checksum();
|
|
32528
|
-
var
|
|
32699
|
+
var BLOCK2 = 64;
|
|
32529
32700
|
var DIGEST_LENGTH = 20;
|
|
32530
32701
|
var INIT = new Int32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
32531
32702
|
var K2 = new Int32Array([1518500249, 1859775393, 2400959708, 3395469782]);
|
|
@@ -32534,7 +32705,7 @@ class Sha1Js {
|
|
|
32534
32705
|
digestLength = DIGEST_LENGTH;
|
|
32535
32706
|
state = Int32Array.from(INIT);
|
|
32536
32707
|
w;
|
|
32537
|
-
buffer = new Uint8Array(
|
|
32708
|
+
buffer = new Uint8Array(BLOCK2);
|
|
32538
32709
|
bufferLength = 0;
|
|
32539
32710
|
bytesHashed = 0;
|
|
32540
32711
|
finished = false;
|
|
@@ -32545,13 +32716,13 @@ class Sha1Js {
|
|
|
32545
32716
|
const key = Sha1Js.normalizeKey(secret);
|
|
32546
32717
|
this.inner = new Sha1Js;
|
|
32547
32718
|
this.outer = new Sha1Js;
|
|
32548
|
-
const pad = new Uint8Array(
|
|
32549
|
-
for (let i3 = 0;i3 <
|
|
32719
|
+
const pad = new Uint8Array(BLOCK2 * 2);
|
|
32720
|
+
for (let i3 = 0;i3 < BLOCK2; ++i3) {
|
|
32550
32721
|
pad[i3] = 54 ^ key[i3];
|
|
32551
|
-
pad[i3 +
|
|
32722
|
+
pad[i3 + BLOCK2] = 92 ^ key[i3];
|
|
32552
32723
|
}
|
|
32553
|
-
this.inner.update(pad.subarray(0,
|
|
32554
|
-
this.outer.update(pad.subarray(
|
|
32724
|
+
this.inner.update(pad.subarray(0, BLOCK2));
|
|
32725
|
+
this.outer.update(pad.subarray(BLOCK2));
|
|
32555
32726
|
}
|
|
32556
32727
|
}
|
|
32557
32728
|
update(data) {
|
|
@@ -32566,19 +32737,19 @@ class Sha1Js {
|
|
|
32566
32737
|
let { length } = data;
|
|
32567
32738
|
this.bytesHashed += length;
|
|
32568
32739
|
if (this.bufferLength > 0) {
|
|
32569
|
-
while (length > 0 && this.bufferLength <
|
|
32740
|
+
while (length > 0 && this.bufferLength < BLOCK2) {
|
|
32570
32741
|
this.buffer[this.bufferLength++] = data[pos++];
|
|
32571
32742
|
--length;
|
|
32572
32743
|
}
|
|
32573
|
-
if (this.bufferLength ===
|
|
32744
|
+
if (this.bufferLength === BLOCK2) {
|
|
32574
32745
|
this.hashBuffer(this.buffer, 0);
|
|
32575
32746
|
this.bufferLength = 0;
|
|
32576
32747
|
}
|
|
32577
32748
|
}
|
|
32578
|
-
while (length >=
|
|
32749
|
+
while (length >= BLOCK2) {
|
|
32579
32750
|
this.hashBuffer(data, pos);
|
|
32580
|
-
pos +=
|
|
32581
|
-
length -=
|
|
32751
|
+
pos += BLOCK2;
|
|
32752
|
+
length -= BLOCK2;
|
|
32582
32753
|
}
|
|
32583
32754
|
while (length > 0) {
|
|
32584
32755
|
this.buffer[this.bufferLength++] = data[pos++];
|
|
@@ -32599,7 +32770,7 @@ class Sha1Js {
|
|
|
32599
32770
|
}
|
|
32600
32771
|
reset() {
|
|
32601
32772
|
this.state = Int32Array.from(INIT);
|
|
32602
|
-
this.buffer = new Uint8Array(
|
|
32773
|
+
this.buffer = new Uint8Array(BLOCK2);
|
|
32603
32774
|
this.bufferLength = 0;
|
|
32604
32775
|
this.bytesHashed = 0;
|
|
32605
32776
|
}
|
|
@@ -32610,19 +32781,19 @@ class Sha1Js {
|
|
|
32610
32781
|
const bitsHi = this.bytesHashed / 536870912 | 0;
|
|
32611
32782
|
const bitsLo = this.bytesHashed << 3;
|
|
32612
32783
|
buffer[bufferLength++] = 128;
|
|
32613
|
-
if (bufferLength >
|
|
32614
|
-
for (let i3 = bufferLength;i3 <
|
|
32784
|
+
if (bufferLength > BLOCK2 - 8) {
|
|
32785
|
+
for (let i3 = bufferLength;i3 < BLOCK2; ++i3) {
|
|
32615
32786
|
buffer[i3] = 0;
|
|
32616
32787
|
}
|
|
32617
32788
|
this.hashBufferWith(state, buffer, 0);
|
|
32618
32789
|
bufferLength = 0;
|
|
32619
32790
|
}
|
|
32620
|
-
for (let i3 = bufferLength;i3 <
|
|
32791
|
+
for (let i3 = bufferLength;i3 < BLOCK2 - 8; ++i3) {
|
|
32621
32792
|
buffer[i3] = 0;
|
|
32622
32793
|
}
|
|
32623
|
-
const v2 = new DataView(buffer.buffer, buffer.byteOffset,
|
|
32624
|
-
v2.setUint32(
|
|
32625
|
-
v2.setUint32(
|
|
32794
|
+
const v2 = new DataView(buffer.buffer, buffer.byteOffset, BLOCK2);
|
|
32795
|
+
v2.setUint32(BLOCK2 - 8, bitsHi, false);
|
|
32796
|
+
v2.setUint32(BLOCK2 - 4, bitsLo, false);
|
|
32626
32797
|
this.hashBufferWith(state, buffer, 0);
|
|
32627
32798
|
const out = new Uint8Array(DIGEST_LENGTH);
|
|
32628
32799
|
out[0] = state[0] >>> 24 & 255;
|
|
@@ -32649,15 +32820,15 @@ class Sha1Js {
|
|
|
32649
32820
|
}
|
|
32650
32821
|
static normalizeKey(secret) {
|
|
32651
32822
|
const key = toUint8Array2(secret);
|
|
32652
|
-
if (key.byteLength >
|
|
32823
|
+
if (key.byteLength > BLOCK2) {
|
|
32653
32824
|
const h3 = new Sha1Js;
|
|
32654
32825
|
h3.update(key);
|
|
32655
32826
|
const digest = h3.digestSync();
|
|
32656
|
-
const padded2 = new Uint8Array(
|
|
32827
|
+
const padded2 = new Uint8Array(BLOCK2);
|
|
32657
32828
|
padded2.set(digest);
|
|
32658
32829
|
return padded2;
|
|
32659
32830
|
}
|
|
32660
|
-
const padded = new Uint8Array(
|
|
32831
|
+
const padded = new Uint8Array(BLOCK2);
|
|
32661
32832
|
padded.set(key);
|
|
32662
32833
|
return padded;
|
|
32663
32834
|
}
|
|
@@ -35094,6 +35265,20 @@ var VALID_PROVENANCE_SOURCES = new Set(["official", "custom", "remote", "private
|
|
|
35094
35265
|
|
|
35095
35266
|
// src/lib/skill-hash.ts
|
|
35096
35267
|
var HASH_EXCLUDE_DIRS = new Set([".git", "node_modules", "dist", "build", ".turbo"]);
|
|
35268
|
+
var CONTENT_HASH_LIMITS = Object.freeze({
|
|
35269
|
+
entries: 1024,
|
|
35270
|
+
rawBytes: 64 * 1024 * 1024,
|
|
35271
|
+
normalizedBytes: 64 * 1024 * 1024,
|
|
35272
|
+
fileBytes: 16 * 1024 * 1024,
|
|
35273
|
+
normalizedFileBytes: 16 * 1024 * 1024,
|
|
35274
|
+
pathBytes: 100,
|
|
35275
|
+
manifestBytes: 16 * 1024,
|
|
35276
|
+
manifestDepth: 64,
|
|
35277
|
+
timeoutMs: 5000
|
|
35278
|
+
});
|
|
35279
|
+
var typedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);
|
|
35280
|
+
var byteLengthOf = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteLength").get;
|
|
35281
|
+
var bufferOf = Object.getOwnPropertyDescriptor(typedArrayPrototype, "buffer").get;
|
|
35097
35282
|
|
|
35098
35283
|
// src/lib/portable-skills-files.ts
|
|
35099
35284
|
var ANY_SEGMENT_COPY_EXCLUDES = new Set([
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Bounded two-line stdin protocol: fresh OTP first, acceptance token second. */
|
|
2
|
+
export declare function readInvitationSecrets(): Promise<{
|
|
3
|
+
code: string;
|
|
4
|
+
token: string;
|
|
5
|
+
}>;
|
|
6
|
+
/** Secret remains local to this prompt, never argv, history, logs or profile state. */
|
|
7
|
+
export declare function promptInvitationToken(): Promise<string | null>;
|
|
8
|
+
export declare function promptInvitationRecoveryCode(): Promise<string | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,8 @@ export { addSchedule, listSchedules, removeSchedule, setScheduleEnabled, getDueS
|
|
|
24
24
|
export { parseSkillFrontmatter, validateRegistryConsistency, validateSkillDirectory, type RegistryConsistencyResult, type SkillFrontmatter, type SkillValidationMessage, type SkillValidationResult, } from "./lib/skill-validation.js";
|
|
25
25
|
export { PORTABLE_SKILL_DEFAULT_VERSION, PORTABLE_SKILL_SCHEMA, PORTABLE_SKILL_STANDARD, findPortableSkill, getPortableSkillPath, getPortableSkillsRoot, listPortableSkillMetas, listPortableSkills, normalizePortableSkillName, portPortableSkill, portPortableSkillDirectory, readPortableSkillManifest, runPortableSkill, scaffoldPortableSkill, validatePortableSkillDirectory, writeCorpusSkill, type BulkPortImportedEntry, type BulkPortPortableSkillOptions, type BulkPortResult, type BulkPortSkippedEntry, type CorpusSkillMeta, type PortableSkillCommand, type PortableSkillInput, type PortableSkillManifest, type PortableSkillProvenance, type PortableSkillRunOptions, type PortableSkillRunResult, type PortableSkillRuntimeContract, type PortableSkillSummary, type SkillKind, type SkillRuntimeName, type SkillSandboxMode, type SkillSystemDep, type WriteCorpusSkillInput, } from "./lib/portable-skills.js";
|
|
26
26
|
export { SKILL_RUNTIMES, SKILL_SANDBOX_MODES, SKILL_SYSTEM_DEPS_ALLOWLIST, } from "./lib/portable-skills-types.js";
|
|
27
|
-
export { canonicalizeManifest, computeContentHash, normalizeLineEndings, verifyContentHash, type ContentHashVerification, } from "./lib/skill-hash.js";
|
|
27
|
+
export { canonicalizeManifest, computeContentHash, computeContentHashFromEntries, verifyContentHashFromEntries, CONTENT_HASH_LIMITS, ContentHashInputError, type ContentHashLimits, type ContentHashOptions, type ContentHashInputErrorCode, normalizeLineEndings, verifyContentHash, type ContentHashVerification, } from "./lib/skill-hash.js";
|
|
28
|
+
export { revisionIdOf, type RevisionContent } from "./lib/revision.js";
|
|
28
29
|
export { validatePortableManifestContract, type PortableContractOptions, } from "./lib/skill-contract.js";
|
|
29
30
|
export { pullSkills, PullSkillError, type PullSkillsOptions, type PullSkillsResult, type PulledSkillResult, type SkillPullClient, } from "./lib/pull.js";
|
|
30
31
|
export { SYNC_AGENTS, SYNC_MARKER_FILE, SYNC_MARKER_MANAGED_BY, adaptSkillMdForAgent, agentGlobalSkillsDir, isSyncAgent, pointerSkillMd, removeManagedAgentSkill, resolveSyncAgents, syncSkillsToAgents, writeManagedAgentSkill, writeManagedSkillDir, type AgentSyncAction, type ManagedDirWriteResult, type SyncActionKind, type SyncAgent, type SyncMarker, type SyncSkillsOptions, type SyncSkillsResult, type WriteManagedAgentSkillParams, } from "./lib/agent-sync.js";
|
|
@@ -48,3 +49,6 @@ export { WorkspaceContextInputError, WorkspaceIdentityMismatchError } from "./li
|
|
|
48
49
|
export { RemoteWorkspaceSelectionError } from "./lib/remote-client.js";
|
|
49
50
|
export type { LeaveRemoteWorkspace, RemoteWorkspaceLeaveResult, RemoteWorkspaceLeaveErrorCode } from "./lib/remote-workspace-leave.js";
|
|
50
51
|
export { WorkspaceLeaveInputError, RemoteWorkspaceLeaveError, RemoteWorkspaceLeaveUnconfirmedError } from "./lib/remote-workspace-leave.js";
|
|
52
|
+
export type { RemoteWorkspaceInvitation, RemoteWorkspaceInvitationsPage, RemoteWorkspaceInvitationResult, RemoteWorkspaceInvitationAcceptance, ListRemoteWorkspaceInvitations, IssueRemoteWorkspaceInvitation, ResendRemoteWorkspaceInvitation, RevokeRemoteWorkspaceInvitation, AcceptRemoteWorkspaceInvitation, RemoteWorkspaceInvitationErrorCode } from "./lib/remote-invitations.js";
|
|
53
|
+
export { WorkspaceInvitationInputError, RemoteWorkspaceInvitationError, RemoteWorkspaceInvitationUnconfirmedError, RemoteWorkspaceInvitationReadError } from "./lib/remote-invitations.js";
|
|
54
|
+
export { InvitationEmailInputError, RemoteInvitationEmailError, RemoteInvitationEmailUnconfirmedError, type RequestInvitationEmailChallenge, type AcceptInvitationEmailChallenge, type RemoteInvitationEmailChallenge, type RemoteInvitationEmailAcceptance, type RemoteInvitationEmailErrorCode } from "./lib/remote-invitation-recovery.js";
|