@gapi/gcli 1.8.237 → 1.8.238
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/.agents/skills/changelog/SKILL.md +59 -0
- package/.agents/skills/cluster-targeting/SKILL.md +70 -0
- package/.agents/skills/gcli-command/SKILL.md +55 -0
- package/.agents/skills/local-ai-runners/SKILL.md +40 -0
- package/.claude/README.md +33 -0
- package/AGENTS.md +105 -0
- package/CLAUDE.md +20 -0
- package/README-CLI.md +385 -23
- package/README.md +40 -0
- package/docs/CHANGELOG.md +8 -0
- package/docs/changelog.d/2026-10-11-local-ai-runners-gcli-runner-commands-bridge-ollama-to-the-chat.md +25 -0
- package/docs/changelog.d/2026-10-11-local-ai-runners-gcli-runner-models-chooses-the-models-shown-in-chat.md +12 -0
- package/docs/changelog.d/2026-10-11-repo-ai-ready-package-setup-agents-md-skills-feature-changelog.md +18 -0
- package/docs/changelog.d/2026-10-11-repo-tests-workflow-runs-lint-and-tests-on-every-branch-push.md +18 -0
- package/docs/changelog.d/README.md +51 -0
- package/docs/features/README.md +33 -0
- package/docs/features/local-ai-runners.md +64 -0
- package/package.json +2 -1
- package/release/index.js +886 -92
- package/scripts/changelog.mjs +348 -0
package/release/index.js
CHANGED
|
@@ -12391,7 +12391,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
12391
12391
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
12392
12392
|
exports2.lastValueFrom = void 0;
|
|
12393
12393
|
var EmptyError_1 = require_EmptyError();
|
|
12394
|
-
function
|
|
12394
|
+
function lastValueFrom38(source, config2) {
|
|
12395
12395
|
var hasConfig = typeof config2 === "object";
|
|
12396
12396
|
return new Promise(function(resolve, reject) {
|
|
12397
12397
|
var _hasValue = false;
|
|
@@ -12414,7 +12414,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
12414
12414
|
});
|
|
12415
12415
|
});
|
|
12416
12416
|
}
|
|
12417
|
-
exports2.lastValueFrom =
|
|
12417
|
+
exports2.lastValueFrom = lastValueFrom38;
|
|
12418
12418
|
}
|
|
12419
12419
|
});
|
|
12420
12420
|
|
|
@@ -16792,7 +16792,7 @@ var require_tap = __commonJS({
|
|
|
16792
16792
|
var lift_1 = require_lift();
|
|
16793
16793
|
var OperatorSubscriber_1 = require_OperatorSubscriber();
|
|
16794
16794
|
var identity_1 = require_identity();
|
|
16795
|
-
function
|
|
16795
|
+
function tap34(observerOrNext, error48, complete) {
|
|
16796
16796
|
var tapObserver = isFunction_1.isFunction(observerOrNext) || error48 || complete ? { next: observerOrNext, error: error48, complete } : observerOrNext;
|
|
16797
16797
|
return tapObserver ? lift_1.operate(function(source, subscriber) {
|
|
16798
16798
|
var _a2;
|
|
@@ -16821,7 +16821,7 @@ var require_tap = __commonJS({
|
|
|
16821
16821
|
}));
|
|
16822
16822
|
}) : identity_1.identity;
|
|
16823
16823
|
}
|
|
16824
|
-
exports2.tap =
|
|
16824
|
+
exports2.tap = tap34;
|
|
16825
16825
|
}
|
|
16826
16826
|
});
|
|
16827
16827
|
|
|
@@ -27839,7 +27839,7 @@ var require_auth = __commonJS({
|
|
|
27839
27839
|
this.a = this.c;
|
|
27840
27840
|
qm(this, true);
|
|
27841
27841
|
};
|
|
27842
|
-
function
|
|
27842
|
+
function rm2(a, b) {
|
|
27843
27843
|
if (b) return a.a = a.c, a.g();
|
|
27844
27844
|
b = a.a;
|
|
27845
27845
|
a.a *= 2;
|
|
@@ -27848,7 +27848,7 @@ var require_auth = __commonJS({
|
|
|
27848
27848
|
}
|
|
27849
27849
|
function qm(a, b) {
|
|
27850
27850
|
a.stop();
|
|
27851
|
-
a.b = Bd(
|
|
27851
|
+
a.b = Bd(rm2(a, b)).then(function() {
|
|
27852
27852
|
return Ye();
|
|
27853
27853
|
}).then(function() {
|
|
27854
27854
|
return a.h();
|
|
@@ -35995,7 +35995,7 @@ var require_index_cjs3 = __commonJS({
|
|
|
35995
35995
|
});
|
|
35996
35996
|
|
|
35997
35997
|
// src/types.ts
|
|
35998
|
-
var import_os, mainDirectory, tokenDirectory, refreshTokenDirectory, urlDirectory, keyDirectory, projectDirectory, generationTimeDirectory, uploadUrlDirectory;
|
|
35998
|
+
var import_os, mainDirectory, tokenDirectory, refreshTokenDirectory, urlDirectory, keyDirectory, projectDirectory, generationTimeDirectory, uploadUrlDirectory, runnerDirectory;
|
|
35999
35999
|
var init_types = __esm({
|
|
36000
36000
|
"src/types.ts"() {
|
|
36001
36001
|
import_os = require("os");
|
|
@@ -36009,6 +36009,7 @@ var init_types = __esm({
|
|
|
36009
36009
|
"/"
|
|
36010
36010
|
);
|
|
36011
36011
|
uploadUrlDirectory = [mainDirectory, "upload-url"].join("/");
|
|
36012
|
+
runnerDirectory = [mainDirectory, "runner.json"].join("/");
|
|
36012
36013
|
}
|
|
36013
36014
|
});
|
|
36014
36015
|
|
|
@@ -36145,6 +36146,29 @@ scaleOptions {
|
|
|
36145
36146
|
}
|
|
36146
36147
|
});
|
|
36147
36148
|
|
|
36149
|
+
// src/services/types/local-runner.fragment.ts
|
|
36150
|
+
var LocalRunnerFragment;
|
|
36151
|
+
var init_local_runner_fragment = __esm({
|
|
36152
|
+
"src/services/types/local-runner.fragment.ts"() {
|
|
36153
|
+
LocalRunnerFragment = `
|
|
36154
|
+
id
|
|
36155
|
+
name
|
|
36156
|
+
tokenPrefix
|
|
36157
|
+
online
|
|
36158
|
+
lastSeenAt
|
|
36159
|
+
runnerVersion
|
|
36160
|
+
createdAt
|
|
36161
|
+
enabledModels
|
|
36162
|
+
models {
|
|
36163
|
+
name
|
|
36164
|
+
parameterSize
|
|
36165
|
+
quantization
|
|
36166
|
+
capabilities
|
|
36167
|
+
}
|
|
36168
|
+
`;
|
|
36169
|
+
}
|
|
36170
|
+
});
|
|
36171
|
+
|
|
36148
36172
|
// src/services/types/plugin.fragment.ts
|
|
36149
36173
|
var PluginFragment, InstalledPluginFragment;
|
|
36150
36174
|
var init_plugin_fragment = __esm({
|
|
@@ -36257,6 +36281,7 @@ var init_gql_client = __esm({
|
|
|
36257
36281
|
init_cluster_fragment();
|
|
36258
36282
|
init_environment_fragment();
|
|
36259
36283
|
init_lambda_fragment();
|
|
36284
|
+
init_local_runner_fragment();
|
|
36260
36285
|
init_plugin_fragment();
|
|
36261
36286
|
init_project_fragment();
|
|
36262
36287
|
init_rabbitmq_fragment();
|
|
@@ -36652,6 +36677,56 @@ var init_gql_client = __esm({
|
|
|
36652
36677
|
variables: { projectId, ...input }
|
|
36653
36678
|
}).pipe((0, import_operators.map)((res) => res.provisionProjectCluster));
|
|
36654
36679
|
}
|
|
36680
|
+
static listLocalRunners() {
|
|
36681
|
+
return this.query({
|
|
36682
|
+
query: gql`
|
|
36683
|
+
query listLocalRunners {
|
|
36684
|
+
listLocalRunners {
|
|
36685
|
+
${LocalRunnerFragment}
|
|
36686
|
+
}
|
|
36687
|
+
}
|
|
36688
|
+
`
|
|
36689
|
+
}).pipe((0, import_operators.map)((res) => res.listLocalRunners));
|
|
36690
|
+
}
|
|
36691
|
+
static createLocalRunner(name2) {
|
|
36692
|
+
return this.query({
|
|
36693
|
+
query: gql`
|
|
36694
|
+
mutation createLocalRunner($name: String!) {
|
|
36695
|
+
createLocalRunner(name: $name) {
|
|
36696
|
+
token
|
|
36697
|
+
runner {
|
|
36698
|
+
${LocalRunnerFragment}
|
|
36699
|
+
}
|
|
36700
|
+
}
|
|
36701
|
+
}
|
|
36702
|
+
`,
|
|
36703
|
+
variables: { name: name2 }
|
|
36704
|
+
}).pipe((0, import_operators.map)((res) => res.createLocalRunner));
|
|
36705
|
+
}
|
|
36706
|
+
static setLocalRunnerModels(runnerId, models) {
|
|
36707
|
+
return this.query({
|
|
36708
|
+
query: gql`
|
|
36709
|
+
mutation setLocalRunnerModels($runnerId: String!, $models: [String!]) {
|
|
36710
|
+
setLocalRunnerModels(runnerId: $runnerId, models: $models) {
|
|
36711
|
+
${LocalRunnerFragment}
|
|
36712
|
+
}
|
|
36713
|
+
}
|
|
36714
|
+
`,
|
|
36715
|
+
variables: { runnerId, models }
|
|
36716
|
+
}).pipe((0, import_operators.map)((res) => res.setLocalRunnerModels));
|
|
36717
|
+
}
|
|
36718
|
+
static deleteLocalRunner(runnerId) {
|
|
36719
|
+
return this.query({
|
|
36720
|
+
query: gql`
|
|
36721
|
+
mutation deleteLocalRunner($runnerId: String!) {
|
|
36722
|
+
deleteLocalRunner(runnerId: $runnerId) {
|
|
36723
|
+
status
|
|
36724
|
+
}
|
|
36725
|
+
}
|
|
36726
|
+
`,
|
|
36727
|
+
variables: { runnerId }
|
|
36728
|
+
}).pipe((0, import_operators.map)((res) => res.deleteLocalRunner));
|
|
36729
|
+
}
|
|
36655
36730
|
static projectClusters(projectId) {
|
|
36656
36731
|
return this.query({
|
|
36657
36732
|
query: gql`
|
|
@@ -42106,7 +42181,7 @@ var require_typescript = __commonJS({
|
|
|
42106
42181
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
42107
42182
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
42108
42183
|
writeCommentRange: () => writeCommentRange,
|
|
42109
|
-
writeFile: () =>
|
|
42184
|
+
writeFile: () => writeFile6,
|
|
42110
42185
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
42111
42186
|
zipWith: () => zipWith
|
|
42112
42187
|
});
|
|
@@ -48438,7 +48513,7 @@ ${lanes.join("\n")}
|
|
|
48438
48513
|
writeOutputIsTTY() {
|
|
48439
48514
|
return process.stdout.isTTY;
|
|
48440
48515
|
},
|
|
48441
|
-
readFile:
|
|
48516
|
+
readFile: readFile3,
|
|
48442
48517
|
writeFile: writeFile22,
|
|
48443
48518
|
watchFile: watchFile2,
|
|
48444
48519
|
watchDirectory,
|
|
@@ -48644,7 +48719,7 @@ ${lanes.join("\n")}
|
|
|
48644
48719
|
callback
|
|
48645
48720
|
);
|
|
48646
48721
|
}
|
|
48647
|
-
function
|
|
48722
|
+
function readFile3(fileName, _encoding) {
|
|
48648
48723
|
let buffer;
|
|
48649
48724
|
try {
|
|
48650
48725
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -60749,7 +60824,7 @@ ${lanes.join("\n")}
|
|
|
60749
60824
|
sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
|
|
60750
60825
|
return combinePaths(newDirPath, sourceFilePath);
|
|
60751
60826
|
}
|
|
60752
|
-
function
|
|
60827
|
+
function writeFile6(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
60753
60828
|
host.writeFile(
|
|
60754
60829
|
fileName,
|
|
60755
60830
|
text,
|
|
@@ -85200,7 +85275,7 @@ ${lanes.join("\n")}
|
|
|
85200
85275
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
85201
85276
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
85202
85277
|
}
|
|
85203
|
-
function parseCommandLineWorker(diagnostics, commandLine,
|
|
85278
|
+
function parseCommandLineWorker(diagnostics, commandLine, readFile3) {
|
|
85204
85279
|
const options = {};
|
|
85205
85280
|
let watchOptions;
|
|
85206
85281
|
const fileNames = [];
|
|
@@ -85248,7 +85323,7 @@ ${lanes.join("\n")}
|
|
|
85248
85323
|
}
|
|
85249
85324
|
}
|
|
85250
85325
|
function parseResponseFile(fileName) {
|
|
85251
|
-
const text = tryReadFile(fileName,
|
|
85326
|
+
const text = tryReadFile(fileName, readFile3 || ((fileName2) => sys.readFile(fileName2)));
|
|
85252
85327
|
if (!isString(text)) {
|
|
85253
85328
|
errors.push(text);
|
|
85254
85329
|
return;
|
|
@@ -85351,8 +85426,8 @@ ${lanes.join("\n")}
|
|
|
85351
85426
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
85352
85427
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
85353
85428
|
};
|
|
85354
|
-
function parseCommandLine(commandLine,
|
|
85355
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
85429
|
+
function parseCommandLine(commandLine, readFile3) {
|
|
85430
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile3);
|
|
85356
85431
|
}
|
|
85357
85432
|
function getOptionFromName(optionName, allowShort) {
|
|
85358
85433
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -85434,8 +85509,8 @@ ${lanes.join("\n")}
|
|
|
85434
85509
|
watchOptionsToExtend
|
|
85435
85510
|
);
|
|
85436
85511
|
}
|
|
85437
|
-
function readConfigFile(fileName,
|
|
85438
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
85512
|
+
function readConfigFile(fileName, readFile3) {
|
|
85513
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile3);
|
|
85439
85514
|
return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
85440
85515
|
}
|
|
85441
85516
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -85450,14 +85525,14 @@ ${lanes.join("\n")}
|
|
|
85450
85525
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
85451
85526
|
};
|
|
85452
85527
|
}
|
|
85453
|
-
function readJsonConfigFile(fileName,
|
|
85454
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
85528
|
+
function readJsonConfigFile(fileName, readFile3) {
|
|
85529
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile3);
|
|
85455
85530
|
return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
85456
85531
|
}
|
|
85457
|
-
function tryReadFile(fileName,
|
|
85532
|
+
function tryReadFile(fileName, readFile3) {
|
|
85458
85533
|
let text;
|
|
85459
85534
|
try {
|
|
85460
|
-
text =
|
|
85535
|
+
text = readFile3(fileName);
|
|
85461
85536
|
} catch (e2) {
|
|
85462
85537
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e2.message);
|
|
85463
85538
|
}
|
|
@@ -169500,7 +169575,7 @@ ${lanes.join("\n")}
|
|
|
169500
169575
|
return;
|
|
169501
169576
|
}
|
|
169502
169577
|
const buildInfo = host.getBuildInfo() || { version: version2 };
|
|
169503
|
-
|
|
169578
|
+
writeFile6(
|
|
169504
169579
|
host,
|
|
169505
169580
|
emitterDiagnostics,
|
|
169506
169581
|
buildInfoPath,
|
|
@@ -169712,7 +169787,7 @@ ${lanes.join("\n")}
|
|
|
169712
169787
|
}
|
|
169713
169788
|
if (sourceMapFilePath) {
|
|
169714
169789
|
const sourceMap = sourceMapGenerator.toString();
|
|
169715
|
-
|
|
169790
|
+
writeFile6(
|
|
169716
169791
|
host,
|
|
169717
169792
|
emitterDiagnostics,
|
|
169718
169793
|
sourceMapFilePath,
|
|
@@ -169727,7 +169802,7 @@ ${lanes.join("\n")}
|
|
|
169727
169802
|
}
|
|
169728
169803
|
const text = writer.getText();
|
|
169729
169804
|
const data = { sourceMapUrlPos, diagnostics: transform22.diagnostics };
|
|
169730
|
-
|
|
169805
|
+
writeFile6(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
|
|
169731
169806
|
writer.clear();
|
|
169732
169807
|
return !data.skippedDtsWrite;
|
|
169733
169808
|
}
|
|
@@ -175115,12 +175190,12 @@ ${lanes.join("\n")}
|
|
|
175115
175190
|
function createCompilerHost(options, setParentNodes) {
|
|
175116
175191
|
return createCompilerHostWorker(options, setParentNodes);
|
|
175117
175192
|
}
|
|
175118
|
-
function createGetSourceFile(
|
|
175193
|
+
function createGetSourceFile(readFile3, setParentNodes) {
|
|
175119
175194
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
175120
175195
|
let text;
|
|
175121
175196
|
try {
|
|
175122
175197
|
mark("beforeIORead");
|
|
175123
|
-
text =
|
|
175198
|
+
text = readFile3(fileName);
|
|
175124
175199
|
mark("afterIORead");
|
|
175125
175200
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
175126
175201
|
} catch (e2) {
|
|
@@ -176024,7 +176099,7 @@ ${lanes.join("\n")}
|
|
|
176024
176099
|
getRedirectFromOutput,
|
|
176025
176100
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
176026
176101
|
});
|
|
176027
|
-
const
|
|
176102
|
+
const readFile3 = host.readFile.bind(host);
|
|
176028
176103
|
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
176029
176104
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
176030
176105
|
(_f = tracing) == null ? void 0 : _f.pop();
|
|
@@ -176250,7 +176325,7 @@ ${lanes.join("\n")}
|
|
|
176250
176325
|
shouldTransformImportCall,
|
|
176251
176326
|
emitBuildInfo,
|
|
176252
176327
|
fileExists,
|
|
176253
|
-
readFile:
|
|
176328
|
+
readFile: readFile3,
|
|
176254
176329
|
directoryExists,
|
|
176255
176330
|
getSymlinkCache,
|
|
176256
176331
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
@@ -237609,7 +237684,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
237609
237684
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
237610
237685
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
237611
237686
|
writeCommentRange: () => writeCommentRange,
|
|
237612
|
-
writeFile: () =>
|
|
237687
|
+
writeFile: () => writeFile6,
|
|
237613
237688
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
237614
237689
|
zipWith: () => zipWith
|
|
237615
237690
|
});
|
|
@@ -250734,7 +250809,7 @@ var require_esbuild_decorators = __commonJS({
|
|
|
250734
250809
|
var typescript_1 = require_typescript();
|
|
250735
250810
|
var util_1 = require("util");
|
|
250736
250811
|
var strip_it_1 = require_strip_it();
|
|
250737
|
-
var { readFile:
|
|
250812
|
+
var { readFile: readFile3 } = fs_1.promises;
|
|
250738
250813
|
var theFinder = new RegExp(/((?<![(\s]\s*['"])@\w[.[\]\w\d]*\s*(?![;])[((?=\s)])/);
|
|
250739
250814
|
var findDecorators = (fileContent) => theFinder.test((0, strip_it_1.strip)(fileContent));
|
|
250740
250815
|
var esbuildDecorators2 = (options = {}) => ({
|
|
@@ -250758,7 +250833,7 @@ var require_esbuild_decorators = __commonJS({
|
|
|
250758
250833
|
if (!forceTsc && (!parsedTsConfig || !parsedTsConfig.options || !parsedTsConfig.options.emitDecoratorMetadata)) {
|
|
250759
250834
|
return;
|
|
250760
250835
|
}
|
|
250761
|
-
const ts = yield
|
|
250836
|
+
const ts = yield readFile3(args.path, "utf8").catch((err) => printDiagnostics({ file: args.path, err }));
|
|
250762
250837
|
const hasDecorator = findDecorators(ts);
|
|
250763
250838
|
if (!ts || !hasDecorator) {
|
|
250764
250839
|
return;
|
|
@@ -267389,8 +267464,8 @@ var require_graceful_fs = __commonJS({
|
|
|
267389
267464
|
fs3.createReadStream = createReadStream3;
|
|
267390
267465
|
fs3.createWriteStream = createWriteStream;
|
|
267391
267466
|
var fs$readFile = fs3.readFile;
|
|
267392
|
-
fs3.readFile =
|
|
267393
|
-
function
|
|
267467
|
+
fs3.readFile = readFile3;
|
|
267468
|
+
function readFile3(path2, options, cb) {
|
|
267394
267469
|
if (typeof options === "function")
|
|
267395
267470
|
cb = options, options = null;
|
|
267396
267471
|
return go$readFile(path2, options, cb);
|
|
@@ -267407,8 +267482,8 @@ var require_graceful_fs = __commonJS({
|
|
|
267407
267482
|
}
|
|
267408
267483
|
}
|
|
267409
267484
|
var fs$writeFile = fs3.writeFile;
|
|
267410
|
-
fs3.writeFile =
|
|
267411
|
-
function
|
|
267485
|
+
fs3.writeFile = writeFile6;
|
|
267486
|
+
function writeFile6(path2, data, options, cb) {
|
|
267412
267487
|
if (typeof options === "function")
|
|
267413
267488
|
cb = options, options = null;
|
|
267414
267489
|
return go$writeFile(path2, data, options, cb);
|
|
@@ -316863,17 +316938,704 @@ var init_delete2 = __esm({
|
|
|
316863
316938
|
}
|
|
316864
316939
|
});
|
|
316865
316940
|
|
|
316866
|
-
// src/commands/
|
|
316941
|
+
// src/commands/runner/config.ts
|
|
316942
|
+
var import_promises, DEFAULT_WS_URL, deriveSubscriptionsUrl, readLoginApiUrl, readSavedRunner, saveRunner, forgetRunner;
|
|
316943
|
+
var init_config = __esm({
|
|
316944
|
+
"src/commands/runner/config.ts"() {
|
|
316945
|
+
import_promises = require("fs/promises");
|
|
316946
|
+
init_types();
|
|
316947
|
+
DEFAULT_WS_URL = "wss://api.lambforge.com/subscriptions";
|
|
316948
|
+
deriveSubscriptionsUrl = (apiUrl) => {
|
|
316949
|
+
if (!apiUrl?.trim()) {
|
|
316950
|
+
return DEFAULT_WS_URL;
|
|
316951
|
+
}
|
|
316952
|
+
const url2 = new URL(apiUrl.trim());
|
|
316953
|
+
if (["localhost", "127.0.0.1"].includes(url2.hostname) && url2.port === "9004") {
|
|
316954
|
+
return `ws://${url2.hostname}:9000/subscriptions`;
|
|
316955
|
+
}
|
|
316956
|
+
url2.protocol = url2.protocol === "http:" ? "ws:" : "wss:";
|
|
316957
|
+
url2.pathname = "/subscriptions";
|
|
316958
|
+
url2.search = "";
|
|
316959
|
+
return url2.toString();
|
|
316960
|
+
};
|
|
316961
|
+
readLoginApiUrl = () => (0, import_promises.readFile)(urlDirectory, "utf-8").catch(() => "");
|
|
316962
|
+
readSavedRunner = async () => {
|
|
316963
|
+
try {
|
|
316964
|
+
const saved = JSON.parse(await (0, import_promises.readFile)(runnerDirectory, "utf-8"));
|
|
316965
|
+
return saved?.id && saved?.token ? saved : null;
|
|
316966
|
+
} catch {
|
|
316967
|
+
return null;
|
|
316968
|
+
}
|
|
316969
|
+
};
|
|
316970
|
+
saveRunner = async (runner) => {
|
|
316971
|
+
await (0, import_promises.mkdir)(mainDirectory, { recursive: true });
|
|
316972
|
+
await (0, import_promises.writeFile)(runnerDirectory, JSON.stringify(runner, null, 2), "utf-8");
|
|
316973
|
+
await (0, import_promises.chmod)(runnerDirectory, 384);
|
|
316974
|
+
};
|
|
316975
|
+
forgetRunner = () => (0, import_promises.rm)(runnerDirectory, { force: true });
|
|
316976
|
+
}
|
|
316977
|
+
});
|
|
316978
|
+
|
|
316979
|
+
// src/commands/runner/ollama.ts
|
|
316980
|
+
var ALLOWED_REQUESTS, isAllowedRequest, resolveOllamaUrl, OllamaModels;
|
|
316981
|
+
var init_ollama = __esm({
|
|
316982
|
+
"src/commands/runner/ollama.ts"() {
|
|
316983
|
+
ALLOWED_REQUESTS = [
|
|
316984
|
+
{ method: "POST", path: "/v1/chat/completions" }
|
|
316985
|
+
];
|
|
316986
|
+
isAllowedRequest = (method, path2) => ALLOWED_REQUESTS.some(
|
|
316987
|
+
(r2) => r2.method === method?.toUpperCase() && r2.path === path2
|
|
316988
|
+
);
|
|
316989
|
+
resolveOllamaUrl = (option) => {
|
|
316990
|
+
const raw = option || process.env.OLLAMA_HOST || "http://127.0.0.1:11434";
|
|
316991
|
+
const withScheme = /^https?:\/\//.test(raw) ? raw : `http://${raw}`;
|
|
316992
|
+
const url2 = new URL(withScheme);
|
|
316993
|
+
if (url2.hostname === "0.0.0.0") {
|
|
316994
|
+
url2.hostname = "127.0.0.1";
|
|
316995
|
+
}
|
|
316996
|
+
return url2.origin;
|
|
316997
|
+
};
|
|
316998
|
+
OllamaModels = class {
|
|
316999
|
+
constructor(baseUrl, fetchFn = fetch) {
|
|
317000
|
+
this.baseUrl = baseUrl;
|
|
317001
|
+
this.fetchFn = fetchFn;
|
|
317002
|
+
this.showCache = /* @__PURE__ */ new Map();
|
|
317003
|
+
}
|
|
317004
|
+
async list() {
|
|
317005
|
+
const res = await this.fetchFn(`${this.baseUrl}/api/tags`);
|
|
317006
|
+
if (!res.ok) {
|
|
317007
|
+
throw new Error(`Ollama /api/tags returned ${res.status}`);
|
|
317008
|
+
}
|
|
317009
|
+
const { models = [] } = await res.json();
|
|
317010
|
+
const described = await Promise.all(
|
|
317011
|
+
models.map((tag) => this.describe(tag))
|
|
317012
|
+
);
|
|
317013
|
+
return described.filter(
|
|
317014
|
+
(m2) => !m2.capabilities.length || m2.capabilities.includes("completion")
|
|
317015
|
+
);
|
|
317016
|
+
}
|
|
317017
|
+
async describe(tag) {
|
|
317018
|
+
const show = await this.show(tag);
|
|
317019
|
+
const contextLength = Object.entries(show?.model_info ?? {}).find(
|
|
317020
|
+
([key]) => key.endsWith(".context_length")
|
|
317021
|
+
)?.[1];
|
|
317022
|
+
return {
|
|
317023
|
+
name: tag.name,
|
|
317024
|
+
family: tag.details?.family,
|
|
317025
|
+
parameterSize: tag.details?.parameter_size,
|
|
317026
|
+
quantization: tag.details?.quantization_level,
|
|
317027
|
+
capabilities: show?.capabilities ?? [],
|
|
317028
|
+
contextLength: typeof contextLength === "number" ? contextLength : void 0
|
|
317029
|
+
};
|
|
317030
|
+
}
|
|
317031
|
+
async show(tag) {
|
|
317032
|
+
const key = tag.digest || tag.name;
|
|
317033
|
+
if (this.showCache.has(key)) {
|
|
317034
|
+
return this.showCache.get(key);
|
|
317035
|
+
}
|
|
317036
|
+
try {
|
|
317037
|
+
const res = await this.fetchFn(`${this.baseUrl}/api/show`, {
|
|
317038
|
+
method: "POST",
|
|
317039
|
+
headers: { "Content-Type": "application/json" },
|
|
317040
|
+
body: JSON.stringify({ model: tag.name })
|
|
317041
|
+
});
|
|
317042
|
+
if (!res.ok) {
|
|
317043
|
+
return void 0;
|
|
317044
|
+
}
|
|
317045
|
+
const show = await res.json();
|
|
317046
|
+
this.showCache.set(key, show);
|
|
317047
|
+
return show;
|
|
317048
|
+
} catch {
|
|
317049
|
+
return void 0;
|
|
317050
|
+
}
|
|
317051
|
+
}
|
|
317052
|
+
};
|
|
317053
|
+
}
|
|
317054
|
+
});
|
|
317055
|
+
|
|
317056
|
+
// src/commands/runner/connection.ts
|
|
317057
|
+
var OPEN, SUBSCRIPTION_ID, MAX_CHUNK_CHARS, REQUESTS_SUBSCRIPTION, HEARTBEAT_MUTATION, RESPOND_MUTATION, RunnerAuthError, describeError, FrameSender, RunnerConnection;
|
|
317058
|
+
var init_connection = __esm({
|
|
317059
|
+
"src/commands/runner/connection.ts"() {
|
|
317060
|
+
init_ollama();
|
|
317061
|
+
OPEN = 1;
|
|
317062
|
+
SUBSCRIPTION_ID = "runner-requests";
|
|
317063
|
+
MAX_CHUNK_CHARS = 32 * 1024;
|
|
317064
|
+
REQUESTS_SUBSCRIPTION = `subscription {
|
|
317065
|
+
subscribeToRunnerRequests { requestId type method path body }
|
|
317066
|
+
}`;
|
|
317067
|
+
HEARTBEAT_MUTATION = `mutation runnerHeartbeat($models: [LocalRunnerModelInput], $runnerVersion: String) {
|
|
317068
|
+
runnerHeartbeat(models: $models, runnerVersion: $runnerVersion) { id name }
|
|
317069
|
+
}`;
|
|
317070
|
+
RESPOND_MUTATION = `mutation runnerRespond($frames: [RunnerResponseFrameInput!]!) {
|
|
317071
|
+
runnerRespond(frames: $frames) { status }
|
|
317072
|
+
}`;
|
|
317073
|
+
RunnerAuthError = class extends Error {
|
|
317074
|
+
};
|
|
317075
|
+
describeError = (e2) => e2 instanceof Error ? e2.message : String(e2);
|
|
317076
|
+
FrameSender = class {
|
|
317077
|
+
constructor(requestId, send, flushMs) {
|
|
317078
|
+
this.requestId = requestId;
|
|
317079
|
+
this.send = send;
|
|
317080
|
+
this.flushMs = flushMs;
|
|
317081
|
+
this.seq = 0;
|
|
317082
|
+
this.queue = [];
|
|
317083
|
+
this.sending = Promise.resolve();
|
|
317084
|
+
this.lastPushAt = Date.now();
|
|
317085
|
+
}
|
|
317086
|
+
push(frame) {
|
|
317087
|
+
this.lastPushAt = Date.now();
|
|
317088
|
+
const last = this.queue[this.queue.length - 1];
|
|
317089
|
+
if (frame.type === "chunk" && last?.type === "chunk" && last.data.length + frame.data.length <= MAX_CHUNK_CHARS) {
|
|
317090
|
+
last.data += frame.data;
|
|
317091
|
+
} else {
|
|
317092
|
+
this.queue.push({ ...frame, requestId: this.requestId, seq: this.seq++ });
|
|
317093
|
+
}
|
|
317094
|
+
if (!this.timer) {
|
|
317095
|
+
this.timer = setTimeout(() => void this.flush(), this.flushMs);
|
|
317096
|
+
}
|
|
317097
|
+
}
|
|
317098
|
+
flush() {
|
|
317099
|
+
clearTimeout(this.timer);
|
|
317100
|
+
this.timer = void 0;
|
|
317101
|
+
const frames = this.queue.splice(0);
|
|
317102
|
+
if (frames.length) {
|
|
317103
|
+
this.sending = this.sending.then(() => this.send(frames)).then(
|
|
317104
|
+
() => void 0,
|
|
317105
|
+
() => void 0
|
|
317106
|
+
);
|
|
317107
|
+
}
|
|
317108
|
+
return this.sending;
|
|
317109
|
+
}
|
|
317110
|
+
};
|
|
317111
|
+
RunnerConnection = class {
|
|
317112
|
+
constructor(options) {
|
|
317113
|
+
this.options = options;
|
|
317114
|
+
this.stopped = false;
|
|
317115
|
+
this.nextOperationId = 1;
|
|
317116
|
+
this.operations = /* @__PURE__ */ new Map();
|
|
317117
|
+
this.activeRequests = /* @__PURE__ */ new Map();
|
|
317118
|
+
this.announcedModels = "";
|
|
317119
|
+
this.fetchFn = options.fetchFn ?? fetch;
|
|
317120
|
+
this.ollama = new OllamaModels(options.ollamaUrl, this.fetchFn);
|
|
317121
|
+
}
|
|
317122
|
+
/** Runs until `stop()`; rejects only when the token is refused. */
|
|
317123
|
+
async run() {
|
|
317124
|
+
let attempt = 0;
|
|
317125
|
+
while (!this.stopped) {
|
|
317126
|
+
const connected = await this.connectOnce();
|
|
317127
|
+
if (this.fatal) {
|
|
317128
|
+
throw this.fatal;
|
|
317129
|
+
}
|
|
317130
|
+
if (this.stopped) {
|
|
317131
|
+
return;
|
|
317132
|
+
}
|
|
317133
|
+
attempt = connected ? 0 : attempt + 1;
|
|
317134
|
+
const delay = Math.min(
|
|
317135
|
+
this.options.maxReconnectDelayMs ?? 3e4,
|
|
317136
|
+
1e3 * 2 ** attempt
|
|
317137
|
+
);
|
|
317138
|
+
this.options.logger.warn(
|
|
317139
|
+
`Disconnected from Lambforge; reconnecting in ${Math.round(delay / 1e3)}s...`
|
|
317140
|
+
);
|
|
317141
|
+
await new Promise((r2) => setTimeout(r2, delay));
|
|
317142
|
+
}
|
|
317143
|
+
}
|
|
317144
|
+
stop() {
|
|
317145
|
+
this.stopped = true;
|
|
317146
|
+
this.socket?.close(1e3, "runner stopped");
|
|
317147
|
+
}
|
|
317148
|
+
/** Resolves when the socket closes; `true` if it got as far as being acknowledged. */
|
|
317149
|
+
connectOnce() {
|
|
317150
|
+
return new Promise((resolve) => {
|
|
317151
|
+
let acknowledged = false;
|
|
317152
|
+
const createSocket = this.options.createSocket ?? ((url2, protocol) => {
|
|
317153
|
+
if (typeof WebSocket === "undefined") {
|
|
317154
|
+
throw new Error("gcli runner requires Node.js 22 or newer");
|
|
317155
|
+
}
|
|
317156
|
+
return new WebSocket(url2, protocol);
|
|
317157
|
+
});
|
|
317158
|
+
let socket;
|
|
317159
|
+
try {
|
|
317160
|
+
socket = createSocket(this.options.wsUrl, "graphql-ws");
|
|
317161
|
+
} catch (e2) {
|
|
317162
|
+
this.options.logger.error(describeError(e2));
|
|
317163
|
+
resolve(false);
|
|
317164
|
+
return;
|
|
317165
|
+
}
|
|
317166
|
+
this.socket = socket;
|
|
317167
|
+
socket.onopen = () => this.send({
|
|
317168
|
+
type: "connection_init",
|
|
317169
|
+
payload: { runnerToken: this.options.token }
|
|
317170
|
+
});
|
|
317171
|
+
socket.onmessage = (event) => {
|
|
317172
|
+
let message;
|
|
317173
|
+
try {
|
|
317174
|
+
message = JSON.parse(String(event.data));
|
|
317175
|
+
} catch {
|
|
317176
|
+
return;
|
|
317177
|
+
}
|
|
317178
|
+
if (message.type === "connection_ack") {
|
|
317179
|
+
acknowledged = true;
|
|
317180
|
+
void this.onConnected();
|
|
317181
|
+
} else if (message.type === "connection_error") {
|
|
317182
|
+
const reason = message.payload?.message || "connection refused";
|
|
317183
|
+
this.fatal = new RunnerAuthError(
|
|
317184
|
+
`Lambforge refused this runner (${reason}). The runner may have been deleted - re-register it with \`gcli runner:start --reset\`.`
|
|
317185
|
+
);
|
|
317186
|
+
socket.close();
|
|
317187
|
+
} else if (message.id === SUBSCRIPTION_ID) {
|
|
317188
|
+
if (message.type === "data") {
|
|
317189
|
+
const request = message.payload?.data?.subscribeToRunnerRequests;
|
|
317190
|
+
if (request) {
|
|
317191
|
+
void this.onRequest(request);
|
|
317192
|
+
}
|
|
317193
|
+
} else if (message.type === "error" || message.type === "complete") {
|
|
317194
|
+
this.options.logger.error(
|
|
317195
|
+
`Request subscription ended: ${JSON.stringify(message.payload ?? {})}`
|
|
317196
|
+
);
|
|
317197
|
+
socket.close();
|
|
317198
|
+
}
|
|
317199
|
+
} else if (message.id && this.operations.has(message.id)) {
|
|
317200
|
+
this.onOperationMessage(message.id, message.type, message.payload);
|
|
317201
|
+
}
|
|
317202
|
+
};
|
|
317203
|
+
socket.onerror = () => void 0;
|
|
317204
|
+
socket.onclose = () => {
|
|
317205
|
+
this.onDisconnected();
|
|
317206
|
+
resolve(acknowledged);
|
|
317207
|
+
};
|
|
317208
|
+
});
|
|
317209
|
+
}
|
|
317210
|
+
async onConnected() {
|
|
317211
|
+
this.send({
|
|
317212
|
+
id: SUBSCRIPTION_ID,
|
|
317213
|
+
type: "start",
|
|
317214
|
+
payload: { query: REQUESTS_SUBSCRIPTION }
|
|
317215
|
+
});
|
|
317216
|
+
const runner = await this.heartbeat(true).catch((e2) => {
|
|
317217
|
+
this.options.logger.error(`Heartbeat failed: ${describeError(e2)}`);
|
|
317218
|
+
return null;
|
|
317219
|
+
});
|
|
317220
|
+
if (runner) {
|
|
317221
|
+
this.options.logger.log(
|
|
317222
|
+
`Connected as "${runner.name}" (${runner.id}). Your local models are now available in the Lambforge chat.`
|
|
317223
|
+
);
|
|
317224
|
+
}
|
|
317225
|
+
clearInterval(this.heartbeatTimer);
|
|
317226
|
+
this.heartbeatTimer = setInterval(
|
|
317227
|
+
() => void this.heartbeat(false).catch((e2) => {
|
|
317228
|
+
this.options.logger.warn(`Heartbeat failed: ${describeError(e2)}`);
|
|
317229
|
+
this.socket?.close();
|
|
317230
|
+
}),
|
|
317231
|
+
this.options.heartbeatMs ?? 3e4
|
|
317232
|
+
);
|
|
317233
|
+
}
|
|
317234
|
+
onDisconnected() {
|
|
317235
|
+
clearInterval(this.heartbeatTimer);
|
|
317236
|
+
for (const [id, op] of this.operations) {
|
|
317237
|
+
clearTimeout(op.timer);
|
|
317238
|
+
op.reject(new Error("connection closed"));
|
|
317239
|
+
this.operations.delete(id);
|
|
317240
|
+
}
|
|
317241
|
+
for (const controller of this.activeRequests.values()) {
|
|
317242
|
+
controller.abort();
|
|
317243
|
+
}
|
|
317244
|
+
this.activeRequests.clear();
|
|
317245
|
+
}
|
|
317246
|
+
async heartbeat(announce) {
|
|
317247
|
+
let models = [];
|
|
317248
|
+
try {
|
|
317249
|
+
models = await this.ollama.list();
|
|
317250
|
+
if (this.ollamaReachable === false || announce) {
|
|
317251
|
+
this.options.logger.info(
|
|
317252
|
+
`Ollama at ${this.options.ollamaUrl}: ${models.length} model(s)`
|
|
317253
|
+
);
|
|
317254
|
+
}
|
|
317255
|
+
this.ollamaReachable = true;
|
|
317256
|
+
} catch (e2) {
|
|
317257
|
+
if (this.ollamaReachable !== false) {
|
|
317258
|
+
this.options.logger.warn(
|
|
317259
|
+
`Cannot reach Ollama at ${this.options.ollamaUrl} (${describeError(e2)}). Is it running? Retrying...`
|
|
317260
|
+
);
|
|
317261
|
+
}
|
|
317262
|
+
this.ollamaReachable = false;
|
|
317263
|
+
}
|
|
317264
|
+
const names = JSON.stringify(
|
|
317265
|
+
models.map((m2) => m2.name)
|
|
317266
|
+
);
|
|
317267
|
+
if (!announce && names !== this.announcedModels && this.ollamaReachable) {
|
|
317268
|
+
this.options.logger.info(
|
|
317269
|
+
`Models: ${models.map((m2) => m2.name).join(", ") || "(none)"}`
|
|
317270
|
+
);
|
|
317271
|
+
}
|
|
317272
|
+
this.announcedModels = names;
|
|
317273
|
+
const data = await this.operation(HEARTBEAT_MUTATION, {
|
|
317274
|
+
models,
|
|
317275
|
+
runnerVersion: this.options.version
|
|
317276
|
+
});
|
|
317277
|
+
return data?.runnerHeartbeat;
|
|
317278
|
+
}
|
|
317279
|
+
async onRequest(request) {
|
|
317280
|
+
if (request.type === "cancel") {
|
|
317281
|
+
this.activeRequests.get(request.requestId)?.abort();
|
|
317282
|
+
return;
|
|
317283
|
+
}
|
|
317284
|
+
const sender = new FrameSender(
|
|
317285
|
+
request.requestId,
|
|
317286
|
+
(frames) => this.operation(RESPOND_MUTATION, { frames }),
|
|
317287
|
+
this.options.flushMs ?? 50
|
|
317288
|
+
);
|
|
317289
|
+
if (!isAllowedRequest(request.method, request.path)) {
|
|
317290
|
+
sender.push({
|
|
317291
|
+
type: "error",
|
|
317292
|
+
error: `${request.method} ${request.path} is not allowed by this runner`
|
|
317293
|
+
});
|
|
317294
|
+
await sender.flush();
|
|
317295
|
+
return;
|
|
317296
|
+
}
|
|
317297
|
+
const controller = new AbortController();
|
|
317298
|
+
this.activeRequests.set(request.requestId, controller);
|
|
317299
|
+
sender.push({ type: "ack" });
|
|
317300
|
+
void sender.flush();
|
|
317301
|
+
const pingMs = this.options.pingMs ?? 3e4;
|
|
317302
|
+
const ping = setInterval(() => {
|
|
317303
|
+
if (Date.now() - sender.lastPushAt >= pingMs) {
|
|
317304
|
+
sender.push({ type: "ping" });
|
|
317305
|
+
void sender.flush();
|
|
317306
|
+
}
|
|
317307
|
+
}, pingMs);
|
|
317308
|
+
const started = Date.now();
|
|
317309
|
+
const model = this.modelOf(request.body);
|
|
317310
|
+
this.options.logger.info(`-> chat request (${model})`);
|
|
317311
|
+
try {
|
|
317312
|
+
const response = await this.fetchFn(
|
|
317313
|
+
`${this.options.ollamaUrl}${request.path}`,
|
|
317314
|
+
{
|
|
317315
|
+
method: request.method,
|
|
317316
|
+
headers: { "Content-Type": "application/json" },
|
|
317317
|
+
body: request.body,
|
|
317318
|
+
signal: controller.signal
|
|
317319
|
+
}
|
|
317320
|
+
);
|
|
317321
|
+
sender.push({
|
|
317322
|
+
type: "head",
|
|
317323
|
+
status: response.status,
|
|
317324
|
+
data: response.headers.get("content-type") ?? void 0
|
|
317325
|
+
});
|
|
317326
|
+
const reader = response.body?.getReader();
|
|
317327
|
+
const decoder = new TextDecoder();
|
|
317328
|
+
while (reader) {
|
|
317329
|
+
const { done, value } = await reader.read();
|
|
317330
|
+
if (done) {
|
|
317331
|
+
break;
|
|
317332
|
+
}
|
|
317333
|
+
const text = decoder.decode(value, { stream: true });
|
|
317334
|
+
if (text) {
|
|
317335
|
+
sender.push({ type: "chunk", data: text });
|
|
317336
|
+
}
|
|
317337
|
+
}
|
|
317338
|
+
const tail = decoder.decode();
|
|
317339
|
+
if (tail) {
|
|
317340
|
+
sender.push({ type: "chunk", data: tail });
|
|
317341
|
+
}
|
|
317342
|
+
sender.push({ type: "end" });
|
|
317343
|
+
this.options.logger.info(
|
|
317344
|
+
`<- ${response.status} (${model}) in ${((Date.now() - started) / 1e3).toFixed(1)}s`
|
|
317345
|
+
);
|
|
317346
|
+
} catch (e2) {
|
|
317347
|
+
if (controller.signal.aborted) {
|
|
317348
|
+
this.options.logger.info(`x cancelled (${model})`);
|
|
317349
|
+
} else {
|
|
317350
|
+
const reason = describeError(e2);
|
|
317351
|
+
this.options.logger.error(`x ${reason}`);
|
|
317352
|
+
sender.push({
|
|
317353
|
+
type: "error",
|
|
317354
|
+
error: /fetch failed|ECONNREFUSED/.test(reason) ? `Could not reach Ollama at ${this.options.ollamaUrl} on the runner machine - is it running?` : reason
|
|
317355
|
+
});
|
|
317356
|
+
}
|
|
317357
|
+
} finally {
|
|
317358
|
+
clearInterval(ping);
|
|
317359
|
+
this.activeRequests.delete(request.requestId);
|
|
317360
|
+
await sender.flush();
|
|
317361
|
+
}
|
|
317362
|
+
}
|
|
317363
|
+
modelOf(body) {
|
|
317364
|
+
try {
|
|
317365
|
+
return JSON.parse(body ?? "{}").model ?? "unknown model";
|
|
317366
|
+
} catch {
|
|
317367
|
+
return "unknown model";
|
|
317368
|
+
}
|
|
317369
|
+
}
|
|
317370
|
+
operation(query, variables) {
|
|
317371
|
+
const id = String(this.nextOperationId++);
|
|
317372
|
+
return new Promise((resolve, reject) => {
|
|
317373
|
+
if (this.socket?.readyState !== OPEN) {
|
|
317374
|
+
reject(new Error("not connected"));
|
|
317375
|
+
return;
|
|
317376
|
+
}
|
|
317377
|
+
const timer2 = setTimeout(() => {
|
|
317378
|
+
this.operations.delete(id);
|
|
317379
|
+
reject(new Error("timed out waiting for Lambforge"));
|
|
317380
|
+
}, this.options.operationTimeoutMs ?? 2e4);
|
|
317381
|
+
this.operations.set(id, { resolve, reject, timer: timer2 });
|
|
317382
|
+
this.send({ id, type: "start", payload: { query, variables } });
|
|
317383
|
+
});
|
|
317384
|
+
}
|
|
317385
|
+
onOperationMessage(id, type, payload) {
|
|
317386
|
+
const op = this.operations.get(id);
|
|
317387
|
+
this.operations.delete(id);
|
|
317388
|
+
clearTimeout(op.timer);
|
|
317389
|
+
if (type === "data" && !payload?.errors?.length) {
|
|
317390
|
+
op.resolve(payload?.data);
|
|
317391
|
+
} else if (type === "complete") {
|
|
317392
|
+
op.resolve(void 0);
|
|
317393
|
+
} else {
|
|
317394
|
+
op.reject(
|
|
317395
|
+
new Error(
|
|
317396
|
+
payload?.errors?.map((e2) => e2.message).join("; ") || payload?.message || "operation failed"
|
|
317397
|
+
)
|
|
317398
|
+
);
|
|
317399
|
+
}
|
|
317400
|
+
}
|
|
317401
|
+
send(message) {
|
|
317402
|
+
if (this.socket?.readyState === OPEN) {
|
|
317403
|
+
this.socket.send(JSON.stringify(message));
|
|
317404
|
+
}
|
|
317405
|
+
}
|
|
317406
|
+
};
|
|
317407
|
+
}
|
|
317408
|
+
});
|
|
317409
|
+
|
|
317410
|
+
// src/commands/runner/start.ts
|
|
316867
317411
|
var start_exports2 = {};
|
|
316868
317412
|
__export(start_exports2, {
|
|
317413
|
+
RUNNER_VERSION: () => RUNNER_VERSION,
|
|
317414
|
+
default: () => start_default
|
|
317415
|
+
});
|
|
317416
|
+
var import_os2, import_rxjs35, RUNNER_VERSION, resolveRunner, start_default;
|
|
317417
|
+
var init_start2 = __esm({
|
|
317418
|
+
"src/commands/runner/start.ts"() {
|
|
317419
|
+
import_os2 = require("os");
|
|
317420
|
+
import_rxjs35 = __toESM(require_cjs());
|
|
317421
|
+
init_gql_client();
|
|
317422
|
+
init_log();
|
|
317423
|
+
init_config();
|
|
317424
|
+
init_connection();
|
|
317425
|
+
init_ollama();
|
|
317426
|
+
RUNNER_VERSION = "gcli-runner/1";
|
|
317427
|
+
resolveRunner = async (cmd) => {
|
|
317428
|
+
if (cmd.token) {
|
|
317429
|
+
return { id: "(from --token)", name: cmd.name ?? "", token: cmd.token };
|
|
317430
|
+
}
|
|
317431
|
+
if (cmd.reset) {
|
|
317432
|
+
await forgetRunner();
|
|
317433
|
+
}
|
|
317434
|
+
const saved = await readSavedRunner();
|
|
317435
|
+
if (saved) {
|
|
317436
|
+
return saved;
|
|
317437
|
+
}
|
|
317438
|
+
const name2 = cmd.name || (0, import_os2.hostname)();
|
|
317439
|
+
Logger.info(`Registering this machine as local runner "${name2}"...`);
|
|
317440
|
+
const { runner, token } = await (0, import_rxjs35.lastValueFrom)(
|
|
317441
|
+
GraphqlClienAPI.createLocalRunner(name2)
|
|
317442
|
+
).catch((e2) => {
|
|
317443
|
+
throw new Error(
|
|
317444
|
+
`Could not register the runner (${e2?.message ?? e2}). Run \`gcli login\` first, or pass --token from Profile -> Local AI runners.`
|
|
317445
|
+
);
|
|
317446
|
+
});
|
|
317447
|
+
const created = { id: runner.id, name: runner.name, token };
|
|
317448
|
+
await saveRunner(created);
|
|
317449
|
+
return created;
|
|
317450
|
+
};
|
|
317451
|
+
start_default = async (cmd) => {
|
|
317452
|
+
const runner = await resolveRunner(cmd);
|
|
317453
|
+
const ollamaUrl = resolveOllamaUrl(cmd.ollama);
|
|
317454
|
+
const wsUrl = cmd.wsUrl || runner.wsUrl || deriveSubscriptionsUrl(await readLoginApiUrl());
|
|
317455
|
+
Logger.log("-------------------");
|
|
317456
|
+
Logger.log("[Lambforge local AI runner]");
|
|
317457
|
+
Logger.info(`Lambforge: ${wsUrl}`);
|
|
317458
|
+
Logger.info(`Ollama: ${ollamaUrl}`);
|
|
317459
|
+
Logger.info(
|
|
317460
|
+
"Tip: agent mode sends large prompts (instructions + tool list). Give Ollama a big context window, e.g. start it with OLLAMA_CONTEXT_LENGTH=32768."
|
|
317461
|
+
);
|
|
317462
|
+
Logger.log("-------------------");
|
|
317463
|
+
const connection = new RunnerConnection({
|
|
317464
|
+
wsUrl,
|
|
317465
|
+
token: runner.token,
|
|
317466
|
+
ollamaUrl,
|
|
317467
|
+
version: RUNNER_VERSION,
|
|
317468
|
+
logger: Logger
|
|
317469
|
+
});
|
|
317470
|
+
const shutdown = () => {
|
|
317471
|
+
Logger.info("Stopping runner...");
|
|
317472
|
+
connection.stop();
|
|
317473
|
+
};
|
|
317474
|
+
process.once("SIGINT", shutdown);
|
|
317475
|
+
process.once("SIGTERM", shutdown);
|
|
317476
|
+
try {
|
|
317477
|
+
await connection.run();
|
|
317478
|
+
} catch (e2) {
|
|
317479
|
+
if (e2 instanceof RunnerAuthError) {
|
|
317480
|
+
Logger.error(e2.message);
|
|
317481
|
+
process.exit(1);
|
|
317482
|
+
}
|
|
317483
|
+
throw e2;
|
|
317484
|
+
}
|
|
317485
|
+
};
|
|
317486
|
+
}
|
|
317487
|
+
});
|
|
317488
|
+
|
|
317489
|
+
// src/commands/runner/list.ts
|
|
317490
|
+
var list_exports6 = {};
|
|
317491
|
+
__export(list_exports6, {
|
|
317492
|
+
default: () => list_default6
|
|
317493
|
+
});
|
|
317494
|
+
var import_rxjs36, import_operators34, list_default6;
|
|
317495
|
+
var init_list6 = __esm({
|
|
317496
|
+
"src/commands/runner/list.ts"() {
|
|
317497
|
+
import_rxjs36 = __toESM(require_cjs());
|
|
317498
|
+
import_operators34 = __toESM(require_operators());
|
|
317499
|
+
init_gql_client();
|
|
317500
|
+
init_log();
|
|
317501
|
+
list_default6 = () => (0, import_rxjs36.lastValueFrom)(
|
|
317502
|
+
GraphqlClienAPI.listLocalRunners().pipe(
|
|
317503
|
+
(0, import_operators34.tap)((runners) => {
|
|
317504
|
+
Logger.log("-------------------");
|
|
317505
|
+
Logger.log("[Action][listLocalRunners]");
|
|
317506
|
+
if (!runners?.length) {
|
|
317507
|
+
Logger.info(
|
|
317508
|
+
"No local runners yet. Run `gcli runner:start` on the machine that runs Ollama."
|
|
317509
|
+
);
|
|
317510
|
+
} else {
|
|
317511
|
+
Logger.table(
|
|
317512
|
+
runners.map((r2) => ({
|
|
317513
|
+
id: r2.id,
|
|
317514
|
+
name: r2.name,
|
|
317515
|
+
online: r2.online,
|
|
317516
|
+
lastSeenAt: r2.lastSeenAt,
|
|
317517
|
+
models: (r2.models ?? []).map((m2) => m2.name).join(", ")
|
|
317518
|
+
}))
|
|
317519
|
+
);
|
|
317520
|
+
}
|
|
317521
|
+
Logger.log("-------------------");
|
|
317522
|
+
})
|
|
317523
|
+
)
|
|
317524
|
+
);
|
|
317525
|
+
}
|
|
317526
|
+
});
|
|
317527
|
+
|
|
317528
|
+
// src/commands/runner/models.ts
|
|
317529
|
+
var models_exports = {};
|
|
317530
|
+
__export(models_exports, {
|
|
317531
|
+
default: () => models_default,
|
|
317532
|
+
parseSelection: () => parseSelection
|
|
317533
|
+
});
|
|
317534
|
+
var import_rxjs37, isShown, parseSelection, models_default;
|
|
317535
|
+
var init_models = __esm({
|
|
317536
|
+
"src/commands/runner/models.ts"() {
|
|
317537
|
+
import_rxjs37 = __toESM(require_cjs());
|
|
317538
|
+
init_gql_client();
|
|
317539
|
+
init_log();
|
|
317540
|
+
init_config();
|
|
317541
|
+
isShown = (runner, name2) => !Array.isArray(runner.enabledModels) || runner.enabledModels.includes(name2);
|
|
317542
|
+
parseSelection = (cmd) => {
|
|
317543
|
+
if ([cmd.show !== void 0, !!cmd.all, !!cmd.none].filter(Boolean).length > 1) {
|
|
317544
|
+
throw new Error("Use only one of --show, --all, --none.");
|
|
317545
|
+
}
|
|
317546
|
+
if (cmd.all) {
|
|
317547
|
+
return { models: null };
|
|
317548
|
+
}
|
|
317549
|
+
if (cmd.none) {
|
|
317550
|
+
return { models: [] };
|
|
317551
|
+
}
|
|
317552
|
+
if (cmd.show !== void 0) {
|
|
317553
|
+
return {
|
|
317554
|
+
models: cmd.show.split(",").map((m2) => m2.trim()).filter(Boolean)
|
|
317555
|
+
};
|
|
317556
|
+
}
|
|
317557
|
+
return null;
|
|
317558
|
+
};
|
|
317559
|
+
models_default = async (cmd) => {
|
|
317560
|
+
const selection = parseSelection(cmd);
|
|
317561
|
+
const runnerId = cmd.id || (await readSavedRunner())?.id;
|
|
317562
|
+
if (!runnerId) {
|
|
317563
|
+
throw new Error("Specify the runner with --id (see `gcli runner:list`).");
|
|
317564
|
+
}
|
|
317565
|
+
let runner;
|
|
317566
|
+
if (selection) {
|
|
317567
|
+
runner = await (0, import_rxjs37.lastValueFrom)(
|
|
317568
|
+
GraphqlClienAPI.setLocalRunnerModels(runnerId, selection.models)
|
|
317569
|
+
);
|
|
317570
|
+
} else {
|
|
317571
|
+
const runners = await (0, import_rxjs37.lastValueFrom)(GraphqlClienAPI.listLocalRunners());
|
|
317572
|
+
runner = runners.find((r2) => r2.id === runnerId);
|
|
317573
|
+
}
|
|
317574
|
+
if (!runner) {
|
|
317575
|
+
throw new Error(`Runner ${runnerId} not found.`);
|
|
317576
|
+
}
|
|
317577
|
+
const models = runner.models ?? [];
|
|
317578
|
+
const unknown2 = (selection?.models ?? []).filter(
|
|
317579
|
+
(m2) => !models.some((x2) => x2.name === m2)
|
|
317580
|
+
);
|
|
317581
|
+
if (unknown2.length) {
|
|
317582
|
+
Logger.warn(
|
|
317583
|
+
`Not reported by this runner (kept anyway, shown once Ollama has them): ${unknown2.join(", ")}`
|
|
317584
|
+
);
|
|
317585
|
+
}
|
|
317586
|
+
Logger.log(
|
|
317587
|
+
`[${runner.name}] shown in chat: ${models.filter((m2) => isShown(runner, m2.name)).length} of ${models.length}`
|
|
317588
|
+
);
|
|
317589
|
+
Logger.table(
|
|
317590
|
+
models.map((m2) => ({
|
|
317591
|
+
model: m2.name,
|
|
317592
|
+
shown: isShown(runner, m2.name),
|
|
317593
|
+
size: m2.parameterSize,
|
|
317594
|
+
tools: m2.capabilities?.includes("tools")
|
|
317595
|
+
}))
|
|
317596
|
+
);
|
|
317597
|
+
};
|
|
317598
|
+
}
|
|
317599
|
+
});
|
|
317600
|
+
|
|
317601
|
+
// src/commands/runner/delete.ts
|
|
317602
|
+
var delete_exports3 = {};
|
|
317603
|
+
__export(delete_exports3, {
|
|
317604
|
+
default: () => delete_default3
|
|
317605
|
+
});
|
|
317606
|
+
var import_rxjs38, delete_default3;
|
|
317607
|
+
var init_delete3 = __esm({
|
|
317608
|
+
"src/commands/runner/delete.ts"() {
|
|
317609
|
+
import_rxjs38 = __toESM(require_cjs());
|
|
317610
|
+
init_gql_client();
|
|
317611
|
+
init_log();
|
|
317612
|
+
init_config();
|
|
317613
|
+
delete_default3 = async (cmd) => {
|
|
317614
|
+
const saved = await readSavedRunner();
|
|
317615
|
+
const runnerId = cmd.id || saved?.id;
|
|
317616
|
+
if (!runnerId) {
|
|
317617
|
+
throw new Error("Specify the runner with --id (see `gcli runner:list`).");
|
|
317618
|
+
}
|
|
317619
|
+
await (0, import_rxjs38.lastValueFrom)(GraphqlClienAPI.deleteLocalRunner(runnerId));
|
|
317620
|
+
if (saved?.id === runnerId) {
|
|
317621
|
+
await forgetRunner();
|
|
317622
|
+
}
|
|
317623
|
+
Logger.log(`Local runner ${runnerId} deleted; its token no longer works.`);
|
|
317624
|
+
};
|
|
317625
|
+
}
|
|
317626
|
+
});
|
|
317627
|
+
|
|
317628
|
+
// src/commands/start/start.ts
|
|
317629
|
+
var start_exports3 = {};
|
|
317630
|
+
__export(start_exports3, {
|
|
316869
317631
|
default: () => start
|
|
316870
317632
|
});
|
|
316871
317633
|
async function start(args) {
|
|
316872
317634
|
Logger.log("---------------------------------");
|
|
316873
|
-
return (0,
|
|
317635
|
+
return (0, import_rxjs39.lastValueFrom)(
|
|
316874
317636
|
loadSpec().pipe(
|
|
316875
|
-
(0,
|
|
316876
|
-
(config2) => (0,
|
|
317637
|
+
(0, import_operators35.switchMap)(
|
|
317638
|
+
(config2) => (0, import_rxjs39.of)({
|
|
316877
317639
|
watcher: (0, import_node_fs2.watch)(process.cwd(), {
|
|
316878
317640
|
recursive: true
|
|
316879
317641
|
}),
|
|
@@ -316894,7 +317656,7 @@ async function start(args) {
|
|
|
316894
317656
|
outfile: args.outfile ?? config2?.options?.bundler?.outfile ?? "index.js",
|
|
316895
317657
|
startCommand: "node"
|
|
316896
317658
|
}).pipe(
|
|
316897
|
-
(0,
|
|
317659
|
+
(0, import_operators35.switchMap)(
|
|
316898
317660
|
({
|
|
316899
317661
|
child,
|
|
316900
317662
|
watcher,
|
|
@@ -316902,14 +317664,14 @@ async function start(args) {
|
|
|
316902
317664
|
outfile,
|
|
316903
317665
|
startCommand,
|
|
316904
317666
|
ignorelist
|
|
316905
|
-
}) => (0,
|
|
316906
|
-
(0,
|
|
317667
|
+
}) => (0, import_rxjs39.from)(build_default(args)).pipe(
|
|
317668
|
+
(0, import_operators35.tap)(() => {
|
|
316907
317669
|
Logger.warn(
|
|
316908
317670
|
`\u{1F4E2} Starting script "${startCommand} ${outfile}"`
|
|
316909
317671
|
);
|
|
316910
317672
|
Logger.log("---------------------------------\n");
|
|
316911
317673
|
}),
|
|
316912
|
-
(0,
|
|
317674
|
+
(0, import_operators35.tap)(() => {
|
|
316913
317675
|
child = (0, import_node_child_process.spawn)(
|
|
316914
317676
|
startCommand,
|
|
316915
317677
|
["--disable-warning=DEP0040", outfile],
|
|
@@ -316919,14 +317681,14 @@ async function start(args) {
|
|
|
316919
317681
|
}
|
|
316920
317682
|
);
|
|
316921
317683
|
}),
|
|
316922
|
-
(0,
|
|
316923
|
-
() => (0,
|
|
316924
|
-
(0,
|
|
316925
|
-
(0,
|
|
316926
|
-
(0,
|
|
317684
|
+
(0, import_operators35.tap)(
|
|
317685
|
+
() => (0, import_rxjs39.merge)(
|
|
317686
|
+
(0, import_rxjs39.fromEvent)(process, "SIGINT"),
|
|
317687
|
+
(0, import_rxjs39.fromEvent)(process, "SIGTERM"),
|
|
317688
|
+
(0, import_rxjs39.fromEvent)(process, "exit")
|
|
316927
317689
|
).pipe(
|
|
316928
|
-
(0,
|
|
316929
|
-
(0,
|
|
317690
|
+
(0, import_operators35.debounceTime)(100),
|
|
317691
|
+
(0, import_operators35.tap)(() => {
|
|
316930
317692
|
Logger.warn("\u26A0\uFE0F Main process shutting down");
|
|
316931
317693
|
watcher.close();
|
|
316932
317694
|
child.kill("SIGTERM");
|
|
@@ -316934,13 +317696,13 @@ async function start(args) {
|
|
|
316934
317696
|
})
|
|
316935
317697
|
).subscribe()
|
|
316936
317698
|
),
|
|
316937
|
-
(0,
|
|
316938
|
-
() => (0,
|
|
316939
|
-
(0,
|
|
317699
|
+
(0, import_operators35.switchMap)(
|
|
317700
|
+
() => (0, import_rxjs39.fromEvent)(watcher, "change").pipe(
|
|
317701
|
+
(0, import_operators35.map)(([event, filename]) => ({
|
|
316940
317702
|
event,
|
|
316941
317703
|
filename
|
|
316942
317704
|
})),
|
|
316943
|
-
(0,
|
|
317705
|
+
(0, import_operators35.filter)(({ filename }) => {
|
|
316944
317706
|
if (!filename) {
|
|
316945
317707
|
return false;
|
|
316946
317708
|
}
|
|
@@ -316952,18 +317714,18 @@ async function start(args) {
|
|
|
316952
317714
|
const rootDir = filename.split(/[/\\]/)[0];
|
|
316953
317715
|
return whitelist.has(rootDir);
|
|
316954
317716
|
}),
|
|
316955
|
-
(0,
|
|
317717
|
+
(0, import_operators35.debounceTime)(100)
|
|
316956
317718
|
)
|
|
316957
317719
|
),
|
|
316958
|
-
(0,
|
|
317720
|
+
(0, import_operators35.tap)((data) => {
|
|
316959
317721
|
Logger.log("\n---------------------------------");
|
|
316960
317722
|
Logger.log(
|
|
316961
317723
|
`\u27F3 Restarting due to change in: ${data.filename}`
|
|
316962
317724
|
);
|
|
316963
317725
|
child?.kill("SIGTERM");
|
|
316964
317726
|
}),
|
|
316965
|
-
(0,
|
|
316966
|
-
(0,
|
|
317727
|
+
(0, import_operators35.switchMap)(() => build_default(args)),
|
|
317728
|
+
(0, import_operators35.tap)(() => {
|
|
316967
317729
|
Logger.warn(
|
|
316968
317730
|
`\u{1F4E2} Starting script "${startCommand} ${outfile}"`
|
|
316969
317731
|
);
|
|
@@ -316984,13 +317746,13 @@ async function start(args) {
|
|
|
316984
317746
|
)
|
|
316985
317747
|
);
|
|
316986
317748
|
}
|
|
316987
|
-
var import_node_child_process, import_node_fs2,
|
|
316988
|
-
var
|
|
317749
|
+
var import_node_child_process, import_node_fs2, import_rxjs39, import_operators35;
|
|
317750
|
+
var init_start3 = __esm({
|
|
316989
317751
|
"src/commands/start/start.ts"() {
|
|
316990
317752
|
import_node_child_process = require("node:child_process");
|
|
316991
317753
|
import_node_fs2 = require("node:fs");
|
|
316992
|
-
|
|
316993
|
-
|
|
317754
|
+
import_rxjs39 = __toESM(require_cjs());
|
|
317755
|
+
import_operators35 = __toESM(require_operators());
|
|
316994
317756
|
init_log();
|
|
316995
317757
|
init_build();
|
|
316996
317758
|
init_load_spec();
|
|
@@ -317002,25 +317764,25 @@ var create_cron_exports = {};
|
|
|
317002
317764
|
__export(create_cron_exports, {
|
|
317003
317765
|
default: () => create_cron_default
|
|
317004
317766
|
});
|
|
317005
|
-
var
|
|
317767
|
+
var import_rxjs40, import_operators36, create_cron_default;
|
|
317006
317768
|
var init_create_cron = __esm({
|
|
317007
317769
|
"src/commands/triggers/cron/create-cron.ts"() {
|
|
317008
|
-
|
|
317009
|
-
|
|
317770
|
+
import_rxjs40 = __toESM(require_cjs());
|
|
317771
|
+
import_operators36 = __toESM(require_operators());
|
|
317010
317772
|
init_helpers();
|
|
317011
317773
|
init_gql_client();
|
|
317012
317774
|
init_log();
|
|
317013
317775
|
init_load_spec();
|
|
317014
|
-
create_cron_default = (cmd) => (0,
|
|
317776
|
+
create_cron_default = (cmd) => (0, import_rxjs40.lastValueFrom)(
|
|
317015
317777
|
parseProjectId(cmd.project).pipe(
|
|
317016
|
-
(0,
|
|
317778
|
+
(0, import_operators36.switchMap)(
|
|
317017
317779
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
317018
|
-
(0,
|
|
317780
|
+
(0, import_operators36.switchMap)(
|
|
317019
317781
|
(data) => GraphqlClienAPI.getLambdaByName(
|
|
317020
317782
|
cmd?.lambdaName ?? data?.function?.name ?? data?.name,
|
|
317021
317783
|
projectId
|
|
317022
317784
|
).pipe(
|
|
317023
|
-
(0,
|
|
317785
|
+
(0, import_operators36.map)((lambda) => ({
|
|
317024
317786
|
lambdaName: lambda.name,
|
|
317025
317787
|
lambdaId: lambda.id,
|
|
317026
317788
|
...data?.triggers?.time ?? data
|
|
@@ -317029,12 +317791,12 @@ var init_create_cron = __esm({
|
|
|
317029
317791
|
)
|
|
317030
317792
|
)
|
|
317031
317793
|
),
|
|
317032
|
-
(0,
|
|
317794
|
+
(0, import_operators36.switchMap)(
|
|
317033
317795
|
({ lambdaId, cron, triggerName, lambdaName }) => GraphqlClienAPI.createTimeTrigger({ lambdaId, cron, triggerName }).pipe(
|
|
317034
|
-
(0,
|
|
317796
|
+
(0, import_operators36.map)((data) => ({ ...data, lambdaName }))
|
|
317035
317797
|
)
|
|
317036
317798
|
),
|
|
317037
|
-
(0,
|
|
317799
|
+
(0, import_operators36.tap)((data) => {
|
|
317038
317800
|
const columns = [
|
|
317039
317801
|
"id",
|
|
317040
317802
|
"lambdaName",
|
|
@@ -317057,25 +317819,25 @@ var delete_cron_exports = {};
|
|
|
317057
317819
|
__export(delete_cron_exports, {
|
|
317058
317820
|
default: () => delete_cron_default
|
|
317059
317821
|
});
|
|
317060
|
-
var
|
|
317822
|
+
var import_rxjs41, import_operators37, delete_cron_default;
|
|
317061
317823
|
var init_delete_cron = __esm({
|
|
317062
317824
|
"src/commands/triggers/cron/delete-cron.ts"() {
|
|
317063
|
-
|
|
317064
|
-
|
|
317825
|
+
import_rxjs41 = __toESM(require_cjs());
|
|
317826
|
+
import_operators37 = __toESM(require_operators());
|
|
317065
317827
|
init_helpers();
|
|
317066
317828
|
init_gql_client();
|
|
317067
317829
|
init_log();
|
|
317068
317830
|
init_load_spec();
|
|
317069
|
-
delete_cron_default = (cmd) => (0,
|
|
317831
|
+
delete_cron_default = (cmd) => (0, import_rxjs41.lastValueFrom)(
|
|
317070
317832
|
parseProjectId(cmd.project).pipe(
|
|
317071
|
-
(0,
|
|
317833
|
+
(0, import_operators37.switchMap)(
|
|
317072
317834
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
317073
|
-
(0,
|
|
317835
|
+
(0, import_operators37.switchMap)(
|
|
317074
317836
|
(data) => GraphqlClienAPI.getLambdaByName(
|
|
317075
317837
|
cmd?.lambdaName ?? data?.function?.name ?? data?.name,
|
|
317076
317838
|
projectId
|
|
317077
317839
|
).pipe(
|
|
317078
|
-
(0,
|
|
317840
|
+
(0, import_operators37.map)((lambda) => ({
|
|
317079
317841
|
lambdaName: lambda.name,
|
|
317080
317842
|
lambdaId: lambda.id
|
|
317081
317843
|
}))
|
|
@@ -317083,12 +317845,12 @@ var init_delete_cron = __esm({
|
|
|
317083
317845
|
)
|
|
317084
317846
|
)
|
|
317085
317847
|
),
|
|
317086
|
-
(0,
|
|
317848
|
+
(0, import_operators37.switchMap)(
|
|
317087
317849
|
({ lambdaId, lambdaName }) => GraphqlClienAPI.deleteLambdaTimeTrigger(lambdaId).pipe(
|
|
317088
|
-
(0,
|
|
317850
|
+
(0, import_operators37.map)((data) => ({ ...data, lambdaName }))
|
|
317089
317851
|
)
|
|
317090
317852
|
),
|
|
317091
|
-
(0,
|
|
317853
|
+
(0, import_operators37.tap)((data) => {
|
|
317092
317854
|
const columns = [
|
|
317093
317855
|
"id",
|
|
317094
317856
|
"lambdaName",
|
|
@@ -317110,29 +317872,29 @@ var list_crons_exports = {};
|
|
|
317110
317872
|
__export(list_crons_exports, {
|
|
317111
317873
|
default: () => list_crons_default
|
|
317112
317874
|
});
|
|
317113
|
-
var
|
|
317875
|
+
var import_rxjs42, import_operators38, list_crons_default;
|
|
317114
317876
|
var init_list_crons = __esm({
|
|
317115
317877
|
"src/commands/triggers/cron/list-crons.ts"() {
|
|
317116
|
-
|
|
317117
|
-
|
|
317878
|
+
import_rxjs42 = __toESM(require_cjs());
|
|
317879
|
+
import_operators38 = __toESM(require_operators());
|
|
317118
317880
|
init_helpers();
|
|
317119
317881
|
init_gql_client();
|
|
317120
317882
|
init_log();
|
|
317121
|
-
list_crons_default = (cmd) => (0,
|
|
317883
|
+
list_crons_default = (cmd) => (0, import_rxjs42.lastValueFrom)(
|
|
317122
317884
|
parseProjectId(cmd.project).pipe(
|
|
317123
|
-
(0,
|
|
317124
|
-
(projectId) => (0,
|
|
317885
|
+
(0, import_operators38.switchMap)(
|
|
317886
|
+
(projectId) => (0, import_rxjs42.combineLatest)([
|
|
317125
317887
|
GraphqlClienAPI.listProjectTimeTriggers(projectId),
|
|
317126
317888
|
GraphqlClienAPI.listLambdas(projectId)
|
|
317127
317889
|
])
|
|
317128
317890
|
),
|
|
317129
|
-
(0,
|
|
317891
|
+
(0, import_operators38.map)(
|
|
317130
317892
|
([triggers, lambdas]) => triggers.map((v) => ({
|
|
317131
317893
|
lambdaName: lambdas.find((l) => l.id === v.lambdaId)?.name,
|
|
317132
317894
|
...v
|
|
317133
317895
|
}))
|
|
317134
317896
|
),
|
|
317135
|
-
(0,
|
|
317897
|
+
(0, import_operators38.tap)((data) => {
|
|
317136
317898
|
const columns = [
|
|
317137
317899
|
"id",
|
|
317138
317900
|
"triggerName",
|
|
@@ -317447,6 +318209,37 @@ function registerRabbitMqCommands(program2) {
|
|
|
317447
318209
|
program2.command("rabbitmq:delete").description("Delete a RabbitMQ broker").option("-p, --project <project>").option("--id <id>", "Broker id (see rabbitmq:list)").action(lazy(() => Promise.resolve().then(() => (init_delete2(), delete_exports2)).then((m2) => m2.default)));
|
|
317448
318210
|
}
|
|
317449
318211
|
|
|
318212
|
+
// src/commands/runner/index.ts
|
|
318213
|
+
init_helpers();
|
|
318214
|
+
function registerRunnerCommands(program2) {
|
|
318215
|
+
program2.command("runner:start").description(
|
|
318216
|
+
"Connect this machine's Ollama to the Lambforge chat as a local AI runner (outbound connection only - works behind NAT, Ollama is never exposed)"
|
|
318217
|
+
).option(
|
|
318218
|
+
"-n, --name <name>",
|
|
318219
|
+
"Runner name shown in the chat model picker (default: hostname)"
|
|
318220
|
+
).option(
|
|
318221
|
+
"-t, --token <token>",
|
|
318222
|
+
"Runner token from Profile -> Local AI runners (instead of `gcli login`)"
|
|
318223
|
+
).option(
|
|
318224
|
+
"--ollama <url>",
|
|
318225
|
+
"Ollama URL (default: $OLLAMA_HOST or http://127.0.0.1:11434)"
|
|
318226
|
+
).option("--wsUrl <url>", "Lambforge subscriptions endpoint override").option("--reset", "Forget the saved runner and register a new one").action(lazy(() => Promise.resolve().then(() => (init_start2(), start_exports2)).then((m2) => m2.default)));
|
|
318227
|
+
program2.command("runner:list").description("List your local AI runners and the models they serve").action(lazy(() => Promise.resolve().then(() => (init_list6(), list_exports6)).then((m2) => m2.default)));
|
|
318228
|
+
program2.command("runner:models").description(
|
|
318229
|
+
"Choose which of a runner's models appear in the chat model picker (no flags: list them)"
|
|
318230
|
+
).option(
|
|
318231
|
+
"--id <id>",
|
|
318232
|
+
"Runner id (default: the runner saved on this machine)"
|
|
318233
|
+
).option(
|
|
318234
|
+
"--show <models>",
|
|
318235
|
+
"Comma-separated models to show (hides the rest)"
|
|
318236
|
+
).option("--all", "Show every model again").option("--none", "Hide all models of this runner from the chat").action(lazy(() => Promise.resolve().then(() => (init_models(), models_exports)).then((m2) => m2.default)));
|
|
318237
|
+
program2.command("runner:delete").description("Delete a local AI runner and revoke its token").option(
|
|
318238
|
+
"--id <id>",
|
|
318239
|
+
"Runner id (default: the runner saved on this machine)"
|
|
318240
|
+
).action(lazy(() => Promise.resolve().then(() => (init_delete3(), delete_exports3)).then((m2) => m2.default)));
|
|
318241
|
+
}
|
|
318242
|
+
|
|
317450
318243
|
// src/commands/start/index.ts
|
|
317451
318244
|
init_helpers();
|
|
317452
318245
|
function startCommands(program2) {
|
|
@@ -317456,7 +318249,7 @@ function startCommands(program2) {
|
|
|
317456
318249
|
).option("-b, --bundle", "Bundle code", true).option("-m, --minify", "Minify code", false).option("-p, --platform <char>", "Platform ", "node").option("-t, --target <char>", "Target ", "node14.4").option("-o, --outfile <char>", "Outfile name").option(
|
|
317457
318250
|
"-i, --ignore <ignore...>",
|
|
317458
318251
|
"Ignore folders from triggering restarts"
|
|
317459
|
-
).option("-e, --external <external...>", "External libraries").action(lazy(() => Promise.resolve().then(() => (
|
|
318252
|
+
).option("-e, --external <external...>", "External libraries").action(lazy(() => Promise.resolve().then(() => (init_start3(), start_exports3)).then((m2) => m2.default)));
|
|
317460
318253
|
}
|
|
317461
318254
|
|
|
317462
318255
|
// src/commands/triggers/cron/index.ts
|
|
@@ -317479,7 +318272,8 @@ var commands = [
|
|
|
317479
318272
|
registerCronTriggerCommands,
|
|
317480
318273
|
registerClusterCommands,
|
|
317481
318274
|
registerRabbitMqCommands,
|
|
317482
|
-
registerPluginCommands
|
|
318275
|
+
registerPluginCommands,
|
|
318276
|
+
registerRunnerCommands
|
|
317483
318277
|
];
|
|
317484
318278
|
|
|
317485
318279
|
// src/main.ts
|