<?xml version="1.0" encoding="UTF-8"?>
<!--
  CounselAI for Microsoft Word — classic (add-in-only) XML manifest.

  Distribution is DIRECT SIDELOAD, not AppSource: a user (or an M365 admin via
  Integrated Apps) uploads this file. Nothing is bundled — every page and icon
  is fetched live from https://counsel-ai.org, which is deliberate:

    * the taskpane is a route of the SAME Next.js app the user signs into, so a
      session established in the taskpane is same-origin with /api/* and needs
      no cross-origin token exchange or CORS entry;
    * shipping a fix means deploying the web app, not re-issuing a manifest to
      everyone who installed it. Only the values in THIS file are frozen at
      install time.

  Therefore: the Id, ProviderName, Version and every Url below are effectively
  permanent once anyone has sideloaded it. Changing Id orphans the install (Word
  treats it as a different add-in); changing a Url breaks existing installs
  until the user re-uploads. Bump Version when a change must be re-pushed.

  Requirement set: WordApi 1.1 is the FLOOR on purpose. Comment insertion needs
  1.4, but gating the whole add-in on 1.4 would make Word refuse to load it on
  hosts that can still run everything else. The taskpane feature-detects 1.4 at
  runtime and disables just that button. See apps/web/lib/office.ts.
-->
<OfficeApp
  xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
  xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides"
  xsi:type="TaskPaneApp">

  <!-- Never regenerate this GUID: it is the identity of every existing install. -->
  <Id>b8435f87-6ea0-4704-866b-9bfe6d25dfca</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>CounselAI</ProviderName>
  <DefaultLocale>en-GB</DefaultLocale>
  <DisplayName DefaultValue="CounselAI" />
  <Description DefaultValue="Run CounselAI's legal review workflows against the document you have open in Word. Results are AI drafts for solicitor review — not legal advice." />

  <IconUrl DefaultValue="https://counsel-ai.org/addin/icon-32.png" />
  <HighResolutionIconUrl DefaultValue="https://counsel-ai.org/addin/icon-64.png" />
  <SupportUrl DefaultValue="https://counsel-ai.org/addin" />

  <!-- Every domain the taskpane may navigate to must be listed, or Word opens
       the link in an external browser instead of in the pane. -->
  <AppDomains>
    <AppDomain>https://counsel-ai.org</AppDomain>
  </AppDomains>

  <Hosts>
    <Host Name="Document" />
  </Hosts>

  <Requirements>
    <Sets DefaultMinVersion="1.1">
      <Set Name="WordApi" MinVersion="1.1" />
    </Sets>
  </Requirements>

  <DefaultSettings>
    <SourceLocation DefaultValue="https://counsel-ai.org/addin/taskpane" />
  </DefaultSettings>

  <!-- ReadWriteDocument, not ReadDocument: "Insert as comment" writes back. -->
  <Permissions>ReadWriteDocument</Permissions>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Hosts>
      <Host xsi:type="Document">
        <DesktopFormFactor>
          <!-- No FunctionFile function is registered; the entry point is the
               taskpane itself. The element is still required by the schema. -->
          <FunctionFile resid="Taskpane.Url" />

          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <OfficeTab id="TabHome">
              <Group id="CounselAI.Group">
                <Label resid="Group.Label" />
                <Icon>
                  <bt:Image size="16" resid="Icon.16" />
                  <bt:Image size="32" resid="Icon.32" />
                  <bt:Image size="80" resid="Icon.80" />
                </Icon>
                <Control xsi:type="Button" id="CounselAI.OpenTaskpane">
                  <Label resid="Taskpane.Label" />
                  <Supertip>
                    <Title resid="Taskpane.Label" />
                    <Description resid="Taskpane.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16" />
                    <bt:Image size="32" resid="Icon.32" />
                    <bt:Image size="80" resid="Icon.80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <TaskpaneId>CounselAI.Taskpane</TaskpaneId>
                    <SourceLocation resid="Taskpane.Url" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>

    <Resources>
      <bt:Images>
        <bt:Image id="Icon.16" DefaultValue="https://counsel-ai.org/addin/icon-16.png" />
        <bt:Image id="Icon.32" DefaultValue="https://counsel-ai.org/addin/icon-32.png" />
        <bt:Image id="Icon.80" DefaultValue="https://counsel-ai.org/addin/icon-80.png" />
      </bt:Images>
      <bt:Urls>
        <bt:Url id="Taskpane.Url" DefaultValue="https://counsel-ai.org/addin/taskpane" />
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="Group.Label" DefaultValue="CounselAI" />
        <bt:String id="Taskpane.Label" DefaultValue="Review document" />
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="Taskpane.Tooltip" DefaultValue="Open CounselAI and run a legal review workflow against this document." />
      </bt:LongStrings>
    </Resources>
  </VersionOverrides>
</OfficeApp>
