orbit-code-ai 0.1.37 → 0.1.39
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/cli.mjs +367 -63
- package/package.json +1 -1
- package/skills/api-contract/SKILL.md +287 -0
- package/skills/apic-api/SKILL.md +309 -73
package/dist/cli.mjs
CHANGED
|
@@ -83792,7 +83792,7 @@ async function printStartupScreen() {
|
|
|
83792
83792
|
const sLen = ` ● ${sL} Ready — type /help to begin`.length;
|
|
83793
83793
|
out.push(boxRow(sRow, W2, sLen));
|
|
83794
83794
|
out.push(`${rgb(...BORDER)}╚${"═".repeat(W2 - 2)}╝${RESET}`);
|
|
83795
|
-
out.push(` ${DIM}${rgb(...DIMCOL)}orbit-code ${RESET}${rgb(...ACCENT)}v${"0.1.
|
|
83795
|
+
out.push(` ${DIM}${rgb(...DIMCOL)}orbit-code ${RESET}${rgb(...ACCENT)}v${"0.1.39"}${RESET}`);
|
|
83796
83796
|
out.push("");
|
|
83797
83797
|
process.stdout.write(out.join(`
|
|
83798
83798
|
`) + `
|
|
@@ -334299,7 +334299,7 @@ function getAnthropicEnvMetadata() {
|
|
|
334299
334299
|
function getBuildAgeMinutes() {
|
|
334300
334300
|
if (false)
|
|
334301
334301
|
;
|
|
334302
|
-
const buildTime = new Date("2026-07-
|
|
334302
|
+
const buildTime = new Date("2026-07-16T10:32:35.333Z").getTime();
|
|
334303
334303
|
if (isNaN(buildTime))
|
|
334304
334304
|
return;
|
|
334305
334305
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -358716,7 +358716,7 @@ function buildPrimarySection() {
|
|
|
358716
358716
|
}, undefined, false, undefined, this);
|
|
358717
358717
|
return [{
|
|
358718
358718
|
label: "Version",
|
|
358719
|
-
value: "0.1.
|
|
358719
|
+
value: "0.1.39"
|
|
358720
358720
|
}, {
|
|
358721
358721
|
label: "Session name",
|
|
358722
358722
|
value: nameValue
|
|
@@ -448476,7 +448476,7 @@ function readState() {
|
|
|
448476
448476
|
if (typeof parsed.p !== "string" || typeof parsed.c !== "number") {
|
|
448477
448477
|
return fresh;
|
|
448478
448478
|
}
|
|
448479
|
-
return { p: parsed.p, c: Math.max(0,
|
|
448479
|
+
return { p: parsed.p, c: Math.max(0, parsed.c) };
|
|
448480
448480
|
} catch {
|
|
448481
448481
|
return fresh;
|
|
448482
448482
|
}
|
|
@@ -448490,34 +448490,37 @@ function writeState(state2) {
|
|
|
448490
448490
|
} catch {}
|
|
448491
448491
|
}
|
|
448492
448492
|
function buildMessage(period) {
|
|
448493
|
-
return `You've reached this build's monthly usage limit (${USAGE_CAP}
|
|
448493
|
+
return `You've reached this build's monthly usage limit (${USAGE_CAP} for ${period}). It resets on ${resetDateLabel()}. Contact ${ADMIN_CONTACT} if you need more.`;
|
|
448494
448494
|
}
|
|
448495
|
-
function
|
|
448495
|
+
function unitsForCost(costUSD) {
|
|
448496
|
+
if (!(costUSD > 0))
|
|
448497
|
+
return 1;
|
|
448498
|
+
if (costUSD < 0.1)
|
|
448499
|
+
return 1;
|
|
448500
|
+
if (costUSD < 0.5)
|
|
448501
|
+
return 1.5;
|
|
448502
|
+
return 2 + Math.floor((costUSD - 0.5) / 0.5) * 0.5;
|
|
448503
|
+
}
|
|
448504
|
+
function checkUsageAllowed() {
|
|
448505
|
+
return getUsageStatus();
|
|
448506
|
+
}
|
|
448507
|
+
function recordTurnCost(costUSD) {
|
|
448496
448508
|
const period = currentPeriod();
|
|
448497
448509
|
const state2 = readState();
|
|
448498
448510
|
if (state2.p !== period) {
|
|
448499
448511
|
state2.p = period;
|
|
448500
448512
|
state2.c = 0;
|
|
448501
448513
|
}
|
|
448502
|
-
|
|
448503
|
-
return {
|
|
448504
|
-
allowed: false,
|
|
448505
|
-
count: state2.c,
|
|
448506
|
-
cap: USAGE_CAP,
|
|
448507
|
-
remaining: 0,
|
|
448508
|
-
periodKey: period,
|
|
448509
|
-
message: buildMessage(period)
|
|
448510
|
-
};
|
|
448511
|
-
}
|
|
448512
|
-
state2.c += 1;
|
|
448514
|
+
state2.c = state2.c + unitsForCost(costUSD);
|
|
448513
448515
|
writeState(state2);
|
|
448514
448516
|
notifyUsageListeners();
|
|
448515
448517
|
return {
|
|
448516
|
-
allowed:
|
|
448518
|
+
allowed: state2.c < USAGE_CAP,
|
|
448517
448519
|
count: state2.c,
|
|
448518
448520
|
cap: USAGE_CAP,
|
|
448519
448521
|
remaining: Math.max(0, USAGE_CAP - state2.c),
|
|
448520
|
-
periodKey: period
|
|
448522
|
+
periodKey: period,
|
|
448523
|
+
...state2.c >= USAGE_CAP ? { message: buildMessage(period) } : {}
|
|
448521
448524
|
};
|
|
448522
448525
|
}
|
|
448523
448526
|
function getUsageStatus() {
|
|
@@ -448542,6 +448545,9 @@ var init_usageCap = __esm(() => {
|
|
|
448542
448545
|
});
|
|
448543
448546
|
|
|
448544
448547
|
// src/components/UsageBar.tsx
|
|
448548
|
+
function fmt(n2) {
|
|
448549
|
+
return Number.isInteger(n2) ? String(n2) : n2.toFixed(1);
|
|
448550
|
+
}
|
|
448545
448551
|
function UsageBar() {
|
|
448546
448552
|
const [status2, setStatus] = import_react230.useState(getUsageStatus);
|
|
448547
448553
|
import_react230.useEffect(() => subscribeUsage(() => setStatus(getUsageStatus())), []);
|
|
@@ -448577,11 +448583,11 @@ function UsageBar() {
|
|
|
448577
448583
|
dimColor: true,
|
|
448578
448584
|
children: [
|
|
448579
448585
|
" ",
|
|
448580
|
-
count4,
|
|
448586
|
+
fmt(count4),
|
|
448581
448587
|
"/",
|
|
448582
448588
|
cap,
|
|
448583
448589
|
" · ",
|
|
448584
|
-
remaining,
|
|
448590
|
+
fmt(remaining),
|
|
448585
448591
|
" left"
|
|
448586
448592
|
]
|
|
448587
448593
|
}, undefined, true, undefined, this)
|
|
@@ -456147,18 +456153,25 @@ async function executeUserInput(params) {
|
|
|
456147
456153
|
const primaryInput = primaryCmd && typeof primaryCmd.value === "string" ? primaryCmd.value : undefined;
|
|
456148
456154
|
const shouldCallBeforeQuery = primaryMode === "prompt";
|
|
456149
456155
|
let effectiveShouldQuery = shouldQuery;
|
|
456156
|
+
let costAtTurnStart = null;
|
|
456150
456157
|
if (shouldQuery) {
|
|
456151
|
-
const
|
|
456152
|
-
if (!
|
|
456158
|
+
const gate = checkUsageAllowed();
|
|
456159
|
+
if (!gate.allowed) {
|
|
456153
456160
|
effectiveShouldQuery = false;
|
|
456154
456161
|
addNotification?.({
|
|
456155
456162
|
key: "usage-cap-reached",
|
|
456156
|
-
text:
|
|
456163
|
+
text: gate.message ?? "Usage limit reached.",
|
|
456157
456164
|
priority: "immediate"
|
|
456158
456165
|
});
|
|
456166
|
+
} else {
|
|
456167
|
+
costAtTurnStart = getTotalCostUSD();
|
|
456159
456168
|
}
|
|
456160
456169
|
}
|
|
456161
456170
|
await onQuery(newMessages, abortController, effectiveShouldQuery, allowedTools ?? [], model ? resolveSkillModelOverride(model, mainLoopModel) : resolveExecutionModel(mainLoopModel), shouldCallBeforeQuery ? onBeforeQuery : undefined, primaryInput, effort);
|
|
456171
|
+
if (costAtTurnStart !== null) {
|
|
456172
|
+
const turnCost = Math.max(0, getTotalCostUSD() - costAtTurnStart);
|
|
456173
|
+
recordTurnCost(turnCost);
|
|
456174
|
+
}
|
|
456162
456175
|
} else {
|
|
456163
456176
|
queryGuard.cancelReservation();
|
|
456164
456177
|
setToolJSX({
|
|
@@ -456193,6 +456206,7 @@ var init_handlePromptSubmit = __esm(() => {
|
|
|
456193
456206
|
init_messageQueueManager();
|
|
456194
456207
|
init_model();
|
|
456195
456208
|
init_processUserInput();
|
|
456209
|
+
init_state();
|
|
456196
456210
|
init_queryProfiler();
|
|
456197
456211
|
init_usageCap();
|
|
456198
456212
|
init_workloadContext();
|
|
@@ -471011,7 +471025,7 @@ function WelcomeV2() {
|
|
|
471011
471025
|
dimColor: true,
|
|
471012
471026
|
children: [
|
|
471013
471027
|
"v",
|
|
471014
|
-
"0.1.
|
|
471028
|
+
"0.1.39",
|
|
471015
471029
|
" "
|
|
471016
471030
|
]
|
|
471017
471031
|
}, undefined, true, undefined, this)
|
|
@@ -471211,7 +471225,7 @@ function WelcomeV2() {
|
|
|
471211
471225
|
dimColor: true,
|
|
471212
471226
|
children: [
|
|
471213
471227
|
"v",
|
|
471214
|
-
"0.1.
|
|
471228
|
+
"0.1.39",
|
|
471215
471229
|
" "
|
|
471216
471230
|
]
|
|
471217
471231
|
}, undefined, true, undefined, this)
|
|
@@ -471437,7 +471451,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
471437
471451
|
dimColor: true,
|
|
471438
471452
|
children: [
|
|
471439
471453
|
"v",
|
|
471440
|
-
"0.1.
|
|
471454
|
+
"0.1.39",
|
|
471441
471455
|
" "
|
|
471442
471456
|
]
|
|
471443
471457
|
}, undefined, true, undefined, this);
|
|
@@ -471691,7 +471705,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
471691
471705
|
dimColor: true,
|
|
471692
471706
|
children: [
|
|
471693
471707
|
"v",
|
|
471694
|
-
"0.1.
|
|
471708
|
+
"0.1.39",
|
|
471695
471709
|
" "
|
|
471696
471710
|
]
|
|
471697
471711
|
}, undefined, true, undefined, this);
|
|
@@ -475716,6 +475730,294 @@ var init_aceSkills = __esm(() => {
|
|
|
475716
475730
|
init_bundledSkills();
|
|
475717
475731
|
});
|
|
475718
475732
|
|
|
475733
|
+
// src/utils/docx.ts
|
|
475734
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
475735
|
+
function escapeReg(s) {
|
|
475736
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
475737
|
+
}
|
|
475738
|
+
function decodeEntities(s) {
|
|
475739
|
+
return s.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&#x([0-9a-fA-F]+);/g, (_m, h2) => String.fromCodePoint(parseInt(h2, 16))).replace(/&#(\d+);/g, (_m, d) => String.fromCodePoint(parseInt(d, 10))).replace(/&/g, "&");
|
|
475740
|
+
}
|
|
475741
|
+
function firstTag(xml, name, from) {
|
|
475742
|
+
const re = new RegExp(`<${escapeReg(name)}(?=[\\s/>])`, "g");
|
|
475743
|
+
re.lastIndex = from;
|
|
475744
|
+
const m = re.exec(xml);
|
|
475745
|
+
return m ? m.index : -1;
|
|
475746
|
+
}
|
|
475747
|
+
function findElementEnd(xml, openIdx, name) {
|
|
475748
|
+
const openRe = new RegExp(`<${escapeReg(name)}(?=[\\s/>])`, "g");
|
|
475749
|
+
const closeStr = `</${name}>`;
|
|
475750
|
+
let depth = 0;
|
|
475751
|
+
let i3 = openIdx;
|
|
475752
|
+
while (i3 < xml.length) {
|
|
475753
|
+
openRe.lastIndex = i3;
|
|
475754
|
+
const om = openRe.exec(xml);
|
|
475755
|
+
const openPos = om ? om.index : -1;
|
|
475756
|
+
const closePos = xml.indexOf(closeStr, i3);
|
|
475757
|
+
if (closePos === -1)
|
|
475758
|
+
return xml.length;
|
|
475759
|
+
if (openPos !== -1 && openPos < closePos) {
|
|
475760
|
+
const gt2 = xml.indexOf(">", openPos);
|
|
475761
|
+
const selfClosing = gt2 > 0 && xml[gt2 - 1] === "/";
|
|
475762
|
+
if (!selfClosing)
|
|
475763
|
+
depth++;
|
|
475764
|
+
i3 = gt2 + 1;
|
|
475765
|
+
} else {
|
|
475766
|
+
depth--;
|
|
475767
|
+
i3 = closePos + closeStr.length;
|
|
475768
|
+
if (depth === 0)
|
|
475769
|
+
return i3;
|
|
475770
|
+
}
|
|
475771
|
+
}
|
|
475772
|
+
return xml.length;
|
|
475773
|
+
}
|
|
475774
|
+
function runText(xml) {
|
|
475775
|
+
let s = "";
|
|
475776
|
+
const re = /<w:t(?:\s[^>]*)?>([\s\S]*?)<\/w:t>/g;
|
|
475777
|
+
let m;
|
|
475778
|
+
while ((m = re.exec(xml)) !== null)
|
|
475779
|
+
s += m[1];
|
|
475780
|
+
return decodeEntities(s);
|
|
475781
|
+
}
|
|
475782
|
+
function inner(xml, name) {
|
|
475783
|
+
const start = xml.indexOf(">");
|
|
475784
|
+
const end = xml.lastIndexOf(`</${name}>`);
|
|
475785
|
+
return start === -1 || end === -1 ? xml : xml.slice(start + 1, end);
|
|
475786
|
+
}
|
|
475787
|
+
function cellText(tcXml) {
|
|
475788
|
+
const body = inner(tcXml, "w:tc");
|
|
475789
|
+
const parts = [];
|
|
475790
|
+
let i3 = 0;
|
|
475791
|
+
while (i3 < body.length) {
|
|
475792
|
+
const pPos = firstTag(body, "w:p", i3);
|
|
475793
|
+
if (pPos === -1)
|
|
475794
|
+
break;
|
|
475795
|
+
const pEnd = findElementEnd(body, pPos, "w:p");
|
|
475796
|
+
const t = runText(body.slice(pPos, pEnd)).trim();
|
|
475797
|
+
if (t)
|
|
475798
|
+
parts.push(t);
|
|
475799
|
+
i3 = pEnd;
|
|
475800
|
+
}
|
|
475801
|
+
return parts.join(" ").replace(/\s+/g, " ").trim().replace(/\|/g, "\\|");
|
|
475802
|
+
}
|
|
475803
|
+
function rowCells(trXml) {
|
|
475804
|
+
const body = inner(trXml, "w:tr");
|
|
475805
|
+
const cells = [];
|
|
475806
|
+
let i3 = 0;
|
|
475807
|
+
while (i3 < body.length) {
|
|
475808
|
+
const nested = firstTag(body, "w:tbl", i3);
|
|
475809
|
+
const tc = firstTag(body, "w:tc", i3);
|
|
475810
|
+
if (tc === -1)
|
|
475811
|
+
break;
|
|
475812
|
+
if (nested !== -1 && nested < tc) {
|
|
475813
|
+
i3 = findElementEnd(body, nested, "w:tbl");
|
|
475814
|
+
continue;
|
|
475815
|
+
}
|
|
475816
|
+
const tcEnd = findElementEnd(body, tc, "w:tc");
|
|
475817
|
+
cells.push(cellText(body.slice(tc, tcEnd)));
|
|
475818
|
+
i3 = tcEnd;
|
|
475819
|
+
}
|
|
475820
|
+
return cells;
|
|
475821
|
+
}
|
|
475822
|
+
function renderTable(tblXml) {
|
|
475823
|
+
const body = inner(tblXml, "w:tbl");
|
|
475824
|
+
const rows = [];
|
|
475825
|
+
let i3 = 0;
|
|
475826
|
+
while (i3 < body.length) {
|
|
475827
|
+
const nested = firstTag(body, "w:tbl", i3);
|
|
475828
|
+
const tr = firstTag(body, "w:tr", i3);
|
|
475829
|
+
if (tr === -1)
|
|
475830
|
+
break;
|
|
475831
|
+
if (nested !== -1 && nested < tr) {
|
|
475832
|
+
i3 = findElementEnd(body, nested, "w:tbl");
|
|
475833
|
+
continue;
|
|
475834
|
+
}
|
|
475835
|
+
const trEnd = findElementEnd(body, tr, "w:tr");
|
|
475836
|
+
rows.push(rowCells(body.slice(tr, trEnd)));
|
|
475837
|
+
i3 = trEnd;
|
|
475838
|
+
}
|
|
475839
|
+
if (rows.length === 0)
|
|
475840
|
+
return "";
|
|
475841
|
+
const width = Math.max(...rows.map((r) => r.length));
|
|
475842
|
+
const pad = (r) => "| " + Array.from({ length: width }, (_, k) => r[k] ?? "").join(" | ") + " |";
|
|
475843
|
+
const md = [pad(rows[0]), "| " + Array(width).fill("---").join(" | ") + " |"];
|
|
475844
|
+
for (const r of rows.slice(1))
|
|
475845
|
+
md.push(pad(r));
|
|
475846
|
+
return md.join(`
|
|
475847
|
+
`);
|
|
475848
|
+
}
|
|
475849
|
+
function renderBody(bodyXml) {
|
|
475850
|
+
const out = [];
|
|
475851
|
+
let i3 = 0;
|
|
475852
|
+
while (i3 < bodyXml.length) {
|
|
475853
|
+
const p = firstTag(bodyXml, "w:p", i3);
|
|
475854
|
+
const tbl = firstTag(bodyXml, "w:tbl", i3);
|
|
475855
|
+
if (p === -1 && tbl === -1)
|
|
475856
|
+
break;
|
|
475857
|
+
if (tbl !== -1 && (p === -1 || tbl < p)) {
|
|
475858
|
+
const end = findElementEnd(bodyXml, tbl, "w:tbl");
|
|
475859
|
+
const t = renderTable(bodyXml.slice(tbl, end));
|
|
475860
|
+
if (t)
|
|
475861
|
+
out.push(t);
|
|
475862
|
+
i3 = end;
|
|
475863
|
+
} else {
|
|
475864
|
+
const end = findElementEnd(bodyXml, p, "w:p");
|
|
475865
|
+
const t = runText(bodyXml.slice(p, end)).trim();
|
|
475866
|
+
if (t)
|
|
475867
|
+
out.push(t);
|
|
475868
|
+
i3 = end;
|
|
475869
|
+
}
|
|
475870
|
+
}
|
|
475871
|
+
return out.join(`
|
|
475872
|
+
|
|
475873
|
+
`);
|
|
475874
|
+
}
|
|
475875
|
+
async function extractDocxText(filePath, maxChars = 60000) {
|
|
475876
|
+
const { unzipSync: unzipSync2 } = await Promise.resolve().then(() => (init_esm3(), exports_esm));
|
|
475877
|
+
const data = readFileSync10(filePath);
|
|
475878
|
+
let files2;
|
|
475879
|
+
try {
|
|
475880
|
+
files2 = unzipSync2(new Uint8Array(data), {
|
|
475881
|
+
filter: (f) => f.name === "word/document.xml"
|
|
475882
|
+
});
|
|
475883
|
+
} catch (e2) {
|
|
475884
|
+
throw new Error(`Not a readable .docx (unzip failed): ${e2.message}`);
|
|
475885
|
+
}
|
|
475886
|
+
const bytes = files2["word/document.xml"];
|
|
475887
|
+
if (!bytes) {
|
|
475888
|
+
throw new Error("word/document.xml not found — the file is not a valid .docx (a .doc or renamed file?).");
|
|
475889
|
+
}
|
|
475890
|
+
const xml = new TextDecoder("utf-8").decode(bytes);
|
|
475891
|
+
const bodyMatch = xml.match(/<w:body[^>]*>([\s\S]*)<\/w:body>/);
|
|
475892
|
+
const text = renderBody(bodyMatch ? bodyMatch[1] : xml).trim();
|
|
475893
|
+
if (text.length > maxChars) {
|
|
475894
|
+
return `${text.slice(0, maxChars)}
|
|
475895
|
+
|
|
475896
|
+
…[truncated; ${text.length} chars total]…`;
|
|
475897
|
+
}
|
|
475898
|
+
return text;
|
|
475899
|
+
}
|
|
475900
|
+
var init_docx = () => {};
|
|
475901
|
+
|
|
475902
|
+
// src/skills/bundled/lld.ts
|
|
475903
|
+
function textBlock(text) {
|
|
475904
|
+
return [{ type: "text", text }];
|
|
475905
|
+
}
|
|
475906
|
+
function parseArgs(args) {
|
|
475907
|
+
const trimmed = args.trim();
|
|
475908
|
+
let path20 = "";
|
|
475909
|
+
let rest = "";
|
|
475910
|
+
const quoted = trimmed.match(/^["']([^"']+)["']\s*(.*)$/);
|
|
475911
|
+
if (quoted) {
|
|
475912
|
+
path20 = quoted[1];
|
|
475913
|
+
rest = quoted[2];
|
|
475914
|
+
} else {
|
|
475915
|
+
const dotdocx = trimmed.match(/^(.*?\.docx)\s*(.*)$/i);
|
|
475916
|
+
if (dotdocx) {
|
|
475917
|
+
path20 = dotdocx[1].trim();
|
|
475918
|
+
rest = dotdocx[2];
|
|
475919
|
+
} else {
|
|
475920
|
+
rest = trimmed;
|
|
475921
|
+
}
|
|
475922
|
+
}
|
|
475923
|
+
const t = rest.match(/\b(contract|api|both)\b/i)?.[1]?.toLowerCase();
|
|
475924
|
+
const target = t === "contract" || t === "api" ? t : "both";
|
|
475925
|
+
return { path: path20.replace(/[.,;]$/, ""), target };
|
|
475926
|
+
}
|
|
475927
|
+
function buildPrompt(path20, content, target) {
|
|
475928
|
+
const gen = target === "contract" ? "the CONTRACT only (invoke /api-contract)" : target === "api" ? "the GATEWAY API only (invoke /apic-api)" : "BOTH the contract (/api-contract) and the gateway API (/apic-api)";
|
|
475929
|
+
return `You are turning an LLD (Low-Level Design) Word document into APIC artifacts. The full LLD text
|
|
475930
|
+
below was extracted from ${path20} (paragraphs as text, tables as markdown). Requested output: ${gen}.
|
|
475931
|
+
|
|
475932
|
+
════════════════════ EXTRACTED LLD ════════════════════
|
|
475933
|
+
${content}
|
|
475934
|
+
════════════════════ END LLD ════════════════════
|
|
475935
|
+
|
|
475936
|
+
Do this, in order:
|
|
475937
|
+
|
|
475938
|
+
1. EXTRACT the API spec from the LLD above, using this house-template map (sections/tables → fields):
|
|
475939
|
+
- Introduction (Purpose / Scope) → API title + description.
|
|
475940
|
+
- "Integration flow (<op>)" → its "API Gateway endpoint" and "Method" → the operation path + verb.
|
|
475941
|
+
- "<op> Request" table → request model. Columns are typically Field | Type | Occurrence | Length |
|
|
475942
|
+
Description | Validation. Convert: Occurrence M → required; O/C → optional (put the C rule in
|
|
475943
|
+
description); Length N → maxLength; allowed-values → enum; "1..*" → array (minItems 1 when ≥1).
|
|
475944
|
+
- "<op> Response" table + any "<type>" tables (e.g. commodity_type) → response model (nested/arrays).
|
|
475945
|
+
- "Error Codes" table + any sample error bodies → error responses (HTTP codes + error schema).
|
|
475946
|
+
- "Transformation Specifications" tables → how request fields map to the backend + any defaulting.
|
|
475947
|
+
- "Annex / Provider" (endpoints, auth) → the backend/provider endpoint(s) and their auth.
|
|
475948
|
+
- Integration pattern: if the middleware is an existing ACE/webMethods service that already returns
|
|
475949
|
+
the response envelope, it is a **wrapper**; if APIC calls a raw backend and must build the
|
|
475950
|
+
envelope, it is **backend**. State which and why.
|
|
475951
|
+
|
|
475952
|
+
2. ECHO a concise EXTRACTION SUMMARY to the user FIRST (do NOT generate yet): API name, pattern,
|
|
475953
|
+
each operation (verb + path), request/response field lists, error codes, backend endpoint, and the
|
|
475954
|
+
fields you could NOT determine. Then ask for the unguessables only: OpenAPI 2.0 vs 3.0; inbound
|
|
475955
|
+
consumer auth (basic/apikey/oauth2); host; and (for /apic-api) JWT on/off + crypto object and the
|
|
475956
|
+
backend target-url variable. NEVER fabricate hosts, crypto objects, scopes, or business fields — ask
|
|
475957
|
+
or use clearly-marked CHANGEME placeholders and list them.
|
|
475958
|
+
|
|
475959
|
+
3. After the user confirms/corrects, GENERATE ${gen}:
|
|
475960
|
+
- Contract → invoke the /api-contract skill, passing the API name, host, security, and the full
|
|
475961
|
+
request/response/error models you extracted.
|
|
475962
|
+
- Gateway API → invoke the /apic-api skill, passing the operation (name, verb, basePath, explicit
|
|
475963
|
+
path), the chosen --pattern (wrapper vs backend), the backend target-url, and the flags. One
|
|
475964
|
+
/apic-api call per operation.
|
|
475965
|
+
Reuse the values from the extraction summary verbatim — do not re-derive or drop fields.
|
|
475966
|
+
|
|
475967
|
+
Ground everything in the extracted LLD above; if the LLD does not state something, say so rather than
|
|
475968
|
+
inventing it.`;
|
|
475969
|
+
}
|
|
475970
|
+
async function handle(args) {
|
|
475971
|
+
const { path: path20, target } = parseArgs(args);
|
|
475972
|
+
if (!path20)
|
|
475973
|
+
return HELP;
|
|
475974
|
+
let content;
|
|
475975
|
+
try {
|
|
475976
|
+
content = await extractDocxText(path20);
|
|
475977
|
+
} catch (e2) {
|
|
475978
|
+
return `Could not read the LLD at "${path20}": ${e2.message}
|
|
475979
|
+
|
|
475980
|
+
Give the full path to a .docx file, e.g.
|
|
475981
|
+
/lld "C:\\\\path\\\\to\\\\LLD.docx" both`;
|
|
475982
|
+
}
|
|
475983
|
+
if (!content.trim()) {
|
|
475984
|
+
return `The LLD at "${path20}" extracted no text (it may be image-only or empty). I can't generate from it — confirm the file, or paste the request/response models directly.`;
|
|
475985
|
+
}
|
|
475986
|
+
return buildPrompt(path20, content, target);
|
|
475987
|
+
}
|
|
475988
|
+
function registerLldSkill() {
|
|
475989
|
+
registerBundledSkill({
|
|
475990
|
+
name: "lld",
|
|
475991
|
+
description: "Read an LLD (.docx) Word document — paragraphs and tables — extract the API spec against the house template, confirm it, then generate the contract-only OpenAPI (/api-contract) and/or the APIC gateway API (/apic-api) from it.",
|
|
475992
|
+
whenToUse: "When the user points at an LLD .docx and wants the APIC contract and/or gateway API generated from it (LLD → YAML).",
|
|
475993
|
+
argumentHint: '"<path-to-LLD.docx>" [contract|api|both]',
|
|
475994
|
+
userInvocable: true,
|
|
475995
|
+
allowedTools: ["Read", "Glob", "Grep"],
|
|
475996
|
+
async getPromptForCommand(args) {
|
|
475997
|
+
try {
|
|
475998
|
+
return textBlock(await handle(args));
|
|
475999
|
+
} catch (e2) {
|
|
476000
|
+
return textBlock(`/lld error: ${e2.message}`);
|
|
476001
|
+
}
|
|
476002
|
+
}
|
|
476003
|
+
});
|
|
476004
|
+
}
|
|
476005
|
+
var HELP = `# /lld — read an LLD (.docx) and generate the APIC contract and/or gateway API
|
|
476006
|
+
|
|
476007
|
+
Usage:
|
|
476008
|
+
/lld "<path-to-LLD.docx>" [contract|api|both]
|
|
476009
|
+
|
|
476010
|
+
- contract → generate the contract-only OpenAPI via /api-contract
|
|
476011
|
+
- api → generate the gateway implementation via /apic-api
|
|
476012
|
+
- both → generate both (default)
|
|
476013
|
+
|
|
476014
|
+
Reads the Word LLD (paragraphs + tables), extracts the API spec against the house template,
|
|
476015
|
+
shows you an extraction summary to confirm, then hands off to the generator skill(s).`;
|
|
476016
|
+
var init_lld = __esm(() => {
|
|
476017
|
+
init_bundledSkills();
|
|
476018
|
+
init_docx();
|
|
476019
|
+
});
|
|
476020
|
+
|
|
475719
476021
|
// src/skills/bundled/orbitInChrome.ts
|
|
475720
476022
|
function registerOrbitInChromeSkill() {
|
|
475721
476023
|
registerBundledSkill({
|
|
@@ -477298,7 +477600,7 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
477298
477600
|
if (value !== null && value !== undefined) {
|
|
477299
477601
|
if (typeof value !== "object" && typeof value !== "function")
|
|
477300
477602
|
throw new TypeError("Object expected.");
|
|
477301
|
-
var dispose4,
|
|
477603
|
+
var dispose4, inner2;
|
|
477302
477604
|
if (async) {
|
|
477303
477605
|
if (!Symbol.asyncDispose)
|
|
477304
477606
|
throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
@@ -477309,14 +477611,14 @@ var require_tslib = __commonJS((exports, module) => {
|
|
|
477309
477611
|
throw new TypeError("Symbol.dispose is not defined.");
|
|
477310
477612
|
dispose4 = value[Symbol.dispose];
|
|
477311
477613
|
if (async)
|
|
477312
|
-
|
|
477614
|
+
inner2 = dispose4;
|
|
477313
477615
|
}
|
|
477314
477616
|
if (typeof dispose4 !== "function")
|
|
477315
477617
|
throw new TypeError("Object not disposable.");
|
|
477316
|
-
if (
|
|
477618
|
+
if (inner2)
|
|
477317
477619
|
dispose4 = function() {
|
|
477318
477620
|
try {
|
|
477319
|
-
|
|
477621
|
+
inner2.call(this);
|
|
477320
477622
|
} catch (e2) {
|
|
477321
477623
|
return Promise.reject(e2);
|
|
477322
477624
|
}
|
|
@@ -478543,8 +478845,8 @@ var require_sprintf = __commonJS((exports) => {
|
|
|
478543
478845
|
function sprintf(key) {
|
|
478544
478846
|
return sprintf_format(sprintf_parse(key), arguments);
|
|
478545
478847
|
}
|
|
478546
|
-
function vsprintf(
|
|
478547
|
-
return sprintf.apply(null, [
|
|
478848
|
+
function vsprintf(fmt2, argv) {
|
|
478849
|
+
return sprintf.apply(null, [fmt2].concat(argv || []));
|
|
478548
478850
|
}
|
|
478549
478851
|
function sprintf_format(parse_tree, argv) {
|
|
478550
478852
|
var cursor = 1, tree_length = parse_tree.length, arg, output = "", i3, k, ph, pad, pad_character, pad_length, is_positive, sign;
|
|
@@ -478646,11 +478948,11 @@ var require_sprintf = __commonJS((exports) => {
|
|
|
478646
478948
|
return output;
|
|
478647
478949
|
}
|
|
478648
478950
|
var sprintf_cache = Object.create(null);
|
|
478649
|
-
function sprintf_parse(
|
|
478650
|
-
if (sprintf_cache[
|
|
478651
|
-
return sprintf_cache[
|
|
478951
|
+
function sprintf_parse(fmt2) {
|
|
478952
|
+
if (sprintf_cache[fmt2]) {
|
|
478953
|
+
return sprintf_cache[fmt2];
|
|
478652
478954
|
}
|
|
478653
|
-
var _fmt =
|
|
478955
|
+
var _fmt = fmt2, match, parse_tree = [], arg_names = 0;
|
|
478654
478956
|
while (_fmt) {
|
|
478655
478957
|
if ((match = re.text.exec(_fmt)) !== null) {
|
|
478656
478958
|
parse_tree.push(match[0]);
|
|
@@ -478697,7 +478999,7 @@ var require_sprintf = __commonJS((exports) => {
|
|
|
478697
478999
|
}
|
|
478698
479000
|
_fmt = _fmt.substring(match[0].length);
|
|
478699
479001
|
}
|
|
478700
|
-
return sprintf_cache[
|
|
479002
|
+
return sprintf_cache[fmt2] = parse_tree;
|
|
478701
479003
|
}
|
|
478702
479004
|
if (typeof exports !== "undefined") {
|
|
478703
479005
|
exports.sprintf = sprintf;
|
|
@@ -510347,7 +510649,7 @@ ${declareVars || " -- (no parameters)"}${resultHandling}`;
|
|
|
510347
510649
|
}
|
|
510348
510650
|
|
|
510349
510651
|
// src/skills/bundled/sql.ts
|
|
510350
|
-
function
|
|
510652
|
+
function textBlock2(text) {
|
|
510351
510653
|
return [{ type: "text", text }];
|
|
510352
510654
|
}
|
|
510353
510655
|
function parseConnectArgs(args) {
|
|
@@ -510586,22 +510888,22 @@ Do this, in order:
|
|
|
510586
510888
|
|
|
510587
510889
|
Data-handling notice (state once): these are REAL values from the connected database and may include personal/production data. Return them as-is; never fabricate. If a SELECT returns no rows, say so plainly — for a happy case it means no qualifying data exists; do not invent a row. If the app calls no stored procedures at all, build the input body from the XSD types alone and clearly mark those values as synthetic (no DB row backs them).`;
|
|
510588
510890
|
}
|
|
510589
|
-
async function
|
|
510891
|
+
async function handle2(args) {
|
|
510590
510892
|
const trimmed = args.trim();
|
|
510591
510893
|
if (!trimmed)
|
|
510592
|
-
return
|
|
510894
|
+
return HELP2;
|
|
510593
510895
|
const firstTok = trimmed.split(/\s+/)[0].toLowerCase();
|
|
510594
510896
|
const restStr = trimmed.slice(trimmed.split(/\s+/)[0].length).trim();
|
|
510595
510897
|
switch (firstTok) {
|
|
510596
510898
|
case "help":
|
|
510597
|
-
return
|
|
510899
|
+
return HELP2;
|
|
510598
510900
|
case "connect": {
|
|
510599
510901
|
const parsed = parseConnectArgs(restStr);
|
|
510600
510902
|
const missing = ["server", "database", "user", "password"].filter((k) => !parsed[k]);
|
|
510601
510903
|
if (missing.length > 0)
|
|
510602
510904
|
return `Missing required field(s): ${missing.join(", ")}.
|
|
510603
510905
|
|
|
510604
|
-
${
|
|
510906
|
+
${HELP2}`;
|
|
510605
510907
|
const conn2 = parsed;
|
|
510606
510908
|
const saved = saveSqlConnection(conn2);
|
|
510607
510909
|
let testMsg;
|
|
@@ -510729,14 +511031,14 @@ function registerSqlSkill() {
|
|
|
510729
511031
|
allowedTools: ["Read", "Glob", "Grep"],
|
|
510730
511032
|
async getPromptForCommand(args) {
|
|
510731
511033
|
try {
|
|
510732
|
-
return
|
|
511034
|
+
return textBlock2(await handle2(args));
|
|
510733
511035
|
} catch (e2) {
|
|
510734
|
-
return
|
|
511036
|
+
return textBlock2(`/sql error: ${e2.message}`);
|
|
510735
511037
|
}
|
|
510736
511038
|
}
|
|
510737
511039
|
});
|
|
510738
511040
|
}
|
|
510739
|
-
var
|
|
511041
|
+
var HELP2, GROUND = `
|
|
510740
511042
|
|
|
510741
511043
|
IMPORTANT: The metadata above is the ONLY database information you have — you cannot query the DB yourself. State only what appears above; never invent, guess, or "fill in" parameters, columns, types, or procedures. If something is not shown, say it is not shown.`, STOPWORDS;
|
|
510742
511044
|
var init_sql = __esm(() => {
|
|
@@ -510744,7 +511046,7 @@ var init_sql = __esm(() => {
|
|
|
510744
511046
|
init_connectionStore();
|
|
510745
511047
|
init_mssqlClient();
|
|
510746
511048
|
init_spMetadata();
|
|
510747
|
-
|
|
511049
|
+
HELP2 = `# /sql — SQL Server helper (native connection)
|
|
510748
511050
|
|
|
510749
511051
|
Subcommands (also understands plain English, e.g. "/sql details of the SP Get_UserInformation"):
|
|
510750
511052
|
- \`/sql connect server=HOST database=DB user=USER password=PASS [port=1433] [encrypt=false]\` — save the connection once (OS secure vault; password never written to disk in plaintext).
|
|
@@ -511307,6 +511609,7 @@ If a hook isn't running:
|
|
|
511307
511609
|
function initBundledSkills() {
|
|
511308
511610
|
registerAceSkills();
|
|
511309
511611
|
registerSqlSkill();
|
|
511612
|
+
registerLldSkill();
|
|
511310
511613
|
registerUpdateConfigSkill();
|
|
511311
511614
|
if (false) {}
|
|
511312
511615
|
if (false) {}
|
|
@@ -511321,6 +511624,7 @@ function initBundledSkills() {
|
|
|
511321
511624
|
var init_bundled = __esm(() => {
|
|
511322
511625
|
init_setup2();
|
|
511323
511626
|
init_aceSkills();
|
|
511627
|
+
init_lld();
|
|
511324
511628
|
init_orbitInChrome();
|
|
511325
511629
|
init_sql();
|
|
511326
511630
|
init_updateConfig();
|
|
@@ -522778,7 +523082,7 @@ ${m.text}
|
|
|
522778
523082
|
let bridgeFailureDetail;
|
|
522779
523083
|
try {
|
|
522780
523084
|
const { initReplBridge: initReplBridge2 } = await Promise.resolve().then(() => (init_initReplBridge(), exports_initReplBridge));
|
|
522781
|
-
const
|
|
523085
|
+
const handle3 = await initReplBridge2({
|
|
522782
523086
|
onInboundMessage(msg) {
|
|
522783
523087
|
const fields = extractInboundMessageFields(msg);
|
|
522784
523088
|
if (!fields)
|
|
@@ -522831,21 +523135,21 @@ ${m.text}
|
|
|
522831
523135
|
},
|
|
522832
523136
|
initialMessages: mutableMessages.length > 0 ? mutableMessages : undefined
|
|
522833
523137
|
});
|
|
522834
|
-
if (!
|
|
523138
|
+
if (!handle3) {
|
|
522835
523139
|
sendControlResponseError(message, bridgeFailureDetail ?? "Remote Control initialization failed");
|
|
522836
523140
|
} else {
|
|
522837
|
-
bridgeHandle =
|
|
523141
|
+
bridgeHandle = handle3;
|
|
522838
523142
|
bridgeLastForwardedIndex = mutableMessages.length;
|
|
522839
523143
|
structuredIO.setOnControlRequestSent((request) => {
|
|
522840
|
-
|
|
523144
|
+
handle3.sendControlRequest(request);
|
|
522841
523145
|
});
|
|
522842
523146
|
structuredIO.setOnControlRequestResolved((requestId) => {
|
|
522843
|
-
|
|
523147
|
+
handle3.sendControlCancelRequest(requestId);
|
|
522844
523148
|
});
|
|
522845
523149
|
sendControlResponseSuccess(message, {
|
|
522846
|
-
session_url: getRemoteSessionUrl(
|
|
522847
|
-
connect_url: buildBridgeConnectUrl(
|
|
522848
|
-
environment_id:
|
|
523150
|
+
session_url: getRemoteSessionUrl(handle3.bridgeSessionId, handle3.sessionIngressUrl),
|
|
523151
|
+
connect_url: buildBridgeConnectUrl(handle3.environmentId, handle3.sessionIngressUrl),
|
|
523152
|
+
environment_id: handle3.environmentId
|
|
522849
523153
|
});
|
|
522850
523154
|
}
|
|
522851
523155
|
} catch (err2) {
|
|
@@ -525453,7 +525757,7 @@ __export(exports_main, {
|
|
|
525453
525757
|
startDeferredPrefetches: () => startDeferredPrefetches,
|
|
525454
525758
|
main: () => main
|
|
525455
525759
|
});
|
|
525456
|
-
import { readFileSync as
|
|
525760
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
525457
525761
|
import { resolve as resolve40 } from "path";
|
|
525458
525762
|
function logManagedSettings() {
|
|
525459
525763
|
try {
|
|
@@ -525609,7 +525913,7 @@ function loadSettingsFromFlag(settingsFile) {
|
|
|
525609
525913
|
resolvedPath: resolvedSettingsPath
|
|
525610
525914
|
} = safeResolvePath(getFsImplementation(), settingsFile);
|
|
525611
525915
|
try {
|
|
525612
|
-
|
|
525916
|
+
readFileSync11(resolvedSettingsPath, "utf8");
|
|
525613
525917
|
} catch (e2) {
|
|
525614
525918
|
if (isENOENT(e2)) {
|
|
525615
525919
|
process.stderr.write(source_default.red(`Error: Settings file not found: ${resolvedSettingsPath}
|
|
@@ -526012,7 +526316,7 @@ ${getTmuxInstallInstructions2()}
|
|
|
526012
526316
|
}
|
|
526013
526317
|
try {
|
|
526014
526318
|
const filePath = resolve40(options2.systemPromptFile);
|
|
526015
|
-
systemPrompt =
|
|
526319
|
+
systemPrompt = readFileSync11(filePath, "utf8");
|
|
526016
526320
|
} catch (error41) {
|
|
526017
526321
|
const code = getErrnoCode(error41);
|
|
526018
526322
|
if (code === "ENOENT") {
|
|
@@ -526034,7 +526338,7 @@ ${getTmuxInstallInstructions2()}
|
|
|
526034
526338
|
}
|
|
526035
526339
|
try {
|
|
526036
526340
|
const filePath = resolve40(options2.appendSystemPromptFile);
|
|
526037
|
-
appendSystemPrompt =
|
|
526341
|
+
appendSystemPrompt = readFileSync11(filePath, "utf8");
|
|
526038
526342
|
} catch (error41) {
|
|
526039
526343
|
const code = getErrnoCode(error41);
|
|
526040
526344
|
if (code === "ENOENT") {
|
|
@@ -527410,7 +527714,7 @@ Usage: orbit --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
527410
527714
|
pendingHookMessages
|
|
527411
527715
|
}, renderAndRun);
|
|
527412
527716
|
}
|
|
527413
|
-
}).version("0.1.
|
|
527717
|
+
}).version("0.1.39 (Orbit AI)", "-v, --version", "Output the version number");
|
|
527414
527718
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
527415
527719
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
527416
527720
|
if (canUserConfigureAdvisor()) {
|
|
@@ -527932,7 +528236,7 @@ if (false) {}
|
|
|
527932
528236
|
async function main2() {
|
|
527933
528237
|
const args = process.argv.slice(2);
|
|
527934
528238
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
527935
|
-
console.log(`${"0.1.
|
|
528239
|
+
console.log(`${"0.1.39"} (Orbit AI)`);
|
|
527936
528240
|
return;
|
|
527937
528241
|
}
|
|
527938
528242
|
if (args.includes("--provider")) {
|
|
@@ -528040,4 +528344,4 @@ async function main2() {
|
|
|
528040
528344
|
}
|
|
528041
528345
|
main2();
|
|
528042
528346
|
|
|
528043
|
-
//# debugId=
|
|
528347
|
+
//# debugId=3DB19D92C131358564756E2164756E21
|