wildcrane-runner 0.6.116 → 0.6.117
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/akb/dist/kanban.mjs +13662 -13226
- package/dist/akb/package.json +1 -1
- package/dist/akb-proxy.mjs +1 -1
- package/dist/codex-proxy.mjs +1 -1
- package/dist/codex-retained.mjs +1 -1
- package/dist/flow-worker-main.mjs +1442 -953
- package/dist/launcher.mjs +533 -422
- package/dist/plugin.mjs +38805 -38692
- package/dist/runner.mjs +1614 -1097
- package/dist/settings.mjs +627 -514
- package/package.json +1 -1
package/dist/launcher.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// wildcrane-runner 0.6.
|
|
1
|
+
// wildcrane-runner 0.6.117 — built by runner/scripts/build.mjs. Do not edit.
|
|
2
2
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
3
3
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
4
4
|
var __create = Object.create;
|
|
@@ -4041,8 +4041,8 @@ var require_infra = __commonJS({
|
|
|
4041
4041
|
assert(!invalidIsomorphicEncodeValueRegex.test(input));
|
|
4042
4042
|
return input;
|
|
4043
4043
|
}
|
|
4044
|
-
function parseJSONFromBytes(
|
|
4045
|
-
return JSON.parse(utf8DecodeBytes(
|
|
4044
|
+
function parseJSONFromBytes(bytes) {
|
|
4045
|
+
return JSON.parse(utf8DecodeBytes(bytes));
|
|
4046
4046
|
}
|
|
4047
4047
|
function removeASCIIWhitespace(str3, leading = true, trailing = true) {
|
|
4048
4048
|
return removeChars(str3, leading, trailing, isASCIIWhitespace);
|
|
@@ -4088,7 +4088,7 @@ var require_data_url = __commonJS({
|
|
|
4088
4088
|
"use strict";
|
|
4089
4089
|
var assert = __require("node:assert");
|
|
4090
4090
|
var { forgivingBase64, collectASequenceOfCodePoints, collectASequenceOfCodePointsFast, isomorphicDecode, removeASCIIWhitespace, removeChars } = require_infra();
|
|
4091
|
-
var
|
|
4091
|
+
var encoder3 = new TextEncoder();
|
|
4092
4092
|
var HTTP_TOKEN_CODEPOINTS = /^[-!#$%&'*+.^_|~A-Za-z0-9]+$/u;
|
|
4093
4093
|
var HTTP_WHITESPACE_REGEX = /[\u000A\u000D\u0009\u0020]/u;
|
|
4094
4094
|
var HTTP_QUOTED_STRING_TOKENS = /^[\u0009\u0020-\u007E\u0080-\u00FF]+$/u;
|
|
@@ -4142,8 +4142,8 @@ var require_data_url = __commonJS({
|
|
|
4142
4142
|
return serialized;
|
|
4143
4143
|
}
|
|
4144
4144
|
function stringPercentDecode(input) {
|
|
4145
|
-
const
|
|
4146
|
-
return percentDecode(
|
|
4145
|
+
const bytes = encoder3.encode(input);
|
|
4146
|
+
return percentDecode(bytes);
|
|
4147
4147
|
}
|
|
4148
4148
|
function isHexCharByte(byte) {
|
|
4149
4149
|
return byte >= 48 && byte <= 57 || byte >= 65 && byte <= 70 || byte >= 97 && byte <= 102;
|
|
@@ -4829,10 +4829,10 @@ var require_webidl = __commonJS({
|
|
|
4829
4829
|
if (jsArrayBuffer.detached) {
|
|
4830
4830
|
return new Uint8Array(0);
|
|
4831
4831
|
}
|
|
4832
|
-
const
|
|
4832
|
+
const bytes = new Uint8Array(length);
|
|
4833
4833
|
const view = new Uint8Array(jsArrayBuffer, offset, length);
|
|
4834
|
-
|
|
4835
|
-
return
|
|
4834
|
+
bytes.set(view);
|
|
4835
|
+
return bytes;
|
|
4836
4836
|
};
|
|
4837
4837
|
webidl.converters.DOMString = function(V, prefix, argument, flags) {
|
|
4838
4838
|
if (V === null && webidl.util.HasFlag(flags, webidl.attributes.LegacyNullToEmptyString)) {
|
|
@@ -5548,19 +5548,19 @@ var require_util2 = __commonJS({
|
|
|
5548
5548
|
}
|
|
5549
5549
|
async function readAllBytes(reader, successSteps, failureSteps) {
|
|
5550
5550
|
try {
|
|
5551
|
-
const
|
|
5551
|
+
const bytes = [];
|
|
5552
5552
|
let byteLength = 0;
|
|
5553
5553
|
do {
|
|
5554
5554
|
const { done, value: chunk } = await reader.read();
|
|
5555
5555
|
if (done) {
|
|
5556
|
-
successSteps(Buffer.concat(
|
|
5556
|
+
successSteps(Buffer.concat(bytes, byteLength));
|
|
5557
5557
|
return;
|
|
5558
5558
|
}
|
|
5559
5559
|
if (!isUint8Array(chunk)) {
|
|
5560
5560
|
failureSteps(new TypeError("Received non-Uint8Array chunk"));
|
|
5561
5561
|
return;
|
|
5562
5562
|
}
|
|
5563
|
-
|
|
5563
|
+
bytes.push(chunk);
|
|
5564
5564
|
byteLength += chunk.length;
|
|
5565
5565
|
} while (true);
|
|
5566
5566
|
} catch (e) {
|
|
@@ -6005,7 +6005,7 @@ var require_formdata_parser = __commonJS({
|
|
|
6005
6005
|
var assert = __require("node:assert");
|
|
6006
6006
|
var { isomorphicDecode } = require_infra();
|
|
6007
6007
|
var dd = Buffer.from("--");
|
|
6008
|
-
var
|
|
6008
|
+
var decoder2 = new TextDecoder();
|
|
6009
6009
|
var decoderIgnoreBOM = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
6010
6010
|
function isAsciiString(chars) {
|
|
6011
6011
|
for (let i = 0; i < chars.length; ++i) {
|
|
@@ -6137,7 +6137,7 @@ var require_formdata_parser = __commonJS({
|
|
|
6137
6137
|
headerValue[4] !== 56) {
|
|
6138
6138
|
throw parsingError("unknown encoding, expected utf-8''");
|
|
6139
6139
|
}
|
|
6140
|
-
value = decodeURIComponent(
|
|
6140
|
+
value = decodeURIComponent(decoder2.decode(headerValue.subarray(7)));
|
|
6141
6141
|
} else if (input[position.position] === 34) {
|
|
6142
6142
|
position.position++;
|
|
6143
6143
|
const quotedValue = collectASequenceOfBytes(
|
|
@@ -6150,7 +6150,7 @@ var require_formdata_parser = __commonJS({
|
|
|
6150
6150
|
throw parsingError("Closing quote not found");
|
|
6151
6151
|
}
|
|
6152
6152
|
position.position++;
|
|
6153
|
-
value =
|
|
6153
|
+
value = decoder2.decode(quotedValue).replace(/%0A/ig, "\n").replace(/%0D/ig, "\r").replace(/%22/g, '"');
|
|
6154
6154
|
} else {
|
|
6155
6155
|
const tokenValue = collectASequenceOfBytes(
|
|
6156
6156
|
(char) => isToken(char) && char !== 59,
|
|
@@ -6158,7 +6158,7 @@ var require_formdata_parser = __commonJS({
|
|
|
6158
6158
|
input,
|
|
6159
6159
|
position
|
|
6160
6160
|
);
|
|
6161
|
-
value =
|
|
6161
|
+
value = decoder2.decode(tokenValue);
|
|
6162
6162
|
}
|
|
6163
6163
|
return { name: attrNameStr, value, extended: isExtended };
|
|
6164
6164
|
}
|
|
@@ -6519,19 +6519,19 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
6519
6519
|
function bodyMixinMethods(instance, getInternalState) {
|
|
6520
6520
|
const methods = {
|
|
6521
6521
|
blob() {
|
|
6522
|
-
return consumeBody(this, (
|
|
6522
|
+
return consumeBody(this, (bytes) => {
|
|
6523
6523
|
let mimeType = bodyMimeType(getInternalState(this));
|
|
6524
6524
|
if (mimeType === null) {
|
|
6525
6525
|
mimeType = "";
|
|
6526
6526
|
} else if (mimeType) {
|
|
6527
6527
|
mimeType = serializeAMimeType(mimeType);
|
|
6528
6528
|
}
|
|
6529
|
-
return new Blob([
|
|
6529
|
+
return new Blob([bytes], { type: mimeType });
|
|
6530
6530
|
}, instance, getInternalState);
|
|
6531
6531
|
},
|
|
6532
6532
|
arrayBuffer() {
|
|
6533
|
-
return consumeBody(this, (
|
|
6534
|
-
return new Uint8Array(
|
|
6533
|
+
return consumeBody(this, (bytes) => {
|
|
6534
|
+
return new Uint8Array(bytes).buffer;
|
|
6535
6535
|
}, instance, getInternalState);
|
|
6536
6536
|
},
|
|
6537
6537
|
text() {
|
|
@@ -6567,8 +6567,8 @@ Content-Type: ${value.type || "application/octet-stream"}\r
|
|
|
6567
6567
|
}, instance, getInternalState);
|
|
6568
6568
|
},
|
|
6569
6569
|
bytes() {
|
|
6570
|
-
return consumeBody(this, (
|
|
6571
|
-
return new Uint8Array(
|
|
6570
|
+
return consumeBody(this, (bytes) => {
|
|
6571
|
+
return new Uint8Array(bytes);
|
|
6572
6572
|
}, instance, getInternalState);
|
|
6573
6573
|
}
|
|
6574
6574
|
};
|
|
@@ -13883,8 +13883,8 @@ var require_snapshot_utils = __commonJS({
|
|
|
13883
13883
|
match: new Set(matchHeaders.map((header) => caseSensitive ? header : header.toLowerCase()))
|
|
13884
13884
|
};
|
|
13885
13885
|
}
|
|
13886
|
-
var
|
|
13887
|
-
var hashId =
|
|
13886
|
+
var crypto11 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
|
|
13887
|
+
var hashId = crypto11?.hash ? (value) => crypto11.hash("sha256", value, "base64url") : (value) => Buffer.from(value).toString("base64url");
|
|
13888
13888
|
function isUndiciHeaders(headers) {
|
|
13889
13889
|
return Array.isArray(headers) && (headers.length & 1) === 0;
|
|
13890
13890
|
}
|
|
@@ -19937,10 +19937,10 @@ var require_response = __commonJS({
|
|
|
19937
19937
|
if (init !== null) {
|
|
19938
19938
|
init = webidl.converters.ResponseInit(init);
|
|
19939
19939
|
}
|
|
19940
|
-
const
|
|
19940
|
+
const bytes = textEncoder.encode(
|
|
19941
19941
|
serializeJavascriptValueToJSONString(data)
|
|
19942
19942
|
);
|
|
19943
|
-
const body = extractBody(
|
|
19943
|
+
const body = extractBody(bytes);
|
|
19944
19944
|
const responseObject = fromInnerResponse(makeResponse({}), "response");
|
|
19945
19945
|
initializeResponse(responseObject, init, { body: body[0], type: "application/json" });
|
|
19946
19946
|
return responseObject;
|
|
@@ -21082,10 +21082,10 @@ var require_subresource_integrity = __commonJS({
|
|
|
21082
21082
|
var { runtimeFeatures } = require_runtime_features();
|
|
21083
21083
|
var { asciiLowercase } = require_infra();
|
|
21084
21084
|
var validSRIHashAlgorithmTokenSet = /* @__PURE__ */ new Map([["sha256", 0], ["sha384", 1], ["sha512", 2]]);
|
|
21085
|
-
var
|
|
21085
|
+
var crypto11;
|
|
21086
21086
|
if (runtimeFeatures.has("crypto")) {
|
|
21087
|
-
|
|
21088
|
-
const cryptoHashes =
|
|
21087
|
+
crypto11 = __require("node:crypto");
|
|
21088
|
+
const cryptoHashes = crypto11.getHashes();
|
|
21089
21089
|
if (cryptoHashes.length === 0) {
|
|
21090
21090
|
validSRIHashAlgorithmTokenSet.clear();
|
|
21091
21091
|
}
|
|
@@ -21104,7 +21104,7 @@ var require_subresource_integrity = __commonJS({
|
|
|
21104
21104
|
)
|
|
21105
21105
|
);
|
|
21106
21106
|
var isValidSRIHashAlgorithm = (algorithm) => validSRIHashAlgorithmTokenSet.has(asciiLowercase(algorithm));
|
|
21107
|
-
var bytesMatch = runtimeFeatures.has("crypto") === false || validSRIHashAlgorithmTokenSet.size === 0 ? () => true : (
|
|
21107
|
+
var bytesMatch = runtimeFeatures.has("crypto") === false || validSRIHashAlgorithmTokenSet.size === 0 ? () => true : (bytes, metadataList) => {
|
|
21108
21108
|
const parsedMetadata = parseMetadata(metadataList);
|
|
21109
21109
|
if (parsedMetadata.length === 0) {
|
|
21110
21110
|
return true;
|
|
@@ -21113,7 +21113,7 @@ var require_subresource_integrity = __commonJS({
|
|
|
21113
21113
|
for (const item of metadata) {
|
|
21114
21114
|
const algorithm = item.alg;
|
|
21115
21115
|
const expectedValue = item.val;
|
|
21116
|
-
const actualValue = applyAlgorithmToBytes(algorithm,
|
|
21116
|
+
const actualValue = applyAlgorithmToBytes(algorithm, bytes);
|
|
21117
21117
|
if (caseSensitiveMatch(actualValue, expectedValue)) {
|
|
21118
21118
|
return true;
|
|
21119
21119
|
}
|
|
@@ -21172,8 +21172,8 @@ var require_subresource_integrity = __commonJS({
|
|
|
21172
21172
|
}
|
|
21173
21173
|
return result;
|
|
21174
21174
|
}
|
|
21175
|
-
var applyAlgorithmToBytes = (algorithm,
|
|
21176
|
-
return
|
|
21175
|
+
var applyAlgorithmToBytes = (algorithm, bytes) => {
|
|
21176
|
+
return crypto11.hash(algorithm, bytes, "base64");
|
|
21177
21177
|
};
|
|
21178
21178
|
function caseSensitiveMatch(actualValue, expectedValue) {
|
|
21179
21179
|
let actualValueLength = actualValue.length;
|
|
@@ -21584,12 +21584,12 @@ var require_fetch = __commonJS({
|
|
|
21584
21584
|
processBodyError(response.error);
|
|
21585
21585
|
return;
|
|
21586
21586
|
}
|
|
21587
|
-
const processBody = (
|
|
21588
|
-
if (!bytesMatch(
|
|
21587
|
+
const processBody = (bytes) => {
|
|
21588
|
+
if (!bytesMatch(bytes, request2.integrity)) {
|
|
21589
21589
|
processBodyError("integrity mismatch");
|
|
21590
21590
|
return;
|
|
21591
21591
|
}
|
|
21592
|
-
response.body = safelyExtractBody(
|
|
21592
|
+
response.body = safelyExtractBody(bytes)[0];
|
|
21593
21593
|
fetchFinale(fetchParams, response);
|
|
21594
21594
|
};
|
|
21595
21595
|
fullyReadBody(response.body, processBody, processBodyError);
|
|
@@ -22032,12 +22032,12 @@ var require_fetch = __commonJS({
|
|
|
22032
22032
|
if (request2.body == null && fetchParams.processRequestEndOfBody) {
|
|
22033
22033
|
queueMicrotask(() => fetchParams.processRequestEndOfBody());
|
|
22034
22034
|
} else if (request2.body != null) {
|
|
22035
|
-
const processBodyChunk = async function* (
|
|
22035
|
+
const processBodyChunk = async function* (bytes) {
|
|
22036
22036
|
if (isCancelled(fetchParams)) {
|
|
22037
22037
|
return;
|
|
22038
22038
|
}
|
|
22039
|
-
yield
|
|
22040
|
-
fetchParams.processRequestBodyChunkLength?.(
|
|
22039
|
+
yield bytes;
|
|
22040
|
+
fetchParams.processRequestBodyChunkLength?.(bytes.byteLength);
|
|
22041
22041
|
};
|
|
22042
22042
|
const processEndOfBody = () => {
|
|
22043
22043
|
if (isCancelled(fetchParams)) {
|
|
@@ -22059,8 +22059,8 @@ var require_fetch = __commonJS({
|
|
|
22059
22059
|
};
|
|
22060
22060
|
requestBody = (async function* () {
|
|
22061
22061
|
try {
|
|
22062
|
-
for await (const
|
|
22063
|
-
yield* processBodyChunk(
|
|
22062
|
+
for await (const bytes of request2.body.stream) {
|
|
22063
|
+
yield* processBodyChunk(bytes);
|
|
22064
22064
|
}
|
|
22065
22065
|
processEndOfBody();
|
|
22066
22066
|
} catch (err) {
|
|
@@ -22108,33 +22108,33 @@ var require_fetch = __commonJS({
|
|
|
22108
22108
|
}
|
|
22109
22109
|
fetchParams.controller.resume = async () => {
|
|
22110
22110
|
while (true) {
|
|
22111
|
-
let
|
|
22111
|
+
let bytes;
|
|
22112
22112
|
let isFailure;
|
|
22113
22113
|
try {
|
|
22114
22114
|
const { done, value } = await fetchParams.controller.next();
|
|
22115
22115
|
if (isAborted(fetchParams)) {
|
|
22116
22116
|
break;
|
|
22117
22117
|
}
|
|
22118
|
-
|
|
22118
|
+
bytes = done ? void 0 : value;
|
|
22119
22119
|
} catch (err) {
|
|
22120
22120
|
if (fetchParams.controller.ended && !timingInfo.encodedBodySize) {
|
|
22121
|
-
|
|
22121
|
+
bytes = void 0;
|
|
22122
22122
|
} else {
|
|
22123
|
-
|
|
22123
|
+
bytes = err;
|
|
22124
22124
|
isFailure = true;
|
|
22125
22125
|
}
|
|
22126
22126
|
}
|
|
22127
|
-
if (
|
|
22127
|
+
if (bytes === void 0) {
|
|
22128
22128
|
readableStreamClose(fetchParams.controller.controller);
|
|
22129
22129
|
finalizeResponse(fetchParams, response);
|
|
22130
22130
|
return;
|
|
22131
22131
|
}
|
|
22132
|
-
timingInfo.decodedBodySize +=
|
|
22132
|
+
timingInfo.decodedBodySize += bytes?.byteLength ?? 0;
|
|
22133
22133
|
if (isFailure) {
|
|
22134
|
-
fetchParams.controller.terminate(
|
|
22134
|
+
fetchParams.controller.terminate(bytes);
|
|
22135
22135
|
return;
|
|
22136
22136
|
}
|
|
22137
|
-
const buffer = new Uint8Array(
|
|
22137
|
+
const buffer = new Uint8Array(bytes);
|
|
22138
22138
|
if (buffer.byteLength) {
|
|
22139
22139
|
fetchParams.controller.controller.enqueue(buffer);
|
|
22140
22140
|
}
|
|
@@ -22274,9 +22274,9 @@ var require_fetch = __commonJS({
|
|
|
22274
22274
|
if (fetchParams.controller.dump) {
|
|
22275
22275
|
return;
|
|
22276
22276
|
}
|
|
22277
|
-
const
|
|
22278
|
-
timingInfo.encodedBodySize +=
|
|
22279
|
-
return this.body.push(
|
|
22277
|
+
const bytes = chunk;
|
|
22278
|
+
timingInfo.encodedBodySize += bytes.byteLength;
|
|
22279
|
+
return this.body.push(bytes);
|
|
22280
22280
|
},
|
|
22281
22281
|
onComplete() {
|
|
22282
22282
|
if (this.abort) {
|
|
@@ -22607,9 +22607,9 @@ var require_cache3 = __commonJS({
|
|
|
22607
22607
|
// 16.
|
|
22608
22608
|
};
|
|
22609
22609
|
operations.push(operation);
|
|
22610
|
-
const
|
|
22610
|
+
const bytes = await bodyReadPromise.promise;
|
|
22611
22611
|
if (clonedResponse.body != null) {
|
|
22612
|
-
clonedResponse.body.source =
|
|
22612
|
+
clonedResponse.body.source = bytes;
|
|
22613
22613
|
}
|
|
22614
22614
|
const cacheJobPromise = createDeferredPromise();
|
|
22615
22615
|
let errorData = null;
|
|
@@ -24161,7 +24161,7 @@ var require_connection = __commonJS({
|
|
|
24161
24161
|
var { WebsocketFrameSend } = require_frame();
|
|
24162
24162
|
var assert = __require("node:assert");
|
|
24163
24163
|
var { runtimeFeatures } = require_runtime_features();
|
|
24164
|
-
var
|
|
24164
|
+
var crypto11 = runtimeFeatures.has("crypto") ? __require("node:crypto") : null;
|
|
24165
24165
|
var warningEmitted = false;
|
|
24166
24166
|
function establishWebSocketConnection(url, protocols, client, handler, options) {
|
|
24167
24167
|
const requestURL = url;
|
|
@@ -24181,7 +24181,7 @@ var require_connection = __commonJS({
|
|
|
24181
24181
|
const headersList = getHeadersList(new Headers(options.headers));
|
|
24182
24182
|
request2.headersList = headersList;
|
|
24183
24183
|
}
|
|
24184
|
-
const keyValue =
|
|
24184
|
+
const keyValue = crypto11.randomBytes(16).toString("base64");
|
|
24185
24185
|
request2.headersList.append("sec-websocket-key", keyValue, true);
|
|
24186
24186
|
request2.headersList.append("sec-websocket-version", "13", true);
|
|
24187
24187
|
for (const protocol of protocols) {
|
|
@@ -24221,7 +24221,7 @@ var require_connection = __commonJS({
|
|
|
24221
24221
|
return;
|
|
24222
24222
|
}
|
|
24223
24223
|
const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
|
|
24224
|
-
const digest =
|
|
24224
|
+
const digest = crypto11.hash("sha1", keyValue + uid, "base64");
|
|
24225
24225
|
if (secWSAccept !== digest) {
|
|
24226
24226
|
failHandshake(handler, response, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
24227
24227
|
return;
|
|
@@ -26683,7 +26683,7 @@ var require_identity = __commonJS({
|
|
|
26683
26683
|
var NODE_TYPE = /* @__PURE__ */ Symbol.for("yaml.node.type");
|
|
26684
26684
|
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
|
|
26685
26685
|
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
|
|
26686
|
-
var
|
|
26686
|
+
var isMap2 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
|
|
26687
26687
|
var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
|
|
26688
26688
|
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
|
|
26689
26689
|
var isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
|
|
@@ -26719,7 +26719,7 @@ var require_identity = __commonJS({
|
|
|
26719
26719
|
exports.isAlias = isAlias;
|
|
26720
26720
|
exports.isCollection = isCollection;
|
|
26721
26721
|
exports.isDocument = isDocument;
|
|
26722
|
-
exports.isMap =
|
|
26722
|
+
exports.isMap = isMap2;
|
|
26723
26723
|
exports.isNode = isNode;
|
|
26724
26724
|
exports.isPair = isPair;
|
|
26725
26725
|
exports.isScalar = isScalar;
|
|
@@ -30831,9 +30831,9 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
30831
30831
|
var blockMsg = "Block collections are not allowed within flow collections";
|
|
30832
30832
|
var isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq");
|
|
30833
30833
|
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
|
|
30834
|
-
const
|
|
30835
|
-
const fcName =
|
|
30836
|
-
const NodeClass = tag?.nodeClass ?? (
|
|
30834
|
+
const isMap2 = fc.start.source === "{";
|
|
30835
|
+
const fcName = isMap2 ? "flow map" : "flow sequence";
|
|
30836
|
+
const NodeClass = tag?.nodeClass ?? (isMap2 ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq);
|
|
30837
30837
|
const coll = new NodeClass(ctx.schema);
|
|
30838
30838
|
coll.flow = true;
|
|
30839
30839
|
const atRoot = ctx.atRoot;
|
|
@@ -30869,7 +30869,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
30869
30869
|
offset = props.end;
|
|
30870
30870
|
continue;
|
|
30871
30871
|
}
|
|
30872
|
-
if (!
|
|
30872
|
+
if (!isMap2 && ctx.options.strict && utilContainsNewline.containsNewline(key))
|
|
30873
30873
|
onError(
|
|
30874
30874
|
key,
|
|
30875
30875
|
// checked by containsNewline()
|
|
@@ -30909,7 +30909,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
30909
30909
|
}
|
|
30910
30910
|
}
|
|
30911
30911
|
}
|
|
30912
|
-
if (!
|
|
30912
|
+
if (!isMap2 && !sep && !props.found) {
|
|
30913
30913
|
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep, null, props, onError);
|
|
30914
30914
|
coll.items.push(valueNode);
|
|
30915
30915
|
offset = valueNode.range[2];
|
|
@@ -30932,7 +30932,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
30932
30932
|
startOnNewline: false
|
|
30933
30933
|
});
|
|
30934
30934
|
if (valueProps.found) {
|
|
30935
|
-
if (!
|
|
30935
|
+
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
30936
30936
|
if (sep)
|
|
30937
30937
|
for (const st of sep) {
|
|
30938
30938
|
if (st === valueProps.found)
|
|
@@ -30964,7 +30964,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
30964
30964
|
const pair = new Pair.Pair(keyNode, valueNode);
|
|
30965
30965
|
if (ctx.options.keepSourceTokens)
|
|
30966
30966
|
pair.srcToken = collItem;
|
|
30967
|
-
if (
|
|
30967
|
+
if (isMap2) {
|
|
30968
30968
|
const map = coll;
|
|
30969
30969
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
30970
30970
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
@@ -30980,7 +30980,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
30980
30980
|
offset = valueNode ? valueNode.range[2] : valueProps.end;
|
|
30981
30981
|
}
|
|
30982
30982
|
}
|
|
30983
|
-
const expectedEnd =
|
|
30983
|
+
const expectedEnd = isMap2 ? "}" : "]";
|
|
30984
30984
|
const [ce, ...ee] = fc.end;
|
|
30985
30985
|
let cePos = offset;
|
|
30986
30986
|
if (ce?.source === expectedEnd)
|
|
@@ -40919,7 +40919,7 @@ import path36 from "node:path";
|
|
|
40919
40919
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
40920
40920
|
|
|
40921
40921
|
// src/home.ts
|
|
40922
|
-
import
|
|
40922
|
+
import crypto2 from "node:crypto";
|
|
40923
40923
|
import fs from "node:fs";
|
|
40924
40924
|
import os2 from "node:os";
|
|
40925
40925
|
import path from "node:path";
|
|
@@ -41015,7 +41015,7 @@ function machineId() {
|
|
|
41015
41015
|
if (held2.id && /^[0-9a-f-]{36}$/i.test(held2.id)) return held2.id;
|
|
41016
41016
|
} catch {
|
|
41017
41017
|
}
|
|
41018
|
-
const id =
|
|
41018
|
+
const id = crypto2.randomUUID();
|
|
41019
41019
|
fs.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
41020
41020
|
fs.writeFileSync(file2, `${JSON.stringify({ id })}
|
|
41021
41021
|
`);
|
|
@@ -41091,7 +41091,7 @@ function status(line) {
|
|
|
41091
41091
|
}
|
|
41092
41092
|
|
|
41093
41093
|
// src/preferences.ts
|
|
41094
|
-
import
|
|
41094
|
+
import crypto3 from "node:crypto";
|
|
41095
41095
|
import fs2 from "node:fs";
|
|
41096
41096
|
import path2 from "node:path";
|
|
41097
41097
|
var file = () => path2.join(runnerHome(), "preferences.json");
|
|
@@ -41105,7 +41105,7 @@ function read() {
|
|
|
41105
41105
|
}
|
|
41106
41106
|
var acceptAlphaUpdates = () => read().acceptAlphaUpdates === true;
|
|
41107
41107
|
function saveAlphaUpdates(value) {
|
|
41108
|
-
const target = file(), temporary = `${target}.${
|
|
41108
|
+
const target = file(), temporary = `${target}.${crypto3.randomUUID()}.tmp`;
|
|
41109
41109
|
fs2.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
41110
41110
|
try {
|
|
41111
41111
|
fs2.writeFileSync(temporary, JSON.stringify({ ...read(), acceptAlphaUpdates: value }) + "\n", { mode: 384 });
|
|
@@ -41116,15 +41116,15 @@ function saveAlphaUpdates(value) {
|
|
|
41116
41116
|
}
|
|
41117
41117
|
|
|
41118
41118
|
// src/protocol.ts
|
|
41119
|
-
var VERSION = true ? "0.6.
|
|
41120
|
-
var AKB_VERSION = true ? "0.11.
|
|
41119
|
+
var VERSION = true ? "0.6.117" : "0.0.0";
|
|
41120
|
+
var AKB_VERSION = true ? "0.11.99" : "0.0.0";
|
|
41121
41121
|
var EXIT_REFUSED = 10;
|
|
41122
41122
|
var EXIT_OUTDATED = 11;
|
|
41123
41123
|
var EXIT_UPDATE = 12;
|
|
41124
41124
|
var EXIT_ALREADY_RUNNING = 13;
|
|
41125
41125
|
|
|
41126
41126
|
// src/update.ts
|
|
41127
|
-
import
|
|
41127
|
+
import crypto4 from "node:crypto";
|
|
41128
41128
|
import fs3 from "node:fs";
|
|
41129
41129
|
import path3 from "node:path";
|
|
41130
41130
|
import zlib from "node:zlib";
|
|
@@ -41156,7 +41156,7 @@ async function installPackage(pkg, version, nodeVersion = process.versions.node)
|
|
|
41156
41156
|
return { ok: false, why: "unreachable", detail: e instanceof Error ? e.message : String(e) };
|
|
41157
41157
|
}
|
|
41158
41158
|
const expected = /^sha512-(.+)$/.exec(meta.dist.integrity ?? "")?.[1];
|
|
41159
|
-
const actual =
|
|
41159
|
+
const actual = crypto4.createHash("sha512").update(tarball).digest("base64");
|
|
41160
41160
|
if (!expected || expected !== actual) return { ok: false, why: "integrity", detail: "sha512 mismatch" };
|
|
41161
41161
|
const staging = `${dir}.${process.pid}.tmp`;
|
|
41162
41162
|
try {
|
|
@@ -41263,42 +41263,191 @@ function meets(version, comparator) {
|
|
|
41263
41263
|
var import_yaml8 = __toESM(require_dist(), 1);
|
|
41264
41264
|
|
|
41265
41265
|
// ../cli/src/lib/agent/cloud-studios.ts
|
|
41266
|
+
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
41266
41267
|
import fs10 from "node:fs";
|
|
41267
41268
|
import path12 from "node:path";
|
|
41268
41269
|
|
|
41269
|
-
// ../cli/src/lib/
|
|
41270
|
-
|
|
41271
|
-
var ASSET_FILE_LIMIT = 100 * 1024 * 1024;
|
|
41270
|
+
// ../cli/src/lib/paths.ts
|
|
41271
|
+
import path5 from "node:path";
|
|
41272
41272
|
|
|
41273
|
-
// ../cli/src/lib/
|
|
41274
|
-
var
|
|
41275
|
-
|
|
41276
|
-
|
|
41277
|
-
|
|
41278
|
-
|
|
41279
|
-
|
|
41280
|
-
|
|
41281
|
-
|
|
41282
|
-
|
|
41283
|
-
|
|
41284
|
-
|
|
41285
|
-
|
|
41273
|
+
// ../cli/src/lib/io.ts
|
|
41274
|
+
var BoardError = class extends Error {
|
|
41275
|
+
// `kind` is the machine-readable name of the refusal (card-not-found, no-board,
|
|
41276
|
+
// unknown-module, …). It is what a caller reads; the exit code stays 1 for every
|
|
41277
|
+
// refusal, so nobody has to keep a table of numbers.
|
|
41278
|
+
kind;
|
|
41279
|
+
// Only `cloud image` / `cloud tts` set it: 2 for a usage error, as the scripts they replaced did.
|
|
41280
|
+
exitCode;
|
|
41281
|
+
// `bare` says the message is already the whole thing a person should see — a usage
|
|
41282
|
+
// block, say — so the dispatcher prints it without putting the command in front of it.
|
|
41283
|
+
bare;
|
|
41284
|
+
details;
|
|
41285
|
+
constructor(message, { kind = "refused", bare = false, exitCode = 1, ...details } = {}) {
|
|
41286
|
+
super(message);
|
|
41287
|
+
this.name = "BoardError";
|
|
41288
|
+
this.kind = kind;
|
|
41289
|
+
this.bare = bare;
|
|
41290
|
+
this.exitCode = exitCode;
|
|
41291
|
+
this.details = details;
|
|
41292
|
+
}
|
|
41293
|
+
};
|
|
41294
|
+
|
|
41295
|
+
// ../cli/src/lib/machine/project.ts
|
|
41296
|
+
import fs4 from "node:fs";
|
|
41297
|
+
import path4 from "node:path";
|
|
41298
|
+
var SESSIONS_FILE = "sessions.json";
|
|
41299
|
+
var SESSIONS_FOLDER = "sessions";
|
|
41300
|
+
var ASSETS_FOLDER = "assets";
|
|
41301
|
+
var SESSIONS_LOCK = "sessions.lock";
|
|
41302
|
+
var INDEX_LOCK = "index.lock";
|
|
41303
|
+
var UI_CONFIG_FILE = "ui.config.json";
|
|
41304
|
+
function realPathOf(dir) {
|
|
41305
|
+
const here2 = path4.resolve(dir);
|
|
41306
|
+
const rest = [];
|
|
41307
|
+
let at = here2;
|
|
41308
|
+
for (; ; ) {
|
|
41309
|
+
try {
|
|
41310
|
+
return path4.join(fs4.realpathSync(at), ...rest);
|
|
41311
|
+
} catch {
|
|
41312
|
+
const up = path4.dirname(at);
|
|
41313
|
+
if (up === at) return here2;
|
|
41314
|
+
rest.unshift(path4.basename(at));
|
|
41315
|
+
at = up;
|
|
41316
|
+
}
|
|
41317
|
+
}
|
|
41318
|
+
}
|
|
41319
|
+
function stateRootOf(board) {
|
|
41320
|
+
let dir = realPathOf(board);
|
|
41321
|
+
for (; ; ) {
|
|
41322
|
+
if (fs4.existsSync(path4.join(dir, ".git"))) return dir;
|
|
41323
|
+
const up = path4.dirname(dir);
|
|
41324
|
+
if (up === dir) break;
|
|
41325
|
+
dir = up;
|
|
41326
|
+
}
|
|
41327
|
+
return rootAbove(realPathOf(board));
|
|
41328
|
+
}
|
|
41329
|
+
function rootAbove(board) {
|
|
41330
|
+
const parent = path4.dirname(board);
|
|
41331
|
+
return ["docs", ".akb"].includes(path4.basename(parent)) ? path4.dirname(parent) : parent;
|
|
41332
|
+
}
|
|
41333
|
+
function projectStateDir(board, root2 = stateRootOf(board)) {
|
|
41334
|
+
const relative = path4.relative(realPathOf(root2), realPathOf(board));
|
|
41335
|
+
if (relative === ".." || relative.startsWith(`..${path4.sep}`) || path4.isAbsolute(relative)) {
|
|
41336
|
+
throw new Error("The board must be inside its project root.");
|
|
41337
|
+
}
|
|
41338
|
+
return path4.join(realPathOf(root2), ".akb", "boards", relative || "_root");
|
|
41286
41339
|
}
|
|
41287
|
-
var taskOfAssets = (path37) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path37)?.[1] ?? null;
|
|
41288
|
-
var studioFolder = (id) => id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
41289
|
-
var studioName = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id);
|
|
41290
|
-
var projectConfigFile = "rules/config.md";
|
|
41291
|
-
var isStudioConfigPath = (path37) => /^rules\/studios\/[^/]+(?:\/config)?\.md$/.test(path37);
|
|
41292
41340
|
|
|
41293
|
-
// ../
|
|
41294
|
-
|
|
41295
|
-
|
|
41296
|
-
|
|
41297
|
-
|
|
41341
|
+
// ../cli/src/lib/paths.ts
|
|
41342
|
+
var REPO_ROOT = "";
|
|
41343
|
+
var KANBAN = "";
|
|
41344
|
+
var TODO = "";
|
|
41345
|
+
var ARCHIVE = "";
|
|
41346
|
+
var ARCHIVE_MD = "";
|
|
41347
|
+
var README = "";
|
|
41348
|
+
var MODULES_MD = "";
|
|
41349
|
+
var CONFIG = "";
|
|
41350
|
+
var KANBAN_GITIGNORE = "";
|
|
41351
|
+
var RELEASES = "";
|
|
41352
|
+
var RELEASE_SUMMARIES = "";
|
|
41353
|
+
var AGENTS = "";
|
|
41354
|
+
var STUDIOS = "";
|
|
41355
|
+
var ASSETS = "";
|
|
41356
|
+
var BOARD_STATE = "";
|
|
41357
|
+
var MEMORY = "";
|
|
41358
|
+
var AGENT_MEMORY = "";
|
|
41359
|
+
var PROJECT_MD = "";
|
|
41360
|
+
var LOCK = "";
|
|
41361
|
+
var UI_CONFIG = "";
|
|
41362
|
+
var ENV_FILE = "";
|
|
41363
|
+
var SESSIONS = "";
|
|
41364
|
+
var SESSIONS_DIR = "";
|
|
41365
|
+
var SESSIONS_LOCK2 = "";
|
|
41366
|
+
var INDEX_LOCK2 = "";
|
|
41367
|
+
var DELIVERIES = "";
|
|
41368
|
+
var PLANS = "";
|
|
41369
|
+
var PLANS_ARCHIVE = "";
|
|
41370
|
+
var RULES = "";
|
|
41371
|
+
var TRIAGE = "";
|
|
41372
|
+
var SIGNALS_ARCHIVED = "";
|
|
41373
|
+
var SIGNALS_DISMISSED = "";
|
|
41374
|
+
var SIGNALS_FILES = "";
|
|
41375
|
+
var SIGNALS_OLD_INBOX = "";
|
|
41376
|
+
var SIGNALS_OLD_HANDLED = "";
|
|
41377
|
+
var AKB_DIR = "";
|
|
41378
|
+
var ROOT_GITIGNORE = "";
|
|
41379
|
+
function boardLockName(kanban, root2) {
|
|
41380
|
+
const from = path5.relative(root2, kanban);
|
|
41381
|
+
const name = from && !from.startsWith("..") ? from : path5.basename(kanban);
|
|
41382
|
+
return `${name.split(path5.sep).join("-")}.lock`;
|
|
41383
|
+
}
|
|
41384
|
+
var shellWord = (value) => /^[\w./:@=-]+$/.test(value) ? value : `"${value.replace(/["`$\\]/g, "\\$&")}"`;
|
|
41385
|
+
var BOARD_FLAG = "";
|
|
41386
|
+
function setBoard(kanban, root2, flag) {
|
|
41387
|
+
REPO_ROOT = path5.resolve(root2);
|
|
41388
|
+
KANBAN = path5.resolve(kanban);
|
|
41389
|
+
BOARD_FLAG = flag;
|
|
41390
|
+
TODO = path5.join(KANBAN, "todo");
|
|
41391
|
+
ARCHIVE = path5.join(KANBAN, ".archive");
|
|
41392
|
+
ARCHIVE_MD = path5.join(KANBAN, "archive.md");
|
|
41393
|
+
README = path5.join(TODO, "README.md");
|
|
41394
|
+
MODULES_MD = path5.join(KANBAN, "modules.md");
|
|
41395
|
+
CONFIG = path5.join(KANBAN, "config.md");
|
|
41396
|
+
KANBAN_GITIGNORE = path5.join(KANBAN, ".gitignore");
|
|
41397
|
+
RELEASES = path5.join(KANBAN, "releases.md");
|
|
41398
|
+
RELEASE_SUMMARIES = path5.join(KANBAN, ".release-summaries");
|
|
41399
|
+
AGENTS = path5.join(KANBAN, "agents");
|
|
41400
|
+
STUDIOS = path5.join(KANBAN, "studios");
|
|
41401
|
+
MEMORY = path5.join(KANBAN, "memory");
|
|
41402
|
+
AGENT_MEMORY = path5.join(MEMORY, "agents");
|
|
41403
|
+
PROJECT_MD = path5.join(MEMORY, "project.md");
|
|
41404
|
+
ENV_FILE = path5.join(KANBAN, ".env");
|
|
41405
|
+
const machine = projectStateDir(KANBAN, REPO_ROOT);
|
|
41406
|
+
BOARD_STATE = machine;
|
|
41407
|
+
UI_CONFIG = path5.join(machine, UI_CONFIG_FILE);
|
|
41408
|
+
ASSETS = path5.join(machine, ASSETS_FOLDER);
|
|
41409
|
+
SESSIONS = path5.join(machine, SESSIONS_FILE);
|
|
41410
|
+
SESSIONS_DIR = path5.join(machine, SESSIONS_FOLDER);
|
|
41411
|
+
SESSIONS_LOCK2 = path5.join(machine, SESSIONS_LOCK);
|
|
41412
|
+
INDEX_LOCK2 = path5.join(machine, INDEX_LOCK);
|
|
41413
|
+
DELIVERIES = path5.join(KANBAN, "deliveries");
|
|
41414
|
+
RULES = path5.join(KANBAN, "rules");
|
|
41415
|
+
PLANS = path5.join(machine, "plans");
|
|
41416
|
+
PLANS_ARCHIVE = path5.join(PLANS, "archive");
|
|
41417
|
+
TRIAGE = path5.join(KANBAN, "triage");
|
|
41418
|
+
SIGNALS_ARCHIVED = path5.join(TRIAGE, "archived");
|
|
41419
|
+
SIGNALS_DISMISSED = path5.join(TRIAGE, "dismissed");
|
|
41420
|
+
SIGNALS_FILES = path5.join(TRIAGE, "files");
|
|
41421
|
+
SIGNALS_OLD_INBOX = path5.join(TRIAGE, "inbox");
|
|
41422
|
+
SIGNALS_OLD_HANDLED = path5.join(TRIAGE, "handled.md");
|
|
41423
|
+
AKB_DIR = path5.join(REPO_ROOT, ".akb");
|
|
41424
|
+
ROOT_GITIGNORE = path5.join(REPO_ROOT, ".gitignore");
|
|
41425
|
+
LOCK = path5.join(AKB_DIR, boardLockName(KANBAN, REPO_ROOT));
|
|
41426
|
+
return REPO_ROOT;
|
|
41427
|
+
}
|
|
41428
|
+
function setBoardRoot(root2, named = false) {
|
|
41429
|
+
const project = path5.resolve(root2);
|
|
41430
|
+
return setBoard(path5.join(project, "docs", "kanban"), project, named ? ` --dir ${shellWord(project)}` : "");
|
|
41431
|
+
}
|
|
41432
|
+
setBoardRoot(process.cwd());
|
|
41433
|
+
|
|
41434
|
+
// ../cli/src/lib/lock.ts
|
|
41435
|
+
function pidAlive(pid) {
|
|
41436
|
+
if (!pid) return false;
|
|
41437
|
+
try {
|
|
41438
|
+
process.kill(pid, 0);
|
|
41439
|
+
return true;
|
|
41440
|
+
} catch (e) {
|
|
41441
|
+
return e.code === "EPERM";
|
|
41442
|
+
}
|
|
41443
|
+
}
|
|
41444
|
+
|
|
41445
|
+
// ../cli/src/lib/shared/studio-files.ts
|
|
41446
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
41298
41447
|
|
|
41299
41448
|
// ../cli/src/lib/agent/studio-def.ts
|
|
41300
41449
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
41301
|
-
var
|
|
41450
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
41302
41451
|
|
|
41303
41452
|
// ../cli/src/lib/agents/icon.ts
|
|
41304
41453
|
var ICON_NAMES = [
|
|
@@ -41483,8 +41632,8 @@ function parseStudioFile(id, source, from, { requirePreviewCopy = false, require
|
|
|
41483
41632
|
return result();
|
|
41484
41633
|
}
|
|
41485
41634
|
const metaOffset = source.indexOf("\n") + 1, bodyOffset = front[0].length;
|
|
41486
|
-
const counter = new
|
|
41487
|
-
const document = (0,
|
|
41635
|
+
const counter = new import_yaml.LineCounter();
|
|
41636
|
+
const document = (0, import_yaml.parseDocument)(front[1], { lineCounter: counter, uniqueKeys: true, strict: true });
|
|
41488
41637
|
for (const error of document.errors) fail(metaOffset + (error.pos[0] ?? 0), "", error.code === "DUPLICATE_KEY" ? "yaml-duplicate-key" : "yaml-syntax", error.message.split("\n")[0], "Correct the indicated YAML location.");
|
|
41489
41638
|
if (problems.length) return result();
|
|
41490
41639
|
let raw;
|
|
@@ -41553,38 +41702,65 @@ function parseStudioFile(id, source, from, { requirePreviewCopy = false, require
|
|
|
41553
41702
|
} };
|
|
41554
41703
|
}
|
|
41555
41704
|
|
|
41556
|
-
// ../cli/src/lib/agent/studio-folder.ts
|
|
41557
|
-
import fs4 from "node:fs";
|
|
41558
|
-
import path4 from "node:path";
|
|
41559
|
-
|
|
41560
|
-
// ../cli/src/lib/shared/studio-files.ts
|
|
41561
|
-
var import_yaml5 = __toESM(require_dist(), 1);
|
|
41562
|
-
|
|
41563
41705
|
// ../cli/src/lib/shared/guide-topics.ts
|
|
41564
41706
|
var GUIDE_TOPICS = ["board", "writing", "add-task", "follow-up", "discuss-goal", "troubleshoot", "card-chat", "task-ui-en", "task-ui-zh", "update-studio", "implement", "settle-background", "archive", "update-questions", "refine", "revise", "resolve", "prune-memory", "review-memory", "describe-project", "review-rejections", "reflect", "write-agent", "write-prompt", "module-map"];
|
|
41565
41707
|
|
|
41566
41708
|
// ../cli/src/lib/shared/studio-files.ts
|
|
41567
41709
|
var STUDIO_FILE = "STUDIO.md";
|
|
41568
41710
|
var MCP_FILE = "mcp.json";
|
|
41569
|
-
var CARD_TEMPLATE_FILE = "CARD.md";
|
|
41570
41711
|
var VERSION_FILE = "version.json";
|
|
41712
|
+
var PUBLICATION_FILE = ".publication.json";
|
|
41713
|
+
var STUDIO_CATALOG_FILE = "catalog.json";
|
|
41571
41714
|
var KB = 1024;
|
|
41572
|
-
var FILE_LIMITS = { file: 2 * KB * KB, total:
|
|
41715
|
+
var FILE_LIMITS = { file: 2 * KB * KB, total: 10 * KB * KB, count: 500, path: 512 };
|
|
41573
41716
|
var officialId = (folder2) => `wf_builtin_${folder2.replace(/-/g, "_")}`;
|
|
41574
41717
|
var hashInput = (files) => JSON.stringify(Object.entries(files).sort(([a], [b]) => a < b ? -1 : 1));
|
|
41575
41718
|
var landsOf = (_def) => ({ lands: true });
|
|
41576
|
-
var
|
|
41719
|
+
var encoder = new TextEncoder();
|
|
41720
|
+
var safeStudioPath = (file2) => encoder.encode(file2).length <= FILE_LIMITS.path && !/[<>:"\\|?*\x00-\x1f\x7f]/.test(file2) && file2.split("/").every((part) => !!part && encoder.encode(part).length <= 255 && !/[. ]$/.test(part) && !/^(?:\.git$|(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$))/i.test(part));
|
|
41721
|
+
var SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
41722
|
+
var skillFile = (name) => "skills/" + name + "/SKILL.md";
|
|
41723
|
+
function skillMetadata(source, directory2) {
|
|
41724
|
+
const front = /^\uFEFF?---[^\S\r\n]*\r?\n([\s\S]*?)^---[^\S\r\n]*(?:\r?\n|$)/m.exec(source);
|
|
41725
|
+
if (!front || front.index !== 0) return "Start SKILL.md with YAML frontmatter";
|
|
41726
|
+
const doc = (0, import_yaml3.parseDocument)(front[1]);
|
|
41727
|
+
if (doc.errors.length || !(0, import_yaml3.isMap)(doc.contents)) return "Use valid YAML frontmatter with unique keys";
|
|
41728
|
+
let data;
|
|
41729
|
+
try {
|
|
41730
|
+
data = doc.toJS({ maxAliasCount: 0 });
|
|
41731
|
+
} catch {
|
|
41732
|
+
return "Use literal YAML metadata";
|
|
41733
|
+
}
|
|
41734
|
+
const { name, description, license, compatibility, metadata, "allowed-tools": allowedTools, ...extra } = data;
|
|
41735
|
+
if (name !== directory2 || !SKILL_NAME.test(directory2) || directory2.length > 64) return "Set name to match the containing skill directory (1\u201364 lowercase letters, digits and single hyphens)";
|
|
41736
|
+
if (typeof description !== "string" || !description.trim() || [...description].length > 1024) return "Set description to 1\u20131024 characters";
|
|
41737
|
+
if (license !== void 0 && typeof license !== "string") return "Set license to a string";
|
|
41738
|
+
if (compatibility !== void 0 && (typeof compatibility !== "string" || !compatibility.trim() || [...compatibility].length > 500)) return "Set compatibility to 1\u2013500 characters";
|
|
41739
|
+
if (metadata !== void 0 && (!metadata || typeof metadata !== "object" || Array.isArray(metadata) || Object.values(metadata).some((value) => typeof value !== "string"))) return "Set metadata to a map of strings";
|
|
41740
|
+
if (allowedTools !== void 0 && typeof allowedTools !== "string") return "Set allowed-tools to a string";
|
|
41741
|
+
if (Object.keys(extra).length) return "Use standard Agent Skills fields and put custom fields under metadata";
|
|
41742
|
+
return { name: directory2, description: description.trim().replace(/\s+/g, " ") };
|
|
41743
|
+
}
|
|
41577
41744
|
var isAboutFile = (file2) => /^ABOUT(\.[a-z]{2})?\.md$/.test(file2) || /^screenshots\/[\w.-]+\.(png|jpe?g|webp)$/.test(file2);
|
|
41578
|
-
var
|
|
41579
|
-
|
|
41580
|
-
|
|
41581
|
-
|
|
41582
|
-
|
|
41583
|
-
|
|
41584
|
-
|
|
41585
|
-
|
|
41586
|
-
|
|
41587
|
-
|
|
41745
|
+
var studioScreenshotPrefix = (path37) => "data:" + (path37.endsWith(".png") ? "image/png" : /\.jpe?g$/.test(path37) ? "image/jpeg" : "image/webp") + ";base64,";
|
|
41746
|
+
function studioFileBody(path37, text2) {
|
|
41747
|
+
if (path37.startsWith("screenshots/") && isAboutFile(path37)) {
|
|
41748
|
+
const prefix = studioScreenshotPrefix(path37);
|
|
41749
|
+
if (text2.startsWith(prefix)) {
|
|
41750
|
+
const data = text2.slice(prefix.length);
|
|
41751
|
+
if (/^[A-Za-z0-9+/]*={0,2}$/.test(data) && data.length % 4 === 0) {
|
|
41752
|
+
const raw = atob(data);
|
|
41753
|
+
if (btoa(raw) === data) return { bytes: Uint8Array.from(raw, (c) => c.charCodeAt(0)), binary: true };
|
|
41754
|
+
}
|
|
41755
|
+
}
|
|
41756
|
+
}
|
|
41757
|
+
const bytes = encoder.encode(text2);
|
|
41758
|
+
if (new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes) !== text2) throw Error("Invalid UTF-8.");
|
|
41759
|
+
return { bytes, binary: false };
|
|
41760
|
+
}
|
|
41761
|
+
function studioSizeProblem(file2, size, total) {
|
|
41762
|
+
if (size > FILE_LIMITS.file) return { file: file2, reason: "is larger than 2 MiB", tooLarge: true };
|
|
41763
|
+
if (total > FILE_LIMITS.total) return { file: "files", reason: "are larger than 10 MiB together", tooLarge: true };
|
|
41588
41764
|
}
|
|
41589
41765
|
function mcpProblem(text2) {
|
|
41590
41766
|
let read3;
|
|
@@ -41620,42 +41796,70 @@ function inspect(value, official, { allowLegacyPreviewCopy, allowLegacyLand } =
|
|
|
41620
41796
|
return { problems };
|
|
41621
41797
|
};
|
|
41622
41798
|
if (!value || typeof value !== "object" || Array.isArray(value)) return fail("files", "must be an object of path \u2192 text");
|
|
41623
|
-
const files = Object.fromEntries(Object.entries(value).filter(([file2]) => file2 !== VERSION_FILE));
|
|
41799
|
+
const files = Object.assign(/* @__PURE__ */ Object.create(null), Object.fromEntries(Object.entries(value).filter(([file2]) => file2 !== VERSION_FILE && file2 !== PUBLICATION_FILE)));
|
|
41624
41800
|
const entries = Object.entries(files);
|
|
41625
41801
|
if (entries.length > FILE_LIMITS.count) return fail("files", `holds at most ${FILE_LIMITS.count} files`, true);
|
|
41626
41802
|
let total = 0;
|
|
41627
41803
|
const skills = /* @__PURE__ */ new Set();
|
|
41804
|
+
const paths = new Map([VERSION_FILE, PUBLICATION_FILE].map((file2) => [file2, { path: file2, file: true }]));
|
|
41805
|
+
const pathProblem = (file2, reason) => problems.push({ file: file2, reason, code: "studio-path", hint: "Use a safe relative file path unique within the Studio." });
|
|
41628
41806
|
for (const [file2, text2] of entries) {
|
|
41629
41807
|
if (typeof text2 !== "string" || text2.includes("\0")) {
|
|
41630
41808
|
fail(file2, "is not a text file");
|
|
41631
41809
|
continue;
|
|
41632
41810
|
}
|
|
41633
|
-
|
|
41634
|
-
|
|
41811
|
+
let size;
|
|
41812
|
+
try {
|
|
41813
|
+
size = studioFileBody(file2, text2).bytes.length;
|
|
41814
|
+
} catch {
|
|
41815
|
+
fail(file2, "is not valid UTF-8");
|
|
41635
41816
|
continue;
|
|
41636
41817
|
}
|
|
41637
|
-
const size = bytes(text2);
|
|
41638
|
-
if (size > FILE_LIMITS.file) return fail(file2, `is larger than ${FILE_LIMITS.file / KB} KB`, true);
|
|
41639
41818
|
total += size;
|
|
41640
|
-
|
|
41641
|
-
if (
|
|
41642
|
-
if (
|
|
41643
|
-
|
|
41644
|
-
if (problem) fail(file2, problem);
|
|
41819
|
+
const limit = studioSizeProblem(file2, size, total);
|
|
41820
|
+
if (limit) return fail(limit.file, limit.reason, true);
|
|
41821
|
+
if (!safeStudioPath(file2)) {
|
|
41822
|
+
pathProblem(file2, "Unsafe Studio path");
|
|
41645
41823
|
continue;
|
|
41646
41824
|
}
|
|
41647
|
-
|
|
41648
|
-
|
|
41649
|
-
|
|
41650
|
-
|
|
41651
|
-
|
|
41825
|
+
const parts = file2.split("/");
|
|
41826
|
+
for (let i = 1; i <= parts.length; i++) {
|
|
41827
|
+
const at = parts.slice(0, i).join("/");
|
|
41828
|
+
const key = at.normalize("NFC").toLowerCase();
|
|
41829
|
+
const prior = paths.get(key);
|
|
41830
|
+
if (prior && (prior.path !== at || prior.file || i === parts.length)) {
|
|
41831
|
+
pathProblem(file2, "Path conflicts with " + prior.path);
|
|
41832
|
+
break;
|
|
41833
|
+
}
|
|
41834
|
+
paths.set(key, { path: at, file: i === parts.length });
|
|
41835
|
+
}
|
|
41836
|
+
if (file2.toLowerCase() === STUDIO_CATALOG_FILE && (!official || file2 !== STUDIO_CATALOG_FILE)) {
|
|
41837
|
+
pathProblem(file2, "The root catalog.json is reserved for official Studio metadata");
|
|
41838
|
+
}
|
|
41839
|
+
if (file2 === MCP_FILE) {
|
|
41840
|
+
const problem = official ? mcpProblem(text2) : "MCP servers are available to official Studios";
|
|
41841
|
+
if (problem) fail(file2, problem);
|
|
41842
|
+
}
|
|
41843
|
+
if (parts[0] === "skills") {
|
|
41844
|
+
const name = parts[1];
|
|
41845
|
+
if (parts.length < 3 || !name || !SKILL_NAME.test(name) || name.length > 64) {
|
|
41846
|
+
pathProblem(file2, "Expected skills/<name>/<path> with a valid Agent Skills name");
|
|
41847
|
+
} else skills.add(name);
|
|
41652
41848
|
}
|
|
41653
|
-
if (isSharedFile(file2)) continue;
|
|
41654
|
-
if (/^(?:references|scripts)\//.test(file2) && file2.split("/").every((p) => SEGMENT.test(p) && p !== "." && p !== "..")) continue;
|
|
41655
|
-
fail(file2, `use ${STUDIO_FILE}, ${CARD_TEMPLATE_FILE}, references/, scripts/ or shared/`);
|
|
41656
41849
|
}
|
|
41657
41850
|
for (const name of skills) {
|
|
41658
|
-
|
|
41851
|
+
const file2 = skillFile(name);
|
|
41852
|
+
const text2 = files[file2];
|
|
41853
|
+
const problem = text2 === void 0 ? "SKILL.md is missing" : typeof text2 === "string" ? skillMetadata(text2, name) : null;
|
|
41854
|
+
if (typeof problem === "string") problems.push({
|
|
41855
|
+
file: file2,
|
|
41856
|
+
line: 1,
|
|
41857
|
+
column: 1,
|
|
41858
|
+
code: "studio-skill",
|
|
41859
|
+
message: problem,
|
|
41860
|
+
reason: problem,
|
|
41861
|
+
hint: "Follow the Agent Skills specification at https://agentskills.io/specification."
|
|
41862
|
+
});
|
|
41659
41863
|
}
|
|
41660
41864
|
const source = files[STUDIO_FILE];
|
|
41661
41865
|
const read3 = typeof source === "string" ? parseStudioFile("studio", source, STUDIO_FILE, { requirePreviewCopy: !official && !allowLegacyPreviewCopy, requireLand: !allowLegacyLand }) : null;
|
|
@@ -41667,7 +41871,7 @@ function inspect(value, official, { allowLegacyPreviewCopy, allowLegacyLand } =
|
|
|
41667
41871
|
if (typeof text2 !== "string" || !file2.endsWith(".md")) continue;
|
|
41668
41872
|
const masked = withoutCode(text2);
|
|
41669
41873
|
const reference = (offset, link, message) => problems.push({ file: file2, ...sourcePosition(text2, offset), path: link, code: "studio-reference", message, reason: message, hint: "Use an existing safe relative resource or a shipped AKB Guide." });
|
|
41670
|
-
for (const match of masked.matchAll(/!?\[[^\]]*\]\(([^\s)]+)(?:\s+[^)]*)?\)/g)) {
|
|
41874
|
+
for (const match of masked.matchAll(/!?\[[^\]]*\]\((<[^>\r\n]+>|[^\s)]+)(?:\s+[^)]*)?\)/g)) {
|
|
41671
41875
|
const link = match[1].replace(/^<|>$/g, "");
|
|
41672
41876
|
if (/^(?:https?:|mailto:|#)/i.test(link)) continue;
|
|
41673
41877
|
let decoded;
|
|
@@ -41689,29 +41893,90 @@ function inspect(value, official, { allowLegacyPreviewCopy, allowLegacyLand } =
|
|
|
41689
41893
|
return { problems, def, files };
|
|
41690
41894
|
}
|
|
41691
41895
|
|
|
41896
|
+
// ../cli/src/lib/shared/studio-package.ts
|
|
41897
|
+
var LOCAL = 30;
|
|
41898
|
+
var CENTRAL = 46;
|
|
41899
|
+
var END = 22;
|
|
41900
|
+
var encoder2 = new TextEncoder();
|
|
41901
|
+
var decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
41902
|
+
var crcTable = Uint32Array.from({ length: 256 }, (_, byte) => {
|
|
41903
|
+
for (let bit = 0; bit < 8; bit++) byte = byte >>> 1 ^ (byte & 1 ? 3988292384 : 0);
|
|
41904
|
+
return byte;
|
|
41905
|
+
});
|
|
41906
|
+
var STUDIO_ZIP_LIMIT = FILE_LIMITS.total + FILE_LIMITS.count * (LOCAL + CENTRAL + 2 * FILE_LIMITS.path) + END;
|
|
41907
|
+
|
|
41908
|
+
// ../cli/src/lib/shared/file-limits.ts
|
|
41909
|
+
var BOARD_FILE_LIMIT = 10 * 1024 * 1024;
|
|
41910
|
+
var ASSET_FILE_LIMIT = 100 * 1024 * 1024;
|
|
41911
|
+
|
|
41912
|
+
// ../cli/src/lib/shared/board-files.ts
|
|
41913
|
+
var ROOTS = ["todo/", ".archive/", "memory/", "studios/", "triage/", "assets/", "rules/"];
|
|
41914
|
+
var SETTINGS = ["modules.md", "config.md"];
|
|
41915
|
+
var isSettingsPath = (path37) => SETTINGS.includes(path37) || path37 === projectConfigFile || isStudioConfigPath(path37) || /^rules\/(?:proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path37);
|
|
41916
|
+
function isBoardPath(path37) {
|
|
41917
|
+
if (!path37 || path37.length > 500 || path37.startsWith("/") || path37.includes("\\") || path37.includes("\0")) return false;
|
|
41918
|
+
if (path37.split("/").some((part) => !part || part === "." || part === "..")) return false;
|
|
41919
|
+
if (path37 === "todo/README.md" || path37.split("/").includes(".sync")) return false;
|
|
41920
|
+
if (path37.startsWith("studios/")) return true;
|
|
41921
|
+
if (SETTINGS.includes(path37)) return true;
|
|
41922
|
+
if (path37.startsWith("rules/")) return isSettingsPath(path37);
|
|
41923
|
+
if (path37.startsWith("assets/")) return taskOfAssets(path37) !== null;
|
|
41924
|
+
return ROOTS.some((root2) => path37.startsWith(root2)) && path37.endsWith(".md");
|
|
41925
|
+
}
|
|
41926
|
+
var taskOfAssets = (path37) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path37)?.[1] ?? null;
|
|
41927
|
+
var studioFolder = (id) => id.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
41928
|
+
var studioName = (id) => id.startsWith("wf_builtin_") ? id.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id);
|
|
41929
|
+
var projectConfigFile = "rules/config.md";
|
|
41930
|
+
var isStudioConfigPath = (path37) => /^rules\/studios\/[^/]+(?:\/config)?\.md$/.test(path37);
|
|
41931
|
+
|
|
41932
|
+
// ../official/pack.ts
|
|
41933
|
+
import crypto5 from "node:crypto";
|
|
41934
|
+
import fs6 from "node:fs";
|
|
41935
|
+
import path7 from "node:path";
|
|
41936
|
+
import { fileURLToPath } from "node:url";
|
|
41937
|
+
|
|
41692
41938
|
// ../cli/src/lib/agent/studio-folder.ts
|
|
41939
|
+
import fs5 from "node:fs";
|
|
41940
|
+
import path6 from "node:path";
|
|
41693
41941
|
var MIME = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".webp": "image/webp" };
|
|
41694
41942
|
function filesOf(dir, base = dir) {
|
|
41695
|
-
return
|
|
41696
|
-
const full =
|
|
41697
|
-
if (e.
|
|
41698
|
-
return e.isDirectory() ? filesOf(full, base) : [
|
|
41943
|
+
return fs5.readdirSync(dir, { withFileTypes: true }).filter((e) => e.name.toLowerCase() !== ".git" && (dir !== base || e.name !== PUBLICATION_FILE)).flatMap((e) => {
|
|
41944
|
+
const full = path6.join(dir, e.name);
|
|
41945
|
+
if (!e.isFile() && !e.isDirectory()) throw new Error(full + ": only regular files and directories are allowed");
|
|
41946
|
+
return e.isDirectory() ? filesOf(full, base) : [path6.relative(base, full).split(path6.sep).join("/")];
|
|
41699
41947
|
});
|
|
41700
41948
|
}
|
|
41701
41949
|
function readStudioFile(dir, file2) {
|
|
41702
|
-
const full =
|
|
41703
|
-
|
|
41950
|
+
const full = path6.join(dir, file2);
|
|
41951
|
+
const bytes = fs5.readFileSync(full);
|
|
41952
|
+
if (isAboutFile(file2) && !file2.endsWith(".md")) return "data:" + MIME[path6.extname(file2)] + ";base64," + bytes.toString("base64");
|
|
41953
|
+
try {
|
|
41954
|
+
return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
41955
|
+
} catch {
|
|
41956
|
+
throw new Error(file2 + ": expected a UTF-8 text file");
|
|
41957
|
+
}
|
|
41958
|
+
}
|
|
41959
|
+
function readStudioFolder(dir) {
|
|
41960
|
+
const files = filesOf(dir).sort();
|
|
41961
|
+
if (files.filter((file2) => file2 !== VERSION_FILE).length > FILE_LIMITS.count) throw new Error("Studio file count limit exceeded");
|
|
41962
|
+
let total = 0;
|
|
41963
|
+
return Object.fromEntries(files.map((file2) => {
|
|
41964
|
+
const size = fs5.statSync(path6.join(dir, file2)).size;
|
|
41965
|
+
if (file2 !== VERSION_FILE) total += size;
|
|
41966
|
+
const problem = studioSizeProblem(file2, size, total);
|
|
41967
|
+
if (problem) throw new Error(problem.file + ": " + problem.reason);
|
|
41968
|
+
return [file2, readStudioFile(dir, file2)];
|
|
41969
|
+
}));
|
|
41704
41970
|
}
|
|
41705
|
-
var readStudioFolder = (dir) => Object.fromEntries(filesOf(dir).sort().map((f) => [f, readStudioFile(dir, f)]));
|
|
41706
41971
|
|
|
41707
41972
|
// ../official/pack.ts
|
|
41708
|
-
var OFFICIAL =
|
|
41709
|
-
var dirs = (dir) =>
|
|
41710
|
-
var hashOf = (files) =>
|
|
41973
|
+
var OFFICIAL = path7.dirname(fileURLToPath(import.meta.url));
|
|
41974
|
+
var dirs = (dir) => fs6.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
|
|
41975
|
+
var hashOf = (files) => crypto5.createHash("sha256").update(hashInput(files)).digest("hex");
|
|
41711
41976
|
function packOfficial(root2 = OFFICIAL, loose = false) {
|
|
41712
|
-
const studiosDir =
|
|
41977
|
+
const studiosDir = path7.join(root2, "studios");
|
|
41713
41978
|
return dirs(studiosDir).map((folder2) => {
|
|
41714
|
-
const files = readStudioFolder(
|
|
41979
|
+
const files = readStudioFolder(path7.join(studiosDir, folder2));
|
|
41715
41980
|
const parsed = parseStudioFile(folder2, files[STUDIO_FILE] ?? "", STUDIO_FILE);
|
|
41716
41981
|
if ("problem" in parsed) throw new Error(parsed.problem);
|
|
41717
41982
|
const def = parsed.def;
|
|
@@ -41732,19 +41997,19 @@ function packOfficial(root2 = OFFICIAL, loose = false) {
|
|
|
41732
41997
|
}
|
|
41733
41998
|
|
|
41734
41999
|
// ../cli/src/lib/cloud/tasks.ts
|
|
41735
|
-
import
|
|
41736
|
-
import
|
|
42000
|
+
import fs8 from "node:fs";
|
|
42001
|
+
import path10 from "node:path";
|
|
41737
42002
|
|
|
41738
42003
|
// ../cli/src/lib/cloud/session.ts
|
|
41739
|
-
import
|
|
42004
|
+
import fs7 from "node:fs";
|
|
41740
42005
|
import { createHash } from "node:crypto";
|
|
41741
|
-
import
|
|
42006
|
+
import path9 from "node:path";
|
|
41742
42007
|
|
|
41743
42008
|
// ../cli/src/lib/machine/home.ts
|
|
41744
42009
|
import os3 from "node:os";
|
|
41745
|
-
import
|
|
42010
|
+
import path8 from "node:path";
|
|
41746
42011
|
function machineHome() {
|
|
41747
|
-
return process.env.AI4KANBAN_HOME ||
|
|
42012
|
+
return process.env.AI4KANBAN_HOME || path8.join(os3.homedir(), ".ai4kanban");
|
|
41748
42013
|
}
|
|
41749
42014
|
|
|
41750
42015
|
// ../cli/src/lib/cloud/session.ts
|
|
@@ -41754,15 +42019,15 @@ var LOCK_WAIT_MS = 2e4;
|
|
|
41754
42019
|
var LOCK_RETRY_MS = 50;
|
|
41755
42020
|
var REFRESH_TIMEOUT_MS = 15e3;
|
|
41756
42021
|
var REFRESH_BACKOFF_MS = 6e4;
|
|
41757
|
-
var sessionFile = () =>
|
|
41758
|
-
var lockDir = () =>
|
|
41759
|
-
var lockOwner = () =>
|
|
41760
|
-
var retryFile = () =>
|
|
42022
|
+
var sessionFile = () => path9.join(machineHome(), "session.json");
|
|
42023
|
+
var lockDir = () => path9.join(machineHome(), "session.lock");
|
|
42024
|
+
var lockOwner = () => path9.join(lockDir(), "owner");
|
|
42025
|
+
var retryFile = () => path9.join(machineHome(), "session-refresh.json");
|
|
41761
42026
|
var transportRetry;
|
|
41762
42027
|
var refreshKey = (session) => createHash("sha256").update(JSON.stringify([cloudEndpoints().api, session.subject, session.refreshToken])).digest("hex");
|
|
41763
42028
|
function readRetry(session) {
|
|
41764
42029
|
try {
|
|
41765
|
-
const retry2 = JSON.parse(
|
|
42030
|
+
const retry2 = JSON.parse(fs7.readFileSync(retryFile(), "utf8"));
|
|
41766
42031
|
if (!retry2.source && ["fetch failed", "The operation was aborted due to timeout"].includes(retry2.error)) return;
|
|
41767
42032
|
if (retry2.key === refreshKey(session) && Number.isFinite(retry2.until) && Number.isInteger(retry2.attempt) && retry2.attempt > 0 && typeof retry2.error === "string") return retry2;
|
|
41768
42033
|
} catch {
|
|
@@ -41784,8 +42049,8 @@ function deferRefresh(session, error, { after, transport = false } = {}) {
|
|
|
41784
42049
|
if (transport) transportRetry = { ...retry2, file: retryFile() };
|
|
41785
42050
|
else {
|
|
41786
42051
|
const temporary = `${retryFile()}.${process.pid}.tmp`;
|
|
41787
|
-
|
|
41788
|
-
|
|
42052
|
+
fs7.writeFileSync(temporary, JSON.stringify({ ...retry2, source: "cloud" }), { mode: 384 });
|
|
42053
|
+
fs7.renameSync(temporary, retryFile());
|
|
41789
42054
|
}
|
|
41790
42055
|
}
|
|
41791
42056
|
return { ok: false, reason: "unreachable", error };
|
|
@@ -41793,7 +42058,7 @@ function deferRefresh(session, error, { after, transport = false } = {}) {
|
|
|
41793
42058
|
function readSession() {
|
|
41794
42059
|
let raw;
|
|
41795
42060
|
try {
|
|
41796
|
-
raw =
|
|
42061
|
+
raw = fs7.readFileSync(sessionFile(), "utf8");
|
|
41797
42062
|
} catch {
|
|
41798
42063
|
return null;
|
|
41799
42064
|
}
|
|
@@ -41807,19 +42072,19 @@ function readSession() {
|
|
|
41807
42072
|
}
|
|
41808
42073
|
}
|
|
41809
42074
|
function writeSession(session) {
|
|
41810
|
-
|
|
42075
|
+
fs7.mkdirSync(machineHome(), { recursive: true, mode: 448 });
|
|
41811
42076
|
const tmp = `${sessionFile()}.${process.pid}.tmp`;
|
|
41812
|
-
|
|
42077
|
+
fs7.writeFileSync(tmp, `${JSON.stringify(session, null, 2)}
|
|
41813
42078
|
`, { mode: 384 });
|
|
41814
|
-
|
|
41815
|
-
if (!expiringSoon(session) || !readRetry(session))
|
|
42079
|
+
fs7.renameSync(tmp, sessionFile());
|
|
42080
|
+
if (!expiringSoon(session) || !readRetry(session)) fs7.rmSync(retryFile(), { force: true });
|
|
41816
42081
|
if (transportRetry?.file === retryFile() && (!expiringSoon(session) || !readTransportRetry(session))) transportRetry = void 0;
|
|
41817
42082
|
}
|
|
41818
42083
|
function clearSession() {
|
|
41819
42084
|
if (transportRetry?.file === retryFile()) transportRetry = void 0;
|
|
41820
42085
|
try {
|
|
41821
|
-
|
|
41822
|
-
|
|
42086
|
+
fs7.rmSync(sessionFile());
|
|
42087
|
+
fs7.rmSync(retryFile(), { force: true });
|
|
41823
42088
|
} catch {
|
|
41824
42089
|
}
|
|
41825
42090
|
}
|
|
@@ -41894,23 +42159,23 @@ async function takeLock() {
|
|
|
41894
42159
|
const until = Date.now() + LOCK_WAIT_MS;
|
|
41895
42160
|
for (; ; ) {
|
|
41896
42161
|
try {
|
|
41897
|
-
|
|
41898
|
-
|
|
42162
|
+
fs7.mkdirSync(machineHome(), { recursive: true, mode: 448 });
|
|
42163
|
+
fs7.mkdirSync(lockDir());
|
|
41899
42164
|
try {
|
|
41900
|
-
|
|
42165
|
+
fs7.writeFileSync(lockOwner(), `${process.pid}
|
|
41901
42166
|
`);
|
|
41902
42167
|
} catch {
|
|
41903
42168
|
}
|
|
41904
42169
|
return () => {
|
|
41905
42170
|
try {
|
|
41906
|
-
|
|
42171
|
+
fs7.rmSync(lockDir(), { recursive: true, force: true });
|
|
41907
42172
|
} catch {
|
|
41908
42173
|
}
|
|
41909
42174
|
};
|
|
41910
42175
|
} catch (err) {
|
|
41911
42176
|
if (err.code !== "EEXIST") throw err;
|
|
41912
42177
|
if (stale()) {
|
|
41913
|
-
|
|
42178
|
+
fs7.rmSync(lockDir(), { recursive: true, force: true });
|
|
41914
42179
|
continue;
|
|
41915
42180
|
}
|
|
41916
42181
|
if (Date.now() > until) return null;
|
|
@@ -41921,14 +42186,14 @@ async function takeLock() {
|
|
|
41921
42186
|
function stale() {
|
|
41922
42187
|
let held2;
|
|
41923
42188
|
try {
|
|
41924
|
-
const pid = Number(
|
|
42189
|
+
const pid = Number(fs7.readFileSync(lockOwner(), "utf8").trim());
|
|
41925
42190
|
held2 = Number.isInteger(pid) && pid > 0 ? pid : void 0;
|
|
41926
42191
|
} catch {
|
|
41927
42192
|
held2 = void 0;
|
|
41928
42193
|
}
|
|
41929
42194
|
if (held2 !== void 0) return !alive(held2);
|
|
41930
42195
|
try {
|
|
41931
|
-
return Date.now() -
|
|
42196
|
+
return Date.now() - fs7.statSync(lockDir()).mtimeMs > LOCK_STALE_MS;
|
|
41932
42197
|
} catch {
|
|
41933
42198
|
return false;
|
|
41934
42199
|
}
|
|
@@ -41943,28 +42208,6 @@ function alive(pid) {
|
|
|
41943
42208
|
}
|
|
41944
42209
|
var sleep = (ms) => new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
41945
42210
|
|
|
41946
|
-
// ../cli/src/lib/io.ts
|
|
41947
|
-
var BoardError = class extends Error {
|
|
41948
|
-
// `kind` is the machine-readable name of the refusal (card-not-found, no-board,
|
|
41949
|
-
// unknown-module, …). It is what a caller reads; the exit code stays 1 for every
|
|
41950
|
-
// refusal, so nobody has to keep a table of numbers.
|
|
41951
|
-
kind;
|
|
41952
|
-
// Only `cloud image` / `cloud tts` set it: 2 for a usage error, as the scripts they replaced did.
|
|
41953
|
-
exitCode;
|
|
41954
|
-
// `bare` says the message is already the whole thing a person should see — a usage
|
|
41955
|
-
// block, say — so the dispatcher prints it without putting the command in front of it.
|
|
41956
|
-
bare;
|
|
41957
|
-
details;
|
|
41958
|
-
constructor(message, { kind = "refused", bare = false, exitCode = 1, ...details } = {}) {
|
|
41959
|
-
super(message);
|
|
41960
|
-
this.name = "BoardError";
|
|
41961
|
-
this.kind = kind;
|
|
41962
|
-
this.bare = bare;
|
|
41963
|
-
this.exitCode = exitCode;
|
|
41964
|
-
this.details = details;
|
|
41965
|
-
}
|
|
41966
|
-
};
|
|
41967
|
-
|
|
41968
42211
|
// ../cli/src/lib/cloud/response.ts
|
|
41969
42212
|
var isRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
41970
42213
|
var hasText = (value) => typeof value === "string" && !!value.trim();
|
|
@@ -41992,15 +42235,15 @@ function workspaceTask() {
|
|
|
41992
42235
|
return id && id.trim() ? id.trim() : null;
|
|
41993
42236
|
}
|
|
41994
42237
|
function runnerProject(board) {
|
|
41995
|
-
if (
|
|
41996
|
-
const linked = linkedProject(board,
|
|
42238
|
+
if (path10.basename(board) !== "kanban" || path10.basename(path10.dirname(board)) !== ".akb") return null;
|
|
42239
|
+
const linked = linkedProject(board, path10.dirname(path10.dirname(board)));
|
|
41997
42240
|
return linked.ok ? linked.value : null;
|
|
41998
42241
|
}
|
|
41999
42242
|
function linkedProject(board, root2) {
|
|
42000
|
-
const file2 =
|
|
42001
|
-
if (!
|
|
42243
|
+
const file2 = path10.join(root2, ".akb", "base.json");
|
|
42244
|
+
if (!fs8.existsSync(file2)) return { ok: true, value: null };
|
|
42002
42245
|
try {
|
|
42003
|
-
const base = JSON.parse(
|
|
42246
|
+
const base = JSON.parse(fs8.readFileSync(file2, "utf8"));
|
|
42004
42247
|
if (!base || typeof base !== "object" || base.project !== void 0 && (typeof base.project !== "string" || !base.project.trim()) || base.files !== void 0 && (!base.files || typeof base.files !== "object" || Array.isArray(base.files))) throw new Error();
|
|
42005
42248
|
const projects = new Set(Object.keys(base.files ?? {}).flatMap((p) => /^projects\/([^/]+)\//.exec(p)?.[1] ?? []));
|
|
42006
42249
|
if (typeof base.project === "string") projects.add(base.project);
|
|
@@ -42012,14 +42255,14 @@ function linkedProject(board, root2) {
|
|
|
42012
42255
|
}
|
|
42013
42256
|
|
|
42014
42257
|
// ../cli/src/lib/file-memo.ts
|
|
42015
|
-
import
|
|
42016
|
-
import
|
|
42258
|
+
import fs9 from "node:fs";
|
|
42259
|
+
import path11 from "node:path";
|
|
42017
42260
|
function stamp(paths) {
|
|
42018
42261
|
const parts = [];
|
|
42019
42262
|
const visit = (p) => {
|
|
42020
42263
|
let st;
|
|
42021
42264
|
try {
|
|
42022
|
-
st =
|
|
42265
|
+
st = fs9.statSync(p, { bigint: true });
|
|
42023
42266
|
} catch {
|
|
42024
42267
|
parts.push(`${p}:-`);
|
|
42025
42268
|
return;
|
|
@@ -42031,11 +42274,11 @@ function stamp(paths) {
|
|
|
42031
42274
|
parts.push(`${p}/`);
|
|
42032
42275
|
let names;
|
|
42033
42276
|
try {
|
|
42034
|
-
names =
|
|
42277
|
+
names = fs9.readdirSync(p).sort();
|
|
42035
42278
|
} catch {
|
|
42036
42279
|
return;
|
|
42037
42280
|
}
|
|
42038
|
-
for (const name of names) if (name !== "node_modules" && name !== ".git") visit(
|
|
42281
|
+
for (const name of names) if (name !== "node_modules" && name !== ".git") visit(path11.join(p, name));
|
|
42039
42282
|
};
|
|
42040
42283
|
for (const p of paths) visit(p);
|
|
42041
42284
|
return parts.join("\n");
|
|
@@ -42076,149 +42319,8 @@ function memoByFiles(paths, read3) {
|
|
|
42076
42319
|
};
|
|
42077
42320
|
}
|
|
42078
42321
|
|
|
42079
|
-
// ../cli/src/lib/paths.ts
|
|
42080
|
-
import path11 from "node:path";
|
|
42081
|
-
|
|
42082
|
-
// ../cli/src/lib/machine/project.ts
|
|
42083
|
-
import fs9 from "node:fs";
|
|
42084
|
-
import path10 from "node:path";
|
|
42085
|
-
var SESSIONS_FILE = "sessions.json";
|
|
42086
|
-
var SESSIONS_FOLDER = "sessions";
|
|
42087
|
-
var ASSETS_FOLDER = "assets";
|
|
42088
|
-
var SESSIONS_LOCK = "sessions.lock";
|
|
42089
|
-
var INDEX_LOCK = "index.lock";
|
|
42090
|
-
var UI_CONFIG_FILE = "ui.config.json";
|
|
42091
|
-
function realPathOf(dir) {
|
|
42092
|
-
const here2 = path10.resolve(dir);
|
|
42093
|
-
const rest = [];
|
|
42094
|
-
let at = here2;
|
|
42095
|
-
for (; ; ) {
|
|
42096
|
-
try {
|
|
42097
|
-
return path10.join(fs9.realpathSync(at), ...rest);
|
|
42098
|
-
} catch {
|
|
42099
|
-
const up = path10.dirname(at);
|
|
42100
|
-
if (up === at) return here2;
|
|
42101
|
-
rest.unshift(path10.basename(at));
|
|
42102
|
-
at = up;
|
|
42103
|
-
}
|
|
42104
|
-
}
|
|
42105
|
-
}
|
|
42106
|
-
function stateRootOf(board) {
|
|
42107
|
-
let dir = realPathOf(board);
|
|
42108
|
-
for (; ; ) {
|
|
42109
|
-
if (fs9.existsSync(path10.join(dir, ".git"))) return dir;
|
|
42110
|
-
const up = path10.dirname(dir);
|
|
42111
|
-
if (up === dir) break;
|
|
42112
|
-
dir = up;
|
|
42113
|
-
}
|
|
42114
|
-
return rootAbove(realPathOf(board));
|
|
42115
|
-
}
|
|
42116
|
-
function rootAbove(board) {
|
|
42117
|
-
const parent = path10.dirname(board);
|
|
42118
|
-
return ["docs", ".akb"].includes(path10.basename(parent)) ? path10.dirname(parent) : parent;
|
|
42119
|
-
}
|
|
42120
|
-
function projectStateDir(board, root2 = stateRootOf(board)) {
|
|
42121
|
-
const relative = path10.relative(realPathOf(root2), realPathOf(board));
|
|
42122
|
-
if (relative === ".." || relative.startsWith(`..${path10.sep}`) || path10.isAbsolute(relative)) {
|
|
42123
|
-
throw new Error("The board must be inside its project root.");
|
|
42124
|
-
}
|
|
42125
|
-
return path10.join(realPathOf(root2), ".akb", "boards", relative || "_root");
|
|
42126
|
-
}
|
|
42127
|
-
|
|
42128
|
-
// ../cli/src/lib/paths.ts
|
|
42129
|
-
var REPO_ROOT = "";
|
|
42130
|
-
var KANBAN = "";
|
|
42131
|
-
var TODO = "";
|
|
42132
|
-
var ARCHIVE = "";
|
|
42133
|
-
var ARCHIVE_MD = "";
|
|
42134
|
-
var README = "";
|
|
42135
|
-
var MODULES_MD = "";
|
|
42136
|
-
var CONFIG = "";
|
|
42137
|
-
var KANBAN_GITIGNORE = "";
|
|
42138
|
-
var RELEASES = "";
|
|
42139
|
-
var RELEASE_SUMMARIES = "";
|
|
42140
|
-
var AGENTS = "";
|
|
42141
|
-
var STUDIOS = "";
|
|
42142
|
-
var ASSETS = "";
|
|
42143
|
-
var BOARD_STATE = "";
|
|
42144
|
-
var MEMORY = "";
|
|
42145
|
-
var AGENT_MEMORY = "";
|
|
42146
|
-
var PROJECT_MD = "";
|
|
42147
|
-
var LOCK = "";
|
|
42148
|
-
var UI_CONFIG = "";
|
|
42149
|
-
var ENV_FILE = "";
|
|
42150
|
-
var SESSIONS = "";
|
|
42151
|
-
var SESSIONS_DIR = "";
|
|
42152
|
-
var SESSIONS_LOCK2 = "";
|
|
42153
|
-
var INDEX_LOCK2 = "";
|
|
42154
|
-
var DELIVERIES = "";
|
|
42155
|
-
var PLANS = "";
|
|
42156
|
-
var PLANS_ARCHIVE = "";
|
|
42157
|
-
var RULES = "";
|
|
42158
|
-
var TRIAGE = "";
|
|
42159
|
-
var SIGNALS_ARCHIVED = "";
|
|
42160
|
-
var SIGNALS_DISMISSED = "";
|
|
42161
|
-
var SIGNALS_FILES = "";
|
|
42162
|
-
var SIGNALS_OLD_INBOX = "";
|
|
42163
|
-
var SIGNALS_OLD_HANDLED = "";
|
|
42164
|
-
var AKB_DIR = "";
|
|
42165
|
-
var ROOT_GITIGNORE = "";
|
|
42166
|
-
function boardLockName(kanban, root2) {
|
|
42167
|
-
const from = path11.relative(root2, kanban);
|
|
42168
|
-
const name = from && !from.startsWith("..") ? from : path11.basename(kanban);
|
|
42169
|
-
return `${name.split(path11.sep).join("-")}.lock`;
|
|
42170
|
-
}
|
|
42171
|
-
var shellWord = (value) => /^[\w./:@=-]+$/.test(value) ? value : `"${value.replace(/["`$\\]/g, "\\$&")}"`;
|
|
42172
|
-
var BOARD_FLAG = "";
|
|
42173
|
-
function setBoard(kanban, root2, flag) {
|
|
42174
|
-
REPO_ROOT = path11.resolve(root2);
|
|
42175
|
-
KANBAN = path11.resolve(kanban);
|
|
42176
|
-
BOARD_FLAG = flag;
|
|
42177
|
-
TODO = path11.join(KANBAN, "todo");
|
|
42178
|
-
ARCHIVE = path11.join(KANBAN, ".archive");
|
|
42179
|
-
ARCHIVE_MD = path11.join(KANBAN, "archive.md");
|
|
42180
|
-
README = path11.join(TODO, "README.md");
|
|
42181
|
-
MODULES_MD = path11.join(KANBAN, "modules.md");
|
|
42182
|
-
CONFIG = path11.join(KANBAN, "config.md");
|
|
42183
|
-
KANBAN_GITIGNORE = path11.join(KANBAN, ".gitignore");
|
|
42184
|
-
RELEASES = path11.join(KANBAN, "releases.md");
|
|
42185
|
-
RELEASE_SUMMARIES = path11.join(KANBAN, ".release-summaries");
|
|
42186
|
-
AGENTS = path11.join(KANBAN, "agents");
|
|
42187
|
-
STUDIOS = path11.join(KANBAN, "studios");
|
|
42188
|
-
MEMORY = path11.join(KANBAN, "memory");
|
|
42189
|
-
AGENT_MEMORY = path11.join(MEMORY, "agents");
|
|
42190
|
-
PROJECT_MD = path11.join(MEMORY, "project.md");
|
|
42191
|
-
ENV_FILE = path11.join(KANBAN, ".env");
|
|
42192
|
-
const machine = projectStateDir(KANBAN, REPO_ROOT);
|
|
42193
|
-
BOARD_STATE = machine;
|
|
42194
|
-
UI_CONFIG = path11.join(machine, UI_CONFIG_FILE);
|
|
42195
|
-
ASSETS = path11.join(machine, ASSETS_FOLDER);
|
|
42196
|
-
SESSIONS = path11.join(machine, SESSIONS_FILE);
|
|
42197
|
-
SESSIONS_DIR = path11.join(machine, SESSIONS_FOLDER);
|
|
42198
|
-
SESSIONS_LOCK2 = path11.join(machine, SESSIONS_LOCK);
|
|
42199
|
-
INDEX_LOCK2 = path11.join(machine, INDEX_LOCK);
|
|
42200
|
-
DELIVERIES = path11.join(KANBAN, "deliveries");
|
|
42201
|
-
RULES = path11.join(KANBAN, "rules");
|
|
42202
|
-
PLANS = path11.join(machine, "plans");
|
|
42203
|
-
PLANS_ARCHIVE = path11.join(PLANS, "archive");
|
|
42204
|
-
TRIAGE = path11.join(KANBAN, "triage");
|
|
42205
|
-
SIGNALS_ARCHIVED = path11.join(TRIAGE, "archived");
|
|
42206
|
-
SIGNALS_DISMISSED = path11.join(TRIAGE, "dismissed");
|
|
42207
|
-
SIGNALS_FILES = path11.join(TRIAGE, "files");
|
|
42208
|
-
SIGNALS_OLD_INBOX = path11.join(TRIAGE, "inbox");
|
|
42209
|
-
SIGNALS_OLD_HANDLED = path11.join(TRIAGE, "handled.md");
|
|
42210
|
-
AKB_DIR = path11.join(REPO_ROOT, ".akb");
|
|
42211
|
-
ROOT_GITIGNORE = path11.join(REPO_ROOT, ".gitignore");
|
|
42212
|
-
LOCK = path11.join(AKB_DIR, boardLockName(KANBAN, REPO_ROOT));
|
|
42213
|
-
return REPO_ROOT;
|
|
42214
|
-
}
|
|
42215
|
-
function setBoardRoot(root2, named = false) {
|
|
42216
|
-
const project = path11.resolve(root2);
|
|
42217
|
-
return setBoard(path11.join(project, "docs", "kanban"), project, named ? ` --dir ${shellWord(project)}` : "");
|
|
42218
|
-
}
|
|
42219
|
-
setBoardRoot(process.cwd());
|
|
42220
|
-
|
|
42221
42322
|
// ../cli/src/lib/agent/cloud-studios.ts
|
|
42323
|
+
var STUDIO_SNAPSHOT_ENV = "AI4KANBAN_STUDIO_SNAPSHOT";
|
|
42222
42324
|
var DEV = "AI4KANBAN_STUDIOS";
|
|
42223
42325
|
var root = () => path12.join(machineHome(), "studios");
|
|
42224
42326
|
var safe = (name) => name.replace(/[^\w.@-]/g, "_");
|
|
@@ -42232,10 +42334,26 @@ function readJson(file2) {
|
|
|
42232
42334
|
return null;
|
|
42233
42335
|
}
|
|
42234
42336
|
}
|
|
42235
|
-
var
|
|
42337
|
+
var filesHash = (files) => createHash2("sha256").update(hashInput(files)).digest("hex");
|
|
42338
|
+
var readVersion = (id, version) => {
|
|
42339
|
+
const held2 = readJson(versionFile(id, version));
|
|
42340
|
+
return held2?.id === id && held2.version === version && isStudioFiles(held2.files) && (!held2.filesSha256 || filesHash(held2.files) === held2.filesSha256) ? held2 : null;
|
|
42341
|
+
};
|
|
42236
42342
|
var readPin = (task) => readJson(pinFile(task));
|
|
42237
42343
|
var boardProject = () => KANBAN ? runnerProject(KANBAN) : null;
|
|
42238
42344
|
var devFolder = () => process.env[DEV]?.trim() || "";
|
|
42345
|
+
var isStudioVersion = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
42346
|
+
function isStudioFiles(value) {
|
|
42347
|
+
return isRecord(value) && hasText(value["STUDIO.md"]) && Object.entries(value).every(([file2, text2]) => typeof text2 === "string" && safeStudioPath(file2));
|
|
42348
|
+
}
|
|
42349
|
+
function executionSnapshot() {
|
|
42350
|
+
try {
|
|
42351
|
+
const value = JSON.parse(process.env[STUDIO_SNAPSHOT_ENV] ?? "null");
|
|
42352
|
+
if (hasText(value?.studio) && isStudioVersion(value.version)) return value;
|
|
42353
|
+
} catch {
|
|
42354
|
+
}
|
|
42355
|
+
}
|
|
42356
|
+
var activeStudioPin = (task) => executionSnapshot() ?? readPin(task);
|
|
42239
42357
|
var flowOf = (held2) => {
|
|
42240
42358
|
const id = studioName(held2.id);
|
|
42241
42359
|
const read3 = parseStudioFile(id, held2.files["STUDIO.md"] ?? "", `the \`${id}\` studio`);
|
|
@@ -42255,36 +42373,29 @@ function readFlows() {
|
|
|
42255
42373
|
return held2 ? flowOf(held2) ?? [] : [];
|
|
42256
42374
|
});
|
|
42257
42375
|
const task = workspaceTask();
|
|
42258
|
-
const pin = task ?
|
|
42376
|
+
const pin = task ? activeStudioPin(task) : null;
|
|
42259
42377
|
const pinned = pin && readVersion(pin.studio, pin.version);
|
|
42260
42378
|
const mine = pinned && flowOf(pinned);
|
|
42261
|
-
if (!mine) return flows2;
|
|
42379
|
+
if (!mine) return pin ? flows2.filter((flow) => flow.cloudId !== pin.studio) : flows2;
|
|
42262
42380
|
return [mine, ...flows2.filter((f) => f.cloudId !== mine.cloudId)];
|
|
42263
42381
|
}
|
|
42264
42382
|
var sources = () => {
|
|
42265
42383
|
if (devFolder()) return [devFolder()];
|
|
42266
42384
|
const project = boardProject();
|
|
42267
42385
|
const task = workspaceTask();
|
|
42268
|
-
|
|
42386
|
+
const pin = task && activeStudioPin(task);
|
|
42387
|
+
return [
|
|
42388
|
+
sessionFile(),
|
|
42389
|
+
...project ? [listFile(project)] : [],
|
|
42390
|
+
...task ? [pinFile(task)] : [],
|
|
42391
|
+
...pin ? [versionFile(pin.studio, pin.version)] : []
|
|
42392
|
+
];
|
|
42269
42393
|
};
|
|
42270
42394
|
var flows = memoByFiles(sources, readFlows);
|
|
42271
42395
|
|
|
42272
42396
|
// ../cli/src/lib/shared/board-conflicts.ts
|
|
42273
42397
|
import fs11 from "node:fs";
|
|
42274
42398
|
import path13 from "node:path";
|
|
42275
|
-
|
|
42276
|
-
// ../cli/src/lib/lock.ts
|
|
42277
|
-
function pidAlive(pid) {
|
|
42278
|
-
if (!pid) return false;
|
|
42279
|
-
try {
|
|
42280
|
-
process.kill(pid, 0);
|
|
42281
|
-
return true;
|
|
42282
|
-
} catch (e) {
|
|
42283
|
-
return e.code === "EPERM";
|
|
42284
|
-
}
|
|
42285
|
-
}
|
|
42286
|
-
|
|
42287
|
-
// ../cli/src/lib/shared/board-conflicts.ts
|
|
42288
42399
|
var folder = (board) => path13.join(projectStateDir(board), "conflicts");
|
|
42289
42400
|
var fileOf = (board, id) => {
|
|
42290
42401
|
if (!/^c_[a-f0-9]{32}$/.test(id)) throw new BoardError("Unknown board conflict.", { kind: "conflict-not-found", id });
|
|
@@ -42326,14 +42437,14 @@ function conflictRecords(board) {
|
|
|
42326
42437
|
var pendingConflicts = (board) => conflictRecords(board).filter((r) => r.state !== "resolved");
|
|
42327
42438
|
|
|
42328
42439
|
// src/cache.ts
|
|
42329
|
-
import
|
|
42440
|
+
import crypto6 from "node:crypto";
|
|
42330
42441
|
import fs22 from "node:fs";
|
|
42331
42442
|
import path26 from "node:path";
|
|
42332
42443
|
|
|
42333
42444
|
// ../cli/src/lib/agent/harnesses/antigravity.ts
|
|
42334
42445
|
import fs18 from "node:fs";
|
|
42335
42446
|
import path20 from "node:path";
|
|
42336
|
-
import { createHash as
|
|
42447
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
42337
42448
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
42338
42449
|
|
|
42339
42450
|
// ../cli/src/lib/agent/locate.ts
|
|
@@ -42716,7 +42827,7 @@ function modelsIn(file2, pick2, salt = "") {
|
|
|
42716
42827
|
}
|
|
42717
42828
|
|
|
42718
42829
|
// ../cli/src/lib/agent/harnesses/types.ts
|
|
42719
|
-
import { createHash as
|
|
42830
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
42720
42831
|
import fs14 from "node:fs";
|
|
42721
42832
|
import path16 from "node:path";
|
|
42722
42833
|
function namesFlag(argv, flags) {
|
|
@@ -42739,7 +42850,7 @@ var MCP_CONFIG = {
|
|
|
42739
42850
|
help: "A JSON file of `mcpServers`, as Claude Code's --mcp-config takes. Empty opens no servers."
|
|
42740
42851
|
};
|
|
42741
42852
|
function machineFile(name, text2) {
|
|
42742
|
-
const suffix =
|
|
42853
|
+
const suffix = createHash3("sha256").update(text2).digest("hex").slice(0, 16);
|
|
42743
42854
|
const file2 = path16.join(machineHome(), "prompts", `${path16.parse(name).name}-${suffix}${path16.extname(name)}`);
|
|
42744
42855
|
try {
|
|
42745
42856
|
if (fs14.readFileSync(file2, "utf8") === text2) return file2;
|
|
@@ -42943,9 +43054,9 @@ function codexFailure(raw, fallback) {
|
|
|
42943
43054
|
// ../cli/src/lib/agent/wire/acp-cost.ts
|
|
42944
43055
|
import fs16 from "node:fs";
|
|
42945
43056
|
import path18 from "node:path";
|
|
42946
|
-
import { createHash as
|
|
43057
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
42947
43058
|
function acpCostFile(tool, cwd, session) {
|
|
42948
|
-
const key =
|
|
43059
|
+
const key = createHash4("sha256").update(JSON.stringify([tool, cwd, session])).digest("hex");
|
|
42949
43060
|
return path18.join(machineHome(), "usage", "acp", `${key}.json`);
|
|
42950
43061
|
}
|
|
42951
43062
|
function readAcpCost(file2) {
|
|
@@ -42983,12 +43094,12 @@ function bounded(work, ms, reason) {
|
|
|
42983
43094
|
}
|
|
42984
43095
|
|
|
42985
43096
|
// ../cli/src/lib/shared/reply-parts.ts
|
|
42986
|
-
function imageMime(
|
|
42987
|
-
const at = (...v) => v.every((n, i) =>
|
|
42988
|
-
const text2 = (a, b) => String.fromCharCode(...
|
|
42989
|
-
if (
|
|
43097
|
+
function imageMime(bytes) {
|
|
43098
|
+
const at = (...v) => v.every((n, i) => bytes[i] === n);
|
|
43099
|
+
const text2 = (a, b) => String.fromCharCode(...bytes.slice(a, b));
|
|
43100
|
+
if (bytes.length >= 24 && at(137, 80, 78, 71, 13, 10, 26, 10) && text2(12, 16) === "IHDR" && bytes.slice(16, 20).some(Boolean) && bytes.slice(20, 24).some(Boolean)) return "image/png";
|
|
42990
43101
|
if (at(255, 216, 255)) return "image/jpeg";
|
|
42991
|
-
if (
|
|
43102
|
+
if (bytes.length >= 13 && ["GIF87a", "GIF89a"].includes(text2(0, 6)) && (bytes[6] || bytes[7]) && (bytes[8] || bytes[9])) return "image/gif";
|
|
42992
43103
|
if (text2(0, 4) === "RIFF" && text2(8, 12) === "WEBP") return "image/webp";
|
|
42993
43104
|
return void 0;
|
|
42994
43105
|
}
|
|
@@ -43303,8 +43414,8 @@ function createTail(log) {
|
|
|
43303
43414
|
// ../cli/package.json
|
|
43304
43415
|
var package_default = {
|
|
43305
43416
|
name: "wildcrane",
|
|
43306
|
-
version: "0.11.
|
|
43307
|
-
akbContract:
|
|
43417
|
+
version: "0.11.99",
|
|
43418
|
+
akbContract: 33,
|
|
43308
43419
|
canonicalCommands: true,
|
|
43309
43420
|
description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
43310
43421
|
keywords: [
|
|
@@ -43597,9 +43708,9 @@ async function oneTurn(io, options) {
|
|
|
43597
43708
|
const images = [];
|
|
43598
43709
|
const files = [];
|
|
43599
43710
|
for (const file2 of io.imageFiles ?? []) {
|
|
43600
|
-
const
|
|
43601
|
-
const mimeType =
|
|
43602
|
-
if (mimeType) images.push({ type: "image", mimeType, data:
|
|
43711
|
+
const bytes = caps.image === true ? fs17.readFileSync(file2) : void 0;
|
|
43712
|
+
const mimeType = bytes && imageMime(bytes);
|
|
43713
|
+
if (mimeType) images.push({ type: "image", mimeType, data: bytes.toString("base64") });
|
|
43603
43714
|
else files.push(file2);
|
|
43604
43715
|
}
|
|
43605
43716
|
if (Date.now() >= preparingUntil) throw Error("ACP preparation timed out.");
|
|
@@ -43778,30 +43889,30 @@ import { existsSync } from "node:fs";
|
|
|
43778
43889
|
function antigravityConversationFile(session) {
|
|
43779
43890
|
if (/^[a-f0-9-]{36}$/i.test(session)) return home(".gemini", "antigravity-cli", "conversations", `${session}.db`);
|
|
43780
43891
|
}
|
|
43781
|
-
function varint(
|
|
43892
|
+
function varint(bytes, offset) {
|
|
43782
43893
|
let value = 0;
|
|
43783
|
-
for (let shift = 0; shift < 70 && offset.value <
|
|
43784
|
-
const byte =
|
|
43894
|
+
for (let shift = 0; shift < 70 && offset.value < bytes.length; shift += 7) {
|
|
43895
|
+
const byte = bytes[offset.value++];
|
|
43785
43896
|
value += (byte & 127) * 2 ** shift;
|
|
43786
43897
|
if (byte < 128) return value;
|
|
43787
43898
|
}
|
|
43788
43899
|
throw new Error("Invalid Antigravity conversation metadata");
|
|
43789
43900
|
}
|
|
43790
|
-
function* fields(
|
|
43901
|
+
function* fields(bytes) {
|
|
43791
43902
|
const offset = { value: 0 };
|
|
43792
|
-
while (offset.value <
|
|
43793
|
-
const tag = varint(
|
|
43903
|
+
while (offset.value < bytes.length) {
|
|
43904
|
+
const tag = varint(bytes, offset);
|
|
43794
43905
|
const number = Math.floor(tag / 8);
|
|
43795
43906
|
const wire = tag % 8;
|
|
43796
43907
|
if (number < 1 || number >= 2 ** 29) throw new Error("Invalid Antigravity conversation metadata");
|
|
43797
43908
|
if (wire === 0) {
|
|
43798
|
-
yield [number, varint(
|
|
43909
|
+
yield [number, varint(bytes, offset)];
|
|
43799
43910
|
continue;
|
|
43800
43911
|
}
|
|
43801
|
-
const size = wire === 2 ? varint(
|
|
43912
|
+
const size = wire === 2 ? varint(bytes, offset) : wire === 1 ? 8 : wire === 5 ? 4 : -1;
|
|
43802
43913
|
const end = offset.value + size;
|
|
43803
|
-
if (size < 0 || end >
|
|
43804
|
-
if (wire === 2) yield [number,
|
|
43914
|
+
if (size < 0 || end > bytes.length) throw new Error("Invalid Antigravity conversation metadata");
|
|
43915
|
+
if (wire === 2) yield [number, bytes.subarray(offset.value, end)];
|
|
43805
43916
|
offset.value = end;
|
|
43806
43917
|
}
|
|
43807
43918
|
}
|
|
@@ -43833,7 +43944,7 @@ function recordedContextLimit(data) {
|
|
|
43833
43944
|
const limit = varintField(bytesField(bytesField(bytesField(data, 1), 9), 10), 4);
|
|
43834
43945
|
return limit !== void 0 && Number.isSafeInteger(limit) && limit > 0 ? limit : void 0;
|
|
43835
43946
|
}
|
|
43836
|
-
var utf8 = (
|
|
43947
|
+
var utf8 = (bytes) => bytes && Buffer.from(bytes).toString("utf8");
|
|
43837
43948
|
function stepUuid(stepRow, index) {
|
|
43838
43949
|
if (!Number.isSafeInteger(index) || index < 0) return;
|
|
43839
43950
|
const id = bytesField(stepRow.get(index)?.metadata, 12);
|
|
@@ -44207,7 +44318,7 @@ function systemPrompt(text2, _argv, env2) {
|
|
|
44207
44318
|
const rule = `${text2}
|
|
44208
44319
|
|
|
44209
44320
|
The task working directory is ${env2.PWD ?? process.cwd()}. Use it as the base for project files and commands. This additional workspace contains only language rules; do not write task output here.`;
|
|
44210
|
-
const hash =
|
|
44321
|
+
const hash = createHash5("sha256").update(rule).digest("hex").slice(0, 16);
|
|
44211
44322
|
const root2 = path20.join(machineHome(), "prompts", `antigravity-${hash}`);
|
|
44212
44323
|
const file2 = path20.join(root2, ".agents", "rules", "language.md");
|
|
44213
44324
|
fs18.mkdirSync(path20.dirname(file2), { recursive: true });
|
|
@@ -45597,7 +45708,7 @@ var IDLE_FAILURE = { code: "idle_timeout", source: "runtime", summary: IDLE_ERRO
|
|
|
45597
45708
|
var PROVIDER_RETRY_MS = { announcement: 10 * 6e4, episode: 30 * 6e4 };
|
|
45598
45709
|
|
|
45599
45710
|
// ../cli/src/lib/agent/wire/codex.ts
|
|
45600
|
-
import { randomUUID } from "node:crypto";
|
|
45711
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
45601
45712
|
import { setTimeout as delay } from "node:timers/promises";
|
|
45602
45713
|
|
|
45603
45714
|
// ../cli/src/guide/settle-background.md
|
|
@@ -45605,19 +45716,19 @@ var settle_background_default = "Wait for and collect needed results from this t
|
|
|
45605
45716
|
|
|
45606
45717
|
// ../cli/src/lib/agent/wire/codex-background.ts
|
|
45607
45718
|
var CODEX_SETTLE_MS = { turn: 6e4, verify: 1e4 };
|
|
45608
|
-
function summary(text2,
|
|
45609
|
-
if (Buffer.byteLength(text2) <=
|
|
45610
|
-
return Buffer.from(text2).subarray(0,
|
|
45719
|
+
function summary(text2, bytes = 1800) {
|
|
45720
|
+
if (Buffer.byteLength(text2) <= bytes) return text2;
|
|
45721
|
+
return Buffer.from(text2).subarray(0, bytes).toString("utf8") + " [truncated; see the original thread item in the run log]";
|
|
45611
45722
|
}
|
|
45612
45723
|
function batch(work) {
|
|
45613
45724
|
const result = [];
|
|
45614
|
-
let
|
|
45725
|
+
let bytes = 0;
|
|
45615
45726
|
for (const entry2 of work) {
|
|
45616
45727
|
const size = Buffer.byteLength(JSON.stringify(entry2));
|
|
45617
45728
|
if (size > 15e3) throw Error("A Codex background identifier exceeds the snapshot limit.");
|
|
45618
|
-
if (
|
|
45729
|
+
if (bytes + size > 15e3) break;
|
|
45619
45730
|
result.push(entry2);
|
|
45620
|
-
|
|
45731
|
+
bytes += size;
|
|
45621
45732
|
}
|
|
45622
45733
|
return result;
|
|
45623
45734
|
}
|
|
@@ -45879,7 +45990,7 @@ async function run(io, options, count2) {
|
|
|
45879
45990
|
};
|
|
45880
45991
|
const work = codexWork();
|
|
45881
45992
|
const children = work.children;
|
|
45882
|
-
const execution =
|
|
45993
|
+
const execution = randomUUID2();
|
|
45883
45994
|
let host = {};
|
|
45884
45995
|
let cleanup = { status: "confirmed", execution, kept: [] };
|
|
45885
45996
|
let hostCleanup;
|
|
@@ -47820,7 +47931,7 @@ var unsentFile = (dir) => path26.join(akbDir(dir), "unsent");
|
|
|
47820
47931
|
var unsent = (dir) => fs22.existsSync(unsentFile(dir));
|
|
47821
47932
|
var holds = /* @__PURE__ */ new Map();
|
|
47822
47933
|
var holdsDir = () => path26.join(runnerHome(), "holds");
|
|
47823
|
-
var holdFile = (dir) => path26.join(holdsDir(), `${
|
|
47934
|
+
var holdFile = (dir) => path26.join(holdsDir(), `${crypto6.createHash("sha256").update(dir).digest("hex")}.${process.pid}`);
|
|
47824
47935
|
function paused(dir) {
|
|
47825
47936
|
try {
|
|
47826
47937
|
const file2 = path26.join(projectStateDir(path26.join(akbDir(dir), "kanban")), SESSIONS_FILE);
|
|
@@ -48097,7 +48208,7 @@ async function launch(own2, options = {}) {
|
|
|
48097
48208
|
|
|
48098
48209
|
// src/settings-server.ts
|
|
48099
48210
|
import { spawn as spawn4 } from "node:child_process";
|
|
48100
|
-
import
|
|
48211
|
+
import crypto7 from "node:crypto";
|
|
48101
48212
|
import fs24 from "node:fs";
|
|
48102
48213
|
import http from "node:http";
|
|
48103
48214
|
import path28 from "node:path";
|
|
@@ -48139,7 +48250,7 @@ var settings_client_default = '"use strict";(()=>{var Q6=Object.create;var Gf=Ob
|
|
|
48139
48250
|
var recordFile = () => path28.join(runnerHome(), "settings-page.json");
|
|
48140
48251
|
var sessionsFile = () => path28.join(runnerHome(), "settings-sessions.json");
|
|
48141
48252
|
var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
48142
|
-
var random = () =>
|
|
48253
|
+
var random = () => crypto7.randomBytes(32).toString("hex");
|
|
48143
48254
|
var PAGE_VERSION = process.env.WILDCRANE_SETTINGS_VERSION ?? VERSION;
|
|
48144
48255
|
var own = null;
|
|
48145
48256
|
var helper = null;
|
|
@@ -48381,7 +48492,7 @@ async function startSettingsServer(action, port = 0) {
|
|
|
48381
48492
|
}
|
|
48382
48493
|
|
|
48383
48494
|
// src/settings.ts
|
|
48384
|
-
import
|
|
48495
|
+
import crypto10 from "node:crypto";
|
|
48385
48496
|
import fs30 from "node:fs";
|
|
48386
48497
|
import path35 from "node:path";
|
|
48387
48498
|
|
|
@@ -48744,12 +48855,12 @@ exec ${shellLine} "$@"
|
|
|
48744
48855
|
var KEEP2 = 256 * 1024;
|
|
48745
48856
|
|
|
48746
48857
|
// src/lock.ts
|
|
48747
|
-
import
|
|
48858
|
+
import crypto8 from "node:crypto";
|
|
48748
48859
|
import net from "node:net";
|
|
48749
48860
|
import path32 from "node:path";
|
|
48750
48861
|
function lockPath() {
|
|
48751
48862
|
const home3 = runnerHome();
|
|
48752
|
-
if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${
|
|
48863
|
+
if (process.platform === "win32") return `\\\\.\\pipe\\wildcrane-${crypto8.createHash("sha256").update(home3).digest("hex").slice(0, 16)}`;
|
|
48753
48864
|
return path32.join(home3, "runner.sock");
|
|
48754
48865
|
}
|
|
48755
48866
|
function runnerSettingsSupport() {
|
|
@@ -48780,7 +48891,7 @@ function runnerSettingsSupport() {
|
|
|
48780
48891
|
|
|
48781
48892
|
// src/signin.ts
|
|
48782
48893
|
import { spawn as spawn6 } from "node:child_process";
|
|
48783
|
-
import
|
|
48894
|
+
import crypto9 from "node:crypto";
|
|
48784
48895
|
import http2 from "node:http";
|
|
48785
48896
|
|
|
48786
48897
|
// src/settings-control.ts
|
|
@@ -48939,8 +49050,8 @@ var PAGE = (outcome, lang, links) => {
|
|
|
48939
49050
|
};
|
|
48940
49051
|
async function signIn(options = {}) {
|
|
48941
49052
|
const generation = accountGeneration();
|
|
48942
|
-
const verifier = base64url(
|
|
48943
|
-
const challenge = base64url(
|
|
49053
|
+
const verifier = base64url(crypto9.randomBytes(32));
|
|
49054
|
+
const challenge = base64url(crypto9.createHash("sha256").update(verifier).digest());
|
|
48944
49055
|
let finish = () => {
|
|
48945
49056
|
};
|
|
48946
49057
|
const answered = new Promise((resolve2) => finish = resolve2);
|
|
@@ -49072,7 +49183,7 @@ function openBrowser2(url) {
|
|
|
49072
49183
|
} catch {
|
|
49073
49184
|
}
|
|
49074
49185
|
}
|
|
49075
|
-
var base64url = (
|
|
49186
|
+
var base64url = (bytes) => bytes.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
49076
49187
|
|
|
49077
49188
|
// src/settings.ts
|
|
49078
49189
|
var failure = (call2) => ({ error: call2.code ?? "offline", message: call2.error });
|
|
@@ -49083,7 +49194,7 @@ var callback = () => {
|
|
|
49083
49194
|
};
|
|
49084
49195
|
var notify = () => {
|
|
49085
49196
|
fs30.mkdirSync(runnerHome(), { recursive: true, mode: 448 });
|
|
49086
|
-
fs30.writeFileSync(path35.join(runnerHome(), "settings-refresh"),
|
|
49197
|
+
fs30.writeFileSync(path35.join(runnerHome(), "settings-refresh"), crypto10.randomUUID(), { mode: 384 });
|
|
49087
49198
|
callback();
|
|
49088
49199
|
};
|
|
49089
49200
|
var onSettingsChange = (next) => {
|
|
@@ -49292,7 +49403,7 @@ async function settingsAction(action, body, context) {
|
|
|
49292
49403
|
if ("error" in found) return found;
|
|
49293
49404
|
if (found.folder) return { error: "folder_taken" };
|
|
49294
49405
|
if (choice.subject !== readSession()?.subject) return { error: "signed_out" };
|
|
49295
|
-
if (!choice.creation || choice.creation.name !== name || choice.creation.workspace !== body.workspace) choice.creation = { key:
|
|
49406
|
+
if (!choice.creation || choice.creation.name !== name || choice.creation.workspace !== body.workspace) choice.creation = { key: crypto10.randomUUID(), name, workspace: body.workspace };
|
|
49296
49407
|
const created = choice.creation.project ? { ok: true, value: { id: choice.creation.project } } : await createProject(name, body.workspace, choice.creation.key);
|
|
49297
49408
|
if (!created.ok) return failure(created);
|
|
49298
49409
|
project = created.value.id;
|