@zihin/agent-client 0.8.0 → 0.9.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/README.md +23 -0
- package/dist/chunk-E2AJSAPA.mjs +2220 -0
- package/dist/core.d.mts +1150 -0
- package/dist/core.d.ts +1150 -0
- package/dist/core.js +2255 -0
- package/dist/core.mjs +38 -0
- package/dist/index.d.mts +17 -1114
- package/dist/index.d.ts +17 -1114
- package/dist/index.js +97 -49
- package/dist/index.mjs +42 -2173
- package/package.json +18 -1
package/README.md
CHANGED
|
@@ -448,6 +448,29 @@ const zihin = createClient({
|
|
|
448
448
|
> um host que **resolva** para IP privado (DNS rebinding) passa. Isto não substitui bloqueio de
|
|
449
449
|
> egresso na borda de rede — mantenha o whitelist (default) em ambiente sensível.
|
|
450
450
|
|
|
451
|
+
## Runtime injetável (`@zihin/agent-client/core`)
|
|
452
|
+
|
|
453
|
+
O entry principal já usa os timers globais e `process.emitWarning` — nada muda para quem importa
|
|
454
|
+
`@zihin/agent-client`. O entry `@zihin/agent-client/core` é o mesmo núcleo **sem** essas
|
|
455
|
+
referências globais, para hosts que as proíbem no código publicado (o scanner de nó verificado do
|
|
456
|
+
n8n reprova `setTimeout`, `globalThis`, `process` e `console`). Ali o cliente exige `runtime`:
|
|
457
|
+
|
|
458
|
+
```ts
|
|
459
|
+
import { createClient } from '@zihin/agent-client/core';
|
|
460
|
+
import { sleepWithAbort } from 'n8n-workflow';
|
|
461
|
+
|
|
462
|
+
const zihin = createClient({
|
|
463
|
+
apiKey,
|
|
464
|
+
runtime: {
|
|
465
|
+
sleep: sleepWithAbort, // backoff entre tentativas e relógio do deadline
|
|
466
|
+
warn: (code, msg) => logger.warn(`[${code}] ${msg}`), // opcional; ausente = silencioso
|
|
467
|
+
},
|
|
468
|
+
});
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
`sleep(ms, signal)` deve resolver após `ms`, rejeitar se `signal` abortar e manter o processo vivo
|
|
472
|
+
enquanto pendente. Qualquer rejeição vira `ZihinAgentError` com `kind: 'aborted'`.
|
|
473
|
+
|
|
451
474
|
## Segurança
|
|
452
475
|
|
|
453
476
|
Reusa as primitivas de `security.ts`: validação SSRF da base URL (whitelist Zihin por padrão; libere
|