memeloop 0.2.3 → 0.2.5

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.
Files changed (96) hide show
  1. package/dist/browser.d.cts +26 -21
  2. package/dist/browser.d.ts +26 -21
  3. package/dist/chunk-4OITUYFC.js +37 -0
  4. package/dist/chunk-4OITUYFC.js.map +1 -0
  5. package/dist/{chunk-HY3U3GLE.js → chunk-5EUJNLVW.js} +1 -1
  6. package/dist/chunk-5EUJNLVW.js.map +1 -0
  7. package/dist/{chunk-KXVZQLJL.js → chunk-645GZGNM.js} +3 -2
  8. package/dist/chunk-645GZGNM.js.map +1 -0
  9. package/dist/{chunk-EPHRIRAL.js → chunk-6OLAL5CW.js} +16 -1
  10. package/dist/chunk-6OLAL5CW.js.map +1 -0
  11. package/dist/{chunk-LGUGYRR4.js → chunk-HVLCOJWI.js} +11 -6
  12. package/dist/{chunk-LGUGYRR4.js.map → chunk-HVLCOJWI.js.map} +1 -1
  13. package/dist/{chunk-5VYZV33O.js → chunk-KTZDDC7M.js} +64 -79
  14. package/dist/chunk-KTZDDC7M.js.map +1 -0
  15. package/dist/{chunk-K5KZJNDP.js → chunk-ROPAEJIM.js} +2 -2
  16. package/dist/{chunk-GYIOMQMY.js → chunk-UB77WKAU.js} +305 -429
  17. package/dist/chunk-UB77WKAU.js.map +1 -0
  18. package/dist/{chunk-KV6TC5UJ.js → chunk-XIEXGFPY.js} +3 -3
  19. package/dist/conversation.d.cts +4 -3
  20. package/dist/conversation.d.ts +4 -3
  21. package/dist/device-network-portable.cjs +2 -1
  22. package/dist/device-network-portable.cjs.map +1 -1
  23. package/dist/device-network-portable.d.cts +9 -7
  24. package/dist/device-network-portable.d.ts +9 -7
  25. package/dist/device-network-portable.js +1 -1
  26. package/dist/device-network.cjs +17 -1
  27. package/dist/device-network.cjs.map +1 -1
  28. package/dist/device-network.d.cts +6 -5
  29. package/dist/device-network.d.ts +6 -5
  30. package/dist/device-network.js +2 -2
  31. package/dist/{fetchProvider-B_vva3b3.d.ts → fetchProvider-Do8Hf1BN.d.ts} +1 -1
  32. package/dist/{fetchProvider-Bz4CE3_R.d.cts → fetchProvider-tMo6gc6N.d.cts} +1 -1
  33. package/dist/index.cjs +465 -537
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +20 -26
  36. package/dist/index.d.ts +20 -26
  37. package/dist/index.js +47 -52
  38. package/dist/index.js.map +1 -1
  39. package/dist/{interface-3C3eG8Hn.d.cts → interface-C54gkLA3.d.ts} +3 -110
  40. package/dist/{interface-3C3eG8Hn.d.ts → interface-CECFnbzR.d.cts} +3 -110
  41. package/dist/llm-providers.cjs.map +1 -1
  42. package/dist/llm-providers.d.cts +3 -2
  43. package/dist/llm-providers.d.ts +3 -2
  44. package/dist/llm-providers.js +1 -1
  45. package/dist/llm-providers.js.map +1 -1
  46. package/dist/loop-api.cjs +88 -89
  47. package/dist/loop-api.cjs.map +1 -1
  48. package/dist/loop-api.d.cts +8 -7
  49. package/dist/loop-api.d.ts +8 -7
  50. package/dist/loop-api.js +5 -5
  51. package/dist/mobile.cjs +10 -5
  52. package/dist/mobile.cjs.map +1 -1
  53. package/dist/mobile.d.cts +6 -5
  54. package/dist/mobile.d.ts +6 -5
  55. package/dist/mobile.js +3 -3
  56. package/dist/{orchestration-portable-B4udCSVd.d.ts → orchestration-portable-CQRrnoEw.d.ts} +15 -5
  57. package/dist/{orchestration-portable-BWaCsCGK.d.cts → orchestration-portable-D4KBEYQb.d.cts} +15 -5
  58. package/dist/orchestration-portable.cjs +201 -343
  59. package/dist/orchestration-portable.cjs.map +1 -1
  60. package/dist/orchestration-portable.d.cts +6 -5
  61. package/dist/orchestration-portable.d.ts +6 -5
  62. package/dist/orchestration-portable.js +1 -1
  63. package/dist/{pairingInvite-C12n-7Ak.d.cts → pairingInvite-BmCQ-bHt.d.cts} +3 -3
  64. package/dist/{pairingInvite-CPQkuhLQ.d.ts → pairingInvite-CsfsexXC.d.ts} +3 -3
  65. package/dist/{promptConcat-VLe5SEN4.d.cts → promptConcat-BqImJtVh.d.cts} +7 -4
  66. package/dist/{promptConcat-CUEIA_3T.d.ts → promptConcat-C5SEgESi.d.ts} +7 -4
  67. package/dist/{providerRegistry-CaFK_aUd.d.ts → providerRegistry-BGrwd7Zl.d.cts} +2 -2
  68. package/dist/{providerRegistry-BDGGs5gz.d.cts → providerRegistry-Bs2lJpj9.d.ts} +2 -2
  69. package/dist/{registry-DNSEVYug.d.cts → registry-CelnriUR.d.cts} +3 -3
  70. package/dist/{registry-yGnYHWhq.d.ts → registry-DVv_RVPZ.d.ts} +3 -3
  71. package/dist/{remoteClient-DwBCoHpc.d.ts → remoteClient-D1gPizds.d.ts} +1 -1
  72. package/dist/{remoteClient-DFIyCZEv.d.cts → remoteClient-DxCHC4_Z.d.cts} +1 -1
  73. package/dist/{runtime-6EELHWVB.js → runtime-SASMRN4I.js} +3 -3
  74. package/dist/{scriptDeploymentPipeline-B1q-UhrO.d.ts → scriptDeploymentPipeline-CdDLEDMS.d.cts} +10 -1
  75. package/dist/{scriptDeploymentPipeline-XJzQyYys.d.cts → scriptDeploymentPipeline-DU6sor6Y.d.ts} +10 -1
  76. package/dist/{syncCloudDevices-C8fCUhnX.d.ts → syncCloudDevices-3RmB41sA.d.cts} +6 -2
  77. package/dist/{syncCloudDevices-BFw_c1g5.d.cts → syncCloudDevices-CSLbMESm.d.ts} +6 -2
  78. package/dist/tools.cjs +63 -0
  79. package/dist/tools.cjs.map +1 -0
  80. package/dist/tools.d.cts +12 -0
  81. package/dist/tools.d.ts +12 -0
  82. package/dist/tools.js +7 -0
  83. package/dist/tools.js.map +1 -0
  84. package/dist/{types-CcFFIk8W.d.ts → types-C29NBZ2w.d.ts} +1 -1
  85. package/dist/types-CcoJ_fdH.d.cts +110 -0
  86. package/dist/types-CcoJ_fdH.d.ts +110 -0
  87. package/dist/{types-C8gnhG9M.d.cts → types-D1rAJy9l.d.cts} +1 -1
  88. package/package.json +6 -1
  89. package/dist/chunk-5VYZV33O.js.map +0 -1
  90. package/dist/chunk-EPHRIRAL.js.map +0 -1
  91. package/dist/chunk-GYIOMQMY.js.map +0 -1
  92. package/dist/chunk-HY3U3GLE.js.map +0 -1
  93. package/dist/chunk-KXVZQLJL.js.map +0 -1
  94. /package/dist/{chunk-K5KZJNDP.js.map → chunk-ROPAEJIM.js.map} +0 -0
  95. /package/dist/{chunk-KV6TC5UJ.js.map → chunk-XIEXGFPY.js.map} +0 -0
  96. /package/dist/{runtime-6EELHWVB.js.map → runtime-SASMRN4I.js.map} +0 -0
