@gapi/gcli 1.8.236 → 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 +1401 -395
- package/scripts/changelog.mjs +348 -0
package/release/index.js
CHANGED
|
@@ -9498,19 +9498,19 @@ var require_Observable = __commonJS({
|
|
|
9498
9498
|
var config_1 = require_config();
|
|
9499
9499
|
var isFunction_1 = require_isFunction();
|
|
9500
9500
|
var errorContext_1 = require_errorContext();
|
|
9501
|
-
var
|
|
9502
|
-
function
|
|
9501
|
+
var Observable4 = (function() {
|
|
9502
|
+
function Observable5(subscribe) {
|
|
9503
9503
|
if (subscribe) {
|
|
9504
9504
|
this._subscribe = subscribe;
|
|
9505
9505
|
}
|
|
9506
9506
|
}
|
|
9507
|
-
|
|
9508
|
-
var observable = new
|
|
9507
|
+
Observable5.prototype.lift = function(operator) {
|
|
9508
|
+
var observable = new Observable5();
|
|
9509
9509
|
observable.source = this;
|
|
9510
9510
|
observable.operator = operator;
|
|
9511
9511
|
return observable;
|
|
9512
9512
|
};
|
|
9513
|
-
|
|
9513
|
+
Observable5.prototype.subscribe = function(observerOrNext, error48, complete) {
|
|
9514
9514
|
var _this = this;
|
|
9515
9515
|
var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new Subscriber_1.SafeSubscriber(observerOrNext, error48, complete);
|
|
9516
9516
|
errorContext_1.errorContext(function() {
|
|
@@ -9519,14 +9519,14 @@ var require_Observable = __commonJS({
|
|
|
9519
9519
|
});
|
|
9520
9520
|
return subscriber;
|
|
9521
9521
|
};
|
|
9522
|
-
|
|
9522
|
+
Observable5.prototype._trySubscribe = function(sink) {
|
|
9523
9523
|
try {
|
|
9524
9524
|
return this._subscribe(sink);
|
|
9525
9525
|
} catch (err) {
|
|
9526
9526
|
sink.error(err);
|
|
9527
9527
|
}
|
|
9528
9528
|
};
|
|
9529
|
-
|
|
9529
|
+
Observable5.prototype.forEach = function(next, promiseCtor) {
|
|
9530
9530
|
var _this = this;
|
|
9531
9531
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
9532
9532
|
return new promiseCtor(function(resolve, reject) {
|
|
@@ -9545,21 +9545,21 @@ var require_Observable = __commonJS({
|
|
|
9545
9545
|
_this.subscribe(subscriber);
|
|
9546
9546
|
});
|
|
9547
9547
|
};
|
|
9548
|
-
|
|
9548
|
+
Observable5.prototype._subscribe = function(subscriber) {
|
|
9549
9549
|
var _a2;
|
|
9550
9550
|
return (_a2 = this.source) === null || _a2 === void 0 ? void 0 : _a2.subscribe(subscriber);
|
|
9551
9551
|
};
|
|
9552
|
-
|
|
9552
|
+
Observable5.prototype[observable_1.observable] = function() {
|
|
9553
9553
|
return this;
|
|
9554
9554
|
};
|
|
9555
|
-
|
|
9555
|
+
Observable5.prototype.pipe = function() {
|
|
9556
9556
|
var operations = [];
|
|
9557
9557
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9558
9558
|
operations[_i] = arguments[_i];
|
|
9559
9559
|
}
|
|
9560
9560
|
return pipe_1.pipeFromArray(operations)(this);
|
|
9561
9561
|
};
|
|
9562
|
-
|
|
9562
|
+
Observable5.prototype.toPromise = function(promiseCtor) {
|
|
9563
9563
|
var _this = this;
|
|
9564
9564
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
9565
9565
|
return new promiseCtor(function(resolve, reject) {
|
|
@@ -9573,12 +9573,12 @@ var require_Observable = __commonJS({
|
|
|
9573
9573
|
});
|
|
9574
9574
|
});
|
|
9575
9575
|
};
|
|
9576
|
-
|
|
9577
|
-
return new
|
|
9576
|
+
Observable5.create = function(subscribe) {
|
|
9577
|
+
return new Observable5(subscribe);
|
|
9578
9578
|
};
|
|
9579
|
-
return
|
|
9579
|
+
return Observable5;
|
|
9580
9580
|
})();
|
|
9581
|
-
exports2.Observable =
|
|
9581
|
+
exports2.Observable = Observable4;
|
|
9582
9582
|
function getPromiseCtor(promiseCtor) {
|
|
9583
9583
|
var _a2;
|
|
9584
9584
|
return (_a2 = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config_1.config.Promise) !== null && _a2 !== void 0 ? _a2 : Promise;
|
|
@@ -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
|
|
|
@@ -18746,121 +18746,6 @@ var init_read_file = __esm({
|
|
|
18746
18746
|
}
|
|
18747
18747
|
});
|
|
18748
18748
|
|
|
18749
|
-
// src/services/log.ts
|
|
18750
|
-
var Logger;
|
|
18751
|
-
var init_log = __esm({
|
|
18752
|
-
"src/services/log.ts"() {
|
|
18753
|
-
Logger = class {
|
|
18754
|
-
static log(...data) {
|
|
18755
|
-
console.log("\x1B[32m%s\x1B[0m", ...data);
|
|
18756
|
-
}
|
|
18757
|
-
static error(...data) {
|
|
18758
|
-
console.error("\x1B[31m%s\x1B[0m", ...data);
|
|
18759
|
-
}
|
|
18760
|
-
static info(...data) {
|
|
18761
|
-
console.info("\x1B[36m%s\x1B[0m", ...data);
|
|
18762
|
-
}
|
|
18763
|
-
static warn(...data) {
|
|
18764
|
-
console.warn("\x1B[33m%s\x1B[0m", ...data);
|
|
18765
|
-
}
|
|
18766
|
-
static table(...data) {
|
|
18767
|
-
console.table(...data);
|
|
18768
|
-
}
|
|
18769
|
-
};
|
|
18770
|
-
}
|
|
18771
|
-
});
|
|
18772
|
-
|
|
18773
|
-
// src/types.ts
|
|
18774
|
-
var import_os, mainDirectory, tokenDirectory, refreshTokenDirectory, urlDirectory, keyDirectory, projectDirectory, generationTimeDirectory, uploadUrlDirectory;
|
|
18775
|
-
var init_types = __esm({
|
|
18776
|
-
"src/types.ts"() {
|
|
18777
|
-
import_os = require("os");
|
|
18778
|
-
mainDirectory = [(0, import_os.homedir)(), ".graphql-server"].join("/");
|
|
18779
|
-
tokenDirectory = [mainDirectory, "token"].join("/");
|
|
18780
|
-
refreshTokenDirectory = [mainDirectory, "refresh"].join("/");
|
|
18781
|
-
urlDirectory = [mainDirectory, "url"].join("/");
|
|
18782
|
-
keyDirectory = [mainDirectory, "key"].join("/");
|
|
18783
|
-
projectDirectory = [mainDirectory, "project"].join("/");
|
|
18784
|
-
generationTimeDirectory = [mainDirectory, "generation-time"].join(
|
|
18785
|
-
"/"
|
|
18786
|
-
);
|
|
18787
|
-
uploadUrlDirectory = [mainDirectory, "upload-url"].join("/");
|
|
18788
|
-
}
|
|
18789
|
-
});
|
|
18790
|
-
|
|
18791
|
-
// src/helpers.ts
|
|
18792
|
-
function exitWithError(error48) {
|
|
18793
|
-
if (error48 instanceof ExitCodeError) {
|
|
18794
|
-
Logger.error(error48.message);
|
|
18795
|
-
process.exit(error48.code);
|
|
18796
|
-
} else {
|
|
18797
|
-
Logger.error(error48);
|
|
18798
|
-
process.exit(1);
|
|
18799
|
-
}
|
|
18800
|
-
}
|
|
18801
|
-
function lazy(getActionFunc) {
|
|
18802
|
-
return async (...args) => {
|
|
18803
|
-
try {
|
|
18804
|
-
const actionFunc = await getActionFunc();
|
|
18805
|
-
await actionFunc(...args);
|
|
18806
|
-
process.exit(0);
|
|
18807
|
-
} catch (error48) {
|
|
18808
|
-
exitWithError(error48);
|
|
18809
|
-
}
|
|
18810
|
-
};
|
|
18811
|
-
}
|
|
18812
|
-
function parseProjectId(projectId) {
|
|
18813
|
-
return readFileAsObservable(projectDirectory).pipe(
|
|
18814
|
-
(0, import_operators.catchError)(() => (0, import_rxjs2.of)("")),
|
|
18815
|
-
(0, import_operators.map)((currentProjectId) => projectId ? projectId : currentProjectId),
|
|
18816
|
-
(0, import_operators.switchMap)(
|
|
18817
|
-
(id) => typeof id !== "string" ? (0, import_rxjs2.throwError)(() => "no-id-provided") : (0, import_rxjs2.of)(id)
|
|
18818
|
-
),
|
|
18819
|
-
(0, import_operators.switchMap)((id) => isMongoId(id))
|
|
18820
|
-
);
|
|
18821
|
-
}
|
|
18822
|
-
function outputAllHelp(cmd) {
|
|
18823
|
-
cmd.outputHelp();
|
|
18824
|
-
cmd.commands.forEach((subCmd) => {
|
|
18825
|
-
Logger.info("\n--- Subcommand: " + subCmd.name() + " ---");
|
|
18826
|
-
outputAllHelp(subCmd);
|
|
18827
|
-
});
|
|
18828
|
-
}
|
|
18829
|
-
var import_rxjs2, import_operators, CustomError, ExitCodeError, isMongoId;
|
|
18830
|
-
var init_helpers = __esm({
|
|
18831
|
-
"src/helpers.ts"() {
|
|
18832
|
-
import_rxjs2 = __toESM(require_cjs());
|
|
18833
|
-
import_operators = __toESM(require_operators());
|
|
18834
|
-
init_read_file();
|
|
18835
|
-
init_log();
|
|
18836
|
-
init_types();
|
|
18837
|
-
CustomError = class extends Error {
|
|
18838
|
-
get name() {
|
|
18839
|
-
return this.constructor.name;
|
|
18840
|
-
}
|
|
18841
|
-
};
|
|
18842
|
-
ExitCodeError = class extends CustomError {
|
|
18843
|
-
constructor(code, command) {
|
|
18844
|
-
if (command) {
|
|
18845
|
-
super(`Command '${command}' exited with code ${code}`);
|
|
18846
|
-
} else {
|
|
18847
|
-
super(`Child exited with code ${code}`);
|
|
18848
|
-
}
|
|
18849
|
-
this.code = code;
|
|
18850
|
-
}
|
|
18851
|
-
};
|
|
18852
|
-
isMongoId = (mongoId) => (0, import_rxjs2.of)(mongoId.trim()).pipe(
|
|
18853
|
-
(0, import_operators.switchMap)(
|
|
18854
|
-
(id) => (0, import_rxjs2.of)(new RegExp("^[0-9a-fA-F]{24}$").test(id)).pipe(
|
|
18855
|
-
(0, import_operators.switchMap)(
|
|
18856
|
-
(isMongoId2) => isMongoId2 ? (0, import_rxjs2.of)(id) : (0, import_rxjs2.throwError)(() => `not-valid-id`)
|
|
18857
|
-
)
|
|
18858
|
-
)
|
|
18859
|
-
)
|
|
18860
|
-
);
|
|
18861
|
-
}
|
|
18862
|
-
});
|
|
18863
|
-
|
|
18864
18749
|
// ../../node_modules/@firebase/app/node_modules/tslib/tslib.js
|
|
18865
18750
|
var require_tslib = __commonJS({
|
|
18866
18751
|
"../../node_modules/@firebase/app/node_modules/tslib/tslib.js"(exports2, module2) {
|
|
@@ -27954,7 +27839,7 @@ var require_auth = __commonJS({
|
|
|
27954
27839
|
this.a = this.c;
|
|
27955
27840
|
qm(this, true);
|
|
27956
27841
|
};
|
|
27957
|
-
function
|
|
27842
|
+
function rm2(a, b) {
|
|
27958
27843
|
if (b) return a.a = a.c, a.g();
|
|
27959
27844
|
b = a.a;
|
|
27960
27845
|
a.a *= 2;
|
|
@@ -27963,7 +27848,7 @@ var require_auth = __commonJS({
|
|
|
27963
27848
|
}
|
|
27964
27849
|
function qm(a, b) {
|
|
27965
27850
|
a.stop();
|
|
27966
|
-
a.b = Bd(
|
|
27851
|
+
a.b = Bd(rm2(a, b)).then(function() {
|
|
27967
27852
|
return Ye();
|
|
27968
27853
|
}).then(function() {
|
|
27969
27854
|
return a.h();
|
|
@@ -36109,6 +35994,25 @@ var require_index_cjs3 = __commonJS({
|
|
|
36109
35994
|
}
|
|
36110
35995
|
});
|
|
36111
35996
|
|
|
35997
|
+
// src/types.ts
|
|
35998
|
+
var import_os, mainDirectory, tokenDirectory, refreshTokenDirectory, urlDirectory, keyDirectory, projectDirectory, generationTimeDirectory, uploadUrlDirectory, runnerDirectory;
|
|
35999
|
+
var init_types = __esm({
|
|
36000
|
+
"src/types.ts"() {
|
|
36001
|
+
import_os = require("os");
|
|
36002
|
+
mainDirectory = [(0, import_os.homedir)(), ".graphql-server"].join("/");
|
|
36003
|
+
tokenDirectory = [mainDirectory, "token"].join("/");
|
|
36004
|
+
refreshTokenDirectory = [mainDirectory, "refresh"].join("/");
|
|
36005
|
+
urlDirectory = [mainDirectory, "url"].join("/");
|
|
36006
|
+
keyDirectory = [mainDirectory, "key"].join("/");
|
|
36007
|
+
projectDirectory = [mainDirectory, "project"].join("/");
|
|
36008
|
+
generationTimeDirectory = [mainDirectory, "generation-time"].join(
|
|
36009
|
+
"/"
|
|
36010
|
+
);
|
|
36011
|
+
uploadUrlDirectory = [mainDirectory, "upload-url"].join("/");
|
|
36012
|
+
runnerDirectory = [mainDirectory, "runner.json"].join("/");
|
|
36013
|
+
}
|
|
36014
|
+
});
|
|
36015
|
+
|
|
36112
36016
|
// src/services/types/cluster.fragment.ts
|
|
36113
36017
|
var ClusterFragment;
|
|
36114
36018
|
var init_cluster_fragment = __esm({
|
|
@@ -36199,6 +36103,8 @@ configs {
|
|
|
36199
36103
|
type
|
|
36200
36104
|
}
|
|
36201
36105
|
env
|
|
36106
|
+
clusterId
|
|
36107
|
+
clusterName
|
|
36202
36108
|
method
|
|
36203
36109
|
createdBy
|
|
36204
36110
|
createdAt
|
|
@@ -36240,6 +36146,29 @@ scaleOptions {
|
|
|
36240
36146
|
}
|
|
36241
36147
|
});
|
|
36242
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
|
+
|
|
36243
36172
|
// src/services/types/plugin.fragment.ts
|
|
36244
36173
|
var PluginFragment, InstalledPluginFragment;
|
|
36245
36174
|
var init_plugin_fragment = __esm({
|
|
@@ -36339,19 +36268,20 @@ function gql(...args) {
|
|
|
36339
36268
|
}
|
|
36340
36269
|
return result;
|
|
36341
36270
|
}
|
|
36342
|
-
var import_compressor, firebase,
|
|
36271
|
+
var import_compressor, firebase, import_rxjs2, import_operators, GraphqlClienAPI;
|
|
36343
36272
|
var init_gql_client = __esm({
|
|
36344
36273
|
"src/services/gql-client.ts"() {
|
|
36345
36274
|
init_index_cjs();
|
|
36346
36275
|
import_compressor = __toESM(require_dist());
|
|
36347
36276
|
firebase = __toESM(require_index_cjs3());
|
|
36348
|
-
|
|
36349
|
-
|
|
36277
|
+
import_rxjs2 = __toESM(require_cjs());
|
|
36278
|
+
import_operators = __toESM(require_operators());
|
|
36350
36279
|
init_read_file();
|
|
36351
36280
|
init_types();
|
|
36352
36281
|
init_cluster_fragment();
|
|
36353
36282
|
init_environment_fragment();
|
|
36354
36283
|
init_lambda_fragment();
|
|
36284
|
+
init_local_runner_fragment();
|
|
36355
36285
|
init_plugin_fragment();
|
|
36356
36286
|
init_project_fragment();
|
|
36357
36287
|
init_rabbitmq_fragment();
|
|
@@ -36362,8 +36292,8 @@ var init_gql_client = __esm({
|
|
|
36362
36292
|
variables
|
|
36363
36293
|
}) {
|
|
36364
36294
|
return this.getConfig().pipe(
|
|
36365
|
-
(0,
|
|
36366
|
-
({ token, url: url2 }) => (0,
|
|
36295
|
+
(0, import_operators.switchMap)(
|
|
36296
|
+
({ token, url: url2 }) => (0, import_rxjs2.from)(
|
|
36367
36297
|
fetch(url2, {
|
|
36368
36298
|
method: "POST",
|
|
36369
36299
|
headers: {
|
|
@@ -36374,8 +36304,8 @@ var init_gql_client = __esm({
|
|
|
36374
36304
|
body: JSON.stringify({ query, variables })
|
|
36375
36305
|
})
|
|
36376
36306
|
).pipe(
|
|
36377
|
-
(0,
|
|
36378
|
-
(0,
|
|
36307
|
+
(0, import_operators.switchMap)((res) => res.json()),
|
|
36308
|
+
(0, import_operators.map)(({ data, errors }) => {
|
|
36379
36309
|
if (errors?.length) {
|
|
36380
36310
|
throw new Error(JSON.stringify(errors, null, 2));
|
|
36381
36311
|
}
|
|
@@ -36397,45 +36327,47 @@ var init_gql_client = __esm({
|
|
|
36397
36327
|
}`,
|
|
36398
36328
|
variables: { lambdaId }
|
|
36399
36329
|
}).pipe(
|
|
36400
|
-
(0,
|
|
36330
|
+
(0, import_operators.switchMap)((res) => {
|
|
36401
36331
|
if (!res.getLambda) {
|
|
36402
|
-
return (0,
|
|
36332
|
+
return (0, import_rxjs2.throwError)(() => "missing-lambda");
|
|
36403
36333
|
}
|
|
36404
|
-
return (0,
|
|
36334
|
+
return (0, import_rxjs2.of)(res.getLambda);
|
|
36405
36335
|
})
|
|
36406
36336
|
);
|
|
36407
36337
|
}
|
|
36408
|
-
static getLambdaByName(name2, projectId, fragments) {
|
|
36338
|
+
static getLambdaByName(name2, projectId, fragments, clusterId) {
|
|
36409
36339
|
return this.query({
|
|
36410
|
-
query: gql`query getLambdaByName($projectId: String!, $name: String
|
|
36411
|
-
getLambdaByName(projectId: $projectId, name: $name) {
|
|
36340
|
+
query: gql`query getLambdaByName($projectId: String!, $name: String!, $clusterId: String) {
|
|
36341
|
+
getLambdaByName(projectId: $projectId, name: $name, clusterId: $clusterId) {
|
|
36412
36342
|
${fragments?.join(" ") || LambdaFragment}
|
|
36413
36343
|
}
|
|
36414
36344
|
}`,
|
|
36415
36345
|
variables: {
|
|
36416
36346
|
name: name2,
|
|
36417
|
-
projectId
|
|
36347
|
+
projectId,
|
|
36348
|
+
clusterId
|
|
36418
36349
|
}
|
|
36419
36350
|
}).pipe(
|
|
36420
|
-
(0,
|
|
36351
|
+
(0, import_operators.switchMap)((res) => {
|
|
36421
36352
|
if (!res.getLambdaByName) {
|
|
36422
|
-
return (0,
|
|
36353
|
+
return (0, import_rxjs2.throwError)(() => "missing-lambda");
|
|
36423
36354
|
}
|
|
36424
|
-
return (0,
|
|
36355
|
+
return (0, import_rxjs2.of)(res.getLambdaByName);
|
|
36425
36356
|
})
|
|
36426
36357
|
);
|
|
36427
36358
|
}
|
|
36428
|
-
static listLambdas(projectId) {
|
|
36359
|
+
static listLambdas(projectId, clusterId) {
|
|
36429
36360
|
return this.query({
|
|
36430
|
-
query: gql`query listProjectLambdas($projectId: String
|
|
36431
|
-
listProjectLambdas(projectId: $projectId) {
|
|
36361
|
+
query: gql`query listProjectLambdas($projectId: String!, $clusterId: String){
|
|
36362
|
+
listProjectLambdas(projectId: $projectId, clusterId: $clusterId) {
|
|
36432
36363
|
${LambdaFragment}
|
|
36433
36364
|
}
|
|
36434
36365
|
}`,
|
|
36435
36366
|
variables: {
|
|
36436
|
-
projectId
|
|
36367
|
+
projectId,
|
|
36368
|
+
clusterId
|
|
36437
36369
|
}
|
|
36438
|
-
}).pipe((0,
|
|
36370
|
+
}).pipe((0, import_operators.map)((res) => res.listProjectLambdas));
|
|
36439
36371
|
}
|
|
36440
36372
|
static createLambda(payload) {
|
|
36441
36373
|
return this.query({
|
|
@@ -36445,7 +36377,7 @@ var init_gql_client = __esm({
|
|
|
36445
36377
|
}
|
|
36446
36378
|
}`,
|
|
36447
36379
|
variables: { payload }
|
|
36448
|
-
}).pipe((0,
|
|
36380
|
+
}).pipe((0, import_operators.map)((res) => res.createLambda));
|
|
36449
36381
|
}
|
|
36450
36382
|
static updateLambda(payload) {
|
|
36451
36383
|
return this.query({
|
|
@@ -36455,7 +36387,7 @@ var init_gql_client = __esm({
|
|
|
36455
36387
|
}
|
|
36456
36388
|
}`,
|
|
36457
36389
|
variables: { payload }
|
|
36458
|
-
}).pipe((0,
|
|
36390
|
+
}).pipe((0, import_operators.map)((res) => res.updateLambda));
|
|
36459
36391
|
}
|
|
36460
36392
|
static getLambdaLogs(lambdaId) {
|
|
36461
36393
|
return this.query({
|
|
@@ -36468,8 +36400,8 @@ var init_gql_client = __esm({
|
|
|
36468
36400
|
`,
|
|
36469
36401
|
variables: { lambdaId }
|
|
36470
36402
|
}).pipe(
|
|
36471
|
-
(0,
|
|
36472
|
-
(0,
|
|
36403
|
+
(0, import_operators.map)((res) => res.getLambdaLogs),
|
|
36404
|
+
(0, import_operators.map)(
|
|
36473
36405
|
(logs) => ({
|
|
36474
36406
|
...logs,
|
|
36475
36407
|
data: import_compressor.LZWService.decompress(logs.data)
|
|
@@ -36477,19 +36409,27 @@ var init_gql_client = __esm({
|
|
|
36477
36409
|
)
|
|
36478
36410
|
);
|
|
36479
36411
|
}
|
|
36480
|
-
static getLambdaLogsByName(name2, projectId) {
|
|
36412
|
+
static getLambdaLogsByName(name2, projectId, clusterId) {
|
|
36481
36413
|
return this.query({
|
|
36482
36414
|
query: gql`
|
|
36483
|
-
query getLambdaLogsByName(
|
|
36484
|
-
|
|
36415
|
+
query getLambdaLogsByName(
|
|
36416
|
+
$projectId: String!
|
|
36417
|
+
$name: String!
|
|
36418
|
+
$clusterId: String
|
|
36419
|
+
) {
|
|
36420
|
+
getLambdaLogsByName(
|
|
36421
|
+
projectId: $projectId
|
|
36422
|
+
name: $name
|
|
36423
|
+
clusterId: $clusterId
|
|
36424
|
+
) {
|
|
36485
36425
|
data
|
|
36486
36426
|
}
|
|
36487
36427
|
}
|
|
36488
36428
|
`,
|
|
36489
|
-
variables: { name: name2, projectId }
|
|
36429
|
+
variables: { name: name2, projectId, clusterId }
|
|
36490
36430
|
}).pipe(
|
|
36491
|
-
(0,
|
|
36492
|
-
(0,
|
|
36431
|
+
(0, import_operators.map)((res) => res.getLambdaLogsByName),
|
|
36432
|
+
(0, import_operators.map)(
|
|
36493
36433
|
(logs) => ({
|
|
36494
36434
|
...logs,
|
|
36495
36435
|
data: import_compressor.LZWService.decompress(logs.data)
|
|
@@ -36508,8 +36448,8 @@ var init_gql_client = __esm({
|
|
|
36508
36448
|
`,
|
|
36509
36449
|
variables: { lambdaId }
|
|
36510
36450
|
}).pipe(
|
|
36511
|
-
(0,
|
|
36512
|
-
(0,
|
|
36451
|
+
(0, import_operators.map)((res) => res.getLambdaBuilderLogs),
|
|
36452
|
+
(0, import_operators.map)(
|
|
36513
36453
|
(logs) => ({
|
|
36514
36454
|
...logs,
|
|
36515
36455
|
data: import_compressor.LZWService.decompress(logs.data)
|
|
@@ -36517,19 +36457,27 @@ var init_gql_client = __esm({
|
|
|
36517
36457
|
)
|
|
36518
36458
|
);
|
|
36519
36459
|
}
|
|
36520
|
-
static getLambdaBuilderLogsByName(name2, projectId) {
|
|
36460
|
+
static getLambdaBuilderLogsByName(name2, projectId, clusterId) {
|
|
36521
36461
|
return this.query({
|
|
36522
36462
|
query: gql`
|
|
36523
|
-
query getLambdaBuilderLogsByName(
|
|
36524
|
-
|
|
36463
|
+
query getLambdaBuilderLogsByName(
|
|
36464
|
+
$projectId: String!
|
|
36465
|
+
$name: String!
|
|
36466
|
+
$clusterId: String
|
|
36467
|
+
) {
|
|
36468
|
+
getLambdaBuilderLogsByName(
|
|
36469
|
+
projectId: $projectId
|
|
36470
|
+
name: $name
|
|
36471
|
+
clusterId: $clusterId
|
|
36472
|
+
) {
|
|
36525
36473
|
data
|
|
36526
36474
|
}
|
|
36527
36475
|
}
|
|
36528
36476
|
`,
|
|
36529
|
-
variables: { name: name2, projectId }
|
|
36477
|
+
variables: { name: name2, projectId, clusterId }
|
|
36530
36478
|
}).pipe(
|
|
36531
|
-
(0,
|
|
36532
|
-
(0,
|
|
36479
|
+
(0, import_operators.map)((res) => res.getLambdaBuilderLogsByName),
|
|
36480
|
+
(0, import_operators.map)(
|
|
36533
36481
|
(logs) => ({
|
|
36534
36482
|
...logs,
|
|
36535
36483
|
data: import_compressor.LZWService.decompress(logs.data)
|
|
@@ -36547,7 +36495,7 @@ var init_gql_client = __esm({
|
|
|
36547
36495
|
}
|
|
36548
36496
|
`,
|
|
36549
36497
|
variables: { payload }
|
|
36550
|
-
}).pipe((0,
|
|
36498
|
+
}).pipe((0, import_operators.map)((res) => res.deleteLambda));
|
|
36551
36499
|
}
|
|
36552
36500
|
static listProjects() {
|
|
36553
36501
|
return this.query({
|
|
@@ -36556,7 +36504,7 @@ var init_gql_client = __esm({
|
|
|
36556
36504
|
${ProjectFragment}
|
|
36557
36505
|
}
|
|
36558
36506
|
}`
|
|
36559
|
-
}).pipe((0,
|
|
36507
|
+
}).pipe((0, import_operators.map)((res) => res.listProjects));
|
|
36560
36508
|
}
|
|
36561
36509
|
static getProject(id) {
|
|
36562
36510
|
return this.query({
|
|
@@ -36568,7 +36516,7 @@ var init_gql_client = __esm({
|
|
|
36568
36516
|
variables: {
|
|
36569
36517
|
id
|
|
36570
36518
|
}
|
|
36571
|
-
}).pipe((0,
|
|
36519
|
+
}).pipe((0, import_operators.map)((res) => res.listProjects));
|
|
36572
36520
|
}
|
|
36573
36521
|
static listEnvironments(projectId) {
|
|
36574
36522
|
return this.query({
|
|
@@ -36580,20 +36528,21 @@ var init_gql_client = __esm({
|
|
|
36580
36528
|
variables: {
|
|
36581
36529
|
projectId
|
|
36582
36530
|
}
|
|
36583
|
-
}).pipe((0,
|
|
36531
|
+
}).pipe((0, import_operators.map)((res) => res.listEnvironmentsByProjectId));
|
|
36584
36532
|
}
|
|
36585
|
-
static getEnvironment(name2, projectId) {
|
|
36533
|
+
static getEnvironment(name2, projectId, clusterId) {
|
|
36586
36534
|
return this.query({
|
|
36587
|
-
query: gql`query getEnvironment($name: String!, $projectId: String
|
|
36588
|
-
getEnvironment(name: $name, projectId: $projectId) {
|
|
36535
|
+
query: gql`query getEnvironment($name: String!, $projectId: String!, $clusterId: String) {
|
|
36536
|
+
getEnvironment(name: $name, projectId: $projectId, clusterId: $clusterId) {
|
|
36589
36537
|
${EnvironmentFragment}
|
|
36590
36538
|
}
|
|
36591
36539
|
}`,
|
|
36592
36540
|
variables: {
|
|
36593
36541
|
name: name2,
|
|
36594
|
-
projectId
|
|
36542
|
+
projectId,
|
|
36543
|
+
clusterId
|
|
36595
36544
|
}
|
|
36596
|
-
}).pipe((0,
|
|
36545
|
+
}).pipe((0, import_operators.map)((res) => res.getEnvironment));
|
|
36597
36546
|
}
|
|
36598
36547
|
static createEnvironment(projectId, payload) {
|
|
36599
36548
|
return this.query({
|
|
@@ -36611,17 +36560,18 @@ var init_gql_client = __esm({
|
|
|
36611
36560
|
projectId,
|
|
36612
36561
|
payload
|
|
36613
36562
|
}
|
|
36614
|
-
}).pipe((0,
|
|
36563
|
+
}).pipe((0, import_operators.map)((res) => res.createEnvironment));
|
|
36615
36564
|
}
|
|
36616
|
-
static deleteEnvironment(name2, projectId, force) {
|
|
36565
|
+
static deleteEnvironment(name2, projectId, force, clusterId) {
|
|
36617
36566
|
return this.query({
|
|
36618
36567
|
query: gql`
|
|
36619
36568
|
mutation deleteEnvironmentByName(
|
|
36620
36569
|
$name: String!
|
|
36621
36570
|
$projectId: String!
|
|
36622
36571
|
$force: Boolean
|
|
36572
|
+
$clusterId: String
|
|
36623
36573
|
) {
|
|
36624
|
-
deleteEnvironmentByName(name: $name, projectId: $projectId, force: $force) {
|
|
36574
|
+
deleteEnvironmentByName(name: $name, projectId: $projectId, force: $force, clusterId: $clusterId) {
|
|
36625
36575
|
${EnvironmentFragment}
|
|
36626
36576
|
}
|
|
36627
36577
|
}
|
|
@@ -36629,9 +36579,10 @@ var init_gql_client = __esm({
|
|
|
36629
36579
|
variables: {
|
|
36630
36580
|
name: name2,
|
|
36631
36581
|
projectId,
|
|
36632
|
-
force
|
|
36582
|
+
force,
|
|
36583
|
+
clusterId
|
|
36633
36584
|
}
|
|
36634
|
-
}).pipe((0,
|
|
36585
|
+
}).pipe((0, import_operators.map)((res) => res.deleteEnvironmentByName));
|
|
36635
36586
|
}
|
|
36636
36587
|
static updateEnvironment(projectId, payload) {
|
|
36637
36588
|
return this.query({
|
|
@@ -36649,7 +36600,7 @@ var init_gql_client = __esm({
|
|
|
36649
36600
|
projectId,
|
|
36650
36601
|
payload
|
|
36651
36602
|
}
|
|
36652
|
-
}).pipe((0,
|
|
36603
|
+
}).pipe((0, import_operators.map)((res) => res.updateEnvironmentByName));
|
|
36653
36604
|
}
|
|
36654
36605
|
static listProjectTimeTriggers(projectId) {
|
|
36655
36606
|
return this.query({
|
|
@@ -36663,7 +36614,7 @@ var init_gql_client = __esm({
|
|
|
36663
36614
|
variables: {
|
|
36664
36615
|
projectId
|
|
36665
36616
|
}
|
|
36666
|
-
}).pipe((0,
|
|
36617
|
+
}).pipe((0, import_operators.map)((res) => res.listProjectTimeTriggers));
|
|
36667
36618
|
}
|
|
36668
36619
|
static createTimeTrigger(payload) {
|
|
36669
36620
|
return this.query({
|
|
@@ -36677,7 +36628,7 @@ var init_gql_client = __esm({
|
|
|
36677
36628
|
variables: {
|
|
36678
36629
|
payload
|
|
36679
36630
|
}
|
|
36680
|
-
}).pipe((0,
|
|
36631
|
+
}).pipe((0, import_operators.map)((res) => res.createLambdaTimeTrigger));
|
|
36681
36632
|
}
|
|
36682
36633
|
static deleteLambdaTimeTrigger(lambdaId) {
|
|
36683
36634
|
return this.query({
|
|
@@ -36691,7 +36642,7 @@ var init_gql_client = __esm({
|
|
|
36691
36642
|
variables: {
|
|
36692
36643
|
lambdaId
|
|
36693
36644
|
}
|
|
36694
|
-
}).pipe((0,
|
|
36645
|
+
}).pipe((0, import_operators.map)((res) => res.deleteLambdaTimeTrigger));
|
|
36695
36646
|
}
|
|
36696
36647
|
// --------------------------------------------------------------------
|
|
36697
36648
|
// Cluster (project-level; resolved by cluster-provisioner via the
|
|
@@ -36724,7 +36675,57 @@ var init_gql_client = __esm({
|
|
|
36724
36675
|
}
|
|
36725
36676
|
`,
|
|
36726
36677
|
variables: { projectId, ...input }
|
|
36727
|
-
}).pipe((0,
|
|
36678
|
+
}).pipe((0, import_operators.map)((res) => res.provisionProjectCluster));
|
|
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));
|
|
36728
36729
|
}
|
|
36729
36730
|
static projectClusters(projectId) {
|
|
36730
36731
|
return this.query({
|
|
@@ -36736,7 +36737,7 @@ var init_gql_client = __esm({
|
|
|
36736
36737
|
}
|
|
36737
36738
|
`,
|
|
36738
36739
|
variables: { projectId }
|
|
36739
|
-
}).pipe((0,
|
|
36740
|
+
}).pipe((0, import_operators.map)((res) => res.projectClusters));
|
|
36740
36741
|
}
|
|
36741
36742
|
static teardownProjectCluster(projectId, clusterId) {
|
|
36742
36743
|
return this.query({
|
|
@@ -36751,7 +36752,7 @@ var init_gql_client = __esm({
|
|
|
36751
36752
|
}
|
|
36752
36753
|
`,
|
|
36753
36754
|
variables: { projectId, clusterId }
|
|
36754
|
-
}).pipe((0,
|
|
36755
|
+
}).pipe((0, import_operators.map)((res) => res.teardownProjectCluster));
|
|
36755
36756
|
}
|
|
36756
36757
|
static clusterKubeconfig(projectId, clusterId) {
|
|
36757
36758
|
return this.query({
|
|
@@ -36761,7 +36762,7 @@ var init_gql_client = __esm({
|
|
|
36761
36762
|
}
|
|
36762
36763
|
`,
|
|
36763
36764
|
variables: { projectId, clusterId }
|
|
36764
|
-
}).pipe((0,
|
|
36765
|
+
}).pipe((0, import_operators.map)((res) => res.clusterKubeconfig));
|
|
36765
36766
|
}
|
|
36766
36767
|
// --------------------------------------------------------------------
|
|
36767
36768
|
// RabbitMQ brokers (graphql-server-lambdas) - a project may have
|
|
@@ -36780,7 +36781,7 @@ var init_gql_client = __esm({
|
|
|
36780
36781
|
}
|
|
36781
36782
|
`,
|
|
36782
36783
|
variables: { projectId, payload }
|
|
36783
|
-
}).pipe((0,
|
|
36784
|
+
}).pipe((0, import_operators.map)((res) => res.installRabbitMq));
|
|
36784
36785
|
}
|
|
36785
36786
|
static listRabbitMqInstances(projectId) {
|
|
36786
36787
|
return this.query({
|
|
@@ -36792,7 +36793,7 @@ var init_gql_client = __esm({
|
|
|
36792
36793
|
}
|
|
36793
36794
|
`,
|
|
36794
36795
|
variables: { projectId }
|
|
36795
|
-
}).pipe((0,
|
|
36796
|
+
}).pipe((0, import_operators.map)((res) => res.listRabbitMqInstances));
|
|
36796
36797
|
}
|
|
36797
36798
|
static uninstallRabbitMq(id, projectId) {
|
|
36798
36799
|
return this.query({
|
|
@@ -36804,7 +36805,7 @@ var init_gql_client = __esm({
|
|
|
36804
36805
|
}
|
|
36805
36806
|
`,
|
|
36806
36807
|
variables: { id, projectId }
|
|
36807
|
-
}).pipe((0,
|
|
36808
|
+
}).pipe((0, import_operators.map)((res) => res.uninstallRabbitMq));
|
|
36808
36809
|
}
|
|
36809
36810
|
// --------------------------------------------------------------------
|
|
36810
36811
|
// Marketplace plugins (graphql-server-lambdas) - a project may have the
|
|
@@ -36820,7 +36821,7 @@ var init_gql_client = __esm({
|
|
|
36820
36821
|
}
|
|
36821
36822
|
`,
|
|
36822
36823
|
variables: {}
|
|
36823
|
-
}).pipe((0,
|
|
36824
|
+
}).pipe((0, import_operators.map)((res) => res.listAvailablePlugins));
|
|
36824
36825
|
}
|
|
36825
36826
|
static listInstalledPlugins(projectId) {
|
|
36826
36827
|
return this.query({
|
|
@@ -36832,7 +36833,7 @@ var init_gql_client = __esm({
|
|
|
36832
36833
|
}
|
|
36833
36834
|
`,
|
|
36834
36835
|
variables: { projectId }
|
|
36835
|
-
}).pipe((0,
|
|
36836
|
+
}).pipe((0, import_operators.map)((res) => res.listInstalledPlugins));
|
|
36836
36837
|
}
|
|
36837
36838
|
static installPlugin(projectId, pluginName, config2, clusterId) {
|
|
36838
36839
|
return this.query({
|
|
@@ -36854,7 +36855,7 @@ var init_gql_client = __esm({
|
|
|
36854
36855
|
}
|
|
36855
36856
|
`,
|
|
36856
36857
|
variables: { projectId, pluginName, config: config2, clusterId }
|
|
36857
|
-
}).pipe((0,
|
|
36858
|
+
}).pipe((0, import_operators.map)((res) => res.installPlugin));
|
|
36858
36859
|
}
|
|
36859
36860
|
static uninstallPlugin(projectId, pluginName, clusterId) {
|
|
36860
36861
|
return this.query({
|
|
@@ -36872,20 +36873,20 @@ var init_gql_client = __esm({
|
|
|
36872
36873
|
}
|
|
36873
36874
|
`,
|
|
36874
36875
|
variables: { projectId, pluginName, clusterId }
|
|
36875
|
-
}).pipe((0,
|
|
36876
|
+
}).pipe((0, import_operators.map)((res) => res.uninstallPlugin));
|
|
36876
36877
|
}
|
|
36877
36878
|
static getConfig(force = false) {
|
|
36878
|
-
return (0,
|
|
36879
|
+
return (0, import_rxjs2.combineLatest)([
|
|
36879
36880
|
readFileAsObservable(tokenDirectory),
|
|
36880
36881
|
readFileAsObservable(urlDirectory),
|
|
36881
36882
|
readFileAsObservable(refreshTokenDirectory),
|
|
36882
36883
|
readFileAsObservable(keyDirectory),
|
|
36883
36884
|
readFileAsObservable(generationTimeDirectory).pipe(
|
|
36884
|
-
(0,
|
|
36885
|
+
(0, import_operators.map)((date5) => Number(date5))
|
|
36885
36886
|
),
|
|
36886
36887
|
readFileAsObservable(uploadUrlDirectory)
|
|
36887
36888
|
]).pipe(
|
|
36888
|
-
(0,
|
|
36889
|
+
(0, import_operators.map)(([token, url2, refresh, key, timeGenerated, uploadUrl]) => ({
|
|
36889
36890
|
token,
|
|
36890
36891
|
url: url2,
|
|
36891
36892
|
refresh,
|
|
@@ -36894,15 +36895,15 @@ var init_gql_client = __esm({
|
|
|
36894
36895
|
expired: force || (Date.now() - timeGenerated) / 1e3 > 1800,
|
|
36895
36896
|
uploadUrl
|
|
36896
36897
|
})),
|
|
36897
|
-
(0,
|
|
36898
|
+
(0, import_operators.switchMap)(
|
|
36898
36899
|
(config2) => config2.expired ? this.refreshToken(config2.key, config2.refresh).pipe(
|
|
36899
|
-
(0,
|
|
36900
|
-
) : (0,
|
|
36900
|
+
(0, import_operators.map)(({ id_token }) => ({ ...config2, token: id_token }))
|
|
36901
|
+
) : (0, import_rxjs2.of)(config2)
|
|
36901
36902
|
)
|
|
36902
36903
|
);
|
|
36903
36904
|
}
|
|
36904
36905
|
static refreshToken(key, refresh_token) {
|
|
36905
|
-
return (0,
|
|
36906
|
+
return (0, import_rxjs2.from)(
|
|
36906
36907
|
fetch(`https://securetoken.googleapis.com/v1/token?key=${key}`, {
|
|
36907
36908
|
method: "POST",
|
|
36908
36909
|
body: JSON.stringify({
|
|
@@ -36911,23 +36912,23 @@ var init_gql_client = __esm({
|
|
|
36911
36912
|
})
|
|
36912
36913
|
})
|
|
36913
36914
|
).pipe(
|
|
36914
|
-
(0,
|
|
36915
|
+
(0, import_operators.switchMap)(
|
|
36915
36916
|
(res) => res.json()
|
|
36916
36917
|
),
|
|
36917
|
-
(0,
|
|
36918
|
-
(cfg) => (0,
|
|
36918
|
+
(0, import_operators.switchMap)(
|
|
36919
|
+
(cfg) => (0, import_rxjs2.combineLatest)([
|
|
36919
36920
|
writeFileAsObservable(tokenDirectory, cfg.id_token),
|
|
36920
36921
|
writeFileAsObservable(refreshTokenDirectory, cfg.refresh_token),
|
|
36921
36922
|
writeFileAsObservable(generationTimeDirectory, Date.now().toString())
|
|
36922
|
-
]).pipe((0,
|
|
36923
|
+
]).pipe((0, import_operators.map)(() => cfg))
|
|
36923
36924
|
)
|
|
36924
36925
|
);
|
|
36925
36926
|
}
|
|
36926
36927
|
static signIn(customToken) {
|
|
36927
|
-
return (0,
|
|
36928
|
-
(0,
|
|
36929
|
-
({ user }) => (0,
|
|
36930
|
-
(0,
|
|
36928
|
+
return (0, import_rxjs2.from)(firebase.auth().signInWithCustomToken(customToken)).pipe(
|
|
36929
|
+
(0, import_operators.switchMap)(
|
|
36930
|
+
({ user }) => (0, import_rxjs2.combineLatest)([user.getIdToken(), (0, import_rxjs2.of)(user.refreshToken)]).pipe(
|
|
36931
|
+
(0, import_operators.map)(([token, refresh]) => ({ user, token, refresh }))
|
|
36931
36932
|
)
|
|
36932
36933
|
)
|
|
36933
36934
|
);
|
|
@@ -36941,6 +36942,121 @@ var init_gql_client = __esm({
|
|
|
36941
36942
|
}
|
|
36942
36943
|
});
|
|
36943
36944
|
|
|
36945
|
+
// src/services/log.ts
|
|
36946
|
+
var Logger;
|
|
36947
|
+
var init_log = __esm({
|
|
36948
|
+
"src/services/log.ts"() {
|
|
36949
|
+
Logger = class {
|
|
36950
|
+
static log(...data) {
|
|
36951
|
+
console.log("\x1B[32m%s\x1B[0m", ...data);
|
|
36952
|
+
}
|
|
36953
|
+
static error(...data) {
|
|
36954
|
+
console.error("\x1B[31m%s\x1B[0m", ...data);
|
|
36955
|
+
}
|
|
36956
|
+
static info(...data) {
|
|
36957
|
+
console.info("\x1B[36m%s\x1B[0m", ...data);
|
|
36958
|
+
}
|
|
36959
|
+
static warn(...data) {
|
|
36960
|
+
console.warn("\x1B[33m%s\x1B[0m", ...data);
|
|
36961
|
+
}
|
|
36962
|
+
static table(...data) {
|
|
36963
|
+
console.table(...data);
|
|
36964
|
+
}
|
|
36965
|
+
};
|
|
36966
|
+
}
|
|
36967
|
+
});
|
|
36968
|
+
|
|
36969
|
+
// src/helpers.ts
|
|
36970
|
+
function exitWithError(error48) {
|
|
36971
|
+
if (error48 instanceof ExitCodeError) {
|
|
36972
|
+
Logger.error(error48.message);
|
|
36973
|
+
process.exit(error48.code);
|
|
36974
|
+
} else {
|
|
36975
|
+
Logger.error(error48);
|
|
36976
|
+
process.exit(1);
|
|
36977
|
+
}
|
|
36978
|
+
}
|
|
36979
|
+
function lazy(getActionFunc) {
|
|
36980
|
+
return async (...args) => {
|
|
36981
|
+
try {
|
|
36982
|
+
const actionFunc = await getActionFunc();
|
|
36983
|
+
await actionFunc(...args);
|
|
36984
|
+
process.exit(0);
|
|
36985
|
+
} catch (e2) {
|
|
36986
|
+
const error48 = e2;
|
|
36987
|
+
exitWithError(error48);
|
|
36988
|
+
}
|
|
36989
|
+
};
|
|
36990
|
+
}
|
|
36991
|
+
function parseProjectId(projectId) {
|
|
36992
|
+
return readFileAsObservable(projectDirectory).pipe(
|
|
36993
|
+
(0, import_operators2.catchError)(() => (0, import_rxjs3.of)("")),
|
|
36994
|
+
(0, import_operators2.map)((currentProjectId) => projectId ? projectId : currentProjectId),
|
|
36995
|
+
(0, import_operators2.switchMap)(
|
|
36996
|
+
(id) => typeof id !== "string" ? (0, import_rxjs3.throwError)(() => "no-id-provided") : (0, import_rxjs3.of)(id)
|
|
36997
|
+
),
|
|
36998
|
+
(0, import_operators2.switchMap)((id) => isMongoId(id))
|
|
36999
|
+
);
|
|
37000
|
+
}
|
|
37001
|
+
function resolveClusterId(projectId, hint) {
|
|
37002
|
+
if (hint.clusterId != null) {
|
|
37003
|
+
return (0, import_rxjs3.of)(hint.clusterId);
|
|
37004
|
+
}
|
|
37005
|
+
if (!hint.clusterName) {
|
|
37006
|
+
return (0, import_rxjs3.of)(void 0);
|
|
37007
|
+
}
|
|
37008
|
+
return GraphqlClienAPI.projectClusters(projectId).pipe(
|
|
37009
|
+
(0, import_operators2.map)((clusters) => clusters.find((c) => c.name === hint.clusterName)),
|
|
37010
|
+
(0, import_operators2.switchMap)(
|
|
37011
|
+
(cluster) => cluster?.id ? (0, import_rxjs3.of)(cluster.id) : (0, import_rxjs3.throwError)(
|
|
37012
|
+
() => `No cluster named "${hint.clusterName}" found in this project - run "gcli cluster:list --project ${projectId}" to see available clusters.`
|
|
37013
|
+
)
|
|
37014
|
+
)
|
|
37015
|
+
);
|
|
37016
|
+
}
|
|
37017
|
+
function outputAllHelp(cmd) {
|
|
37018
|
+
cmd.outputHelp();
|
|
37019
|
+
cmd.commands.forEach((subCmd) => {
|
|
37020
|
+
Logger.info("\n--- Subcommand: " + subCmd.name() + " ---");
|
|
37021
|
+
outputAllHelp(subCmd);
|
|
37022
|
+
});
|
|
37023
|
+
}
|
|
37024
|
+
var import_rxjs3, import_operators2, CustomError, ExitCodeError, isMongoId;
|
|
37025
|
+
var init_helpers = __esm({
|
|
37026
|
+
"src/helpers.ts"() {
|
|
37027
|
+
import_rxjs3 = __toESM(require_cjs());
|
|
37028
|
+
import_operators2 = __toESM(require_operators());
|
|
37029
|
+
init_read_file();
|
|
37030
|
+
init_gql_client();
|
|
37031
|
+
init_log();
|
|
37032
|
+
init_types();
|
|
37033
|
+
CustomError = class extends Error {
|
|
37034
|
+
get name() {
|
|
37035
|
+
return this.constructor.name;
|
|
37036
|
+
}
|
|
37037
|
+
};
|
|
37038
|
+
ExitCodeError = class extends CustomError {
|
|
37039
|
+
constructor(code, command) {
|
|
37040
|
+
if (command) {
|
|
37041
|
+
super(`Command '${command}' exited with code ${code}`);
|
|
37042
|
+
} else {
|
|
37043
|
+
super(`Child exited with code ${code}`);
|
|
37044
|
+
}
|
|
37045
|
+
this.code = code;
|
|
37046
|
+
}
|
|
37047
|
+
};
|
|
37048
|
+
isMongoId = (mongoId) => (0, import_rxjs3.of)(mongoId.trim()).pipe(
|
|
37049
|
+
(0, import_operators2.switchMap)(
|
|
37050
|
+
(id) => (0, import_rxjs3.of)(new RegExp("^[0-9a-fA-F]{24}$").test(id)).pipe(
|
|
37051
|
+
(0, import_operators2.switchMap)(
|
|
37052
|
+
(isMongoId2) => isMongoId2 ? (0, import_rxjs3.of)(id) : (0, import_rxjs3.throwError)(() => `not-valid-id`)
|
|
37053
|
+
)
|
|
37054
|
+
)
|
|
37055
|
+
)
|
|
37056
|
+
);
|
|
37057
|
+
}
|
|
37058
|
+
});
|
|
37059
|
+
|
|
36944
37060
|
// src/commands/auth/login.ts
|
|
36945
37061
|
var login_exports = {};
|
|
36946
37062
|
__export(login_exports, {
|
|
@@ -42065,7 +42181,7 @@ var require_typescript = __commonJS({
|
|
|
42065
42181
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
42066
42182
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
42067
42183
|
writeCommentRange: () => writeCommentRange,
|
|
42068
|
-
writeFile: () =>
|
|
42184
|
+
writeFile: () => writeFile6,
|
|
42069
42185
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
42070
42186
|
zipWith: () => zipWith
|
|
42071
42187
|
});
|
|
@@ -48397,7 +48513,7 @@ ${lanes.join("\n")}
|
|
|
48397
48513
|
writeOutputIsTTY() {
|
|
48398
48514
|
return process.stdout.isTTY;
|
|
48399
48515
|
},
|
|
48400
|
-
readFile:
|
|
48516
|
+
readFile: readFile3,
|
|
48401
48517
|
writeFile: writeFile22,
|
|
48402
48518
|
watchFile: watchFile2,
|
|
48403
48519
|
watchDirectory,
|
|
@@ -48603,7 +48719,7 @@ ${lanes.join("\n")}
|
|
|
48603
48719
|
callback
|
|
48604
48720
|
);
|
|
48605
48721
|
}
|
|
48606
|
-
function
|
|
48722
|
+
function readFile3(fileName, _encoding) {
|
|
48607
48723
|
let buffer;
|
|
48608
48724
|
try {
|
|
48609
48725
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -60708,7 +60824,7 @@ ${lanes.join("\n")}
|
|
|
60708
60824
|
sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
|
|
60709
60825
|
return combinePaths(newDirPath, sourceFilePath);
|
|
60710
60826
|
}
|
|
60711
|
-
function
|
|
60827
|
+
function writeFile6(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
60712
60828
|
host.writeFile(
|
|
60713
60829
|
fileName,
|
|
60714
60830
|
text,
|
|
@@ -85159,7 +85275,7 @@ ${lanes.join("\n")}
|
|
|
85159
85275
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
85160
85276
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
85161
85277
|
}
|
|
85162
|
-
function parseCommandLineWorker(diagnostics, commandLine,
|
|
85278
|
+
function parseCommandLineWorker(diagnostics, commandLine, readFile3) {
|
|
85163
85279
|
const options = {};
|
|
85164
85280
|
let watchOptions;
|
|
85165
85281
|
const fileNames = [];
|
|
@@ -85207,7 +85323,7 @@ ${lanes.join("\n")}
|
|
|
85207
85323
|
}
|
|
85208
85324
|
}
|
|
85209
85325
|
function parseResponseFile(fileName) {
|
|
85210
|
-
const text = tryReadFile(fileName,
|
|
85326
|
+
const text = tryReadFile(fileName, readFile3 || ((fileName2) => sys.readFile(fileName2)));
|
|
85211
85327
|
if (!isString(text)) {
|
|
85212
85328
|
errors.push(text);
|
|
85213
85329
|
return;
|
|
@@ -85310,8 +85426,8 @@ ${lanes.join("\n")}
|
|
|
85310
85426
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
85311
85427
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
85312
85428
|
};
|
|
85313
|
-
function parseCommandLine(commandLine,
|
|
85314
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
85429
|
+
function parseCommandLine(commandLine, readFile3) {
|
|
85430
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile3);
|
|
85315
85431
|
}
|
|
85316
85432
|
function getOptionFromName(optionName, allowShort) {
|
|
85317
85433
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -85393,8 +85509,8 @@ ${lanes.join("\n")}
|
|
|
85393
85509
|
watchOptionsToExtend
|
|
85394
85510
|
);
|
|
85395
85511
|
}
|
|
85396
|
-
function readConfigFile(fileName,
|
|
85397
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
85512
|
+
function readConfigFile(fileName, readFile3) {
|
|
85513
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile3);
|
|
85398
85514
|
return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
85399
85515
|
}
|
|
85400
85516
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -85409,14 +85525,14 @@ ${lanes.join("\n")}
|
|
|
85409
85525
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
85410
85526
|
};
|
|
85411
85527
|
}
|
|
85412
|
-
function readJsonConfigFile(fileName,
|
|
85413
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
85528
|
+
function readJsonConfigFile(fileName, readFile3) {
|
|
85529
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile3);
|
|
85414
85530
|
return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
85415
85531
|
}
|
|
85416
|
-
function tryReadFile(fileName,
|
|
85532
|
+
function tryReadFile(fileName, readFile3) {
|
|
85417
85533
|
let text;
|
|
85418
85534
|
try {
|
|
85419
|
-
text =
|
|
85535
|
+
text = readFile3(fileName);
|
|
85420
85536
|
} catch (e2) {
|
|
85421
85537
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e2.message);
|
|
85422
85538
|
}
|
|
@@ -169459,7 +169575,7 @@ ${lanes.join("\n")}
|
|
|
169459
169575
|
return;
|
|
169460
169576
|
}
|
|
169461
169577
|
const buildInfo = host.getBuildInfo() || { version: version2 };
|
|
169462
|
-
|
|
169578
|
+
writeFile6(
|
|
169463
169579
|
host,
|
|
169464
169580
|
emitterDiagnostics,
|
|
169465
169581
|
buildInfoPath,
|
|
@@ -169671,7 +169787,7 @@ ${lanes.join("\n")}
|
|
|
169671
169787
|
}
|
|
169672
169788
|
if (sourceMapFilePath) {
|
|
169673
169789
|
const sourceMap = sourceMapGenerator.toString();
|
|
169674
|
-
|
|
169790
|
+
writeFile6(
|
|
169675
169791
|
host,
|
|
169676
169792
|
emitterDiagnostics,
|
|
169677
169793
|
sourceMapFilePath,
|
|
@@ -169686,7 +169802,7 @@ ${lanes.join("\n")}
|
|
|
169686
169802
|
}
|
|
169687
169803
|
const text = writer.getText();
|
|
169688
169804
|
const data = { sourceMapUrlPos, diagnostics: transform22.diagnostics };
|
|
169689
|
-
|
|
169805
|
+
writeFile6(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
|
|
169690
169806
|
writer.clear();
|
|
169691
169807
|
return !data.skippedDtsWrite;
|
|
169692
169808
|
}
|
|
@@ -175074,12 +175190,12 @@ ${lanes.join("\n")}
|
|
|
175074
175190
|
function createCompilerHost(options, setParentNodes) {
|
|
175075
175191
|
return createCompilerHostWorker(options, setParentNodes);
|
|
175076
175192
|
}
|
|
175077
|
-
function createGetSourceFile(
|
|
175193
|
+
function createGetSourceFile(readFile3, setParentNodes) {
|
|
175078
175194
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
175079
175195
|
let text;
|
|
175080
175196
|
try {
|
|
175081
175197
|
mark("beforeIORead");
|
|
175082
|
-
text =
|
|
175198
|
+
text = readFile3(fileName);
|
|
175083
175199
|
mark("afterIORead");
|
|
175084
175200
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
175085
175201
|
} catch (e2) {
|
|
@@ -175983,7 +176099,7 @@ ${lanes.join("\n")}
|
|
|
175983
176099
|
getRedirectFromOutput,
|
|
175984
176100
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
175985
176101
|
});
|
|
175986
|
-
const
|
|
176102
|
+
const readFile3 = host.readFile.bind(host);
|
|
175987
176103
|
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
175988
176104
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
175989
176105
|
(_f = tracing) == null ? void 0 : _f.pop();
|
|
@@ -176209,7 +176325,7 @@ ${lanes.join("\n")}
|
|
|
176209
176325
|
shouldTransformImportCall,
|
|
176210
176326
|
emitBuildInfo,
|
|
176211
176327
|
fileExists,
|
|
176212
|
-
readFile:
|
|
176328
|
+
readFile: readFile3,
|
|
176213
176329
|
directoryExists,
|
|
176214
176330
|
getSymlinkCache,
|
|
176215
176331
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
@@ -237568,7 +237684,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
237568
237684
|
walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
|
|
237569
237685
|
whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
|
|
237570
237686
|
writeCommentRange: () => writeCommentRange,
|
|
237571
|
-
writeFile: () =>
|
|
237687
|
+
writeFile: () => writeFile6,
|
|
237572
237688
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
237573
237689
|
zipWith: () => zipWith
|
|
237574
237690
|
});
|
|
@@ -250693,7 +250809,7 @@ var require_esbuild_decorators = __commonJS({
|
|
|
250693
250809
|
var typescript_1 = require_typescript();
|
|
250694
250810
|
var util_1 = require("util");
|
|
250695
250811
|
var strip_it_1 = require_strip_it();
|
|
250696
|
-
var { readFile:
|
|
250812
|
+
var { readFile: readFile3 } = fs_1.promises;
|
|
250697
250813
|
var theFinder = new RegExp(/((?<![(\s]\s*['"])@\w[.[\]\w\d]*\s*(?![;])[((?=\s)])/);
|
|
250698
250814
|
var findDecorators = (fileContent) => theFinder.test((0, strip_it_1.strip)(fileContent));
|
|
250699
250815
|
var esbuildDecorators2 = (options = {}) => ({
|
|
@@ -250717,7 +250833,7 @@ var require_esbuild_decorators = __commonJS({
|
|
|
250717
250833
|
if (!forceTsc && (!parsedTsConfig || !parsedTsConfig.options || !parsedTsConfig.options.emitDecoratorMetadata)) {
|
|
250718
250834
|
return;
|
|
250719
250835
|
}
|
|
250720
|
-
const ts = yield
|
|
250836
|
+
const ts = yield readFile3(args.path, "utf8").catch((err) => printDiagnostics({ file: args.path, err }));
|
|
250721
250837
|
const hasDecorator = findDecorators(ts);
|
|
250722
250838
|
if (!ts || !hasDecorator) {
|
|
250723
250839
|
return;
|
|
@@ -253462,44 +253578,55 @@ var init_create_environment = __esm({
|
|
|
253462
253578
|
init_gql_client();
|
|
253463
253579
|
init_log();
|
|
253464
253580
|
init_load_spec();
|
|
253465
|
-
create_environment_default = (cmd) =>
|
|
253466
|
-
|
|
253467
|
-
|
|
253468
|
-
|
|
253469
|
-
|
|
253470
|
-
|
|
253471
|
-
|
|
253472
|
-
|
|
253473
|
-
|
|
253474
|
-
|
|
253475
|
-
|
|
253476
|
-
|
|
253477
|
-
|
|
253478
|
-
...
|
|
253581
|
+
create_environment_default = (cmd) => {
|
|
253582
|
+
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
253583
|
+
return (0, import_rxjs13.lastValueFrom)(
|
|
253584
|
+
parseProjectId(cmd.project).pipe(
|
|
253585
|
+
(0, import_operators12.switchMap)(
|
|
253586
|
+
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
253587
|
+
(0, import_operators12.map)((data) => ({
|
|
253588
|
+
projectId,
|
|
253589
|
+
...data?.environment ?? data
|
|
253590
|
+
}))
|
|
253591
|
+
)
|
|
253592
|
+
),
|
|
253593
|
+
(0, import_operators12.switchMap)(
|
|
253594
|
+
({ projectId, clusterName: dataClusterName, ...data }) => resolveClusterId(projectId, {
|
|
253595
|
+
clusterId: cmdRest.clusterId || data.clusterId,
|
|
253596
|
+
clusterName: cmdClusterName || dataClusterName
|
|
253597
|
+
}).pipe(
|
|
253598
|
+
(0, import_operators12.switchMap)(
|
|
253599
|
+
(clusterId) => GraphqlClienAPI.createEnvironment(projectId, {
|
|
253600
|
+
...data,
|
|
253601
|
+
...cmdRest,
|
|
253602
|
+
clusterId
|
|
253603
|
+
})
|
|
253604
|
+
)
|
|
253605
|
+
)
|
|
253606
|
+
),
|
|
253607
|
+
(0, import_operators12.tap)((data) => {
|
|
253608
|
+
const columns = [
|
|
253609
|
+
"id",
|
|
253610
|
+
"name",
|
|
253611
|
+
"image",
|
|
253612
|
+
"builder",
|
|
253613
|
+
"poolSize",
|
|
253614
|
+
"minCpu",
|
|
253615
|
+
"maxCpu",
|
|
253616
|
+
"minMemory",
|
|
253617
|
+
"maxMemory",
|
|
253618
|
+
"region",
|
|
253619
|
+
"clusterId",
|
|
253620
|
+
"clusterName"
|
|
253621
|
+
];
|
|
253622
|
+
Logger.log("-------------------");
|
|
253623
|
+
Logger.log("[Action][createEnvironment]");
|
|
253624
|
+
Logger.table([data], columns);
|
|
253625
|
+
Logger.log("-------------------");
|
|
253479
253626
|
})
|
|
253480
|
-
)
|
|
253481
|
-
|
|
253482
|
-
|
|
253483
|
-
"id",
|
|
253484
|
-
"name",
|
|
253485
|
-
"image",
|
|
253486
|
-
"builder",
|
|
253487
|
-
"poolSize",
|
|
253488
|
-
"minCpu",
|
|
253489
|
-
"maxCpu",
|
|
253490
|
-
"minMemory",
|
|
253491
|
-
"maxMemory",
|
|
253492
|
-
"region",
|
|
253493
|
-
"clusterId",
|
|
253494
|
-
"clusterName"
|
|
253495
|
-
];
|
|
253496
|
-
Logger.log("-------------------");
|
|
253497
|
-
Logger.log("[Action][createEnvironment]");
|
|
253498
|
-
Logger.table([data], columns);
|
|
253499
|
-
Logger.log("-------------------");
|
|
253500
|
-
})
|
|
253501
|
-
)
|
|
253502
|
-
);
|
|
253627
|
+
)
|
|
253628
|
+
);
|
|
253629
|
+
};
|
|
253503
253630
|
}
|
|
253504
253631
|
});
|
|
253505
253632
|
|
|
@@ -253517,45 +253644,56 @@ var init_update_environment = __esm({
|
|
|
253517
253644
|
init_gql_client();
|
|
253518
253645
|
init_log();
|
|
253519
253646
|
init_load_spec();
|
|
253520
|
-
update_environment_default = (cmd) =>
|
|
253521
|
-
|
|
253522
|
-
|
|
253523
|
-
|
|
253524
|
-
|
|
253525
|
-
|
|
253526
|
-
|
|
253527
|
-
|
|
253528
|
-
|
|
253529
|
-
|
|
253530
|
-
|
|
253531
|
-
|
|
253532
|
-
(
|
|
253533
|
-
|
|
253534
|
-
...
|
|
253647
|
+
update_environment_default = (cmd) => {
|
|
253648
|
+
const { clusterName: cmdClusterName, ...cmdRest } = cmd;
|
|
253649
|
+
return (0, import_rxjs14.lastValueFrom)(
|
|
253650
|
+
parseProjectId(cmd.project).pipe(
|
|
253651
|
+
(0, import_operators13.switchMap)(
|
|
253652
|
+
(projectId) => loadSpec(cmd.spec ?? "env.yaml").pipe(
|
|
253653
|
+
(0, import_operators13.map)((data) => ({
|
|
253654
|
+
projectId,
|
|
253655
|
+
...data?.environment ?? data
|
|
253656
|
+
}))
|
|
253657
|
+
)
|
|
253658
|
+
),
|
|
253659
|
+
(0, import_operators13.tap)(Logger.log),
|
|
253660
|
+
(0, import_operators13.switchMap)(
|
|
253661
|
+
({ projectId, clusterName: dataClusterName, ...data }) => resolveClusterId(projectId, {
|
|
253662
|
+
clusterId: cmdRest.clusterId || data.clusterId,
|
|
253663
|
+
clusterName: cmdClusterName || dataClusterName
|
|
253664
|
+
}).pipe(
|
|
253665
|
+
(0, import_operators13.switchMap)(
|
|
253666
|
+
(clusterId) => GraphqlClienAPI.updateEnvironment(projectId, {
|
|
253667
|
+
...data,
|
|
253668
|
+
...cmdRest,
|
|
253669
|
+
clusterId
|
|
253670
|
+
})
|
|
253671
|
+
)
|
|
253672
|
+
)
|
|
253673
|
+
),
|
|
253674
|
+
(0, import_operators13.tap)((data) => {
|
|
253675
|
+
const columns = [
|
|
253676
|
+
"id",
|
|
253677
|
+
"name",
|
|
253678
|
+
"image",
|
|
253679
|
+
"builder",
|
|
253680
|
+
"poolSize",
|
|
253681
|
+
"minCpu",
|
|
253682
|
+
"maxCpu",
|
|
253683
|
+
"minMemory",
|
|
253684
|
+
"maxMemory",
|
|
253685
|
+
"region",
|
|
253686
|
+
"clusterId",
|
|
253687
|
+
"clusterName"
|
|
253688
|
+
];
|
|
253689
|
+
Logger.log("-------------------");
|
|
253690
|
+
Logger.log("[Action][updateEnvironment]");
|
|
253691
|
+
Logger.table([data], columns);
|
|
253692
|
+
Logger.log("-------------------");
|
|
253535
253693
|
})
|
|
253536
|
-
)
|
|
253537
|
-
|
|
253538
|
-
|
|
253539
|
-
"id",
|
|
253540
|
-
"name",
|
|
253541
|
-
"image",
|
|
253542
|
-
"builder",
|
|
253543
|
-
"poolSize",
|
|
253544
|
-
"minCpu",
|
|
253545
|
-
"maxCpu",
|
|
253546
|
-
"minMemory",
|
|
253547
|
-
"maxMemory",
|
|
253548
|
-
"region",
|
|
253549
|
-
"clusterId",
|
|
253550
|
-
"clusterName"
|
|
253551
|
-
];
|
|
253552
|
-
Logger.log("-------------------");
|
|
253553
|
-
Logger.log("[Action][updateEnvironment]");
|
|
253554
|
-
Logger.table([data], columns);
|
|
253555
|
-
Logger.log("-------------------");
|
|
253556
|
-
})
|
|
253557
|
-
)
|
|
253558
|
-
);
|
|
253694
|
+
)
|
|
253695
|
+
);
|
|
253696
|
+
};
|
|
253559
253697
|
}
|
|
253560
253698
|
});
|
|
253561
253699
|
|
|
@@ -253584,7 +253722,19 @@ var init_delete_environment = __esm({
|
|
|
253584
253722
|
)
|
|
253585
253723
|
),
|
|
253586
253724
|
(0, import_operators14.switchMap)(
|
|
253587
|
-
({ projectId, name: name2 }) =>
|
|
253725
|
+
({ projectId, name: name2 }) => resolveClusterId(projectId, {
|
|
253726
|
+
clusterId: cmd.clusterId,
|
|
253727
|
+
clusterName: cmd.clusterName
|
|
253728
|
+
}).pipe(
|
|
253729
|
+
(0, import_operators14.switchMap)(
|
|
253730
|
+
(clusterId) => GraphqlClienAPI.deleteEnvironment(
|
|
253731
|
+
name2,
|
|
253732
|
+
projectId,
|
|
253733
|
+
cmd.force,
|
|
253734
|
+
clusterId
|
|
253735
|
+
)
|
|
253736
|
+
)
|
|
253737
|
+
)
|
|
253588
253738
|
),
|
|
253589
253739
|
(0, import_operators14.tap)((data) => {
|
|
253590
253740
|
const columns = [
|
|
@@ -253634,7 +253784,18 @@ var init_get_environment = __esm({
|
|
|
253634
253784
|
)
|
|
253635
253785
|
),
|
|
253636
253786
|
(0, import_operators15.switchMap)(
|
|
253637
|
-
({ projectId, name: name2 }) =>
|
|
253787
|
+
({ projectId, name: name2 }) => resolveClusterId(projectId, {
|
|
253788
|
+
clusterId: cmd.clusterId,
|
|
253789
|
+
clusterName: cmd.clusterName
|
|
253790
|
+
}).pipe(
|
|
253791
|
+
(0, import_operators15.switchMap)(
|
|
253792
|
+
(clusterId) => GraphqlClienAPI.getEnvironment(
|
|
253793
|
+
cmd.name ?? name2,
|
|
253794
|
+
projectId,
|
|
253795
|
+
clusterId
|
|
253796
|
+
)
|
|
253797
|
+
)
|
|
253798
|
+
)
|
|
253638
253799
|
),
|
|
253639
253800
|
(0, import_operators15.tap)((data) => {
|
|
253640
253801
|
const columns = [
|
|
@@ -267303,8 +267464,8 @@ var require_graceful_fs = __commonJS({
|
|
|
267303
267464
|
fs3.createReadStream = createReadStream3;
|
|
267304
267465
|
fs3.createWriteStream = createWriteStream;
|
|
267305
267466
|
var fs$readFile = fs3.readFile;
|
|
267306
|
-
fs3.readFile =
|
|
267307
|
-
function
|
|
267467
|
+
fs3.readFile = readFile3;
|
|
267468
|
+
function readFile3(path2, options, cb) {
|
|
267308
267469
|
if (typeof options === "function")
|
|
267309
267470
|
cb = options, options = null;
|
|
267310
267471
|
return go$readFile(path2, options, cb);
|
|
@@ -267321,8 +267482,8 @@ var require_graceful_fs = __commonJS({
|
|
|
267321
267482
|
}
|
|
267322
267483
|
}
|
|
267323
267484
|
var fs$writeFile = fs3.writeFile;
|
|
267324
|
-
fs3.writeFile =
|
|
267325
|
-
function
|
|
267485
|
+
fs3.writeFile = writeFile6;
|
|
267486
|
+
function writeFile6(path2, data, options, cb) {
|
|
267326
267487
|
if (typeof options === "function")
|
|
267327
267488
|
cb = options, options = null;
|
|
267328
267489
|
return go$writeFile(path2, data, options, cb);
|
|
@@ -284993,6 +285154,12 @@ var init_helpers2 = __esm({
|
|
|
284993
285154
|
);
|
|
284994
285155
|
}),
|
|
284995
285156
|
(0, import_operators17.switchMap)(async (payload) => {
|
|
285157
|
+
const clusterId = await (0, import_rxjs18.lastValueFrom)(
|
|
285158
|
+
resolveClusterId(payload.projectId, {
|
|
285159
|
+
clusterId: cmd.clusterId || payload.clusterId,
|
|
285160
|
+
clusterName: cmd.clusterName || payload.clusterName
|
|
285161
|
+
})
|
|
285162
|
+
);
|
|
284996
285163
|
return (0, import_rxjs18.lastValueFrom)(
|
|
284997
285164
|
GraphqlClienAPI[type]({
|
|
284998
285165
|
code: cmd.code || await (0, import_rxjs18.lastValueFrom)(ReadFile2(cmd.file || payload.file)) || "",
|
|
@@ -285007,6 +285174,7 @@ var init_helpers2 = __esm({
|
|
|
285007
285174
|
params: cmd.params || payload.params || [],
|
|
285008
285175
|
secrets: cmd.secrets || payload.secrets || [],
|
|
285009
285176
|
envSecrets: cmd.envSecrets || payload.envSecrets || [],
|
|
285177
|
+
clusterId,
|
|
285010
285178
|
network: cmd.network || payload.network || ["public", "private"],
|
|
285011
285179
|
federation: cmd.federation ?? !!payload.federation,
|
|
285012
285180
|
subgraphs: cmd.subgraphs || payload.subgraphs || [],
|
|
@@ -285065,9 +285233,24 @@ var init_list2 = __esm({
|
|
|
285065
285233
|
init_log();
|
|
285066
285234
|
list_default2 = (cmd) => (0, import_rxjs19.lastValueFrom)(
|
|
285067
285235
|
parseProjectId(cmd.project).pipe(
|
|
285068
|
-
(0, import_operators18.switchMap)(
|
|
285236
|
+
(0, import_operators18.switchMap)(
|
|
285237
|
+
(projectId) => resolveClusterId(projectId, {
|
|
285238
|
+
clusterId: cmd.clusterId,
|
|
285239
|
+
clusterName: cmd.clusterName
|
|
285240
|
+
}).pipe(
|
|
285241
|
+
(0, import_operators18.switchMap)(
|
|
285242
|
+
(clusterId) => GraphqlClienAPI.listLambdas(projectId, clusterId)
|
|
285243
|
+
)
|
|
285244
|
+
)
|
|
285245
|
+
),
|
|
285069
285246
|
(0, import_operators18.tap)((data) => {
|
|
285070
|
-
const columns = [
|
|
285247
|
+
const columns = [
|
|
285248
|
+
"id",
|
|
285249
|
+
"name",
|
|
285250
|
+
"url",
|
|
285251
|
+
"clusterId",
|
|
285252
|
+
"clusterName"
|
|
285253
|
+
];
|
|
285071
285254
|
Logger.log("-------------------");
|
|
285072
285255
|
Logger.log("[Action][listLambdas]");
|
|
285073
285256
|
Logger.table(data, columns);
|
|
@@ -285098,7 +285281,9 @@ var init_get = __esm({
|
|
|
285098
285281
|
"name",
|
|
285099
285282
|
"projectId",
|
|
285100
285283
|
"url",
|
|
285101
|
-
"method"
|
|
285284
|
+
"method",
|
|
285285
|
+
"clusterId",
|
|
285286
|
+
"clusterName"
|
|
285102
285287
|
];
|
|
285103
285288
|
Logger.log("-------------------");
|
|
285104
285289
|
Logger.log("[Action][getLambda]");
|
|
@@ -285128,7 +285313,19 @@ var init_get = __esm({
|
|
|
285128
285313
|
return (0, import_rxjs20.throwError)(() => error48);
|
|
285129
285314
|
}),
|
|
285130
285315
|
(0, import_operators19.switchMap)(
|
|
285131
|
-
(projectId) =>
|
|
285316
|
+
(projectId) => resolveClusterId(projectId, {
|
|
285317
|
+
clusterId: cmd.clusterId,
|
|
285318
|
+
clusterName: cmd.clusterName
|
|
285319
|
+
}).pipe(
|
|
285320
|
+
(0, import_operators19.switchMap)(
|
|
285321
|
+
(clusterId) => GraphqlClienAPI.getLambdaByName(
|
|
285322
|
+
name2,
|
|
285323
|
+
projectId,
|
|
285324
|
+
void 0,
|
|
285325
|
+
clusterId
|
|
285326
|
+
)
|
|
285327
|
+
)
|
|
285328
|
+
)
|
|
285132
285329
|
),
|
|
285133
285330
|
table
|
|
285134
285331
|
)
|
|
@@ -285182,10 +285379,20 @@ var init_delete = __esm({
|
|
|
285182
285379
|
delete_default = async (cmd) => {
|
|
285183
285380
|
const spec = await (0, import_rxjs21.lastValueFrom)(loadSpec(cmd.spec));
|
|
285184
285381
|
const name2 = typeof cmd.name === "string" ? cmd.name : spec.function?.name ?? spec.name;
|
|
285382
|
+
const env = cmd.env ?? spec.function?.env ?? spec.env;
|
|
285383
|
+
const clusterIdHint = cmd.clusterId ?? spec.function?.clusterId ?? spec.clusterId;
|
|
285384
|
+
const clusterNameHint = cmd.clusterName ?? spec.function?.clusterName ?? spec.clusterName;
|
|
285185
285385
|
return (0, import_rxjs21.lastValueFrom)(
|
|
285186
285386
|
parseProjectId(cmd.project).pipe(
|
|
285187
285387
|
(0, import_operators20.switchMap)(
|
|
285188
|
-
(projectId) =>
|
|
285388
|
+
(projectId) => resolveClusterId(projectId, {
|
|
285389
|
+
clusterId: clusterIdHint,
|
|
285390
|
+
clusterName: clusterNameHint
|
|
285391
|
+
}).pipe(
|
|
285392
|
+
(0, import_operators20.switchMap)(
|
|
285393
|
+
(clusterId) => GraphqlClienAPI.deleteLambda({ name: name2, projectId, env, clusterId })
|
|
285394
|
+
)
|
|
285395
|
+
)
|
|
285189
285396
|
),
|
|
285190
285397
|
(0, import_operators20.tap)((data) => {
|
|
285191
285398
|
const columns = [
|
|
@@ -285244,7 +285451,14 @@ var init_logs = __esm({
|
|
|
285244
285451
|
return (0, import_rxjs22.throwError)(() => error48);
|
|
285245
285452
|
}),
|
|
285246
285453
|
(0, import_operators21.switchMap)(
|
|
285247
|
-
(projectId) =>
|
|
285454
|
+
(projectId) => resolveClusterId(projectId, {
|
|
285455
|
+
clusterId: cmd.clusterId,
|
|
285456
|
+
clusterName: cmd.clusterName
|
|
285457
|
+
}).pipe(
|
|
285458
|
+
(0, import_operators21.switchMap)(
|
|
285459
|
+
(clusterId) => GraphqlClienAPI.getLambdaLogsByName(name2, projectId, clusterId)
|
|
285460
|
+
)
|
|
285461
|
+
)
|
|
285248
285462
|
),
|
|
285249
285463
|
result
|
|
285250
285464
|
)
|
|
@@ -285294,7 +285508,18 @@ var init_logs_builder = __esm({
|
|
|
285294
285508
|
return (0, import_rxjs23.throwError)(() => error48);
|
|
285295
285509
|
}),
|
|
285296
285510
|
(0, import_operators22.switchMap)(
|
|
285297
|
-
(projectId) =>
|
|
285511
|
+
(projectId) => resolveClusterId(projectId, {
|
|
285512
|
+
clusterId: cmd.clusterId,
|
|
285513
|
+
clusterName: cmd.clusterName
|
|
285514
|
+
}).pipe(
|
|
285515
|
+
(0, import_operators22.switchMap)(
|
|
285516
|
+
(clusterId) => GraphqlClienAPI.getLambdaBuilderLogsByName(
|
|
285517
|
+
name2,
|
|
285518
|
+
projectId,
|
|
285519
|
+
clusterId
|
|
285520
|
+
)
|
|
285521
|
+
)
|
|
285522
|
+
)
|
|
285298
285523
|
),
|
|
285299
285524
|
result
|
|
285300
285525
|
)
|
|
@@ -316713,17 +316938,704 @@ var init_delete2 = __esm({
|
|
|
316713
316938
|
}
|
|
316714
316939
|
});
|
|
316715
316940
|
|
|
316716
|
-
// 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
|
|
316717
317411
|
var start_exports2 = {};
|
|
316718
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, {
|
|
316719
317631
|
default: () => start
|
|
316720
317632
|
});
|
|
316721
317633
|
async function start(args) {
|
|
316722
317634
|
Logger.log("---------------------------------");
|
|
316723
|
-
return (0,
|
|
317635
|
+
return (0, import_rxjs39.lastValueFrom)(
|
|
316724
317636
|
loadSpec().pipe(
|
|
316725
|
-
(0,
|
|
316726
|
-
(config2) => (0,
|
|
317637
|
+
(0, import_operators35.switchMap)(
|
|
317638
|
+
(config2) => (0, import_rxjs39.of)({
|
|
316727
317639
|
watcher: (0, import_node_fs2.watch)(process.cwd(), {
|
|
316728
317640
|
recursive: true
|
|
316729
317641
|
}),
|
|
@@ -316744,7 +317656,7 @@ async function start(args) {
|
|
|
316744
317656
|
outfile: args.outfile ?? config2?.options?.bundler?.outfile ?? "index.js",
|
|
316745
317657
|
startCommand: "node"
|
|
316746
317658
|
}).pipe(
|
|
316747
|
-
(0,
|
|
317659
|
+
(0, import_operators35.switchMap)(
|
|
316748
317660
|
({
|
|
316749
317661
|
child,
|
|
316750
317662
|
watcher,
|
|
@@ -316752,14 +317664,14 @@ async function start(args) {
|
|
|
316752
317664
|
outfile,
|
|
316753
317665
|
startCommand,
|
|
316754
317666
|
ignorelist
|
|
316755
|
-
}) => (0,
|
|
316756
|
-
(0,
|
|
317667
|
+
}) => (0, import_rxjs39.from)(build_default(args)).pipe(
|
|
317668
|
+
(0, import_operators35.tap)(() => {
|
|
316757
317669
|
Logger.warn(
|
|
316758
317670
|
`\u{1F4E2} Starting script "${startCommand} ${outfile}"`
|
|
316759
317671
|
);
|
|
316760
317672
|
Logger.log("---------------------------------\n");
|
|
316761
317673
|
}),
|
|
316762
|
-
(0,
|
|
317674
|
+
(0, import_operators35.tap)(() => {
|
|
316763
317675
|
child = (0, import_node_child_process.spawn)(
|
|
316764
317676
|
startCommand,
|
|
316765
317677
|
["--disable-warning=DEP0040", outfile],
|
|
@@ -316769,14 +317681,14 @@ async function start(args) {
|
|
|
316769
317681
|
}
|
|
316770
317682
|
);
|
|
316771
317683
|
}),
|
|
316772
|
-
(0,
|
|
316773
|
-
() => (0,
|
|
316774
|
-
(0,
|
|
316775
|
-
(0,
|
|
316776
|
-
(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")
|
|
316777
317689
|
).pipe(
|
|
316778
|
-
(0,
|
|
316779
|
-
(0,
|
|
317690
|
+
(0, import_operators35.debounceTime)(100),
|
|
317691
|
+
(0, import_operators35.tap)(() => {
|
|
316780
317692
|
Logger.warn("\u26A0\uFE0F Main process shutting down");
|
|
316781
317693
|
watcher.close();
|
|
316782
317694
|
child.kill("SIGTERM");
|
|
@@ -316784,13 +317696,13 @@ async function start(args) {
|
|
|
316784
317696
|
})
|
|
316785
317697
|
).subscribe()
|
|
316786
317698
|
),
|
|
316787
|
-
(0,
|
|
316788
|
-
() => (0,
|
|
316789
|
-
(0,
|
|
317699
|
+
(0, import_operators35.switchMap)(
|
|
317700
|
+
() => (0, import_rxjs39.fromEvent)(watcher, "change").pipe(
|
|
317701
|
+
(0, import_operators35.map)(([event, filename]) => ({
|
|
316790
317702
|
event,
|
|
316791
317703
|
filename
|
|
316792
317704
|
})),
|
|
316793
|
-
(0,
|
|
317705
|
+
(0, import_operators35.filter)(({ filename }) => {
|
|
316794
317706
|
if (!filename) {
|
|
316795
317707
|
return false;
|
|
316796
317708
|
}
|
|
@@ -316802,18 +317714,18 @@ async function start(args) {
|
|
|
316802
317714
|
const rootDir = filename.split(/[/\\]/)[0];
|
|
316803
317715
|
return whitelist.has(rootDir);
|
|
316804
317716
|
}),
|
|
316805
|
-
(0,
|
|
317717
|
+
(0, import_operators35.debounceTime)(100)
|
|
316806
317718
|
)
|
|
316807
317719
|
),
|
|
316808
|
-
(0,
|
|
317720
|
+
(0, import_operators35.tap)((data) => {
|
|
316809
317721
|
Logger.log("\n---------------------------------");
|
|
316810
317722
|
Logger.log(
|
|
316811
317723
|
`\u27F3 Restarting due to change in: ${data.filename}`
|
|
316812
317724
|
);
|
|
316813
317725
|
child?.kill("SIGTERM");
|
|
316814
317726
|
}),
|
|
316815
|
-
(0,
|
|
316816
|
-
(0,
|
|
317727
|
+
(0, import_operators35.switchMap)(() => build_default(args)),
|
|
317728
|
+
(0, import_operators35.tap)(() => {
|
|
316817
317729
|
Logger.warn(
|
|
316818
317730
|
`\u{1F4E2} Starting script "${startCommand} ${outfile}"`
|
|
316819
317731
|
);
|
|
@@ -316834,13 +317746,13 @@ async function start(args) {
|
|
|
316834
317746
|
)
|
|
316835
317747
|
);
|
|
316836
317748
|
}
|
|
316837
|
-
var import_node_child_process, import_node_fs2,
|
|
316838
|
-
var
|
|
317749
|
+
var import_node_child_process, import_node_fs2, import_rxjs39, import_operators35;
|
|
317750
|
+
var init_start3 = __esm({
|
|
316839
317751
|
"src/commands/start/start.ts"() {
|
|
316840
317752
|
import_node_child_process = require("node:child_process");
|
|
316841
317753
|
import_node_fs2 = require("node:fs");
|
|
316842
|
-
|
|
316843
|
-
|
|
317754
|
+
import_rxjs39 = __toESM(require_cjs());
|
|
317755
|
+
import_operators35 = __toESM(require_operators());
|
|
316844
317756
|
init_log();
|
|
316845
317757
|
init_build();
|
|
316846
317758
|
init_load_spec();
|
|
@@ -316852,25 +317764,25 @@ var create_cron_exports = {};
|
|
|
316852
317764
|
__export(create_cron_exports, {
|
|
316853
317765
|
default: () => create_cron_default
|
|
316854
317766
|
});
|
|
316855
|
-
var
|
|
317767
|
+
var import_rxjs40, import_operators36, create_cron_default;
|
|
316856
317768
|
var init_create_cron = __esm({
|
|
316857
317769
|
"src/commands/triggers/cron/create-cron.ts"() {
|
|
316858
|
-
|
|
316859
|
-
|
|
317770
|
+
import_rxjs40 = __toESM(require_cjs());
|
|
317771
|
+
import_operators36 = __toESM(require_operators());
|
|
316860
317772
|
init_helpers();
|
|
316861
317773
|
init_gql_client();
|
|
316862
317774
|
init_log();
|
|
316863
317775
|
init_load_spec();
|
|
316864
|
-
create_cron_default = (cmd) => (0,
|
|
317776
|
+
create_cron_default = (cmd) => (0, import_rxjs40.lastValueFrom)(
|
|
316865
317777
|
parseProjectId(cmd.project).pipe(
|
|
316866
|
-
(0,
|
|
317778
|
+
(0, import_operators36.switchMap)(
|
|
316867
317779
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
316868
|
-
(0,
|
|
317780
|
+
(0, import_operators36.switchMap)(
|
|
316869
317781
|
(data) => GraphqlClienAPI.getLambdaByName(
|
|
316870
317782
|
cmd?.lambdaName ?? data?.function?.name ?? data?.name,
|
|
316871
317783
|
projectId
|
|
316872
317784
|
).pipe(
|
|
316873
|
-
(0,
|
|
317785
|
+
(0, import_operators36.map)((lambda) => ({
|
|
316874
317786
|
lambdaName: lambda.name,
|
|
316875
317787
|
lambdaId: lambda.id,
|
|
316876
317788
|
...data?.triggers?.time ?? data
|
|
@@ -316879,12 +317791,12 @@ var init_create_cron = __esm({
|
|
|
316879
317791
|
)
|
|
316880
317792
|
)
|
|
316881
317793
|
),
|
|
316882
|
-
(0,
|
|
317794
|
+
(0, import_operators36.switchMap)(
|
|
316883
317795
|
({ lambdaId, cron, triggerName, lambdaName }) => GraphqlClienAPI.createTimeTrigger({ lambdaId, cron, triggerName }).pipe(
|
|
316884
|
-
(0,
|
|
317796
|
+
(0, import_operators36.map)((data) => ({ ...data, lambdaName }))
|
|
316885
317797
|
)
|
|
316886
317798
|
),
|
|
316887
|
-
(0,
|
|
317799
|
+
(0, import_operators36.tap)((data) => {
|
|
316888
317800
|
const columns = [
|
|
316889
317801
|
"id",
|
|
316890
317802
|
"lambdaName",
|
|
@@ -316907,25 +317819,25 @@ var delete_cron_exports = {};
|
|
|
316907
317819
|
__export(delete_cron_exports, {
|
|
316908
317820
|
default: () => delete_cron_default
|
|
316909
317821
|
});
|
|
316910
|
-
var
|
|
317822
|
+
var import_rxjs41, import_operators37, delete_cron_default;
|
|
316911
317823
|
var init_delete_cron = __esm({
|
|
316912
317824
|
"src/commands/triggers/cron/delete-cron.ts"() {
|
|
316913
|
-
|
|
316914
|
-
|
|
317825
|
+
import_rxjs41 = __toESM(require_cjs());
|
|
317826
|
+
import_operators37 = __toESM(require_operators());
|
|
316915
317827
|
init_helpers();
|
|
316916
317828
|
init_gql_client();
|
|
316917
317829
|
init_log();
|
|
316918
317830
|
init_load_spec();
|
|
316919
|
-
delete_cron_default = (cmd) => (0,
|
|
317831
|
+
delete_cron_default = (cmd) => (0, import_rxjs41.lastValueFrom)(
|
|
316920
317832
|
parseProjectId(cmd.project).pipe(
|
|
316921
|
-
(0,
|
|
317833
|
+
(0, import_operators37.switchMap)(
|
|
316922
317834
|
(projectId) => loadSpec(cmd.spec ?? "cron.yaml").pipe(
|
|
316923
|
-
(0,
|
|
317835
|
+
(0, import_operators37.switchMap)(
|
|
316924
317836
|
(data) => GraphqlClienAPI.getLambdaByName(
|
|
316925
317837
|
cmd?.lambdaName ?? data?.function?.name ?? data?.name,
|
|
316926
317838
|
projectId
|
|
316927
317839
|
).pipe(
|
|
316928
|
-
(0,
|
|
317840
|
+
(0, import_operators37.map)((lambda) => ({
|
|
316929
317841
|
lambdaName: lambda.name,
|
|
316930
317842
|
lambdaId: lambda.id
|
|
316931
317843
|
}))
|
|
@@ -316933,12 +317845,12 @@ var init_delete_cron = __esm({
|
|
|
316933
317845
|
)
|
|
316934
317846
|
)
|
|
316935
317847
|
),
|
|
316936
|
-
(0,
|
|
317848
|
+
(0, import_operators37.switchMap)(
|
|
316937
317849
|
({ lambdaId, lambdaName }) => GraphqlClienAPI.deleteLambdaTimeTrigger(lambdaId).pipe(
|
|
316938
|
-
(0,
|
|
317850
|
+
(0, import_operators37.map)((data) => ({ ...data, lambdaName }))
|
|
316939
317851
|
)
|
|
316940
317852
|
),
|
|
316941
|
-
(0,
|
|
317853
|
+
(0, import_operators37.tap)((data) => {
|
|
316942
317854
|
const columns = [
|
|
316943
317855
|
"id",
|
|
316944
317856
|
"lambdaName",
|
|
@@ -316960,29 +317872,29 @@ var list_crons_exports = {};
|
|
|
316960
317872
|
__export(list_crons_exports, {
|
|
316961
317873
|
default: () => list_crons_default
|
|
316962
317874
|
});
|
|
316963
|
-
var
|
|
317875
|
+
var import_rxjs42, import_operators38, list_crons_default;
|
|
316964
317876
|
var init_list_crons = __esm({
|
|
316965
317877
|
"src/commands/triggers/cron/list-crons.ts"() {
|
|
316966
|
-
|
|
316967
|
-
|
|
317878
|
+
import_rxjs42 = __toESM(require_cjs());
|
|
317879
|
+
import_operators38 = __toESM(require_operators());
|
|
316968
317880
|
init_helpers();
|
|
316969
317881
|
init_gql_client();
|
|
316970
317882
|
init_log();
|
|
316971
|
-
list_crons_default = (cmd) => (0,
|
|
317883
|
+
list_crons_default = (cmd) => (0, import_rxjs42.lastValueFrom)(
|
|
316972
317884
|
parseProjectId(cmd.project).pipe(
|
|
316973
|
-
(0,
|
|
316974
|
-
(projectId) => (0,
|
|
317885
|
+
(0, import_operators38.switchMap)(
|
|
317886
|
+
(projectId) => (0, import_rxjs42.combineLatest)([
|
|
316975
317887
|
GraphqlClienAPI.listProjectTimeTriggers(projectId),
|
|
316976
317888
|
GraphqlClienAPI.listLambdas(projectId)
|
|
316977
317889
|
])
|
|
316978
317890
|
),
|
|
316979
|
-
(0,
|
|
317891
|
+
(0, import_operators38.map)(
|
|
316980
317892
|
([triggers, lambdas]) => triggers.map((v) => ({
|
|
316981
317893
|
lambdaName: lambdas.find((l) => l.id === v.lambdaId)?.name,
|
|
316982
317894
|
...v
|
|
316983
317895
|
}))
|
|
316984
317896
|
),
|
|
316985
|
-
(0,
|
|
317897
|
+
(0, import_operators38.tap)((data) => {
|
|
316986
317898
|
const columns = [
|
|
316987
317899
|
"id",
|
|
316988
317900
|
"triggerName",
|
|
@@ -317057,13 +317969,34 @@ function registerEnvironmentCommands(program2) {
|
|
|
317057
317969
|
).option(
|
|
317058
317970
|
"-cid, --clusterId <clusterId>",
|
|
317059
317971
|
"Private cluster this environment should run on (see cluster:list); omit for the shared cluster. Immutable after creation."
|
|
317972
|
+
).option(
|
|
317973
|
+
"-cn, --clusterName <clusterName>",
|
|
317974
|
+
"Same as --clusterId but by the cluster's human-readable name; --clusterId wins if both are given. Can also be set as `clusterName` in env.yaml."
|
|
317060
317975
|
).action(lazy(() => Promise.resolve().then(() => (init_create_environment(), create_environment_exports)).then((m2) => m2.default)));
|
|
317061
317976
|
program2.command("environment:update").description("Update environment for project").option("-p, --project <project>").option("-minCpu, --minCpu <minCpu>").option("-maxCpu, --maxCpu <maxCpu>").option("-minMemory, --minMemory <minMemory>").option("-maxMemory, --maxMemory <maxMemory>").option("-poolSize, --poolSize <poolSize>").option("-builder, --builder <builder>").option("-image, --image <image>").option("-name, --name <name>").option("-spec, --spec <spec>").option(
|
|
317062
317977
|
"-r, --region <region>",
|
|
317063
317978
|
"Default region is eu-central 'DEFAULT' | 'EU_BALKANS' | 'EU_CENTRAL'"
|
|
317979
|
+
).option(
|
|
317980
|
+
"-cid, --clusterId <clusterId>",
|
|
317981
|
+
"Disambiguates which environment to update when --name matches more than one across different clusters (clusterId itself is immutable and never changed by this command)."
|
|
317982
|
+
).option(
|
|
317983
|
+
"-cn, --clusterName <clusterName>",
|
|
317984
|
+
"Same as --clusterId but by the cluster's human-readable name; --clusterId wins if both are given"
|
|
317064
317985
|
).action(lazy(() => Promise.resolve().then(() => (init_update_environment(), update_environment_exports)).then((m2) => m2.default)));
|
|
317065
|
-
program2.command("environment:delete").description("Delete environment for project").option("-p, --project <project>").option("-n, --name <name>").option("-f, --force").option("-spec, --spec <spec>").
|
|
317066
|
-
|
|
317986
|
+
program2.command("environment:delete").description("Delete environment for project").option("-p, --project <project>").option("-n, --name <name>").option("-f, --force").option("-spec, --spec <spec>").option(
|
|
317987
|
+
"-cid, --clusterId <clusterId>",
|
|
317988
|
+
"Disambiguates which environment to delete when --name matches more than one across different clusters"
|
|
317989
|
+
).option(
|
|
317990
|
+
"-cn, --clusterName <clusterName>",
|
|
317991
|
+
"Same as --clusterId but by the cluster's human-readable name; --clusterId wins if both are given"
|
|
317992
|
+
).action(lazy(() => Promise.resolve().then(() => (init_delete_environment(), delete_environment_exports)).then((m2) => m2.default)));
|
|
317993
|
+
program2.command("environment:get").description("Get environment for project").option("-p, --project <project>").option("-n, --name <name>").option(
|
|
317994
|
+
"-cid, --clusterId <clusterId>",
|
|
317995
|
+
"Disambiguates which environment to fetch when --name matches more than one across different clusters"
|
|
317996
|
+
).option(
|
|
317997
|
+
"-cn, --clusterName <clusterName>",
|
|
317998
|
+
"Same as --clusterId but by the cluster's human-readable name; --clusterId wins if both are given"
|
|
317999
|
+
).action(lazy(() => Promise.resolve().then(() => (init_get_environment(), get_environment_exports)).then((m2) => m2.default)));
|
|
317067
318000
|
}
|
|
317068
318001
|
|
|
317069
318002
|
// src/commands/lambda/index.ts
|
|
@@ -317073,12 +318006,32 @@ function registerLambdaCommands(program2) {
|
|
|
317073
318006
|
program2.command("lambda:list").description("List of all lambdas for project").option(
|
|
317074
318007
|
"-p, --project <project>",
|
|
317075
318008
|
"Specify custom token generated from the website"
|
|
318009
|
+
).option(
|
|
318010
|
+
"-cid, --clusterId <clusterId>",
|
|
318011
|
+
"Only lambdas whose environment targets this cluster (empty string for shared-cluster-only; omit for all)"
|
|
318012
|
+
).option(
|
|
318013
|
+
"-cn, --clusterName <clusterName>",
|
|
318014
|
+
"Same as --clusterId but by the cluster's human-readable name (see cluster:list) - resolved to its id before the request; --clusterId wins if both are given"
|
|
317076
318015
|
).action(lazy(() => Promise.resolve().then(() => (init_list2(), list_exports2)).then((m2) => m2.default)));
|
|
317077
|
-
program2.command("lambda:get").description("Get lambda by id").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-p, --spec <spec>", "get by lambda name").
|
|
318016
|
+
program2.command("lambda:get").description("Get lambda by id").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-p, --spec <spec>", "get by lambda name").option(
|
|
318017
|
+
"-cid, --clusterId <clusterId>",
|
|
318018
|
+
"Disambiguates which lambda to fetch when --name matches more than one across different clusters"
|
|
318019
|
+
).option(
|
|
318020
|
+
"-cn, --clusterName <clusterName>",
|
|
318021
|
+
"Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given"
|
|
318022
|
+
).action(lazy(() => Promise.resolve().then(() => (init_get(), get_exports)).then((m2) => m2.default)));
|
|
317078
318023
|
const createOrUpdateOptions = [
|
|
317079
318024
|
["--name <name>", "Function name"],
|
|
317080
318025
|
["--project <project>", "Project in which this lambda is defined"],
|
|
317081
318026
|
["--env <env>", "Environment name for function can be NODEJS"],
|
|
318027
|
+
[
|
|
318028
|
+
"--clusterId <clusterId>",
|
|
318029
|
+
"Disambiguation hint: which of the project's clusters --env lives on (see cluster:list); omit for the shared cluster. Only needed once a project has private clusters and a duplicate-named environment across them."
|
|
318030
|
+
],
|
|
318031
|
+
[
|
|
318032
|
+
"--clusterName <clusterName>",
|
|
318033
|
+
"Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given. Can also be set as `clusterName` in the lambforge.yaml spec's function block."
|
|
318034
|
+
],
|
|
317082
318035
|
[
|
|
317083
318036
|
"--method <method...>",
|
|
317084
318037
|
"HTTP Methods: GET,POST,PUT,DELETE,HEAD. To mention single method"
|
|
@@ -317180,9 +318133,30 @@ function registerLambdaCommands(program2) {
|
|
|
317180
318133
|
createCommand("lambda:update")(createOrUpdateOptions)(program2).action(
|
|
317181
318134
|
lazy(() => Promise.resolve().then(() => (init_update(), update_exports)).then((m2) => m2.default))
|
|
317182
318135
|
);
|
|
317183
|
-
program2.command("lambda:delete").description("Get lambda by id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").
|
|
317184
|
-
|
|
317185
|
-
|
|
318136
|
+
program2.command("lambda:delete").description("Get lambda by id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").option(
|
|
318137
|
+
"-e, --env <env>",
|
|
318138
|
+
"disambiguates which lambda to delete when --name matches more than one across environments/clusters"
|
|
318139
|
+
).option(
|
|
318140
|
+
"-cid, --clusterId <clusterId>",
|
|
318141
|
+
"disambiguates which lambda to delete when --name matches more than one across different clusters"
|
|
318142
|
+
).option(
|
|
318143
|
+
"-cn, --clusterName <clusterName>",
|
|
318144
|
+
"Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given"
|
|
318145
|
+
).action(lazy(() => Promise.resolve().then(() => (init_delete(), delete_exports)).then((m2) => m2.default)));
|
|
318146
|
+
program2.command("lambda:log").description("Get lambda log").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").option(
|
|
318147
|
+
"-cid, --clusterId <clusterId>",
|
|
318148
|
+
"disambiguates which lambda to fetch logs for when --name matches more than one across different clusters"
|
|
318149
|
+
).option(
|
|
318150
|
+
"-cn, --clusterName <clusterName>",
|
|
318151
|
+
"Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given"
|
|
318152
|
+
).action(lazy(() => Promise.resolve().then(() => (init_logs(), logs_exports)).then((m2) => m2.default)));
|
|
318153
|
+
program2.command("lambda:build:log").description("Get build log").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda project").option("-s, --spec <spec>", "use configuration").option(
|
|
318154
|
+
"-cid, --clusterId <clusterId>",
|
|
318155
|
+
"disambiguates which lambda to fetch build logs for when --name matches more than one across different clusters"
|
|
318156
|
+
).option(
|
|
318157
|
+
"-cn, --clusterName <clusterName>",
|
|
318158
|
+
"Same as --clusterId but by the cluster's human-readable name (see cluster:list); --clusterId wins if both are given"
|
|
318159
|
+
).action(lazy(() => Promise.resolve().then(() => (init_logs_builder(), logs_builder_exports)).then((m2) => m2.default)));
|
|
317186
318160
|
program2.command("lambda:test").description("Test lambda").option("-l, --lambda <lambda>", "get by lambda id").option("-n, --name <name>", "get by lambda name").option("-p, --project <project>", "get by lambda name").option("-s, --spec <spec>", "get by lambda name").option("-qp, --queryParams <queryParams>", "Adds query params to request").option("-pp, --pathParams <pathParams>", "Adds query params to request").option("-b, --body <body>", "Add body to request").option(
|
|
317187
318161
|
"-m, --method <method>",
|
|
317188
318162
|
"HTTP Methods: GET,POST,PUT,DELETE,HEAD. To mention single method"
|
|
@@ -317235,6 +318209,37 @@ function registerRabbitMqCommands(program2) {
|
|
|
317235
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)));
|
|
317236
318210
|
}
|
|
317237
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
|
+
|
|
317238
318243
|
// src/commands/start/index.ts
|
|
317239
318244
|
init_helpers();
|
|
317240
318245
|
function startCommands(program2) {
|
|
@@ -317244,7 +318249,7 @@ function startCommands(program2) {
|
|
|
317244
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(
|
|
317245
318250
|
"-i, --ignore <ignore...>",
|
|
317246
318251
|
"Ignore folders from triggering restarts"
|
|
317247
|
-
).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)));
|
|
317248
318253
|
}
|
|
317249
318254
|
|
|
317250
318255
|
// src/commands/triggers/cron/index.ts
|
|
@@ -317267,7 +318272,8 @@ var commands = [
|
|
|
317267
318272
|
registerCronTriggerCommands,
|
|
317268
318273
|
registerClusterCommands,
|
|
317269
318274
|
registerRabbitMqCommands,
|
|
317270
|
-
registerPluginCommands
|
|
318275
|
+
registerPluginCommands,
|
|
318276
|
+
registerRunnerCommands
|
|
317271
318277
|
];
|
|
317272
318278
|
|
|
317273
318279
|
// src/main.ts
|