@kybernesis/create 0.19.0 → 0.20.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/doctor.js CHANGED
@@ -294,7 +294,10 @@ export async function doctor() {
294
294
  // iMessage or Telegram should never be told to create a Slack connector.
295
295
  const hasSlackChannel = existsSync(join(cwd, "agent/channels/slack.ts"));
296
296
  if (hasSlackChannel) {
297
- if (env.SLACK_CONNECTOR_UID)
297
+ const slackSource = readFileSync(join(cwd, "agent/channels/slack.ts"), "utf8");
298
+ if (slackSource.includes("controlPlaneSlackCredentials"))
299
+ add("pass", "Slack via the control plane (this agent's own Slack app)", "the owner adds it from the Channels page");
300
+ else if (env.SLACK_CONNECTOR_UID)
298
301
  add("pass", `Slack connector uid: ${env.SLACK_CONNECTOR_UID}`, "verify trigger path /eve/v1/slack (vercel connect list)");
299
302
  else if (env.SLACK_BOT_TOKEN)
300
303
  add("pass", "Slack via portable credentials (SLACK_BOT_TOKEN)");
package/dist/templates.js CHANGED
@@ -260,19 +260,23 @@ export function channelPlan(kind, name, host) {
260
260
  return {
261
261
  file: "slack.ts",
262
262
  content: onExe
263
- ? `import { multiplayerSlackChannel } from "@kybernesis/multiplayer/slack";
264
- import { forwardedSocketVerifier } from "@kybernesis/exe/slack";
265
-
266
- // Slack on a self-hosted (exe.dev) host.
267
- // Inbound: a forwarder holds the exe-brokered Socket Mode connection and POSTs
268
- // events here; the verifier authenticates them on SLACK_SOCKET_FORWARDING_SECRET.
269
- // Outbound: SLACK_BOT_TOKEN must be on the host — eve's SlackChannelCredentials
270
- // has no apiUrl, so calls can't route through the exe integration yet.
263
+ ? `import { channelIdentity } from "@kybernesis/enterprise";
264
+ import { controlPlaneSlackCredentials, multiplayerSlackChannel } from "@kybernesis/multiplayer/slack";
265
+
266
+ // Slack as this agent's own Slack app: its own name, @handle and picture in the
267
+ // customer's workspace. The control plane makes the app and keeps its signing
268
+ // secret and bot token in the customer's org; this channel reads them with the
269
+ // agent credential at call time, so installing or removing the app from the
270
+ // Channels page needs no restart and nothing Slack-related lives on this host.
271
+ //
272
+ // Every sender is a control-plane person, never a bare Slack user: an unlinked
273
+ // one gets a private DM with a one-time claim link and nothing else.
274
+ const issuer = process.env.KYBERNESIS_ISSUER ?? "https://agent.kybernesis.ai";
275
+ const credential = process.env.KYBERNESIS_AGENT_CREDENTIAL;
276
+
271
277
  export default multiplayerSlackChannel({
272
- credentials: {
273
- botToken: process.env.SLACK_BOT_TOKEN!,
274
- webhookVerifier: forwardedSocketVerifier(),
275
- },
278
+ credentials: controlPlaneSlackCredentials({ issuer, credential }),
279
+ identity: credential ? channelIdentity({ issuer, credential }) : null,
276
280
  });
277
281
  `
278
282
  : `import { connectSlackCredentials } from "@vercel/connect/eve";
@@ -284,20 +288,13 @@ export default multiplayerSlackChannel({
284
288
  credentials: connectSlackCredentials(process.env.SLACK_CONNECTOR_UID!),
285
289
  });
286
290
  `,
287
- deps: ["@kybernesis/multiplayer", ...(onExe ? ["@kybernesis/exe"] : ["@vercel/connect"])],
291
+ deps: onExe ? ["@kybernesis/multiplayer@^0.6.0", "@kybernesis/enterprise"] : ["@kybernesis/multiplayer", "@vercel/connect"],
288
292
  registryItems: [],
289
- env: onExe
290
- ? [
291
- `SLACK_BOT_TOKEN="xoxb-..." # outbound; from Slack OAuth & Permissions`,
292
- `SLACK_SOCKET_FORWARDING_SECRET="$(openssl rand -hex 24)"`,
293
- ]
294
- : [`SLACK_CONNECTOR_UID="slack/${name}"`],
293
+ env: onExe ? [] : [`SLACK_CONNECTOR_UID="slack/${name}"`],
295
294
  steps: onExe
296
295
  ? [
297
- `Create a Slack app (Socket Mode on; scopes: app_mentions:read, chat:write, channels:history, groups:history, im:history, users:read)`,
298
- `Hold its tokens off-host: ssh exe.dev integrations add slack --name ${name} --bot-token=- --app-token=-`,
299
- `Run the forwarder (scripts/slack-forwarder.py in @kybernesis/exe) with EXE_SLACK_GW set`,
300
- `After ANY scope change, reinstall the app — a stale token silently stops receiving events`,
296
+ `Make the host public so Slack can reach /eve/v1/slack (ssh exe.dev share set-public <vm>)`,
297
+ `The control plane makes this agent's Slack app; the owner adds it to their workspace from the Channels page`,
301
298
  ]
302
299
  : [
303
300
  `vercel connect create slack --triggers --name ${name}`,
@@ -305,40 +302,72 @@ export default multiplayerSlackChannel({
305
302
  ],
306
303
  };
307
304
  case "imessage":
308
- return {
309
- file: "photon.ts",
310
- content: `import { photonIMessageChannel } from "eve/channels/photon";
311
- ${onExe ? `import { photonEnvCredentials } from "@kybernesis/exe/photon";\n` : ""}
305
+ return onExe
306
+ ? {
307
+ file: "linq.ts",
308
+ content: `import { channelIdentity } from "@kybernesis/enterprise";
309
+ import { linqEnvCredentials, linqSenderIdentity } from "@kybernesis/exe/linq";
310
+ import { linqChannel } from "eve/channels/linq";
311
+
312
+ // iMessage and SMS via the customer's own Linq account. Inbound is a signed
313
+ // webhook at /eve/v1/linq. The owner connects a line from the Channels page
314
+ // (the manage linq.signup and linq.verify actions), which writes LINQ_API_KEY
315
+ // and LINQ_WEBHOOK_SECRET and registers this host's webhook.
316
+ //
317
+ // A sender is a control-plane person, never a phone number: an unlinked number
318
+ // gets one text with a claim link and nothing else.
319
+ const issuer = process.env.KYBERNESIS_ISSUER ?? "https://agent.kybernesis.ai";
320
+ const credential = process.env.KYBERNESIS_AGENT_CREDENTIAL;
321
+ const agentName = process.env.KYBERNESIS_AGENT;
322
+
323
+ export default linqChannel({
324
+ credentials: linqEnvCredentials(),
325
+ ...(agentName ? { userName: agentName } : {}),
326
+ onMessage: linqSenderIdentity({
327
+ issuer,
328
+ agentName,
329
+ identity: credential ? channelIdentity({ issuer, credential }) : null,
330
+ }),
331
+ });
332
+ `,
333
+ deps: ["@kybernesis/exe", "@kybernesis/enterprise"],
334
+ registryItems: [],
335
+ env: [],
336
+ steps: [
337
+ `Make the host public so Linq can reach /eve/v1/linq (ssh exe.dev share set-public <vm>)`,
338
+ `The owner connects a line from the Channels page; it signs up their own Linq account with their email`,
339
+ ],
340
+ }
341
+ : {
342
+ file: "photon.ts",
343
+ content: `import { photonIMessageChannel } from "eve/channels/photon";
344
+
312
345
  // iMessage via Photon. Inbound is a plain webhook at /eve/v1/photon; the Photon
313
346
  // signing secret takes precedence over the default Vercel-OIDC verifier, so this
314
347
  // works on any host with a public HTTPS URL.
315
348
  export default photonIMessageChannel({
316
- ${onExe
317
- ? ` credentials: photonEnvCredentials(),`
318
- : ` async credentials() {
349
+ async credentials() {
319
350
  const projectId = process.env.IMESSAGE_PROJECT_ID;
320
351
  const projectSecret = process.env.IMESSAGE_PROJECT_SECRET;
321
352
  if (!projectId || !projectSecret) throw new Error("Photon project credentials are required.");
322
353
  return { projectId, projectSecret };
323
- },`}
354
+ },
324
355
  webhookSecret: process.env.IMESSAGE_WEBHOOK_SECRET,
325
356
  });
326
357
  `,
327
- deps: onExe ? ["@kybernesis/exe"] : [],
328
- registryItems: [],
329
- env: [
330
- `IMESSAGE_PROJECT_ID="..."`,
331
- `IMESSAGE_PROJECT_SECRET="..."`,
332
- `IMESSAGE_WEBHOOK_SECRET="..." # Photon webhook signing secret`,
333
- ],
334
- steps: [
335
- `Create a Photon project and register the phone number (npx eve add channel/photon-imessage walks it)`,
336
- onExe
337
- ? `Make the host public FIRST — webhooks need anonymous access:\n ssh exe.dev share port <vm> 8000 && ssh exe.dev share set-public <vm>`
338
- : `Deploy so the public URL exists`,
339
- `Register a Photon webhook for https://<your-host>/eve/v1/photon and copy its signing secret to IMESSAGE_WEBHOOK_SECRET`,
340
- ],
341
- };
358
+ deps: [],
359
+ registryItems: [],
360
+ env: [
361
+ `IMESSAGE_PROJECT_ID="..."`,
362
+ `IMESSAGE_PROJECT_SECRET="..."`,
363
+ `IMESSAGE_WEBHOOK_SECRET="..." # Photon webhook signing secret`,
364
+ ],
365
+ steps: [
366
+ `Create a Photon project and register the phone number (npx eve add channel/photon-imessage walks it)`,
367
+ `Deploy so the public URL exists`,
368
+ `Register a Photon webhook for https://<your-host>/eve/v1/photon and copy its signing secret to IMESSAGE_WEBHOOK_SECRET`,
369
+ ],
370
+ };
342
371
  case "telegram":
343
372
  return {
344
373
  file: "telegram.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kybernesis/create",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "The Kybernesis agent scaffolder and FDE toolkit: one command to a governed, remembering, multiplayer, self-testing eve agent \u2014 plus doctor and upgrade.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -82,7 +82,10 @@ then `eve add @kybernesis/<item>`). Each covers one axis:
82
82
  - **manage** — the other direction: `manageChannel()` lets Studio install
83
83
  capabilities and write schedules onto a running agent, and `routineTools()`
84
84
  turns "every morning at 8, brief me" into a real schedule file. This is how a
85
- routine gets created from chat without anyone touching the repo. Since 0.11
85
+ routine gets created from chat without anyone touching the repo. The registry
86
+ item writes `create_routine`, `list_routines` and `delete_routine` into
87
+ `agent/tools/` (sharing `agent/lib/routines.ts`, which reads the restart from
88
+ `agent/channels/kyb.ts`), so `kyb init --studio` agents have them. Since 0.11
86
89
  it also carries the owner's setup routes (`GET /eve/v1/kyb/setup`,
87
90
  `POST .../setup/env`, `POST .../setup/action`): a `manage` grant only;
88
91
  allowlisted env (`EXE_MODEL`, `EXE_LLM_URL`, `ANTHROPIC_API_KEY`,