@@ -13,7 +13,7 @@ import {
13
13
  startAgentToolLoopTurn,
14
14
  stopAgentToolLoopTurn,
15
15
  truncateToolSummary
16
- } from "./chunk-LGUGYRR4.js";
16
+ } from "./chunk-HVLCOJWI.js";
17
17
  import {
18
18
  AGENT_WORKLOAD_API_VERSION,
19
19
  AGENT_WORKLOAD_KIND,
@@ -764,6 +764,39 @@ function createScriptDeploymentClient(config) {
764
764
  };
765
765
  }
766
766
 
767
+ // src/loopAPI/scriptRuntime.ts
768
+ function messageStep(message) {
769
+ return { type: "message", data: message };
770
+ }
771
+ function createScriptStepEmitter(emittedSteps, onEmit) {
772
+ return (step) => {
773
+ emittedSteps.push(step);
774
+ onEmit?.(step);
775
+ };
776
+ }
777
+ function isAsyncIterable(value) {
778
+ return Boolean(value && typeof value === "object" && Symbol.asyncIterator in value);
779
+ }
780
+ async function* drainEmittedSteps(steps) {
781
+ while (steps.length > 0) {
782
+ const step = steps.shift();
783
+ if (step) yield step;
784
+ }
785
+ }
786
+ async function* yieldScriptResult(result, emittedSteps) {
787
+ yield* drainEmittedSteps(emittedSteps);
788
+ if (isAsyncIterable(result)) {
789
+ yield* result;
790
+ yield* drainEmittedSteps(emittedSteps);
791
+ } else if (typeof result === "string") {
792
+ yield messageStep(result);
793
+ } else if (Array.isArray(result)) {
794
+ yield* result;
795
+ } else if (result) {
796
+ yield result;
797
+ }
798
+ }
799
+
767
800
  // src/loops/agent-agent-loop/builtinLoopSources.ts
