@stagewhisper/stagewhisper 0.52.0 → 0.54.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/index.js CHANGED
@@ -4236,6 +4236,11 @@ function createRelayService(api) {
4236
4236
  }
4237
4237
  return null;
4238
4238
  }
4239
+ function waitTimeoutMsForJob(job, fallbackMs) {
4240
+ const parsedDeadline = new Date(job.deadline_at).getTime();
4241
+ if (!Number.isFinite(parsedDeadline)) return fallbackMs;
4242
+ return Math.max(1e3, parsedDeadline - Date.now());
4243
+ }
4239
4244
  async function extractReplyForTask(sessionKey, taskId, maxAttempts = 3) {
4240
4245
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
4241
4246
  if (attempt > 0) {
@@ -4451,7 +4456,7 @@ function createRelayService(api) {
4451
4456
  });
4452
4457
  const waitResult = await api.runtime.subagent.waitForRun({
4453
4458
  runId: result.runId,
4454
- timeoutMs: 35e3
4459
+ timeoutMs: waitTimeoutMsForJob(job, 6e4)
4455
4460
  });
4456
4461
  if (waitResult.status === "ok") {
4457
4462
  const reply = await extractReplyWithRetry(sessionKey);
@@ -4645,7 +4650,7 @@ function createRelayService(api) {
4645
4650
  } else {
4646
4651
  health.recordFailure(result.error_message ?? `reasoning ${result.status}`);
4647
4652
  }
4648
- let encryptedResult;
4653
+ let completionResult;
4649
4654
  try {
4650
4655
  const resultJson = JSON.stringify(result.output ?? {});
4651
4656
  const resultBytes = new TextEncoder().encode(resultJson);
@@ -4659,28 +4664,40 @@ function createRelayService(api) {
4659
4664
  "reasoning_output",
4660
4665
  resultBytes
4661
4666
  );
4662
- encryptedResult = {
4663
- byo_encrypted: true,
4664
- envelope: resultEnvelope,
4665
- job_id: job.job_id,
4667
+ completionResult = {
4666
4668
  status: result.status,
4669
+ provider_run_id: result.provider_run_id,
4670
+ model_ref: result.model_ref,
4667
4671
  usage: result.usage,
4668
- model_ref: result.model_ref
4672
+ output: {
4673
+ byo_encrypted: true,
4674
+ envelope: resultEnvelope,
4675
+ status: result.status
4676
+ },
4677
+ error_code: result.error_code,
4678
+ error_message: result.error_message
4669
4679
  };
4670
4680
  } catch (err) {
4671
4681
  api.logger.error(`BYO job ${job.job_id} result encryption failed: ${err}`);
4672
- encryptedResult = {
4673
- job_id: job.job_id,
4682
+ completionResult = {
4674
4683
  status: "failed",
4684
+ provider_run_id: result.provider_run_id,
4685
+ model_ref: result.model_ref,
4686
+ usage: result.usage,
4687
+ output: {
4688
+ byo_encrypted: true,
4689
+ status: "failed",
4690
+ error_code: "encryption_error",
4691
+ error_message: "Failed to encrypt result"
4692
+ },
4675
4693
  error_code: "encryption_error",
4676
- error_message: "Failed to encrypt result",
4677
- byo_encrypted: true
4694
+ error_message: "Failed to encrypt result"
4678
4695
  };
4679
4696
  }
4680
4697
  try {
4681
4698
  await client.postReasoningResult(
4682
4699
  job.job_id,
4683
- encryptedResult,
4700
+ completionResult,
4684
4701
  correlationId
4685
4702
  );
4686
4703
  completedReasoningJobs.set(job.job_id, Date.now());
@@ -4690,6 +4707,10 @@ function createRelayService(api) {
4690
4707
  }
4691
4708
  }
4692
4709
  async function handleReasoningJob(job, client) {
4710
+ if (typeof job.job_id !== "string" || job.job_id.length === 0) {
4711
+ api.logger.error("Received reasoning job without job_id");
4712
+ return;
4713
+ }
4693
4714
  const correlationId = job.correlation_id;
4694
4715
  api.logger.info(
4695
4716
  `Received reasoning job: ${job.job_id} (purpose: ${job.purpose}, correlation: ${correlationId ?? "none"})`
@@ -5008,10 +5029,6 @@ var plugin_main_default = definePluginEntry({
5008
5029
  swConfig["integrationId"] = result.integration_id;
5009
5030
  swConfig["relayToken"] = result.relay_token;
5010
5031
  swConfig["label"] = result.label;
5011
- swConfig["pluginSecretKey"] = Buffer.from(pluginKeypair.secretBytes()).toString("base64");
5012
- if (result.byo_public_key) {
5013
- swConfig["desktopPublicKey"] = result.byo_public_key;
5014
- }
5015
5032
  swEntry["config"] = swConfig;
5016
5033
  entries["stagewhisper"] = swEntry;
5017
5034
  plugins["entries"] = entries;
@@ -2,7 +2,7 @@
2
2
  "id": "stagewhisper",
3
3
  "name": "StageWhisper",
4
4
  "description": "Turn live call moments into assistant tasks via StageWhisper",
5
- "version": "0.52.0",
5
+ "version": "0.54.0",
6
6
  "channels": [
7
7
  "stagewhisper"
8
8
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stagewhisper/stagewhisper",
3
- "version": "0.52.0",
3
+ "version": "0.54.0",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin that connects StageWhisper live calls to your AI assistant",
6
6
  "license": "MIT",