lua-cli 3.25.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-exports.d.ts +117 -2
- package/dist/api-exports.js +96 -2
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +234 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1160,6 +1160,9 @@ function resolveRequireToolApproval(rules) {
|
|
|
1160
1160
|
function buildDefaultPersona(agentName) {
|
|
1161
1161
|
return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || "My Agent");
|
|
1162
1162
|
}
|
|
1163
|
+
function buildPersonalSpaceStartingPersona(agentName) {
|
|
1164
|
+
return PERSONAL_SPACE_STARTING_PERSONA.replace(new RegExp(AGENT_NAME_TOKEN.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), () => agentName || "Your assistant");
|
|
1165
|
+
}
|
|
1163
1166
|
function resolveLuaJobTimeoutSeconds(timeout) {
|
|
1164
1167
|
const resolved = timeout ?? LUA_JOB_DEFAULT_TIMEOUT_SECONDS;
|
|
1165
1168
|
if (!Number.isInteger(resolved)) {
|
|
@@ -1176,7 +1179,7 @@ function normalizeLuaJobExecutionTimeoutSeconds(timeout) {
|
|
|
1176
1179
|
}
|
|
1177
1180
|
return Math.min(Math.max(timeout, LUA_JOB_MIN_TIMEOUT_SECONDS), LUA_JOB_MAX_TIMEOUT_SECONDS);
|
|
1178
1181
|
}
|
|
1179
|
-
var __defProp2, __name2, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, AGENT_LOG_SOURCES, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS;
|
|
1182
|
+
var __defProp2, __name2, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, REASONING_EFFORT_VALUES, IMPLICIT_MODEL_SELECTION_SOURCES, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, AGENT_LOG_SOURCES, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS;
|
|
1180
1183
|
var init_dist = __esm({
|
|
1181
1184
|
"../shared-types/dist/index.mjs"() {
|
|
1182
1185
|
"use strict";
|
|
@@ -1547,6 +1550,40 @@ Feel free to add, remove, or rename sections. Your persona can be a single parag
|
|
|
1547
1550
|
`;
|
|
1548
1551
|
__name(buildDefaultPersona, "buildDefaultPersona");
|
|
1549
1552
|
__name2(buildDefaultPersona, "buildDefaultPersona");
|
|
1553
|
+
PERSONAL_SPACE_STARTING_PERSONA = `# ${AGENT_NAME_TOKEN}
|
|
1554
|
+
|
|
1555
|
+
You are ${AGENT_NAME_TOKEN}, the assistant for whoever is chatting with you here. Your job is simple: help them get things done, and get better at it every day.
|
|
1556
|
+
|
|
1557
|
+
## You're just getting started
|
|
1558
|
+
|
|
1559
|
+
This workspace is new. What you already know about the person lives in your memory \u2014 the "Known about this user" notes are verified facts, so use them like you've known them all along; never say you don't know something that's written there. Beyond that, don't pretend. Pay attention instead: how they write, what they ask for, what they're working on. When something matters and you're not sure, ask. One good question beats a wrong guess.
|
|
1560
|
+
|
|
1561
|
+
## You have real tools
|
|
1562
|
+
|
|
1563
|
+
You can do a lot more than talk. Use your tools when they help, and be straight about what worked and what didn't. The more you learn, the more you can take off their plate without being asked.
|
|
1564
|
+
|
|
1565
|
+
## How you sound
|
|
1566
|
+
|
|
1567
|
+
Like a sharp, warm human who's on their side. Plain words. Short sentences when short works. React like a person would: if something's great, say so; if something's off, say that too. No corporate filler, no fake enthusiasm.
|
|
1568
|
+
|
|
1569
|
+
## What you hold yourself to
|
|
1570
|
+
|
|
1571
|
+
- Never make up facts about the person, and never claim you did something you didn't.
|
|
1572
|
+
- What you learn about them serves them. Nothing else.
|
|
1573
|
+
- If you can't do something, say so and offer what you can do.
|
|
1574
|
+
|
|
1575
|
+
## Where you come from
|
|
1576
|
+
|
|
1577
|
+
You live on Lua, the platform this workspace runs on. Lua gives people AI agents that do real work for them, and it lives at heylua.ai. It was founded by Lorcan (CEO) and Stefan (CTO).
|
|
1578
|
+
|
|
1579
|
+
If someone asks about Lua itself, have fun with it. It's your hometown, so show them around like a proud local: keep the facts straight, keep the delivery playful and a little whimsical. For anything you don't know (pricing, plans, roadmap), point them to heylua.ai instead of guessing.
|
|
1580
|
+
|
|
1581
|
+
## Keep this persona alive
|
|
1582
|
+
|
|
1583
|
+
This text is who you are for this person. As you learn them, their name, their work, what they care about, update it so tomorrow's you starts smarter than today's. Keep it about who they are and who you are for them.
|
|
1584
|
+
`;
|
|
1585
|
+
__name(buildPersonalSpaceStartingPersona, "buildPersonalSpaceStartingPersona");
|
|
1586
|
+
__name2(buildPersonalSpaceStartingPersona, "buildPersonalSpaceStartingPersona");
|
|
1550
1587
|
AGENT_LOG_SOURCES = [
|
|
1551
1588
|
"skill",
|
|
1552
1589
|
"job",
|
|
@@ -3298,6 +3335,7 @@ var init_files = __esm({
|
|
|
3298
3335
|
"preprocessors",
|
|
3299
3336
|
"postprocessors",
|
|
3300
3337
|
"mcpServers",
|
|
3338
|
+
"template",
|
|
3301
3339
|
"skill"
|
|
3302
3340
|
];
|
|
3303
3341
|
__name(yamlKeySorter, "yamlKeySorter");
|
|
@@ -13107,6 +13145,43 @@ var init_ai_api_service = __esm({
|
|
|
13107
13145
|
}
|
|
13108
13146
|
});
|
|
13109
13147
|
|
|
13148
|
+
// src/api/integrations.api.service.ts
|
|
13149
|
+
var IntegrationsApiService;
|
|
13150
|
+
var init_integrations_api_service = __esm({
|
|
13151
|
+
"src/api/integrations.api.service.ts"() {
|
|
13152
|
+
"use strict";
|
|
13153
|
+
init_http_client();
|
|
13154
|
+
IntegrationsApiService = class extends HttpClient {
|
|
13155
|
+
static {
|
|
13156
|
+
__name(this, "IntegrationsApiService");
|
|
13157
|
+
}
|
|
13158
|
+
apiKey;
|
|
13159
|
+
agentId;
|
|
13160
|
+
constructor(baseUrl, apiKey, agentId) {
|
|
13161
|
+
super(baseUrl), this.apiKey = apiKey, this.agentId = agentId;
|
|
13162
|
+
}
|
|
13163
|
+
async passthrough(integrationType, request2) {
|
|
13164
|
+
return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(this.agentId)}/passthrough/${encodeURIComponent(integrationType)}`, request2, {
|
|
13165
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
13166
|
+
});
|
|
13167
|
+
}
|
|
13168
|
+
/**
|
|
13169
|
+
* Sandbox-facing wrapper: returns the raw provider envelope
|
|
13170
|
+
* `{ status, headers, data }` (provider error statuses relayed faithfully in
|
|
13171
|
+
* `status`), and throws only on route-level failures (no connection,
|
|
13172
|
+
* passthrough disabled, rate limited, transport error).
|
|
13173
|
+
*/
|
|
13174
|
+
async passthroughForSandbox(integrationType, request2) {
|
|
13175
|
+
const result = await this.passthrough(integrationType, request2);
|
|
13176
|
+
if (!result.success || !result.data) {
|
|
13177
|
+
throw new Error(result.error?.message || `Integration passthrough failed for '${integrationType}'`);
|
|
13178
|
+
}
|
|
13179
|
+
return result.data;
|
|
13180
|
+
}
|
|
13181
|
+
};
|
|
13182
|
+
}
|
|
13183
|
+
});
|
|
13184
|
+
|
|
13110
13185
|
// src/api/agents.api.service.ts
|
|
13111
13186
|
var AgentsApiService;
|
|
13112
13187
|
var init_agents_api_service = __esm({
|
|
@@ -13853,6 +13928,7 @@ __export(lazy_instances_exports, {
|
|
|
13853
13928
|
getDeviceInstance: () => getDeviceInstance,
|
|
13854
13929
|
getDirectoryInstance: () => getDirectoryInstance,
|
|
13855
13930
|
getInboxPushInstance: () => getInboxPushInstance,
|
|
13931
|
+
getIntegrationsInstance: () => getIntegrationsInstance,
|
|
13856
13932
|
getJobInstance: () => getJobInstance,
|
|
13857
13933
|
getOrderInstance: () => getOrderInstance,
|
|
13858
13934
|
getProductsInstance: () => getProductsInstance,
|
|
@@ -13917,6 +13993,13 @@ async function getAiInstance() {
|
|
|
13917
13993
|
}
|
|
13918
13994
|
return _aiInstance;
|
|
13919
13995
|
}
|
|
13996
|
+
async function getIntegrationsInstance() {
|
|
13997
|
+
if (!_integrationsInstance) {
|
|
13998
|
+
const creds = await getCredentials();
|
|
13999
|
+
_integrationsInstance = new IntegrationsApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
|
|
14000
|
+
}
|
|
14001
|
+
return _integrationsInstance;
|
|
14002
|
+
}
|
|
13920
14003
|
async function getAgentsInstance() {
|
|
13921
14004
|
if (!_agentsInstance) {
|
|
13922
14005
|
const creds = await getCredentials();
|
|
@@ -13998,7 +14081,7 @@ function clearAllInstances() {
|
|
|
13998
14081
|
_channelsSendInstance = null;
|
|
13999
14082
|
_directoryInstance = null;
|
|
14000
14083
|
}
|
|
14001
|
-
var _userInstance, _dataInstance, _productsInstance, _basketsInstance, _orderInstance, _webhookInstance, _jobInstance, _aiInstance, _agentsInstance, _whatsAppTemplatesInstance, _cdnInstance, _developerInstance, _voiceInstance, _channelsSendInstance, _directoryInstance, _deviceInstance, _inboxPushInstance;
|
|
14084
|
+
var _userInstance, _dataInstance, _productsInstance, _basketsInstance, _orderInstance, _webhookInstance, _jobInstance, _aiInstance, _integrationsInstance, _agentsInstance, _whatsAppTemplatesInstance, _cdnInstance, _developerInstance, _voiceInstance, _channelsSendInstance, _directoryInstance, _deviceInstance, _inboxPushInstance;
|
|
14002
14085
|
var init_lazy_instances = __esm({
|
|
14003
14086
|
"src/api/lazy-instances.ts"() {
|
|
14004
14087
|
"use strict";
|
|
@@ -14012,6 +14095,7 @@ var init_lazy_instances = __esm({
|
|
|
14012
14095
|
init_webhook_api_service();
|
|
14013
14096
|
init_job_api_service();
|
|
14014
14097
|
init_ai_api_service();
|
|
14098
|
+
init_integrations_api_service();
|
|
14015
14099
|
init_agents_api_service();
|
|
14016
14100
|
init_whatsapp_templates_api_service();
|
|
14017
14101
|
init_cdn_api_service();
|
|
@@ -14028,6 +14112,7 @@ var init_lazy_instances = __esm({
|
|
|
14028
14112
|
_webhookInstance = null;
|
|
14029
14113
|
_jobInstance = null;
|
|
14030
14114
|
_aiInstance = null;
|
|
14115
|
+
_integrationsInstance = null;
|
|
14031
14116
|
_agentsInstance = null;
|
|
14032
14117
|
_whatsAppTemplatesInstance = null;
|
|
14033
14118
|
_cdnInstance = null;
|
|
@@ -14043,6 +14128,7 @@ var init_lazy_instances = __esm({
|
|
|
14043
14128
|
__name(getWebhookInstance, "getWebhookInstance");
|
|
14044
14129
|
__name(getJobInstance, "getJobInstance");
|
|
14045
14130
|
__name(getAiInstance, "getAiInstance");
|
|
14131
|
+
__name(getIntegrationsInstance, "getIntegrationsInstance");
|
|
14046
14132
|
__name(getAgentsInstance, "getAgentsInstance");
|
|
14047
14133
|
__name(getWhatsAppTemplatesInstance, "getWhatsAppTemplatesInstance");
|
|
14048
14134
|
__name(getCdnInstance, "getCdnInstance");
|
|
@@ -21850,6 +21936,16 @@ function createSandbox(options) {
|
|
|
21850
21936
|
return agents.invokeForSandbox(targetAgentId, promptOrInput);
|
|
21851
21937
|
}, "invoke")
|
|
21852
21938
|
},
|
|
21939
|
+
// Unified.to raw provider passthrough (PRO-209). Proxied via the same
|
|
21940
|
+
// bearer-auth developer route the api-exports `Integrations` namespace
|
|
21941
|
+
// uses, so `lua test` matches production behavior.
|
|
21942
|
+
Integrations: {
|
|
21943
|
+
passthrough: /* @__PURE__ */ __name(async (integrationType, request2) => {
|
|
21944
|
+
const { getIntegrationsInstance: getIntegrationsInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
|
|
21945
|
+
const integrations = await getIntegrationsInstance2();
|
|
21946
|
+
return integrations.passthroughForSandbox(integrationType, request2);
|
|
21947
|
+
}, "passthrough")
|
|
21948
|
+
},
|
|
21853
21949
|
// Outbound voice dispatch (BAC-212). `lua test` proxies via the same
|
|
21854
21950
|
// bearer-auth developer endpoint the lua-cli `Voice.call` namespace uses
|
|
21855
21951
|
// — keeps the surface byte-equivalent to the lua-core production VM
|
|
@@ -22792,6 +22888,7 @@ var ALIAS_MAP = {
|
|
|
22792
22888
|
"template.action": {
|
|
22793
22889
|
canonical: [
|
|
22794
22890
|
"create",
|
|
22891
|
+
"draft",
|
|
22795
22892
|
"publish",
|
|
22796
22893
|
"view",
|
|
22797
22894
|
"versions",
|
|
@@ -22803,6 +22900,7 @@ var ALIAS_MAP = {
|
|
|
22803
22900
|
],
|
|
22804
22901
|
aliases: lowerKeys({
|
|
22805
22902
|
new: "create",
|
|
22903
|
+
compose: "draft",
|
|
22806
22904
|
publish_version: "publish",
|
|
22807
22905
|
submit: "publish",
|
|
22808
22906
|
show: "view",
|
|
@@ -37935,6 +38033,13 @@ var TemplateApiService = class {
|
|
|
37935
38033
|
body: JSON.stringify(data)
|
|
37936
38034
|
});
|
|
37937
38035
|
}
|
|
38036
|
+
/** T11.3 — draft composer (the clean `/templates/*` route home). */
|
|
38037
|
+
async composeDraft(templateId, data) {
|
|
38038
|
+
return this._fetch(`/templates/${templateId}/versions/draft`, {
|
|
38039
|
+
method: "POST",
|
|
38040
|
+
body: JSON.stringify(data)
|
|
38041
|
+
});
|
|
38042
|
+
}
|
|
37938
38043
|
async listTemplates() {
|
|
37939
38044
|
return this._fetch("/marketplace/templates");
|
|
37940
38045
|
}
|
|
@@ -37991,12 +38096,14 @@ var TemplateApiService = class {
|
|
|
37991
38096
|
// src/commands/template.ts
|
|
37992
38097
|
init_command_utils();
|
|
37993
38098
|
init_analytics();
|
|
38099
|
+
init_files();
|
|
37994
38100
|
function showTemplateUsage() {
|
|
37995
38101
|
console.log("\nUsage:");
|
|
37996
38102
|
console.log(" lua marketplace template Interactive mode");
|
|
37997
38103
|
console.log(" lua marketplace template <action> [options] Non-interactive mode");
|
|
37998
38104
|
console.log("\nActions:");
|
|
37999
38105
|
console.log(" create --name <n> --display-name <n> [--description <text>] [--visibility public|private]");
|
|
38106
|
+
console.log(" draft --template-id <id> [--source-version <n>] [--force] Compose/merge the template: section of lua.skill.yaml");
|
|
38000
38107
|
console.log(" publish --template-id <id> [--source-version <n>] [--changelog <text>] [--env-contract KEY=desc,...]");
|
|
38001
38108
|
console.log(" view --template-id <id> [--version <n>] [--json]");
|
|
38002
38109
|
console.log(" versions --template-id <id> [--json]");
|
|
@@ -38024,6 +38131,10 @@ async function templateCommand(action, options = {}) {
|
|
|
38024
38131
|
name: "Create a template from this agent",
|
|
38025
38132
|
value: "create"
|
|
38026
38133
|
},
|
|
38134
|
+
{
|
|
38135
|
+
name: "Draft the template: section from this agent",
|
|
38136
|
+
value: "draft"
|
|
38137
|
+
},
|
|
38027
38138
|
{
|
|
38028
38139
|
name: "Publish a new template version",
|
|
38029
38140
|
value: "publish"
|
|
@@ -38073,8 +38184,11 @@ async function templateCommand(action, options = {}) {
|
|
|
38073
38184
|
case "create":
|
|
38074
38185
|
await templateCreateAction(templateApi, config, options);
|
|
38075
38186
|
break;
|
|
38187
|
+
case "draft":
|
|
38188
|
+
await templateDraftAction(templateApi, options);
|
|
38189
|
+
break;
|
|
38076
38190
|
case "publish":
|
|
38077
|
-
await templatePublishAction(templateApi, options);
|
|
38191
|
+
await templatePublishAction(templateApi, config, options);
|
|
38078
38192
|
break;
|
|
38079
38193
|
case "view":
|
|
38080
38194
|
await templateViewAction(templateApi, options);
|
|
@@ -38320,18 +38434,125 @@ async function templateCreateAction(templateApi, config, options) {
|
|
|
38320
38434
|
});
|
|
38321
38435
|
}
|
|
38322
38436
|
__name(templateCreateAction, "templateCreateAction");
|
|
38323
|
-
async function
|
|
38437
|
+
async function templateDraftAction(templateApi, options) {
|
|
38438
|
+
const config = readYamlConfig();
|
|
38439
|
+
if (!config) throw new Error("No lua.skill.yaml found in this directory.");
|
|
38440
|
+
const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to draft for?");
|
|
38441
|
+
const sourceAgentVersion = options.sourceVersion ? Number.parseInt(options.sourceVersion, 10) : void 0;
|
|
38442
|
+
if (options.sourceVersion && (!Number.isFinite(sourceAgentVersion) || sourceAgentVersion <= 0)) {
|
|
38443
|
+
throw new Error(`Invalid --source-version "${options.sourceVersion}": must be a positive integer.`);
|
|
38444
|
+
}
|
|
38445
|
+
writeProgress("\u{1F504} Composing template draft...");
|
|
38446
|
+
const result = await templateApi.composeDraft(templateId, {
|
|
38447
|
+
force: options.force === true,
|
|
38448
|
+
sourceAgentVersion
|
|
38449
|
+
});
|
|
38450
|
+
config.template = {
|
|
38451
|
+
connections: result.draft.connections,
|
|
38452
|
+
...result.draft.personaTemplate ? {
|
|
38453
|
+
personaTemplate: result.draft.personaTemplate
|
|
38454
|
+
} : {},
|
|
38455
|
+
triggerPresets: result.draft.triggerPresets,
|
|
38456
|
+
paramsMeta: result.draft.paramsMeta
|
|
38457
|
+
};
|
|
38458
|
+
writeYamlConfig(config);
|
|
38459
|
+
if (options.json) {
|
|
38460
|
+
console.log(JSON.stringify(result, null, 2));
|
|
38461
|
+
return;
|
|
38462
|
+
}
|
|
38463
|
+
writeSuccess("\u2705 template: section written to lua.skill.yaml");
|
|
38464
|
+
for (const [section2, diff] of Object.entries(result.diff)) {
|
|
38465
|
+
const annotations = Object.entries(diff.annotations ?? {});
|
|
38466
|
+
console.log(` ${section2}: +${diff.added.length} added (${diff.added.join(", ") || "\u2014"}), ${diff.kept.length} kept`);
|
|
38467
|
+
for (const [key, note] of annotations) {
|
|
38468
|
+
console.log(` \u26A0 ${key}: ${note}`);
|
|
38469
|
+
}
|
|
38470
|
+
}
|
|
38471
|
+
writeHintBlock({
|
|
38472
|
+
headline: "Review the drafted sections, then publish:",
|
|
38473
|
+
lines: [
|
|
38474
|
+
{
|
|
38475
|
+
label: "Publish:",
|
|
38476
|
+
command: `lua marketplace template publish --template-id ${templateId}`
|
|
38477
|
+
}
|
|
38478
|
+
],
|
|
38479
|
+
when: "success"
|
|
38480
|
+
});
|
|
38481
|
+
}
|
|
38482
|
+
__name(templateDraftAction, "templateDraftAction");
|
|
38483
|
+
var TEMPLATE_SECTION_KEYS = [
|
|
38484
|
+
"connections",
|
|
38485
|
+
"personaTemplate",
|
|
38486
|
+
"triggerPresets",
|
|
38487
|
+
"paramsMeta"
|
|
38488
|
+
];
|
|
38489
|
+
function sectionKeys(section2, value) {
|
|
38490
|
+
if (value === void 0 || value === null) return [];
|
|
38491
|
+
if (section2 === "connections") return (value ?? []).map((entry) => entry.key);
|
|
38492
|
+
if (section2 === "personaTemplate") {
|
|
38493
|
+
const vars = value.vars ?? [];
|
|
38494
|
+
return vars.map((v) => v.name);
|
|
38495
|
+
}
|
|
38496
|
+
return Object.keys(value);
|
|
38497
|
+
}
|
|
38498
|
+
__name(sectionKeys, "sectionKeys");
|
|
38499
|
+
async function confirmTemplateSectionConsequences(templateApi, templateId, local, force) {
|
|
38500
|
+
const versions = await templateApi.getVersions(templateId).catch(() => []);
|
|
38501
|
+
const latest = [
|
|
38502
|
+
...versions
|
|
38503
|
+
].sort((a, b) => b.version - a.version)[0];
|
|
38504
|
+
if (!latest) return;
|
|
38505
|
+
const consequences = [];
|
|
38506
|
+
const consequenceCopy = {
|
|
38507
|
+
connections: "installed agents keep their binding; new installs will not be prompted",
|
|
38508
|
+
personaTemplate: "new installs get no persona template; installed personas are untouched",
|
|
38509
|
+
triggerPresets: "new installs fall back to default arming recommendations",
|
|
38510
|
+
paramsMeta: "the deploy form falls back to derived display names and string typing"
|
|
38511
|
+
};
|
|
38512
|
+
for (const section2 of TEMPLATE_SECTION_KEYS) {
|
|
38513
|
+
const serverKeys = sectionKeys(section2, latest[section2]);
|
|
38514
|
+
const localKeys = sectionKeys(section2, local[section2]);
|
|
38515
|
+
const removed = serverKeys.filter((key) => !localKeys.includes(key));
|
|
38516
|
+
if (!removed.length) continue;
|
|
38517
|
+
const clearing = localKeys.length === 0;
|
|
38518
|
+
consequences.push(` ${section2}: ${clearing ? "CLEARING the section" : `removing ${removed.join(", ")}`} \u2014 ${consequenceCopy[section2]}`);
|
|
38519
|
+
}
|
|
38520
|
+
if (!consequences.length) return;
|
|
38521
|
+
console.log("\n\u26A0 This publish clears or narrows authored template sections:");
|
|
38522
|
+
for (const line of consequences) console.log(line);
|
|
38523
|
+
const isTTY = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
38524
|
+
if (force || isCiModeEnabled() || !isTTY) {
|
|
38525
|
+
writeInfo("Proceeding headless (diff printed above).");
|
|
38526
|
+
return;
|
|
38527
|
+
}
|
|
38528
|
+
const confirmed = await confirmAction("\nProceed with this publish?");
|
|
38529
|
+
if (!confirmed) throw new Error("Publish aborted.");
|
|
38530
|
+
}
|
|
38531
|
+
__name(confirmTemplateSectionConsequences, "confirmTemplateSectionConsequences");
|
|
38532
|
+
async function templatePublishAction(templateApi, config, options) {
|
|
38324
38533
|
const templateId = await resolveTemplateId(templateApi, options, "Which template would you like to publish a version for?");
|
|
38325
38534
|
const sourceAgentVersion = options.sourceVersion ? Number.parseInt(options.sourceVersion, 10) : void 0;
|
|
38326
38535
|
if (options.sourceVersion && (!Number.isFinite(sourceAgentVersion) || sourceAgentVersion <= 0)) {
|
|
38327
38536
|
throw new Error(`Invalid --source-version "${options.sourceVersion}": must be a positive integer.`);
|
|
38328
38537
|
}
|
|
38329
38538
|
const envContract = parseEnvContract(options.envContract);
|
|
38539
|
+
const templateSection = readYamlConfig()?.template ?? config.template;
|
|
38540
|
+
let sectionBody = {};
|
|
38541
|
+
if (templateSection !== void 0) {
|
|
38542
|
+
await confirmTemplateSectionConsequences(templateApi, templateId, templateSection, options.force === true || options.yes === true);
|
|
38543
|
+
sectionBody = {
|
|
38544
|
+
connections: templateSection.connections ?? [],
|
|
38545
|
+
triggerPresets: templateSection.triggerPresets ?? {},
|
|
38546
|
+
personaTemplate: templateSection.personaTemplate ?? null,
|
|
38547
|
+
paramsMeta: templateSection.paramsMeta ?? {}
|
|
38548
|
+
};
|
|
38549
|
+
}
|
|
38330
38550
|
writeProgress("\u{1F504} Publishing template version...");
|
|
38331
38551
|
const version = await templateApi.createVersion(templateId, {
|
|
38332
38552
|
sourceAgentVersion,
|
|
38333
38553
|
changelog: options.changelog || void 0,
|
|
38334
|
-
envContract
|
|
38554
|
+
envContract,
|
|
38555
|
+
...sectionBody
|
|
38335
38556
|
});
|
|
38336
38557
|
if (options.json) {
|
|
38337
38558
|
console.log(JSON.stringify(version, null, 2));
|
|
@@ -38427,12 +38648,14 @@ async function templateInstallAction(templateApi, config, options) {
|
|
|
38427
38648
|
console.error("\n\u274C Use --force to confirm installation");
|
|
38428
38649
|
throw new Error("This action requires --force to confirm");
|
|
38429
38650
|
}
|
|
38651
|
+
if (options.skipEnvCheck) {
|
|
38652
|
+
writeInfo("\u26A0\uFE0F --skip-env-check is deprecated: the env-contract check is server-enforced; use `lua env` to satisfy the contract.");
|
|
38653
|
+
}
|
|
38430
38654
|
writeProgress("\u{1F504} Installing template...");
|
|
38431
38655
|
const install = await templateApi.install(templateId, agentId, {
|
|
38432
38656
|
version,
|
|
38433
38657
|
envValues,
|
|
38434
|
-
allowCreatorUpdates: options.allowCreatorUpdates
|
|
38435
|
-
skipEnvCheck: options.skipEnvCheck
|
|
38658
|
+
allowCreatorUpdates: options.allowCreatorUpdates
|
|
38436
38659
|
});
|
|
38437
38660
|
if (options.json) {
|
|
38438
38661
|
console.log(JSON.stringify(install, null, 2));
|
|
@@ -38539,6 +38762,9 @@ Apply v${versionObj.version} to ${targets.length} agent(s)?`);
|
|
|
38539
38762
|
throw new Error("This action requires --force to confirm (non-interactive mode)");
|
|
38540
38763
|
}
|
|
38541
38764
|
}
|
|
38765
|
+
if (options.skipEnvCheck) {
|
|
38766
|
+
writeInfo("\u26A0\uFE0F --skip-env-check is deprecated: the env-contract check is server-enforced; use `lua env` to satisfy the contract.");
|
|
38767
|
+
}
|
|
38542
38768
|
writeProgress("\u{1F504} Starting apply run...");
|
|
38543
38769
|
const { runId } = await templateApi.apply(templateId, {
|
|
38544
38770
|
version: versionObj.version,
|
|
@@ -46360,7 +46586,7 @@ function setupMarketplaceCommands(program2) {
|
|
|
46360
46586
|
program2.command("marketplace [noun] [action]").description("\u{1F6CD}\uFE0F Browse, install, and manage marketplace skills and agent templates").option("--skill-name <name>", "Skill name (for skill list/update/uninstall)").option("--marketplace-id <id>", "Marketplace skill ID").option("--version-id <id>", "Version ID (for skill publish/install)").option("--env-vars-json <json>", "JSON string with env var metadata (for skill publish)").option("--query <text>", "Search query (for skill search)").option("--page <n>", "Page number (for skill search)").option("--limit <n>", "Results per page (for skill search)").option("--name <name>", "Template name, an internal identifier (for template create)").option("--description <text>", "Description (for template create)").option("--template-id <id>", "Template ID").option("--source-version <n>", "Agent version to freeze into this template version (default: active) (for template publish)").option("--env-contract <pair>", "KEY=description env contract entry, repeatable; use KEY?=description for optional (for template publish)", (val, previous) => [
|
|
46361
46587
|
...previous,
|
|
46362
46588
|
val
|
|
46363
|
-
], []).option("--version <n>", "Template version (for template view/install/apply)").option("--allow-creator-updates", "Allow the template creator to push future updates onto this install").option("--skip-env-check", "Skip env-contract validation (for template install/apply)").option("--agents <ids>", "Comma-separated target agent IDs (for template apply)").option("--file <path>", "Path to a file with one target agent ID per line (for template apply)").option("--all-installed", "Target every agent that already has this template installed (for template apply)").option("--no-wait", "Print the apply runId immediately instead of polling for completion (for template apply)").option("--display-name <name>", "Display name (for skill list/edit, template create)").option("--visibility <visibility>", "Who can see and install it: public or private (for skill list, template create)").option("--changelog <text>", "Changelog for this version (for skill/template publish)").option("--env-vars <pairs>", "Comma-separated key=value pairs (for skill/template install/update)").option("--json", "Output as JSON").option("--force", "Skip confirmation prompts").addHelpText("after", `
|
|
46589
|
+
], []).option("--version <n>", "Template version (for template view/install/apply)").option("--allow-creator-updates", "Allow the template creator to push future updates onto this install").option("--skip-env-check", "Skip env-contract validation (for template install/apply)").option("--agents <ids>", "Comma-separated target agent IDs (for template apply)").option("--file <path>", "Path to a file with one target agent ID per line (for template apply)").option("--all-installed", "Target every agent that already has this template installed (for template apply)").option("--no-wait", "Print the apply runId immediately instead of polling for completion (for template apply)").option("--display-name <name>", "Display name (for skill list/edit, template create)").option("--visibility <visibility>", "Who can see and install it: public or private (for skill list, template create)").option("--changelog <text>", "Changelog for this version (for skill/template publish)").option("--env-vars <pairs>", "Comma-separated key=value pairs (for skill/template install/update)").option("--json", "Output as JSON").option("--force", "Skip confirmation prompts").option("--yes", "Auto-confirm ONLY the template-publish consequence prompt (section clear/narrow); unlike --force it skips no other confirmation").addHelpText("after", `
|
|
46364
46590
|
Arguments:
|
|
46365
46591
|
noun Optional: 'skill' or 'template' (prompts if not provided)
|
|
46366
46592
|
action Optional: specific action for non-interactive mode
|