768
801
  var AgentAgentLoopArtifactResourceLifecycleScriptId = "builtin:agent-agent-loop/artifact-resource-lifecycle";
769
802
  var AgentAgentLoopDeclarativeAgentRunScriptId = "builtin:agent-agent-loop/declarative-agent-run";
@@ -1121,6 +1154,18 @@ function getBuiltinAgentAgentLoopSource(id) {
1121
1154
  }
1122
1155
 
1123
1156
  // src/loopAPI/scriptLoader.ts
1157
+ function createBuiltinAgentLoopScriptLoader(loaderOptions) {
1158
+ let builtinDigestsRegistered;
1159
+ return async (scriptReference, policy = {}) => {
1160
+ builtinDigestsRegistered ??= registerBuiltinScriptSources(loaderOptions.sources);
1161
+ await builtinDigestsRegistered;
1162
+ return loadAgentLoopScript(scriptReference, {
1163
+ ...policy,
1164
+ getBuiltinScriptSource: loaderOptions.getBuiltinScriptSource,
1165
+ scriptType: loaderOptions.scriptType
1166
+ });
1167
+ };
1168
+ }
1124
1169
  var DEFAULT_POLICY = {
1125
1170
  allowBuiltin: true,
1126
1171
  allowFile: false,
@@ -1295,30 +1340,19 @@ async function loadAgentLoopScript(scriptReference, options = {}) {
1295
1340
  }
1296
1341
 
1297
1342
  // src/loopAPI/agent-agent-loop/scriptLoader.ts
1298
- var builtinDigestsRegistered;
1299
- function ensureBuiltinDigestsRegistered() {
1300
- builtinDigestsRegistered ??= registerBuiltinScriptSources(builtinAgentAgentLoopSources);
1301
- return builtinDigestsRegistered;
1302
- }
1343
+ var loadScript = createBuiltinAgentLoopScriptLoader({
1344
+ sources: builtinAgentAgentLoopSources,
1345
+ getBuiltinScriptSource: getBuiltinAgentAgentLoopSource,
1346
+ scriptType: "AgentAgentLoop script"
1347
+ });
1303
1348
  async function loadAgentAgentLoopScript(scriptReference, options = {}) {
1304
- await ensureBuiltinDigestsRegistered();
1305
- return loadAgentLoopScript(scriptReference, {
1306
- ...options,
1307
- getBuiltinScriptSource: getBuiltinAgentAgentLoopSource,
1308
- scriptType: "AgentAgentLoop script"
1309
- });
1349
+ return loadScript(scriptReference, options);
1310
1350
  }
1311
1351
 
1312
1352
  // src/loopAPI/agent-agent-loop/loop.ts
1313
1353
  var LOOP_ID = "agent-agent-loop";
1314
1354
  var LOOP_NAME = "AgentAgent Loop";
1315
1355
  var LOOP_DESC = "Orchestrates child agents to collaborate on a task. Supports sequential chaining, parallel execution, and feedback loops.";
1316
- function isAsyncIterable(value) {
1317
- return Boolean(value && typeof value === "object" && Symbol.asyncIterator in value);
1318
- }
1319
- function messageStep(message) {
1320
- return { type: "message", data: message };
1321
- }
1322
1356
  function stepText(step) {
1323
1357
  if (step.type !== "message") return void 0;
1324
1358
  if (typeof step.data === "string") return step.data;
@@ -1372,10 +1406,7 @@ function createScriptArguments(input, context, emittedSteps) {
1372
1406
  if (key === "agents") return agentEntries;
1373
1407
  return readProfileAgentEntries(context.profile, key) ?? [];
1374
1408
  };
1375
- const emit = (step) => {
1376
- emittedSteps.push(step);
1377
- context.runtime?.emit?.(step);
1378
- };
1409
+ const emit = createScriptStepEmitter(emittedSteps, context.runtime?.emit);
1379
1410
  const log = (event, data) => {
1380
1411
  context.runtime?.log?.(event, data);
1381
1412
  };
@@ -1490,27 +1521,11 @@ function createScriptArguments(input, context, emittedSteps) {
1490
1521
  loadCheckpoint: context.runtime?.loadCheckpoint ?? (async () => void 0)
1491
1522
  };
1492
1523
  }
1493
- async function* drainEmittedSteps(steps) {
1494
- while (steps.length > 0) {
1495
- const step = steps.shift();
1496
- if (step) yield step;
1497
- }
1498
- }
1499
1524
  async function* runScript(script, input, context) {
1500
1525
  const emittedSteps = [];
1501
1526
  const scriptArguments = createScriptArguments(input, context, emittedSteps);
1502
1527
  const result = await script(scriptArguments);
1503
- yield* drainEmittedSteps(emittedSteps);
1504
- if (isAsyncIterable(result)) {
1505
- yield* result;
1506
- yield* drainEmittedSteps(emittedSteps);
1507
- } else if (typeof result === "string") {
1508
- yield messageStep(result);
1509
- } else if (Array.isArray(result)) {
1510
- yield* result;
1511
- } else if (result) {
1512
- yield result;
1513
- }
1528
+ yield* yieldScriptResult(result, emittedSteps);
1514
1529
  }
1515
1530
  function asAgentAgentContext(context) {
1516
1531
  return context;
@@ -1603,33 +1618,16 @@ function getBuiltinAgentToolLoopSource(id) {
1603
1618
  }
1604
1619
 
1605
1620
  // src/loopAPI/agent-tool-loop/scriptLoader.ts
1606
- var builtinDigestsRegistered2;
1607
- function ensureBuiltinDigestsRegistered2() {
1608
- builtinDigestsRegistered2 ??= registerBuiltinScriptSources(builtinAgentToolLoopSources);
1609
- return builtinDigestsRegistered2;
1610
- }
1621
+ var loadScript2 = createBuiltinAgentLoopScriptLoader({
1622
+ sources: builtinAgentToolLoopSources,
1623
+ getBuiltinScriptSource: getBuiltinAgentToolLoopSource,
1624
+ scriptType: "AgentToolLoop script"
1625
+ });
1611
1626
  async function loadAgentToolLoopScript(scriptReference, options = {}) {
1612
- await ensureBuiltinDigestsRegistered2();
1613
- return loadAgentLoopScript(scriptReference, {
1614
- ...options,
1615
- getBuiltinScriptSource: getBuiltinAgentToolLoopSource,
1616
- scriptType: "AgentToolLoop script"
1617
- });
1627
+ return loadScript2(scriptReference, options);
1618
1628
  }
1619
1629
 
1620
1630
  // src/loopAPI/agent-tool-loop/scriptRunner.ts
1621
- function isAsyncIterable2(value) {
1622
- return Boolean(value && typeof value === "object" && Symbol.asyncIterator in value);
1623
- }
1624
- function messageStep2(message) {
1625
- return { type: "message", data: message };
1626
- }
1627
- async function* drainEmittedSteps2(steps) {
1628
- while (steps.length > 0) {
1629
- const step = steps.shift();
1630
- if (step) yield step;
1631
- }
1632
- }
1633
1631
  function asAgentToolLoopContext(rawContext) {
1634
1632
  return rawContext;
1635
1633
  }
@@ -1641,10 +1639,7 @@ async function resolveAgentToolLoopScript(context) {
1641
1639
  return loadAgentToolLoopScript(scriptReference, context.scriptPolicy);
1642
1640
  }
1643
1641
  function createAgentToolLoopScriptContext(input, context, emittedSteps) {
1644
- const emit = (step) => {
1645
- emittedSteps.push(step);
1646
- context.runtime?.emit?.(step);
1647
- };
1642
+ const emit = createScriptStepEmitter(emittedSteps, context.runtime?.emit);
1648
1643
  return {
1649
1644
  input,
1650
1645
  context,
@@ -1655,7 +1650,7 @@ function createAgentToolLoopScriptContext(input, context, emittedSteps) {
1655
1650
  stopTurn: (state, reason) => stopAgentToolLoopTurn(context, input, state, reason),
1656
1651
  emit,
1657
1652
  finish: (message) => {
1658
- emit(typeof message === "string" ? messageStep2(message) : message);
1653
+ emit(typeof message === "string" ? messageStep(message) : message);
1659
1654
  },
1660
1655
  isCancelled: () => context.runtime?.signal?.cancelled === true || context.agentToolLoop?.isCancelled?.(input.conversationId) === true,
1661
1656
  log: (event, data) => {
@@ -1667,17 +1662,7 @@ function createAgentToolLoopScriptContext(input, context, emittedSteps) {
1667
1662
  async function* runAgentToolLoopScript(script, input, context) {
1668
1663
  const emittedSteps = [];
1669
1664
  const result = await script(createAgentToolLoopScriptContext(input, context, emittedSteps));
1670
- yield* drainEmittedSteps2(emittedSteps);
1671
- if (isAsyncIterable2(result)) {
1672
- yield* result;
1673
- yield* drainEmittedSteps2(emittedSteps);
1674
- } else if (typeof result === "string") {
1675
- yield messageStep2(result);
1676
- } else if (Array.isArray(result)) {
1677
- yield* result;
1678
- } else if (result) {
1679
- yield result;
1680
- }
1665
+ yield* yieldScriptResult(result, emittedSteps);
1681
1666
  }
1682
1667
 
1683
1668
  // src/loopAPI/agent-tool-loop/loop.ts
@@ -3635,4 +3620,4 @@ export {
3635
3620
  createAgentAgentLoopDefinition,
3636
3621
  getAgentAgentLoopId
3637
3622
  };
3638
- //# sourceMappingURL=chunk-5VYZV33O.js.map
3623
+ //# sourceMappingURL=chunk-KTZDDC7M.js.map