@awiki/dsh-plugin 0.2.0-rc.4

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 (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/README.zh.md +114 -0
  4. package/THIRD_PARTY_NOTICES.md +21 -0
  5. package/cordis.patch.yml +26 -0
  6. package/lib/client.js +8398 -0
  7. package/lib/client.js.map +1 -0
  8. package/lib/index.js +1497 -0
  9. package/lib/invariant.js +16 -0
  10. package/lib/provider.js +22 -0
  11. package/lib/sdk-adapter-DPPZhs6p.mjs +316 -0
  12. package/lib/summary-provider.js +192 -0
  13. package/lib/typert.host.d.ts +3 -0
  14. package/lib/typert.host.js +1201 -0
  15. package/lib/typert.remote-client.d.ts +54 -0
  16. package/lib/typert.remote-client.d.ts.map +1 -0
  17. package/lib/typert.remote-client.js +817 -0
  18. package/lib/types/client/AwikiOverlay.d.ts +22 -0
  19. package/lib/types/client/AwikiOverlay.d.ts.map +1 -0
  20. package/lib/types/client/AwikiOverlay.js +689 -0
  21. package/lib/types/client/AwikiOverlay.js.map +1 -0
  22. package/lib/types/client/AwikiSettingsSection.d.ts +25 -0
  23. package/lib/types/client/AwikiSettingsSection.d.ts.map +1 -0
  24. package/lib/types/client/AwikiSettingsSection.js +119 -0
  25. package/lib/types/client/AwikiSettingsSection.js.map +1 -0
  26. package/lib/types/client/assets.d.ts +3 -0
  27. package/lib/types/client/assets.d.ts.map +1 -0
  28. package/lib/types/client/assets.js +70 -0
  29. package/lib/types/client/assets.js.map +1 -0
  30. package/lib/types/client/controller.d.ts +194 -0
  31. package/lib/types/client/controller.d.ts.map +1 -0
  32. package/lib/types/client/controller.js +701 -0
  33. package/lib/types/client/controller.js.map +1 -0
  34. package/lib/types/client/file.d.ts +20 -0
  35. package/lib/types/client/file.d.ts.map +1 -0
  36. package/lib/types/client/file.js +41 -0
  37. package/lib/types/client/file.js.map +1 -0
  38. package/lib/types/client/index.d.ts +16 -0
  39. package/lib/types/client/index.d.ts.map +1 -0
  40. package/lib/types/client/index.js +129 -0
  41. package/lib/types/client/index.js.map +1 -0
  42. package/lib/types/client/settings-controller.d.ts +28 -0
  43. package/lib/types/client/settings-controller.d.ts.map +1 -0
  44. package/lib/types/client/settings-controller.js +139 -0
  45. package/lib/types/client/settings-controller.js.map +1 -0
  46. package/lib/types/client/settings-locales.d.ts +13 -0
  47. package/lib/types/client/settings-locales.d.ts.map +1 -0
  48. package/lib/types/client/settings-locales.js +68 -0
  49. package/lib/types/client/settings-locales.js.map +1 -0
  50. package/lib/types/client/slots.d.ts +74 -0
  51. package/lib/types/client/slots.d.ts.map +1 -0
  52. package/lib/types/client/slots.js +3 -0
  53. package/lib/types/client/slots.js.map +1 -0
  54. package/lib/types/client/store.d.ts +18 -0
  55. package/lib/types/client/store.d.ts.map +1 -0
  56. package/lib/types/client/store.js +17 -0
  57. package/lib/types/client/store.js.map +1 -0
  58. package/lib/types/client.d.ts +3 -0
  59. package/lib/types/client.d.ts.map +1 -0
  60. package/lib/types/client.js +3 -0
  61. package/lib/types/client.js.map +1 -0
  62. package/lib/types/domain.d.ts +10 -0
  63. package/lib/types/domain.d.ts.map +1 -0
  64. package/lib/types/domain.js +18 -0
  65. package/lib/types/domain.js.map +1 -0
  66. package/lib/types/index.d.ts +188 -0
  67. package/lib/types/index.d.ts.map +1 -0
  68. package/lib/types/index.js +861 -0
  69. package/lib/types/index.js.map +1 -0
  70. package/lib/types/invariant.d.ts +9 -0
  71. package/lib/types/invariant.d.ts.map +1 -0
  72. package/lib/types/invariant.js +14 -0
  73. package/lib/types/invariant.js.map +1 -0
  74. package/lib/types/provider-api.d.ts +70 -0
  75. package/lib/types/provider-api.d.ts.map +1 -0
  76. package/lib/types/provider-api.js +3 -0
  77. package/lib/types/provider-api.js.map +1 -0
  78. package/lib/types/provider.d.ts +9 -0
  79. package/lib/types/provider.d.ts.map +1 -0
  80. package/lib/types/provider.js +20 -0
  81. package/lib/types/provider.js.map +1 -0
  82. package/lib/types/sdk-adapter.d.ts +46 -0
  83. package/lib/types/sdk-adapter.d.ts.map +1 -0
  84. package/lib/types/sdk-adapter.js +327 -0
  85. package/lib/types/sdk-adapter.js.map +1 -0
  86. package/lib/types/session.d.ts +14 -0
  87. package/lib/types/session.d.ts.map +1 -0
  88. package/lib/types/session.js +76 -0
  89. package/lib/types/session.js.map +1 -0
  90. package/lib/types/settings-rpc-contract.d.ts +34 -0
  91. package/lib/types/settings-rpc-contract.d.ts.map +1 -0
  92. package/lib/types/settings-rpc-contract.js +62 -0
  93. package/lib/types/settings-rpc-contract.js.map +1 -0
  94. package/lib/types/settings-rpc.d.ts +6 -0
  95. package/lib/types/settings-rpc.d.ts.map +1 -0
  96. package/lib/types/settings-rpc.js +147 -0
  97. package/lib/types/settings-rpc.js.map +1 -0
  98. package/lib/types/settings.d.ts +13 -0
  99. package/lib/types/settings.d.ts.map +1 -0
  100. package/lib/types/settings.js +15 -0
  101. package/lib/types/settings.js.map +1 -0
  102. package/lib/types/summary-provider-api.d.ts +45 -0
  103. package/lib/types/summary-provider-api.d.ts.map +1 -0
  104. package/lib/types/summary-provider-api.js +3 -0
  105. package/lib/types/summary-provider-api.js.map +1 -0
  106. package/lib/types/summary-provider.d.ts +48 -0
  107. package/lib/types/summary-provider.d.ts.map +1 -0
  108. package/lib/types/summary-provider.js +208 -0
  109. package/lib/types/summary-provider.js.map +1 -0
  110. package/lib/types/tools.d.ts +20 -0
  111. package/lib/types/tools.d.ts.map +1 -0
  112. package/lib/types/tools.js +139 -0
  113. package/lib/types/tools.js.map +1 -0
  114. package/lib/types/types.d.ts +292 -0
  115. package/lib/types/types.d.ts.map +1 -0
  116. package/lib/types/types.js +6 -0
  117. package/lib/types/types.js.map +1 -0
  118. package/package.json +179 -0
@@ -0,0 +1,74 @@
1
+ /** Composed props and injected browser operations for the AWiki overlay. */
2
+ import type { HostObservable, InjectFace, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots';
3
+ import type { AwikiAttachmentId, AwikiConversationId, AwikiDownloadedAttachment, AwikiIdentity, AwikiMessageId, AwikiRegistrationOtpRequest, AwikiRegistrationOtpResult, AwikiRegistrationRequest, AwikiConversationSummary, AwikiSession } from '@awiki/dsh-plugin/types';
4
+ import type { AwikiActionResult, AwikiView } from './controller.ts';
5
+ import type { createAwikiOverlayStore } from './store.ts';
6
+ /** Injected browser actions; components never receive Cordis ctx or Remote. */
7
+ export interface AwikiInjected {
8
+ hooks: {
9
+ /** One controller snapshot shared by the trigger and drawer. */
10
+ awiki: HostObservable<AwikiView>;
11
+ };
12
+ /** Load browser-safe policy, identity, and the first conversation page, then keep unread state fresh. */
13
+ open: () => Promise<AwikiActionResult>;
14
+ /** Stop polling and invalidate work when the overlay is unmounted. */
15
+ close: () => void;
16
+ /**
17
+ * Request a registration verification code.
18
+ * @param request - desired Handle and verification phone number.
19
+ */
20
+ sendRegistrationOtp: (request: AwikiRegistrationOtpRequest) => Promise<AwikiActionResult<AwikiRegistrationOtpResult>>;
21
+ /**
22
+ * Register the deployment's shared identity.
23
+ * @param request - Handle, phone number, and verification code.
24
+ */
25
+ registerIdentity: (request: AwikiRegistrationRequest) => Promise<AwikiActionResult<AwikiIdentity>>;
26
+ /** Update the deployment identity's public WNS display name. */
27
+ updateDisplayName: (displayName: string) => Promise<AwikiActionResult<AwikiIdentity>>;
28
+ /** Load the next conversation page with the Host-owned cursor. */
29
+ loadMoreConversations: () => Promise<AwikiActionResult>;
30
+ /**
31
+ * Open an existing direct conversation or a local draft for one Handle.
32
+ * @param handle - peer Handle or DID typed by the user.
33
+ */
34
+ startDirectChat: (handle: string) => Promise<AwikiActionResult>;
35
+ /**
36
+ * Select one conversation or return to the roster.
37
+ * @param conversationId - conversation identifier, or `null` for the roster.
38
+ */
39
+ selectConversation: (conversationId: AwikiConversationId | null) => Promise<AwikiActionResult>;
40
+ /** Load the next older history page for the selected conversation. */
41
+ loadOlderHistory: () => Promise<AwikiActionResult>;
42
+ /** Generate or regenerate the selected conversation's AI summary. */
43
+ summarizeConversation: () => Promise<AwikiActionResult<AwikiConversationSummary>>;
44
+ /** Toggle a cached summary without invoking the model. */
45
+ setSummaryCollapsed: (conversationId: AwikiConversationId, collapsed: boolean) => void;
46
+ /**
47
+ * Send text to the selected conversation.
48
+ * @param text - non-empty composer text.
49
+ */
50
+ sendText: (text: string) => Promise<AwikiActionResult>;
51
+ /**
52
+ * Send one JSON-safe file payload to the selected conversation.
53
+ * @param file - file metadata, base64 bytes, and an optional caption.
54
+ */
55
+ sendAttachment: (file: {
56
+ readonly fileName: string;
57
+ readonly mimeType: string;
58
+ readonly bytesBase64: string;
59
+ readonly caption?: string;
60
+ }) => Promise<AwikiActionResult>;
61
+ /**
62
+ * Download one attachment through its containing message.
63
+ * @param messageId - message that contains the attachment.
64
+ * @param attachmentId - attachment selected by the user.
65
+ */
66
+ downloadAttachment: (messageId: AwikiMessageId, attachmentId: AwikiAttachmentId) => Promise<AwikiActionResult<AwikiDownloadedAttachment>>;
67
+ /** Sign out on this installation without deleting local identity data. */
68
+ logout: () => Promise<AwikiActionResult<AwikiSession>>;
69
+ /** Resume the same locally preserved identity. */
70
+ login: () => Promise<AwikiActionResult<AwikiSession>>;
71
+ }
72
+ /** Full four-share props of the floating launcher and anchored `shell.overlay` panel. */
73
+ export type AwikiOverlayProps = PropsRuntime<'shell.overlay'> & PropsStore<ReturnType<typeof createAwikiOverlayStore>> & InjectFace<AwikiInjected>;
74
+ //# sourceMappingURL=slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../../src/client/slots.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,OAAO,KAAK,EACV,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EACrD,MAAM,kCAAkC,CAAA;AAEzC,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,aAAa,EACb,cAAc,EACd,2BAA2B,EA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C,wBAAwB,CAAC,CAAC,CAAA;IACjF,0DAA0D;IAC1D,mBAAmB,EAAE,CAAC,cAAc,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;IACtF;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACtD;;;OAGG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE;QACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;QAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAC1B,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAChC;;;;OAIG;IACH,kBAAkB,EAAE,CAClB,SAAS,EAAE,cAAc,EACzB,YAAY,EAAE,iBAAiB,KAC5B,OAAO,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC,CAAA;IAC1D,0EAA0E;IAC1E,MAAM,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAA;IACtD,kDAAkD;IAClD,KAAK,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAA;CACtD;AAED,yFAAyF;AACzF,MAAM,MAAM,iBAAiB,GAC3B,YAAY,CAAC,eAAe,CAAC,GAC3B,UAAU,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,GACtD,UAAU,CAAC,aAAa,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** Composed props and injected browser operations for the AWiki overlay. */
2
+ export {};
3
+ //# sourceMappingURL=slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.js","sourceRoot":"","sources":["../../../src/client/slots.ts"],"names":[],"mappings":"AAAA,4EAA4E"}
@@ -0,0 +1,18 @@
1
+ /** Root-scoped interaction state for the AWiki overlay. */
2
+ import { type EngineStoreHandle } from '@deepseek-ai/dsh-client-runtime/client';
3
+ /** State that survives the overlay entry's component remounts. */
4
+ export interface AwikiOverlayState {
5
+ open: boolean;
6
+ }
7
+ type AwikiOverlayActions = {
8
+ open: (draft: AwikiOverlayState) => void;
9
+ close: (draft: AwikiOverlayState) => void;
10
+ toggle: (draft: AwikiOverlayState) => void;
11
+ };
12
+ /**
13
+ * Create the overlay's root-scoped interaction store.
14
+ * @returns a fresh framework store handle.
15
+ */
16
+ export declare function createAwikiOverlayStore(): EngineStoreHandle<AwikiOverlayState, AwikiOverlayActions>;
17
+ export {};
18
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/client/store.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAE3D,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAE5F,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,OAAO,CAAA;CACd;AAED,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACxC,KAAK,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAA;IACzC,MAAM,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAA;CAC3C,CAAA;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,iBAAiB,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CASnG"}
@@ -0,0 +1,17 @@
1
+ /** Root-scoped interaction state for the AWiki overlay. */
2
+ import { defineStore } from '@deepseek-ai/dsh-client-runtime/client';
3
+ /**
4
+ * Create the overlay's root-scoped interaction store.
5
+ * @returns a fresh framework store handle.
6
+ */
7
+ export function createAwikiOverlayStore() {
8
+ return defineStore({
9
+ init: () => ({ open: false }),
10
+ actions: {
11
+ open: (draft) => { draft.open = true; },
12
+ close: (draft) => { draft.open = false; },
13
+ toggle: (draft) => { draft.open = !draft.open; },
14
+ },
15
+ });
16
+ }
17
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/client/store.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAE3D,OAAO,EAAE,WAAW,EAA0B,MAAM,wCAAwC,CAAA;AAa5F;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,WAAW,CAAC;QACjB,IAAI,EAAE,GAAsB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAChD,OAAO,EAAE;YACP,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,GAAG,IAAI,CAAA,CAAC,CAAC;YACtC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAA,CAAC,CAAC;YACxC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAA,CAAC,CAAC;SAChD;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Client compilation projection of the AWiki Remote data types. */
2
+ export type * from './types.ts';
3
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,mBAAmB,YAAY,CAAA"}
@@ -0,0 +1,3 @@
1
+ /** Client compilation projection of the AWiki Remote data types. */
2
+ export {};
3
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,oEAAoE"}
@@ -0,0 +1,10 @@
1
+ /** Client-safe AWiki Handle provider domain constants and validation. */
2
+ /** Default Handle provider domain for new AWiki deployments. */
3
+ export declare const DEFAULT_AWIKI_DOMAIN = "awiki.ai";
4
+ /** Field carrying the Handle provider domain in the AWiki settings namespace. */
5
+ export declare const AWIKI_DOMAIN_FIELD = "domain";
6
+ /** Settings namespace owned by the AWiki plugin. */
7
+ export declare const AWIKI_SETTINGS_NAMESPACE = "awiki";
8
+ /** Normalize and validate one DNS provider domain. */
9
+ export declare function normalizeAwikiDomain(raw: string, field?: string): string;
10
+ //# sourceMappingURL=domain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../src/domain.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,gEAAgE;AAChE,eAAO,MAAM,oBAAoB,aAAa,CAAA;AAE9C,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,WAAW,CAAA;AAE1C,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,UAAU,CAAA;AAE/C,sDAAsD;AACtD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAW,GAAG,MAAM,CAQ1E"}
@@ -0,0 +1,18 @@
1
+ /** Client-safe AWiki Handle provider domain constants and validation. */
2
+ /** Default Handle provider domain for new AWiki deployments. */
3
+ export const DEFAULT_AWIKI_DOMAIN = 'awiki.ai';
4
+ /** Field carrying the Handle provider domain in the AWiki settings namespace. */
5
+ export const AWIKI_DOMAIN_FIELD = 'domain';
6
+ /** Settings namespace owned by the AWiki plugin. */
7
+ export const AWIKI_SETTINGS_NAMESPACE = 'awiki';
8
+ /** Normalize and validate one DNS provider domain. */
9
+ export function normalizeAwikiDomain(raw, field = 'domain') {
10
+ const value = raw.trim().toLowerCase();
11
+ const valid = /^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u
12
+ .test(value);
13
+ if (value.length > 253 || !valid) {
14
+ throw new TypeError(`awiki: ${field} must contain a valid DNS domain`);
15
+ }
16
+ return value;
17
+ }
18
+ //# sourceMappingURL=domain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain.js","sourceRoot":"","sources":["../../src/domain.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,gEAAgE;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAA;AAE9C,iFAAiF;AACjF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAA;AAE1C,oDAAoD;AACpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAA;AAE/C,sDAAsD;AACtD,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,KAAK,GAAG,QAAQ;IAChE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACtC,MAAM,KAAK,GAAG,iGAAiG;SAC5G,IAAI,CAAC,KAAK,CAAC,CAAA;IACd,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QACjC,MAAM,IAAI,SAAS,CAAC,UAAU,KAAK,kCAAkC,CAAC,CAAA;IACxE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,188 @@
1
+ /** Unified AWiki identity, messaging, attachment, Remote, and model-tool service. */
2
+ import { Context } from '@deepseek-ai/cordis';
3
+ import z from '@deepseek-ai/schemastery';
4
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
5
+ import type { AwikiClearLocalDataRequest, AwikiClearLocalDataResult, AwikiConversation, AwikiConversationSummary, AwikiDownloadAttachmentRequest, AwikiDownloadedAttachment, AwikiHistoryRequest, AwikiHostClient, AwikiIdentity, AwikiLogoutRequest, AwikiMessage, AwikiMarkConversationReadRequest, AwikiPage, AwikiPageRequest, AwikiRegistrationOtpRequest, AwikiRegistrationOtpResult, AwikiRegistrationRequest, AwikiResolvePeerRequest, AwikiResolvedPeer, AwikiResult, AwikiRuntimeConfig, AwikiSession, AwikiSendAttachmentRequest, AwikiSendTextRequest, AwikiSummarizeConversationRequest, AwikiUpdateDisplayNameRequest } from './types.ts';
6
+ import type { AwikiClientFactory } from './provider-api.ts';
7
+ import type { AwikiSummaryProvider } from './summary-provider-api.ts';
8
+ export type * from './types.ts';
9
+ export { AWIKI_CLEAR_LOCAL_DATA_CONFIRMATION, AWIKI_LOGOUT_CONFIRMATION } from './types.ts';
10
+ export type { AwikiClientFactory, AwikiClientOptions, AwikiSdkClient } from './provider-api.ts';
11
+ export type { AwikiSummaryProvider, AwikiSummaryProviderRequest, AwikiSummaryProviderResult, AwikiSummarySourceMessage, } from './summary-provider-api.ts';
12
+ export { AWIKI_DOMAIN_FIELD, AWIKI_SETTINGS_NAMESPACE, AwikiSettingsSchema, DEFAULT_AWIKI_DOMAIN, normalizeAwikiDomain, validateAwikiSettings, type AwikiSettings, } from './settings.ts';
13
+ export { AWIKI_HISTORY_TOOL, AWIKI_IDENTITY_STATUS_TOOL, AWIKI_LIST_CONVERSATIONS_TOOL, AWIKI_SEND_ATTACHMENT_TOOL, AWIKI_SEND_MESSAGE_TOOL, } from './tools.ts';
14
+ declare module '@deepseek-ai/cordis' {
15
+ interface Context {
16
+ awiki: AwikiService;
17
+ }
18
+ }
19
+ /** Default maximum attachment size: 10 MiB. */
20
+ export declare const DEFAULT_ATTACHMENT_MAX_BYTES: number;
21
+ /** Default browser polling interval while the AWiki drawer is open. */
22
+ export declare const DEFAULT_POLL_INTERVAL_MS = 3000;
23
+ /** Default AWiki production service origin. */
24
+ export declare const DEFAULT_AWIKI_SERVICE_URL = "https://awiki.ai";
25
+ /** Default authoritative AWiki message-service DID. */
26
+ export declare const DEFAULT_AWIKI_MESSAGE_SERVICE_DID = "did:wba:awiki.ai";
27
+ /** Host-owned model input cap after message minimization. */
28
+ export declare const DEFAULT_SUMMARY_MAX_INPUT_BYTES: number;
29
+ /** Hard limit for one user-triggered conversation summary. */
30
+ export declare const MAX_SUMMARY_MESSAGES = 50;
31
+ /** Host deployment configuration. */
32
+ export interface Config {
33
+ /** AWiki user-service base URL. Production deployments require HTTPS. */
34
+ readonly userServiceUrl?: string;
35
+ /** Handle provider domain used by Legacy registration. */
36
+ readonly userServiceDomain?: string;
37
+ /** AWiki message-service base URL. Production deployments require HTTPS. */
38
+ readonly messageServiceUrl?: string;
39
+ /** Public message-service base URL published in the identity DID document. */
40
+ readonly messageServicePublicUrl?: string;
41
+ /** Authoritative DID of the configured message service. */
42
+ readonly messageServiceDid?: string;
43
+ /** Exact HTTPS origins allowed for discovered attachment object URLs. Defaults to the public message-service origin. */
44
+ readonly allowedAttachmentOrigins?: string[];
45
+ /** Permit loopback HTTP only for local tests. Defaults to false. */
46
+ readonly allowInsecureLoopbackForTesting?: boolean;
47
+ /** Rust IM Core root for identity, SQLite, cache, and compatibility state. */
48
+ readonly stateRoot?: string;
49
+ /** Complete decoded attachment byte limit. Defaults to 10 MiB. */
50
+ readonly attachmentMaxBytes?: number;
51
+ /** Browser history polling interval while its drawer is open. Defaults to 3000 ms. */
52
+ readonly pollIntervalMs?: number;
53
+ /** Maximum UTF-8 bytes of minimized message JSON sent to a summary provider. */
54
+ readonly summaryMaxInputBytes?: number;
55
+ }
56
+ /** Loader schema for the Host deployment configuration. */
57
+ export declare const Config: z<Config>;
58
+ /** Deployment-wide AWiki service over one replaceable high-level client provider. */
59
+ export declare class AwikiService extends TypertRemoteService implements AwikiHostClient {
60
+ static inject: string[];
61
+ static Config: z<Config>;
62
+ private readonly resolved;
63
+ private readonly sessionStore;
64
+ private startupUserServiceDomain;
65
+ private settingsProvider;
66
+ private provider;
67
+ private signedOut;
68
+ private sessionMutation;
69
+ private sessionRevision;
70
+ private readonly activeSummaryRequests;
71
+ private summaryProvider;
72
+ /**
73
+ * @param ctx - owning Host context.
74
+ * @param config - service endpoints, SDK state path, and public limits.
75
+ */
76
+ constructor(ctx: Context, config: Config);
77
+ /**
78
+ * Register the deployment's sole client factory. The caller must return the
79
+ * resulting disposer from its own `ctx.effect`; disposal clears the slot
80
+ * before awaiting the client's quiescence and is idempotent.
81
+ * @param factory - synchronous factory for one owned high-level client.
82
+ * @returns asynchronous disposer for the exact registered client.
83
+ */
84
+ registerClientFactory(factory: AwikiClientFactory): () => Promise<void>;
85
+ /** Register one replaceable conversation-summary provider for this deployment. */
86
+ registerSummaryProvider(provider: AwikiSummaryProvider): () => void;
87
+ /**
88
+ * Read settings needed by the browser presentation.
89
+ * @returns Browser-safe polling configuration without SDK endpoints or state paths.
90
+ */
91
+ getConfig(): Promise<AwikiResult<AwikiRuntimeConfig>>;
92
+ /**
93
+ * Read the deployment's identity status.
94
+ * @returns The public deployment identity or `null`.
95
+ */
96
+ getIdentity(): Promise<AwikiResult<AwikiIdentity | null>>;
97
+ /** Return the local registration and sign-in state without exposing secrets. */
98
+ getSession(): Promise<AwikiResult<AwikiSession>>;
99
+ /** Lock this installation while preserving the encrypted identity and local database. */
100
+ logout(request: AwikiLogoutRequest): Promise<AwikiResult<AwikiSession>>;
101
+ /** Resume the same locally preserved identity without registration. */
102
+ login(): Promise<AwikiResult<AwikiSession>>;
103
+ /**
104
+ * Send one Legacy registration verification code.
105
+ * @param request - Handle and phone used for the registration challenge.
106
+ * @returns Public retry timing or a closed failure.
107
+ */
108
+ sendRegistrationOtp(request: AwikiRegistrationOtpRequest): Promise<AwikiResult<AwikiRegistrationOtpResult>>;
109
+ /**
110
+ * Register and persist the deployment's only AWiki identity.
111
+ * @param request - Handle, phone, and verification code for registration.
112
+ * @returns The new public identity or a closed failure.
113
+ */
114
+ registerIdentity(request: AwikiRegistrationRequest): Promise<AwikiResult<AwikiIdentity>>;
115
+ /**
116
+ * Update the deployment identity's public WNS display name.
117
+ * @param request - replacement display name selected by the user.
118
+ * @returns The updated public identity or a closed failure.
119
+ */
120
+ updateDisplayName(request: AwikiUpdateDisplayNameRequest): Promise<AwikiResult<AwikiIdentity>>;
121
+ /**
122
+ * Resolve one Handle or DID before the browser opens a direct chat.
123
+ * @param request - typed Handle or DID.
124
+ * @returns The public peer and conversation id, or a closed failure.
125
+ */
126
+ resolvePeer(request: AwikiResolvePeerRequest): Promise<AwikiResult<AwikiResolvedPeer>>;
127
+ /**
128
+ * List direct and existing group conversations.
129
+ * @param request - Optional opaque cursor and page limit.
130
+ * @returns One page of direct and existing group conversations.
131
+ */
132
+ listConversations(request?: AwikiPageRequest): Promise<AwikiResult<AwikiPage<AwikiConversation>>>;
133
+ /**
134
+ * Read one direct or group conversation history page.
135
+ * @param request - Conversation id, optional cursor, and page limit.
136
+ * @returns One chronological history page.
137
+ */
138
+ getHistory(request: AwikiHistoryRequest): Promise<AwikiResult<AwikiPage<AwikiMessage>>>;
139
+ /**
140
+ * Read real AWiki history, enforce range and byte caps, then invoke the configured model once.
141
+ * @param request - selected conversation and its unread snapshot at open time.
142
+ * @returns a structured summary plus the exact summarized source range.
143
+ */
144
+ summarizeConversation(request: AwikiSummarizeConversationRequest): Promise<AwikiResult<AwikiConversationSummary>>;
145
+ /**
146
+ * Mark every currently unread inbox message in one conversation as read.
147
+ * @param request - conversation whose current inbox entries should be acknowledged.
148
+ * @returns Number of inbox entries acknowledged by the Message Service.
149
+ */
150
+ markConversationRead(request: AwikiMarkConversationReadRequest): Promise<AwikiResult<number>>;
151
+ /**
152
+ * Send one text message through the deployment identity.
153
+ * @param request - Target, text, and idempotency key.
154
+ * @returns The accepted public message or a closed failure.
155
+ */
156
+ sendText(request: AwikiSendTextRequest): Promise<AwikiResult<AwikiMessage>>;
157
+ /**
158
+ * Upload and send one attachment after Host validation.
159
+ * @param request - Target, attachment metadata and Base64 bytes, caption, and idempotency key.
160
+ * @returns The accepted attachment message or a closed failure.
161
+ */
162
+ sendAttachment(request: AwikiSendAttachmentRequest): Promise<AwikiResult<AwikiMessage>>;
163
+ /**
164
+ * Download and encode one provider-verified attachment.
165
+ * @param request - Containing message id and attachment id.
166
+ * @returns Verified public metadata and canonical Base64 bytes, or a closed failure.
167
+ */
168
+ downloadAttachment(request: AwikiDownloadAttachmentRequest): Promise<AwikiResult<AwikiDownloadedAttachment>>;
169
+ /**
170
+ * Permanently remove the exact SDK-owned local state after an explicit browser acknowledgement.
171
+ * The remote AWiki account and Handle are not deleted.
172
+ * @param request - exact destructive-action marker emitted only after the UI's second confirmation.
173
+ * @returns Whether a persisted state file existed when the reset completed.
174
+ */
175
+ clearLocalData(request: AwikiClearLocalDataRequest): Promise<AwikiResult<AwikiClearLocalDataResult>>;
176
+ /** Invalidate cached session work and cancel every model request still owned by the old session. */
177
+ private invalidateSummaries;
178
+ /** Invoke the current client and normalize every rejection to a public result. */
179
+ private run;
180
+ /** Read and cache the private Host-owned session marker. */
181
+ private isSignedOut;
182
+ /** Serialize sign-in, sign-out, and destructive clear transitions. */
183
+ private mutateSession;
184
+ /** Clear one exact provider slot before joining its one shared disposal. */
185
+ private disposeProvider;
186
+ }
187
+ export default AwikiService;
188
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAG7C,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,EAAU,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAE9E,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,8BAA8B,EAC9B,yBAAyB,EAGzB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,gCAAgC,EAChC,SAAS,EACT,gBAAgB,EAChB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,EACpB,iCAAiC,EACjC,6BAA6B,EAC9B,MAAM,YAAY,C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