@piagent/platform 1.37.0 → 1.37.1

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 (67) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +1 -1
  3. package/README.vi.md +1 -1
  4. package/docs/command-reference-vietnamese.md +2 -2
  5. package/docs/distribution-standard.md +6 -6
  6. package/docs/languages.json +2 -2
  7. package/docs/operator-manual-vietnamese.md +7 -7
  8. package/docs/publishing-for-teams.md +1 -0
  9. package/docs/release-install-policy.md +2 -2
  10. package/docs/team-onboarding.md +2 -2
  11. package/docs-site/architecture.html +1 -1
  12. package/docs-site/benchmark.html +1 -1
  13. package/docs-site/commands.html +1 -1
  14. package/docs-site/content/en/index.html +4 -4
  15. package/docs-site/content/en/whats-new.html +6 -0
  16. package/docs-site/content/index.html +4 -4
  17. package/docs-site/content/whats-new.html +6 -0
  18. package/docs-site/context-engine.html +1 -1
  19. package/docs-site/ecosystem.html +1 -1
  20. package/docs-site/en/architecture.html +1 -1
  21. package/docs-site/en/benchmark.html +1 -1
  22. package/docs-site/en/commands.html +1 -1
  23. package/docs-site/en/context-engine.html +1 -1
  24. package/docs-site/en/ecosystem.html +1 -1
  25. package/docs-site/en/index.html +5 -5
  26. package/docs-site/en/mcp-approval.html +1 -1
  27. package/docs-site/en/mcp-auth.html +1 -1
  28. package/docs-site/en/mcp-servers.html +1 -1
  29. package/docs-site/en/mcp.html +1 -1
  30. package/docs-site/en/permissions.html +1 -1
  31. package/docs-site/en/profiles.html +1 -1
  32. package/docs-site/en/quickstart.html +1 -1
  33. package/docs-site/en/runtime.html +1 -1
  34. package/docs-site/en/scope.html +1 -1
  35. package/docs-site/en/security.html +1 -1
  36. package/docs-site/en/team.html +1 -1
  37. package/docs-site/en/whats-new.html +7 -1
  38. package/docs-site/en/windows.html +1 -1
  39. package/docs-site/en/workflows.html +1 -1
  40. package/docs-site/index.html +5 -5
  41. package/docs-site/mcp-approval.html +1 -1
  42. package/docs-site/mcp-auth.html +1 -1
  43. package/docs-site/mcp-servers.html +1 -1
  44. package/docs-site/mcp.html +1 -1
  45. package/docs-site/permissions.html +1 -1
  46. package/docs-site/profiles.html +1 -1
  47. package/docs-site/quickstart.html +1 -1
  48. package/docs-site/runtime.html +1 -1
  49. package/docs-site/scope.html +1 -1
  50. package/docs-site/security.html +1 -1
  51. package/docs-site/team.html +1 -1
  52. package/docs-site/whats-new.html +7 -1
  53. package/docs-site/windows.html +1 -1
  54. package/docs-site/workflows.html +1 -1
  55. package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
  56. package/package.json +1 -1
  57. package/packages/piagent-core/managed/helper-run.mjs +11 -1
  58. package/packages/piagent-core/managed/helper-settlement.mjs +17 -6
  59. package/packages/piagent-core/managed/ip-policy.mjs +50 -0
  60. package/packages/piagent-core/managed/memory-lessons.mjs +4 -1
  61. package/packages/piagent-core/managed/memory.mjs +1 -1
  62. package/packages/piagent-core/managed/package-proxy.mjs +12 -14
  63. package/packages/piagent-core/managed/session.mjs +4 -5
  64. package/packages/piagent-core/managed/skill-feedback.mjs +9 -1
  65. package/packages/piagent-core/managed/studio-link.mjs +16 -0
  66. package/packages/piagent-core/managed/web-fetch.mjs +3 -14
  67. package/packages/piagent-core/package.json +1 -1
@@ -269,3 +269,19 @@ export async function viaLink(link, ask, { conversation = null, runId = null } =
269
269
  }
270
270
  }
271
271
  }
272
+
273
+ // Closing a round's run, asked again through the link. Only a refused report
274
+ // closes again without it; an unconfirmed close throws (the turn fails). An
275
+ // Agent Watch without close-retry forgets a run whose close failed, so asking
276
+ // again "succeeds" without reaching Studio: false then, and the run stays
277
+ // "active" for the runtime (reopening recovers or abandons it).
278
+ export async function closeRun(link, broker, features, process, where) {
279
+ let unsent = false;
280
+ const close = args => viaLink(link, () => broker.request('close', args).catch(error => {
281
+ if (!features.includes('close-retry') && String(error?.message) !== 'managed-broker:invalidResponse') unsent = true;
282
+ throw error;
283
+ }), where);
284
+ try { await close(process ? { process } : {}); }
285
+ catch (error) { if (!process || String(error?.message) !== 'managed-broker:invalidResponse') throw error; await close(); }
286
+ return !unsent;
287
+ }
@@ -2,6 +2,9 @@ import dns from 'node:dns/promises';
2
2
  import https from 'node:https';
3
3
  import net from 'node:net';
4
4
  import zlib from 'node:zlib';
5
+ import { privateAddress } from './ip-policy.mjs';
6
+
7
+ export { privateAddress };
5
8
 
6
9
  // Reads one public https page for the company session, from the runtime
7
10
  // process (tools in the sandbox have no network). GET only, no cookies or
@@ -11,20 +14,6 @@ const MAX_BYTES = 5 * 1024 * 1024;
11
14
  const MAX_REDIRECTS = 5;
12
15
  const TEXT = /^(text\/|application\/(json|xml|xhtml\+xml|javascript|x-yaml|yaml|ld\+json|rss\+xml|atom\+xml))/i;
13
16
 
14
- function v4Private(address) {
15
- const [a, b] = address.split('.').map(Number);
16
- return a === 0 || a === 10 || a === 127 || a >= 224 || (a === 100 && b >= 64 && b <= 127) || (a === 169 && b === 254)
17
- || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168) || (a === 192 && b === 0) || (a === 198 && (b === 18 || b === 19));
18
- }
19
- export function privateAddress(address) {
20
- if (net.isIPv4(address)) return v4Private(address);
21
- if (!net.isIPv6(address)) return true;
22
- const value = address.toLowerCase();
23
- const mapped = value.match(/^(?:0*:)*:ffff:(\d+\.\d+\.\d+\.\d+)$/) ?? value.match(/^64:ff9b::(\d+\.\d+\.\d+\.\d+)$/);
24
- if (mapped) return v4Private(mapped[1]);
25
- return value === '::' || value === '::1' || /^f[cd]/.test(value) || /^fe[89ab]/.test(value) || /^ff/.test(value) || value.startsWith('2001:db8');
26
- }
27
-
28
17
  async function publicTarget(url, resolve) {
29
18
  if (url.protocol !== 'https:' || url.username || url.password) throw new Error('web-fetch-url-not-allowed');
30
19
  const host = url.hostname.replace(/^\[|\]$/g, '');
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piagent/core",
3
- "version": "1.37.0",
3
+ "version": "1.37.1",
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "license": "MIT",